/* 智语 · 视觉系统 */
:root {
  --bg: #eceef3;
  --panel: #ffffff;
  --panel-2: #f5f7fa;
  --panel-3: #eef1f6;
  --line: #e6e9ef;
  --line-strong: #d7dce5;
  --text: #11141a;
  --text-2: #454d5b;
  --muted: #8a93a2;
  --accent: #4f5ef7;
  --accent-2: #7a5cf5;
  --accent-soft: #eef0ff;
  --accent-line: #d9ddff;
  --ai: #7a5cf5;
  --ai-soft: #f3f0ff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #e5484d;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 28px rgba(16, 24, 40, .08);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, .18);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
  --bg: #0a0c10;
  --panel: #12151b;
  --panel-2: #171b22;
  --panel-3: #1d222b;
  --line: #232833;
  --line-strong: #2f3644;
  --text: #e9edf4;
  --text-2: #b3bbca;
  --muted: #7e8798;
  --accent: #7b87ff;
  --accent-2: #a78bfa;
  --accent-soft: #1a1f30;
  --accent-line: #2c3452;
  --ai: #a78bfa;
  --ai-soft: #1d1a2e;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font-family: inherit; color: var(--text); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 30%, transparent); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 50%, transparent); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局 ---------- */
.app {
  display: grid;
  grid-template-columns: 76px 316px minmax(0, 1fr) 304px;
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}
.app.side-hidden { grid-template-columns: 76px 316px minmax(0, 1fr); }
.app.side-hidden .side-pane { display: none; }

/* ---------- 左侧导航 ---------- */
.rail {
  display: flex; flex-direction: column; align-items: center; min-height: 0;
  padding: 14px 0 16px; gap: 8px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.brand {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 19px;
  background: linear-gradient(135deg, #5b63f5, #8b5cf6 60%, #d946ef);
  box-shadow: 0 6px 18px rgba(99, 102, 241, .35);
  margin-bottom: 14px;
  user-select: none;
}
.rail-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; align-items: center; }
.rail-btn {
  width: 60px; padding: 8px 0 6px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--muted); transition: .16s;
}
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn span { font-size: 11px; letter-spacing: .02em; }
.rail-btn:hover { background: var(--panel-2); color: var(--text-2); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent); }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  color: var(--muted); transition: .16s;
}
.rail-icon:hover { background: var(--panel-2); color: var(--text); }
.me-avatar {
  width: 38px; height: 38px; border-radius: 12px; border: 0;
  color: #fff; font-size: 15px; font-weight: 600;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}

/* ---------- 会话列表 ---------- */
.list-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--panel); border-right: 1px solid var(--line);
}
.list-head {
  padding: 20px 20px 12px; display: flex; align-items: flex-start; justify-content: space-between;
}
.list-head h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.list-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.head-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center;
  color: var(--text-2); transition: .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.conv-search {
  margin: 0 16px 10px; display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid transparent; border-radius: 10px;
  padding: 0 10px; height: 36px; color: var(--muted);
}
.conv-search:focus-within { border-color: var(--accent-line); background: var(--panel); }
.conv-search svg { width: 15px; height: 15px; flex: none; }
.conv-search input {
  border: 0; background: transparent; outline: none; width: 100%; font-size: 13px;
}
.conv-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 10px 12px; }
.conv-item {
  display: flex; gap: 11px; padding: 10px; border-radius: 12px; cursor: pointer;
  transition: background .14s; position: relative;
}
.conv-item:hover { background: var(--panel-2); }
.conv-item.active { background: var(--accent-soft); }
.conv-item.active::before {
  content: ""; position: absolute; left: -10px; top: 16px; bottom: 16px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.conv-avatar { flex: none; }
.conv-main { min-width: 0; flex: 1; }
.conv-top { display: flex; align-items: baseline; gap: 6px; }
.conv-name {
  font-weight: 560; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-time { margin-left: auto; font-size: 11px; color: var(--muted); flex: none; }
.conv-preview {
  margin-top: 3px; font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 600;
  display: inline-grid; place-items: center; margin-left: 6px;
}
.conv-more {
  position: absolute; right: 8px; top: 20px; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center; color: var(--muted); background: var(--panel);
  opacity: 0; transition: .12s;
}
.conv-more:hover { background: var(--panel-3); color: var(--text); }
.conv-more svg { width: 15px; height: 15px; }
.conv-item:hover .conv-more { opacity: 1; }
.conv-item:hover .conv-time, .conv-item:hover .badge { opacity: 0; }
.menu-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  font-size: 13px; color: var(--text); text-align: left;
}
.menu-row svg { width: 16px; height: 16px; color: var(--muted); }
.menu-row:hover {
  border-color: var(--danger); color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
.menu-row:hover svg { color: var(--danger); }
.list-foot {
  border-top: 1px solid var(--line); padding: 9px 18px; font-size: 11.5px; color: var(--muted);
  display: flex; align-items: center; gap: 7px;
}
.list-foot .link { margin-left: auto; color: var(--accent); font-size: 11.5px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pulse.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }

/* ---------- 头像 ---------- */
.avatar, .conv-avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; font-size: 15px; font-weight: 600; flex: none; user-select: none;
  letter-spacing: .02em;
}
.av-indigo { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.av-blue { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.av-teal { background: linear-gradient(135deg, #14b8a6, #0ea5e9); }
.av-pink { background: linear-gradient(135deg, #f472b6, #fb7185); }
.av-amber { background: linear-gradient(135deg, #f59e0b, #f97316); }
.av-purple { background: linear-gradient(135deg, #a855f7, #8b5cf6); }
.av-green { background: linear-gradient(135deg, #22c55e, #14b8a6); }
.av-orange { background: linear-gradient(135deg, #fb923c, #f43f5e); }
.av-violet { background: linear-gradient(135deg, #8b5cf6, #d946ef); }
.av-cyan { background: linear-gradient(135deg, #06b6d4, #3b82f6); }

/* ---------- 聊天区 ---------- */
.chat-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative;
  background: var(--panel);
}
.chat-head {
  height: 66px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); flex: none;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(12px);
  z-index: 3;
}
.chat-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-title { font-size: 16px; font-weight: 620; letter-spacing: -.01em; display: flex; align-items: center; gap: 7px; }
.chat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actions { display: flex; align-items: center; gap: 6px; }
.ai-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 10px; font-size: 13px; font-weight: 550; color: var(--ai);
  background: var(--ai-soft); border: 1px solid color-mix(in srgb, var(--ai) 16%, transparent);
  transition: .16s;
}
.ai-pill svg { width: 15px; height: 15px; }
.ai-pill:hover { transform: translateY(-1px); box-shadow: 0 4px 14px color-mix(in srgb, var(--ai) 18%, transparent); }

.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 0 8px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.msg {
  display: flex; gap: 10px; padding: 7px 28px; max-width: 940px; margin: 0 auto;
  animation: rise .22s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }
.msg.mine { flex-direction: row-reverse; }
.msg .avatar { width: 36px; height: 36px; font-size: 14px; border-radius: 11px; margin-top: 1px; }
.msg-main { min-width: 0; max-width: min(680px, 78%); }
.msg.mine .msg-main { display: flex; flex-direction: column; align-items: flex-end; }
.msg-head { display: flex; align-items: baseline; gap: 7px; margin: 0 2px 5px; }
.m-name { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.m-role { font-size: 11px; color: var(--muted); }
.m-time { font-size: 11px; color: var(--muted); }
.msg.mine .msg-head { justify-content: flex-end; }
.bubble {
  background: var(--panel-2); border-radius: 14px; padding: 9px 13px;
  font-size: 14px; line-height: 1.65; word-break: break-word;
  border: 1px solid transparent;
}
.msg.grouped { margin-top: -3px; }
.avatar-spacer { width: 36px; height: 36px; flex: none; }
[data-theme="light"] .bubble { background: #f4f6fa; }
.msg.mine .bubble {
  background: linear-gradient(135deg, #5b63f5, #7c5cf5);
  color: #fff; border: 0;
}
.bubble p { margin: 0; }
.bubble p + p { margin-top: 6px; }
.bubble h4 {
  margin: 10px 0 4px; font-size: 13px; font-weight: 650; color: var(--accent);
  letter-spacing: .01em;
}
.bubble h4:first-child { margin-top: 0; }
.bubble ul, .bubble ol { margin: 4px 0; padding-left: 20px; }
.bubble li { margin: 2px 0; }
.bubble code {
  background: color-mix(in srgb, var(--text) 7%, transparent); padding: 1px 5px;
  border-radius: 5px; font-size: 12.5px; font-family: "JetBrains Mono", Consolas, monospace;
}
.bubble blockquote {
  margin: 6px 0; padding: 6px 10px; border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 0 6px 6px 0;
  color: var(--text-2); font-size: 13px;
}
.msg.ai .bubble {
  background: linear-gradient(180deg, var(--ai-soft), color-mix(in srgb, var(--ai-soft) 55%, var(--panel)));
  border: 1px solid color-mix(in srgb, var(--ai) 16%, transparent);
}
.msg.ai .ai-head {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 11px;
  color: var(--ai); font-weight: 600; letter-spacing: .02em;
}
.msg.ai .ai-head .spark { font-size: 12px; }
.ai-mode {
  font-size: 10px; font-weight: 500; color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; letter-spacing: 0;
}
.msg-actions {
  display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: .15s;
}
.msg:hover .msg-actions { opacity: 1; }
.act-btn {
  font-size: 11px; color: var(--muted); padding: 2px 6px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 3px;
}
.act-btn:hover { background: var(--panel-2); color: var(--text-2); }
.act-btn.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.edit-wrap { min-width: 280px; max-width: 100%; }
.edit-input {
  width: 100%; min-height: 64px; resize: vertical; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  padding: 8px 10px; font: inherit; font-size: 13.5px; line-height: 1.55; outline: none;
}
.edit-input:focus { border-color: var(--accent); }
.edit-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.edit-hint { margin-right: auto; font-size: 11px; color: var(--muted); }
.edited-tag { font-size: 10.5px; color: var(--muted); margin: 3px 0 0 2px; }
.bubble.recalled-bubble {
  background: transparent; border: 1px dashed var(--line-strong); color: var(--muted);
  font-size: 12.5px; padding: 6px 11px;
}
.msg.mine .bubble.recalled-bubble {
  background: transparent; border: 1px dashed var(--line-strong); color: var(--muted);
  box-shadow: none;
}

/* ---------- 图片消息 ---------- */
.img-msg { line-height: 0; }
.img-msg img {
  max-width: 300px; max-height: 320px; border-radius: 10px; display: block;
  cursor: zoom-in; object-fit: cover;
}
.bubble.img-bubble { padding: 4px; background: transparent; border: 0; }
.msg.mine .bubble.img-bubble { background: transparent; padding: 4px; color: var(--text); }
.img-cap { margin-top: 6px; font-size: 14px; line-height: 1.6; }
.lightbox-img { max-width: 100%; max-height: 70vh; border-radius: 12px; }
.image-modal { width: min(920px, calc(100vw - 40px)); }
.msg.pending { opacity: .6; }
.msg.mine .bubble a { color: #dfe3ff; }

.day-sep {
  display: flex; align-items: center; gap: 10px; max-width: 940px; margin: 14px auto 6px;
  padding: 0 28px; color: var(--muted); font-size: 11px;
}
.day-sep::before, .day-sep::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.day-sep span { padding: 0 4px; }

.typing-row { display: flex; gap: 10px; padding: 6px 28px; max-width: 940px; margin: 0 auto; align-items: center; }
.typing-row .avatar { width: 36px; height: 36px; border-radius: 11px; font-size: 14px; }
.typing-bubble {
  background: var(--panel-2); border-radius: 14px; padding: 11px 14px; display: flex; gap: 4px;
}
.typing-bubble i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--muted); display: block;
  animation: blink 1.2s infinite;
}
.typing-bubble i:nth-child(2) { animation-delay: .18s; }
.typing-bubble i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.typing-text { font-size: 12px; color: var(--muted); }

.cite {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px;
  margin: 0 1px; border-radius: 5px; font-size: 10px; font-weight: 700;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
  vertical-align: 1px; cursor: pointer; border: 0; line-height: 1;
}
.cite:hover { background: var(--accent); color: #fff; }

.jump-bottom {
  position: absolute; right: 26px; bottom: 190px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); color: var(--text-2);
  display: none; place-items: center; box-shadow: var(--shadow-md); z-index: 4;
}
.jump-bottom.show { display: grid; }

/* ---------- 输入区 ---------- */
.composer { padding: 0 20px 12px; flex: none; position: relative; }
.ai-strip {
  display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px 8px; scrollbar-width: none;
}
.ai-strip::-webkit-scrollbar { display: none; }
.ai-strip button {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  height: 27px; padding: 0 10px; border-radius: 8px; font-size: 12px; color: var(--text-2);
  background: var(--panel-2); border: 1px solid var(--line); transition: .15s;
}
.ai-strip button svg { width: 13px; height: 13px; color: var(--ai); }
.ai-strip button:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.input-wrap {
  position: relative;
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px;
  padding: 8px 8px 8px 14px; box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s;
}
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); }
.input-wrap textarea {
  flex: 1; border: 0; outline: none; resize: none; background: transparent;
  font-size: 14px; line-height: 1.6; max-height: 168px; min-height: 26px; padding: 3px 0;
}
.input-wrap textarea::placeholder { color: var(--muted); }
.input-actions { display: flex; align-items: center; gap: 2px; }
.send-btn {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #5b63f5, #7c5cf5); color: #fff; margin-left: 2px;
  transition: .15s; box-shadow: 0 3px 10px rgba(99, 102, 241, .3);
}
.send-btn:hover { transform: translateY(-1px); }
.send-btn:disabled { opacity: .5; transform: none; cursor: default; }
.send-btn svg { width: 16px; height: 16px; }
.pending-row { display: none; gap: 8px; flex-wrap: wrap; padding: 0 2px 8px; }
.pending-row.show { display: flex; }
.pending-status { width: 100%; font-size: 11.5px; color: var(--accent); padding: 2px 2px 0; }
.pending-chip {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); max-width: 230px;
}
.pending-chip img { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; }
.pending-name {
  font-size: 11.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 120px;
}
.pending-x {
  width: 18px; height: 18px; border-radius: 50%; background: var(--panel-3); color: var(--muted);
  display: grid; place-items: center; font-size: 13px; line-height: 1; flex: none;
}
.pending-x:hover { background: var(--danger); color: #fff; }
.composer-hint {
  display: flex; justify-content: space-between; font-size: 11px; color: var(--muted);
  padding: 7px 4px 0;
}
kbd {
  font-family: inherit; font-size: 10px; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 4px; background: var(--panel-2);
}
.model-tag { color: var(--muted); }
.model-tag.on { color: var(--ok); }

/* ---------- @ 提及 ---------- */
.mention-pop {
  position: absolute; left: 0; bottom: calc(100% + 8px); width: 258px; max-height: 286px;
  overflow-y: auto; padding: 5px; display: none; z-index: 75;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.mention-pop.open { display: block; animation: pop .12s ease both; }
.mention-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.mention-item:hover, .mention-item.active { background: var(--accent-soft); }
.mention-item .avatar { width: 24px; height: 24px; border-radius: 7px; font-size: 11px; }
.mi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-tag { font-size: 10px; color: var(--muted); }
.mi-all {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 13px; font-weight: 700;
}
.mention {
  color: var(--accent); background: var(--accent-soft); border-radius: 4px;
  padding: 0 2px; font-weight: 500;
}
.msg.mine .bubble .mention { background: rgba(255, 255, 255, .22); color: #fff; }
.mention-flag { color: var(--danger); font-size: 10.5px; font-weight: 600; margin-right: 3px; }

/* ---------- 右侧面板 ---------- */
.side-pane {
  border-left: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
}
.side-tabs {
  display: flex; gap: 2px; padding: 12px 12px 0; border-bottom: 1px solid var(--line);
  align-items: center;
}
.side-tabs button[data-tab] {
  padding: 6px 10px 9px; font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.side-tabs button[data-tab].active { color: var(--text); border-bottom-color: var(--accent); font-weight: 550; }
.side-close { margin-left: auto; width: 28px; height: 28px; color: var(--muted); }
.side-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.side-section { margin-bottom: 20px; }
.side-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin-bottom: 8px; font-weight: 600;
}
.topic-card {
  background: var(--panel-2); border-radius: 12px; padding: 10px 12px; font-size: 12.5px;
  color: var(--text-2); line-height: 1.6;
}
.member-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 9px; }
.member-row:hover { background: var(--panel-2); }
.member-row .avatar { width: 32px; height: 32px; border-radius: 9px; font-size: 12.5px; }
.member-name { font-size: 13px; font-weight: 500; }
.member-title { font-size: 11px; color: var(--muted); margin-top: 1px; }
.bot-tag {
  font-size: 10px; color: var(--ai); background: var(--ai-soft); border-radius: 5px;
  padding: 0 5px; margin-left: 5px; font-weight: 600; vertical-align: 1px;
}
.member-row .mini {
  font-size: 11px; color: var(--accent); padding: 3px 8px; border-radius: 7px;
  border: 1px solid var(--accent-line); background: var(--panel);
}
.member-row > .mini { margin-left: auto; }
.member-row > div:not(.avatar) { flex: 1; min-width: 0; }
.member-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex: none; }
.member-actions .mini { color: var(--accent); }
.member-row .mini:hover { background: var(--accent-soft); }
.todo-row {
  display: flex; gap: 9px; padding: 8px 4px; border-radius: 9px; align-items: flex-start;
}
.todo-row > div { flex: 1; min-width: 0; }
.todo-row[draggable="true"] { cursor: grab; }
.todo-row.dragging { opacity: .45; }
.todo-row.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.todo-row:hover { background: var(--panel-2); }
.todo-del {
  width: 24px; height: 24px; flex: none; margin-left: auto; border-radius: 6px;
  display: grid; place-items: center; color: var(--muted); opacity: .35; transition: .12s;
}
.todo-del:hover, .todo-row:hover .todo-del { opacity: 1; }
.todo-del.armed { opacity: 1; color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.todo-del svg { width: 14px; height: 14px; }
.todo-layout { display: flex; gap: 16px; align-items: flex-start; }
.todo-projects {
  width: 170px; flex: none; border-right: 1px solid var(--line);
  padding-right: 10px; max-height: 480px; overflow-y: auto;
}
.todo-proj-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; letter-spacing: .06em; color: var(--muted);
  text-transform: uppercase; padding: 0 4px 6px;
}
.todo-proj-head .icon-btn { width: 26px; height: 26px; }
.todo-proj {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border-radius: 8px; font-size: 13px; color: var(--text-2); cursor: pointer;
}
.todo-proj:hover { background: var(--panel-2); }
.todo-proj.active { background: var(--accent-soft); color: var(--accent); }
.todo-proj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-proj-x { opacity: 0; color: var(--muted); font-weight: 600; padding: 0 2px; }
.todo-proj:hover .todo-proj-x { opacity: 1; }
.todo-proj-x:hover, .todo-proj-x.armed { color: var(--danger); }
.todo-proj.editing { padding: 4px 6px; }
.todo-proj.editing input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 13px; color: var(--text); }
.todo-proj.editing button { font-size: 12px; color: var(--accent); }
.todo-main { flex: 1; min-width: 0; }
.report-status { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.report-date { font-size: 15px; font-weight: 600; }
.report-date-input {
  height: 32px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); padding: 0 8px; font: inherit; font-size: 12px;
}
.report-cutoff { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.report-form .field { margin-bottom: 10px; }
.report-form textarea, .report-form input, .report-actions input, .report-actions select {
  width: 100%; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); padding: 8px 10px; font: inherit;
  font-size: 13px; outline: none; resize: vertical;
}
.report-form textarea:focus, .report-form input:focus { border-color: var(--accent); }
.report-form input[type="checkbox"] { width: auto; height: auto; padding: 0; }
.report-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.report-row .field { flex: 1 1 320px; min-width: 0; }
.report-nowork {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  font-size: 12px; color: var(--text-2); white-space: nowrap; padding-bottom: 10px;
}
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.report-actions select, .report-actions input { width: auto; flex: 1; min-width: 120px; }
.report-hints { margin: 10px 0; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); font-size: 12px; color: var(--text-2); }
.report-exempt { margin: 16px 0; padding: 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.report-note { margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.report-exempt-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.report-exempt-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-exempt-row select, .report-exempt-row input {
  height: 34px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); padding: 0 10px; font: inherit; font-size: 12px;
}
.report-exempt-row input { flex: 1; min-width: 140px; }
.report-team-head { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.report-team-head input { height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); padding: 0 8px; }
.report-counts { font-size: 12px; color: var(--muted); margin-left: auto; }
.report-self { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.report-self input { width: auto; }
.report-team-list { border-top: 1px solid var(--line); }
.report-team-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.report-team-main { flex: 1; min-width: 0; }
.report-team-name { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.report-team-sum { margin-top: 4px; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-ai-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; align-items: center; }
.report-ai-out { min-height: 80px; font-size: 13px; line-height: 1.7; }
.ai-period + .ai-period { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.ai-period h4 { font-size: 13px; margin: 0 0 8px; color: var(--text-2); }
.chip.ok, .chip.submitted { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.chip.missing { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.chip.late { background: color-mix(in srgb, var(--warn, #d97706) 15%, transparent); color: var(--warn, #b45309); }
.chip.exempt { background: var(--panel-3); color: var(--text-2); }
.chip.draft { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.chart-seg.draft { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.report-legend i.draft { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.report-stats-head { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.report-stats-head select { height: 32px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); padding: 0 8px; }
.report-stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-card { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.stat-card b { display: block; font-size: 20px; color: var(--text); }
.stat-card span { font-size: 11.5px; color: var(--muted); }
.stat-card.warn b { color: #d97706; }
.stat-card.danger b { color: var(--danger); }
.report-chart { display: flex; gap: 4px; align-items: flex-end; height: 140px; overflow-x: auto; padding: 6px 0 0; }
.chart-col { flex: 1 0 18px; min-width: 18px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.chart-stack { width: 100%; height: 120px; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 4px; overflow: hidden; background: var(--panel-2); }
.chart-seg { width: 100%; min-height: 1px; }
.chart-seg.ok { background: var(--ok); }
.chart-seg.late { background: #d97706; }
.chart-seg.exempt { background: var(--line-strong); }
.chart-seg.missing { background: color-mix(in srgb, var(--danger) 55%, transparent); }
.chart-label { font-size: 9px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.report-legend { display: flex; gap: 12px; font-size: 11px; color: var(--muted); margin: 6px 0 12px; }
.report-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.report-legend i.ok { background: var(--ok); }
.report-legend i.late { background: #d97706; }
.report-legend i.exempt { background: var(--line-strong); }
.report-legend i.missing { background: color-mix(in srgb, var(--danger) 55%, transparent); }
.report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th, .report-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.report-table th { color: var(--muted); font-weight: 500; }
.report-table td.danger { color: var(--danger); }
.report-table td { vertical-align: middle; }
.report-person { display: flex; align-items: center; gap: 8px; }
.report-person .avatar { width: 28px; height: 28px; font-size: 11px; }
.link-btn { color: var(--accent); font-size: 12px; }
.report-detail-block { margin-bottom: 12px; }
.report-detail-block label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.report-detail-block div { white-space: pre-wrap; font-size: 13px; line-height: 1.6; }
.report-detail-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; font-size: 13px; }
.report-back { height: 36px; padding: 0 16px; font-weight: 600; box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 28%, transparent); }
.todo-viewbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.todo-viewbar[hidden] { display: none; }
.todo-viewbar .seg button { white-space: nowrap; }
.gantt {
  display: flex; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--panel);
}
.gantt-left { width: 210px; flex: none; border-right: 1px solid var(--line); }
.gantt-left-head {
  height: 34px; display: flex; align-items: center; padding: 0 10px;
  font-size: 11px; color: var(--muted); background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.gantt-left-row {
  height: 34px; display: flex; align-items: center; padding: 0 10px;
  border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2);
}
.gantt-left-row:first-of-type { border-top: 0; }
.gantt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-right { flex: 1; overflow-x: auto; }
.gantt-head { height: 34px; display: flex; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.gantt-day {
  flex: none; display: flex; flex-direction: column; align-items: center;
  justify-content: center; border-left: 1px solid var(--line);
  font-size: 9px; color: var(--muted); line-height: 1.15;
}
.gantt-day b { font-size: 10px; font-weight: 550; color: var(--text-2); }
.gantt-day.weekend { background: color-mix(in srgb, var(--panel-3) 55%, transparent); }
.gantt-body { position: relative; }
.gantt-track { position: relative; height: 34px; border-top: 1px solid var(--line); }
.gantt-track:first-child { border-top: 0; }
.gantt-bar {
  position: absolute; top: 8px; height: 18px; border-radius: 5px; z-index: 2;
  background: var(--accent); color: #fff; font-size: 10px; line-height: 18px;
  padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; touch-action: none; user-select: none; cursor: grab;
}
.gantt-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.gantt-handle {
  position: absolute; top: 0; bottom: 0; width: 7px; z-index: 3;
  cursor: ew-resize; opacity: 0; background: rgba(255, 255, 255, .55);
}
.gantt-bar:hover .gantt-handle { opacity: 1; }
.gantt-handle.left { left: 0; border-radius: 5px 0 0 5px; }
.gantt-handle.right { right: 0; border-radius: 0 5px 5px 0; }
.gantt-bar.done { background: var(--ok); opacity: .75; }
.gantt-bar.overdue { background: var(--danger); }
.gantt-today {
  position: absolute; top: 0; bottom: 0; width: 1px; z-index: 1;
  background: var(--danger); opacity: .55;
}
.todo-add { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.todo-add #newTodoText {
  flex: 1; min-width: 180px; height: 34px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  padding: 0 10px; font-size: 13px; outline: none;
}
.todo-add #newTodoText:focus { border-color: var(--accent); }
.todo-add select, .todo-add input[type="datetime-local"] {
  height: 34px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text-2); padding: 0 8px; font-size: 12.5px;
}
.todo-date {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted); white-space: nowrap;
}
.todo-date input { width: 148px; }
.chip.proj { background: var(--accent-soft); color: var(--accent); }
.chip.start { background: var(--panel-3); color: var(--text-2); }
.chip.due { font-variant-numeric: tabular-nums; }
.chip.due.overdue { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.checkbox {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--line-strong);
  flex: none; margin-top: 2px; display: grid; place-items: center; background: var(--panel);
  transition: .15s; color: #fff;
}
.checkbox svg { width: 11px; height: 11px; opacity: 0; }
.todo-row.done .checkbox { background: var(--ok); border-color: var(--ok); }
.todo-row.done .checkbox svg { opacity: 1; }
.todo-row.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-claim {
  font-size: 10.5px; padding: 1px 6px; border-radius: 5px;
  border: 1px dashed var(--line-strong); color: var(--muted); line-height: 16px;
}
.todo-claim:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.todo-due-input {
  height: 24px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); font-size: 11px; padding: 0 4px;
}
.todo-text { font-size: 13px; line-height: 1.5; }
.todo-meta { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.chip {
  font-size: 10.5px; padding: 1px 6px; border-radius: 5px;
  background: var(--panel-3); color: var(--text-2);
}
.chip.due { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.chip.owner { color: var(--accent); background: var(--accent-soft); }
.doc-row { display: flex; gap: 9px; padding: 8px 4px; border-radius: 9px; cursor: pointer; align-items: flex-start; }
.doc-row:hover { background: var(--panel-2); }
.doc-icon {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex: none;
}
.doc-icon svg { width: 15px; height: 15px; }
.doc-title { font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.doc-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.side-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 28px 10px; }
.add-todo {
  display: flex; gap: 6px; margin-top: 8px;
}
.add-todo input {
  flex: 1; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px;
  padding: 6px 9px; font-size: 12px; outline: none;
}
.add-todo input:focus { border-color: var(--accent-line); }
.add-todo button { font-size: 12px; color: var(--accent); padding: 0 6px; }

/* ---------- 空状态 ---------- */
.empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); gap: 10px; text-align: center; padding: 40px;
}
.empty .big { font-size: 15px; color: var(--text-2); font-weight: 500; }
.empty svg { width: 34px; height: 34px; opacity: .5; }

/* ---------- AI 菜单 ---------- */
.ai-menu {
  position: fixed; z-index: 60; width: 286px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); display: none;
}
.ai-menu.open { display: block; animation: pop .16s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.99); } }
.ai-menu-head { font-size: 11px; color: var(--muted); padding: 7px 9px 5px; letter-spacing: .04em; }
.ai-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 9px; border-radius: 9px;
}
.ai-menu button:hover { background: var(--panel-2); }
.ai-menu b { display: block; font-size: 13px; font-weight: 560; }
.ai-menu span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- 右键菜单 ---------- */
.ctx-menu {
  position: fixed; z-index: 90; min-width: 140px; padding: 5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); display: none;
}
.ctx-menu.open { display: block; animation: pop .12s ease both; }
.ctx-menu button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px;
  font-size: 12.5px; color: var(--text-2);
}
.ctx-menu button:hover { background: var(--panel-2); color: var(--text); }
.ctx-menu button[data-ctx="recall"] { color: var(--danger); }
.ctx-menu button[data-ctx="recall"]:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* ---------- 弹层通用 ---------- */
.modal-root, .palette-root { position: fixed; inset: 0; z-index: 80; display: none; }
.modal-root.open, .palette-root.open { display: block; }
.mask {
  position: absolute; inset: 0; background: rgba(9, 12, 20, .45); backdrop-filter: blur(3px);
  animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; z-index: 1; width: min(760px, calc(100vw - 48px)); max-height: calc(100dvh - 80px);
  margin: 40px auto; background: var(--panel); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  animation: up .2s cubic-bezier(.2, .8, .3, 1) both;
}
.modal.wide { width: min(1060px, calc(100vw - 48px)); }
.modal.narrow { width: min(520px, calc(100vw - 48px)); }
@keyframes up { from { opacity: 0; transform: translateY(14px) scale(.99); } }
.modal-head {
  display: flex; align-items: center; gap: 10px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 620; }
.modal-head .sub { font-size: 12px; color: var(--muted); }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 12px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px;
  justify-content: flex-end; align-items: center;
}
.btn {
  height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 520;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.btn:hover { border-color: var(--accent-line); color: var(--accent); }
.btn.primary {
  background: linear-gradient(135deg, #5b63f5, #7c5cf5); color: #fff; border: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .28);
}
.btn.primary:hover { color: #fff; transform: translateY(-1px); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 520; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line-strong); background: var(--panel-2);
  border-radius: 10px; padding: 9px 11px; font-size: 13px; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); background: var(--panel); }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
textarea.input-lg {
  width: 100%; min-height: 130px; resize: vertical; border: 1px solid var(--line-strong);
  background: var(--panel-2); border-radius: 12px; padding: 12px; font-size: 13.5px; line-height: 1.7; outline: none;
}
textarea.input-lg:focus { border-color: var(--accent); background: var(--panel); }

.status-line {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--panel-2); font-size: 12.5px; color: var(--text-2); margin-bottom: 16px;
}
.status-line .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-line .dot.on { background: var(--ok); }
.status-line .dot.off { background: var(--warn); }

/* ---------- 知识库 ---------- */
.kb-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.kb-toolbar .grow { flex: 1; }
.kb-search {
  display: flex; align-items: center; gap: 8px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; height: 36px;
  flex: 1; max-width: 340px; color: var(--muted);
}
.kb-search input { border: 0; background: transparent; outline: none; width: 100%; font-size: 13px; }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.kb-body { padding-top: 10px; }
.kb-layout { display: flex; gap: 18px; align-items: flex-start; }
.kb-side {
  width: 196px; flex: none; border-right: 1px solid var(--line);
  padding-right: 12px; max-height: 520px; overflow-y: auto;
}
.kb-side-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px; padding: 0 4px;
}
.kb-side-head .icon-btn { width: 26px; height: 26px; }
.kb-tree { display: flex; flex-direction: column; gap: 1px; }
.kb-tree-item {
  display: flex; align-items: center; gap: 7px; padding: 0 8px; height: 30px;
  border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none;
}
.kb-tree-item:hover { background: var(--panel-2); }
.kb-caret {
  width: 14px; height: 14px; flex: none; display: block;
  background-color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 18l6-6-6-6' fill='none' stroke='black' stroke-width='3'/%3E%3C/svg%3E") center / 10px 10px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 18l6-6-6-6' fill='none' stroke='black' stroke-width='3'/%3E%3C/svg%3E") center / 10px 10px no-repeat;
  transition: transform .15s;
}
.kb-caret.open { transform: rotate(90deg); }
.kb-caret.kb-caret-none { visibility: hidden; }
.kb-tree-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.kb-tree-item svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.kb-tree-item.active svg { color: var(--accent); }
.kb-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-tree-item .kb-folder-x { opacity: 0; transition: .12s; }
.kb-tree-item:hover .kb-folder-x { opacity: 1; }
.kb-tree-item.editing { height: auto; padding: 4px 6px; }
.kb-tree-item.editing input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 13px;
}
.kb-tree-item.editing button { font-size: 12px; color: var(--accent); }
.kb-main { flex: 1; min-width: 0; }
.kb-main .kb-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.kb-crumbs {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); margin: 2px 0 10px;
}
.kb-crumbs button { color: var(--text-2); font-size: 12px; padding: 2px 4px; border-radius: 5px; }
.kb-crumbs button:hover { background: var(--accent-soft); color: var(--accent); }
.kb-drop { padding: 14px 16px; margin-bottom: 12px; }
.kb-drop span { display: block; font-size: 11.5px; margin-top: 3px; }
.kb-folders { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
.kb-path { font-size: 11.5px; color: var(--muted); margin: 10px 0 -4px; }
.kb-path:empty { display: none; }
.kb-folder {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px;
  cursor: pointer; color: var(--text-2); user-select: none;
}
.kb-folder svg { width: 14px; height: 14px; color: var(--muted); }
.kb-folder.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.kb-folder.active svg { color: var(--accent); }
.kb-count {
  font-size: 10.5px; background: var(--panel-3); color: var(--muted);
  padding: 0 5px; border-radius: 6px; line-height: 16px;
}
.kb-folder.editing { padding: 3px 6px; gap: 4px; background: var(--panel); border-color: var(--accent); }
.kb-folder.editing input {
  border: 0; background: transparent; outline: none; width: 108px;
  font-size: 12.5px; color: var(--text);
}
.kb-folder.editing button { font-size: 11.5px; color: var(--accent); padding: 2px 4px; }
.kb-folder-x { margin-left: 2px; color: var(--muted); font-weight: 600; padding: 0 2px; }
.kb-folder-x:hover { color: var(--danger); }
.kb-video { max-width: 100%; max-height: 65vh; border-radius: 12px; background: #000; }
.kb-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer;
  background: var(--panel-2); transition: .16s; position: relative;
}
.kb-card:hover { border-color: var(--accent-line); background: var(--panel); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kb-card .top { display: flex; gap: 9px; align-items: flex-start; }
.kb-card .doc-icon { width: 34px; height: 34px; }
.kb-card h4 { margin: 0; font-size: 13.5px; font-weight: 560; line-height: 1.45; }
.kb-card .meta { font-size: 11px; color: var(--muted); margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.kb-card .del {
  position: absolute; right: 8px; top: 8px; opacity: 0; color: var(--muted); padding: 4px; border-radius: 6px;
}
.kb-card:hover .del { opacity: 1; }
.kb-card .del:hover { color: var(--danger); background: var(--panel-3); }
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 26px; text-align: center;
  color: var(--muted); font-size: 13px; cursor: pointer; transition: .16s; margin-bottom: 16px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dropzone b { color: var(--text-2); font-weight: 560; }
.kb-ask {
  border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--panel-2);
  margin-top: 18px;
}
.kb-ask-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 560; margin-bottom: 10px; }
.kb-scope { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.kb-ask-head svg { color: var(--ai); }
.kb-ask-row { display: flex; gap: 8px; }
.kb-ask-row input {
  flex: 1; height: 38px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--panel); padding: 0 12px; font-size: 13px; outline: none;
}
.kb-ask-row input:focus { border-color: var(--accent); }
.kb-history { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.kb-history-head { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kb-history-list { display: flex; flex-direction: column; gap: 2px; max-height: 180px; overflow: auto; }
.kb-history-item {
  display: flex; gap: 8px; align-items: center; width: 100%; text-align: left;
  padding: 6px 8px; border-radius: 7px; color: var(--text-2); font-size: 12px;
}
.kb-history-item:hover { background: var(--panel-2); }
.kb-history-q { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-history-time { flex: none; color: var(--muted); font-size: 10.5px; }
.kb-history-empty { font-size: 11.5px; color: var(--muted); padding: 6px 0; }
.answer { margin-top: 14px; font-size: 13.5px; line-height: 1.75; }
.answer h4 { margin: 10px 0 4px; font-size: 12.5px; color: var(--accent); }
.answer blockquote {
  margin: 6px 0; padding: 7px 11px; border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent); border-radius: 0 8px 8px 0;
  color: var(--text-2); font-size: 12.5px;
}
.cite-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.cite-item {
  display: flex; gap: 8px; padding: 8px 10px; border-radius: 9px; background: var(--panel);
  border: 1px solid var(--line); cursor: pointer; font-size: 12px; color: var(--text-2);
}
.cite-item:hover { border-color: var(--accent-line); }
.cite-item b { color: var(--accent); flex: none; }
.cite-item span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px; font-size: 13px; }

/* ---------- 文档阅读 ---------- */
.doc-body { font-size: 14px; line-height: 1.85; color: var(--text-2); }
.doc-body h2 { font-size: 18px; color: var(--text); margin: 22px 0 8px; letter-spacing: -.01em; }
.doc-body h3 { font-size: 15px; color: var(--text); margin: 18px 0 6px; }
.doc-body p { margin: 8px 0; }
.doc-body ul, .doc-body ol { padding-left: 22px; margin: 8px 0; }
.doc-body li { margin: 3px 0; }
.doc-body blockquote {
  margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text-2);
}
.doc-body .chunk { border-radius: 10px; padding: 2px 4px; transition: background .3s; }
.doc-body .chunk.flash { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.doc-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-bottom: 14px; }
.tag { font-size: 10.5px; padding: 1px 7px; border-radius: 6px; background: var(--panel-3); color: var(--text-2); }

/* ---------- 搜索结果 / 命令面板 ---------- */
.palette {
  position: relative; z-index: 1; width: min(680px, calc(100vw - 40px)); margin: 70px auto;
  background: var(--panel); border-radius: 18px; box-shadow: var(--shadow-lg);
  overflow: hidden; animation: up .18s ease both; border: 1px solid var(--line);
  max-height: calc(100dvh - 140px); display: flex; flex-direction: column;
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.palette-input svg { color: var(--muted); }
.palette-input input { flex: 1; border: 0; outline: none; font-size: 15px; background: transparent; }
.palette-input .esc { font-size: 10px; color: var(--muted); border: 1px solid var(--line-strong); padding: 1px 5px; border-radius: 4px; }
.palette-results { overflow-y: auto; padding: 8px; }
.p-group { font-size: 10.5px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; padding: 8px 10px 4px; font-weight: 600; }
.p-item {
  display: flex; gap: 11px; padding: 9px 10px; border-radius: 10px; cursor: pointer; align-items: flex-start;
}
.p-item:hover, .p-item.active { background: var(--panel-2); }
.p-item .avatar { width: 30px; height: 30px; font-size: 12px; border-radius: 8px; }
.p-main { min-width: 0; flex: 1; }
.p-title { font-size: 13px; font-weight: 520; display: flex; gap: 6px; align-items: baseline; }
.p-title .where { font-size: 10.5px; color: var(--muted); font-weight: 400; }
.p-snippet { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-snippet mark, .search-mark { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); border-radius: 3px; padding: 0 1px; }
.p-time { font-size: 10.5px; color: var(--muted); flex: none; margin-top: 2px; }
.p-empty { padding: 34px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 设置 ---------- */
.settings-section { margin-bottom: 22px; }
.settings-section h4 { margin: 0 0 10px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.identity-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.identity {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 7px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px;
}
.identity.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.identity .avatar { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }

/* ---------- Toast ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 120;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  background: var(--text); color: var(--panel); padding: 9px 16px; border-radius: 10px;
  font-size: 12.5px; box-shadow: var(--shadow-lg); animation: toastIn .2s ease both;
  max-width: 70vw;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: #16a34a; color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 滚动与动画细节 ---------- */
.msg.highlight .bubble { animation: flash 1.6s ease; }
@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  20% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
}
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录 / 注册 ---------- */
body.unauth .app { display: none; }
.auth-screen {
  display: none; position: fixed; inset: 0; z-index: 200;
  align-items: center; justify-content: center; overflow: hidden;
  background:
    radial-gradient(900px 500px at 15% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    radial-gradient(700px 500px at 95% 100%, color-mix(in srgb, #d946ef 9%, transparent), transparent 60%),
    var(--bg);
}
body.unauth .auth-screen { display: flex; }
.auth-card {
  position: relative; z-index: 2; width: 402px; max-width: calc(100vw - 32px);
  padding: 30px 30px 24px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: up .25s cubic-bezier(.2, .8, .3, 1) both;
}
.auth-brand { display: flex; gap: 13px; align-items: center; margin-bottom: 22px; }
.brand.big { width: 48px; height: 48px; border-radius: 14px; font-size: 22px; margin: 0; }
.auth-brand-text b { font-size: 18px; display: block; letter-spacing: -.01em; }
.auth-brand-text span { font-size: 12px; color: var(--muted); }
.auth-tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.auth-tabs button { flex: 1; height: 32px; border-radius: 8px; font-size: 13px; color: var(--muted); transition: .15s; }
.auth-tabs button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 560; }
.auth-form label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.auth-form input {
  display: block; width: 100%; margin-top: 6px; height: 38px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel-2);
  padding: 0 12px; font-size: 13.5px; outline: none; transition: .15s;
}
.auth-form input:focus {
  border-color: var(--accent); background: var(--panel);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.auth-submit { width: 100%; height: 40px; margin-top: 4px; justify-content: center; }
.auth-msg { min-height: 18px; font-size: 12px; color: var(--danger); margin-top: 10px; }
.auth-hint { font-size: 11px; color: var(--muted); margin-top: 14px; text-align: center; line-height: 1.6; }
.auth-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; }
.auth-blob.a { width: 420px; height: 420px; background: #8b5cf6; top: -140px; left: -80px; }
.auth-blob.b { width: 460px; height: 460px; background: #3b82f6; bottom: -180px; right: -110px; }

/* ---------- 系统消息 / 选择器 ---------- */
.sys-msg {
  max-width: 940px; margin: 6px auto; padding: 0 28px;
  text-align: center; font-size: 11.5px; color: var(--muted);
}
.seg { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.seg button { flex: 1; height: 30px; border-radius: 8px; font-size: 12.5px; color: var(--muted); }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 550; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; }
.pick-row:hover { background: var(--panel-2); }
.pick-row input { accent-color: var(--accent); width: 16px; height: 16px; margin-left: auto; }
.invite-btn {
  width: 100%; margin-top: 10px; height: 32px; border: 1px dashed var(--line-strong);
  border-radius: 9px; color: var(--accent); font-size: 12px;
}
.invite-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.invite-btn.leave { margin-top: 6px; color: var(--muted); }
.invite-btn.leave:hover { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.mini.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.mini.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.online-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 16%, transparent); flex: none;
}
.member-row .online-dot { margin-left: 0; }
.member-badge {
  font-size: 10px; padding: 0 5px; border-radius: 5px; margin-left: 5px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.member-badge.off { background: var(--panel-3); color: var(--muted); }
.invite-code {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px dashed var(--line-strong); margin: 4px 0 8px;
}
.invite-code b { font-family: "JetBrains Mono", Consolas, monospace; font-size: 15px; letter-spacing: .06em; }
.invite-code span { margin-left: auto; font-size: 11px; color: var(--muted); }

/* ---------- 审计日志 ---------- */
.audit-row {
  display: grid; grid-template-columns: 84px 88px minmax(0, 1fr); gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--line); align-items: start;
}
.audit-row:last-child { border-bottom: 0; }
.audit-time { color: var(--muted); font-size: 11px; padding-top: 2px; white-space: nowrap; }
.audit-actor {
  font-size: 12.5px; font-weight: 520; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.audit-detail { font-size: 12.5px; color: var(--text-2); line-height: 1.55; word-break: break-word; }
.audit-badge {
  display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 5px;
  background: var(--panel-3); color: var(--text-2); margin-right: 6px; vertical-align: 1px;
}
.audit-badge.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.audit-badge.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.audit-empty { text-align: center; color: var(--muted); padding: 30px; font-size: 13px; }

/* ---------- 响应式 ---------- */
.mobile-back { display: none; }
@media (max-width: 1240px) {
  .app { grid-template-columns: 72px 290px minmax(0, 1fr); }
  .side-pane { display: none; }
  .jump-bottom { bottom: 176px; }
}
@media (max-width: 940px) {
  .app { grid-template-columns: 56px minmax(0, 1fr); }
  .list-pane { display: flex; grid-column: 2; border-right: 0; }
  .chat-pane { display: none; grid-column: 2; }
  .app.mobile-chat .list-pane { display: none; }
  .app.mobile-chat .chat-pane { display: flex; }
  .mobile-back { display: inline-grid; margin-right: 2px; }
  .mobile-back svg { transform: rotate(180deg); }
  .brand { width: 36px; height: 36px; font-size: 16px; }
  .rail-btn { width: 48px; padding: 7px 0 5px; }
  .rail-btn svg { width: 19px; height: 19px; }
  .rail-btn span { font-size: 10px; }
  .msg { padding: 6px 12px; }
  .msg-main { max-width: 90%; }
  .composer { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  .jump-bottom { bottom: calc(138px + env(safe-area-inset-bottom)); }
  #input, .composer input, .auth-form input, textarea, select { font-size: 16px; }
  .icon-btn { width: 40px; height: 40px; }
  .rail-icon { width: 42px; height: 42px; }
  .mini { min-height: 36px; padding: 6px 9px; }
  .act-btn { min-height: 36px; padding: 6px 8px; }
  .msg-actions { opacity: 1; }
  .auth-tabs button { min-height: 40px; }
}
@media (max-width: 560px) {
  .chat-sub, .composer-hint { display: none; }
  .chat-head { padding: 8px 8px; gap: 4px; }
  .chat-title { font-size: 14px; }
  .chat-actions { gap: 2px; }
  .chat-actions .icon-btn { width: 36px; height: 36px; }
  .ai-pill { width: 36px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  .ai-pill svg { width: 17px; height: 17px; }
  .chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-meta { min-width: 0; }
  .ai-strip {
    display: flex; overflow-x: auto; flex-wrap: nowrap;
    padding: 6px 8px; gap: 6px; scrollbar-width: none;
  }
  .ai-strip::-webkit-scrollbar { display: none; }
  .ai-strip button { flex: none; font-size: 11px; padding: 5px 8px; }
  .composer { padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .msg { padding: 5px 8px; }
  .msg-main { max-width: 93%; }
  .modal {
    width: calc(100vw - 12px); margin: 6px auto;
    max-height: calc(100dvh - 12px); border-radius: 14px;
  }
  .modal-body { padding: 12px; }
  .kb-layout { display: block; }
  .kb-side { display: none; }
  .kb-grid { grid-template-columns: 1fr; }
  .report-table { display: block; overflow-x: auto; white-space: nowrap; }
  .report-team-head { flex-wrap: wrap; }
  .report-actions input, .report-actions select { min-width: 100px; }
}
