/* 中转站 — 设计变量
   纸面灰底 + 白色工作区，强调色是信号青；AI 干活时头像外圈亮起琥珀色的转动环，这是整个界面唯一的动效。 */
:root {
  --paper: #f4f5f7;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #6a7080;
  --faint: #9aa0ad;
  --line: #e4e6ea;
  --hover: #eceef1;
  --accent: #0e7c6b;
  --accent-soft: #e2f2ef;
  --working: #e8a317;
  --waiting: #7a5cf0;
  --danger: #d6453d;
  --bubble: #f1f2f4;
  --sidebar-w: 288px;
  --panel-w: 300px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--panel-w);
  height: 100dvh;
  overflow: hidden;
}
.sidebar, .chat, .panel { min-height: 0; min-width: 0; }

/* ---------- 头像 ---------- */
.av {
  --size: 40px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  flex: none;
  position: relative;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: calc(var(--size) * 0.42);
  letter-spacing: -0.02em;
  background: var(--c, #8a909c);
}
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #fff; }
.av.has-img { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.av.me { background: var(--ink); }
.av.sm { --size: 28px; }
.av.xs { --size: 22px; font-size: 10px; }
.av.lg { --size: 72px; }

/* 干活中：琥珀色虚线环转动 */
.av.working::after,
.av.waiting::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px dashed var(--working);
  animation: spin 3.2s linear infinite;
}
.av.waiting::after { border-color: var(--waiting); border-style: dotted; animation-duration: 6s; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .av.working::after, .av.waiting::after { animation: none; }
}

/* 群头像：成员头像叠在一起 */
.stack { position: relative; display: inline-block; vertical-align: middle; width: 40px; height: 40px; flex: none; }
.stack .av { position: absolute; --size: 27px; font-size: 12px; box-shadow: 0 0 0 2px var(--paper); }
.stack .av:nth-child(1) { left: 0; top: 0; }
.stack .av:nth-child(2) { right: 0; bottom: 0; }
.chat-head .stack .av { box-shadow: 0 0 0 2px var(--surface); }
.conv.active .stack .av { box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---------- 左栏 ---------- */
.sidebar { background: var(--paper); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 14px 14px 18px; padding-top: max(18px, env(safe-area-inset-top)); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; stroke-width: 2.2; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; flex: 1; }

.conv-list { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.conv-group { font-size: 12.5px; color: var(--faint); padding: 14px 8px 6px; }
.conv {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 8px; border: 0; border-radius: var(--r-md);
  background: transparent; text-align: left;
}
.conv:hover { background: var(--hover); }
.conv.active { background: var(--accent-soft); }
.conv-meta { min-width: 0; flex: 1; }
.conv-top { display: flex; align-items: baseline; gap: 8px; }
.conv-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.conv-time { font-size: 11.5px; color: var(--faint); flex: none; }
.conv-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-preview.state { color: var(--working); }
.conv-empty { font-size: 13px; color: var(--faint); padding: 6px 8px; }

.sidebar-foot { border-top: 1px solid var(--line); padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot:not(:has(> :not([hidden]))) { display: none; }
.foot-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-size: 13.5px; text-align: left; }
.foot-btn:hover { background: var(--hover); color: var(--ink); }
.foot-btn svg { width: 18px; height: 18px; }
.foot-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-btn.on { color: var(--accent); }
.foot-hint { font-size: 12px; color: var(--faint); padding: 0 8px 4px 36px; line-height: 1.5; }
.foot-hint:empty { display: none; }

/* ---------- 中间 ---------- */
.chat { background: var(--surface); display: flex; flex-direction: column; position: relative; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line); padding-top: max(12px, env(safe-area-inset-top)); min-height: 64px; }
.head-avatar { display: flex; }
.head-avatar:empty { display: none; }
.chat-title { flex: 1; min-width: 0; }
.chat-name { font-weight: 650; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub .state { color: var(--working); }

.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: var(--r-sm); color: var(--muted); display: grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }
.only-narrow { display: none; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(22, 24, 29, 0.12); padding: 5px; min-width: 160px; z-index: 30; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-sm); font-size: 14px; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu .danger { color: var(--danger); }
.menu svg { width: 18px; height: 18px; }

.messages { flex: 1; overflow-y: auto; padding: 20px 24px 8px; }
.msg-col { max-width: 760px; margin: 0 auto; }
.msg { display: flex; gap: 12px; margin-top: 18px; }
.msg.mine { flex-direction: row-reverse; }
.msg.cont { margin-top: 4px; }
.msg.cont > .av { visibility: hidden; height: 0; }
.msg.cont .msg-head { display: none; }
.msg-body { min-width: 0; max-width: min(620px, 80%); display: flex; flex-direction: column; }
.msg.mine .msg-body { align-items: flex-end; }
.msg-head { font-size: 12.5px; color: var(--faint); margin: 0 2px 5px; display: flex; gap: 8px; align-items: baseline; }
.msg-head b { color: var(--muted); font-weight: 600; font-size: 13px; }
.bubble { background: var(--bubble); border-radius: 4px var(--r-lg) var(--r-lg) var(--r-lg); padding: 10px 14px; line-height: 1.65; word-break: break-word; overflow-wrap: anywhere; font-size: 15px; }
.msg.mine .bubble { background: var(--accent); color: #fff; border-radius: var(--r-lg) 4px var(--r-lg) var(--r-lg); }
.msg.mine .bubble a, .msg.mine .bubble .mention { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble pre { background: #1b1e24; color: #e6e8ec; border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 13px; line-height: 1.55; margin: 8px 0; }
.bubble code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.bubble :not(pre) > code { background: rgba(22, 24, 29, 0.07); padding: 1px 5px; border-radius: 4px; }
.msg.mine .bubble :not(pre) > code { background: rgba(255, 255, 255, 0.18); }
.bubble blockquote { margin: 6px 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.bubble ul, .bubble ol { margin: 6px 0; padding-left: 22px; }
.bubble a { color: var(--accent); }
.bubble .cmd { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 5px; padding: 2px 8px; margin: 2px 0; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.mention { color: var(--accent); font-weight: 600; }

.notice { text-align: center; margin: 14px auto; font-size: 12.5px; color: var(--faint); max-width: 560px; }
.notice.task { text-align: left; color: var(--ink); background: var(--accent-soft); border-radius: var(--r-md); padding: 8px 12px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; }
.notice.error { text-align: left; color: var(--danger); background: #fdf0ef; border-radius: var(--r-md); padding: 8px 12px; white-space: pre-wrap; font-size: 13px; }
.time-sep { text-align: center; font-size: 12px; color: var(--faint); margin: 22px 0 4px; }

.empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.empty h2 { font-size: 20px; color: var(--ink); margin: 0 0 6px; font-weight: 650; }
.empty p { margin: 0 0 18px; line-height: 1.6; }
.empty .who { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }

.typing { padding: 0 24px; min-height: 26px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12.5px; color: var(--muted); }
.typing-item { display: inline-flex; gap: 6px; align-items: center; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--working); opacity: 0.35; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 40% { opacity: 1; } }

/* 输入框 */
.composer { padding: 6px 20px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); position: relative; }
.composer > * { max-width: 800px; margin-left: auto; margin-right: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 4px; font-size: 13px; color: var(--muted); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.plain { padding-left: 10px; }
.input-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px 6px 6px 14px; background: var(--surface); transition: border-color 0.15s; }
.input-box:focus-within { border-color: var(--accent); }
#input { flex: 1; border: 0; outline: none; resize: none; font: inherit; font-size: 16px; line-height: 1.5; padding: 6px 0; max-height: 220px; background: transparent; }
.send { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.send svg { stroke-width: 2.2; width: 18px; height: 18px; }
.send:disabled { opacity: 0.4; cursor: default; }
.mention-pop { position: absolute; bottom: calc(100% - 4px); left: 20px; width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(22, 24, 29, 0.12); padding: 5px; z-index: 20; }
.mention-opt { display: flex; gap: 10px; align-items: center; width: 100%; padding: 6px 8px; border: 0; background: none; border-radius: var(--r-sm); text-align: left; font-size: 14px; }
.mention-opt.sel, .mention-opt:hover { background: var(--accent-soft); }
.mention-opt small { color: var(--faint); margin-left: auto; font-size: 12px; }

/* ---------- 右栏 ---------- */
.panel { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px; min-height: 64px; padding-top: max(14px, env(safe-area-inset-top)); }
.panel-title { font-weight: 650; padding-left: 4px; }
.tabs { display: flex; gap: 2px; background: var(--paper); border-radius: 9px; padding: 3px; }
.tab { border: 0; background: transparent; border-radius: 7px; padding: 5px 14px; font-size: 13.5px; color: var(--muted); }
.tab.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(22, 24, 29, 0.08); }
.count { display: inline-block; min-width: 17px; padding: 0 5px; border-radius: 9px; background: var(--working); color: #fff; font-size: 11px; line-height: 17px; text-align: center; margin-left: 2px; }
.count:empty { display: none; }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 10px 14px; }

.member { display: flex; gap: 12px; align-items: center; padding: 9px 8px; border-radius: var(--r-md); }
.member:hover { background: var(--paper); }
.member-meta { flex: 1; min-width: 0; }
.member-name { font-weight: 600; font-size: 14.5px; }
.member-state { font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.member-state.working { color: var(--working); }
.member-state.waiting { color: var(--waiting); }
.small-btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); font-size: 12.5px; padding: 3px 9px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.small-btn:hover { color: var(--ink); border-color: var(--faint); }
.small-btn.stop { color: var(--danger); }
.small-btn svg { width: 14px; height: 14px; }
.av-edit { border: 0; padding: 0; background: none; border-radius: 50%; position: relative; }
.av-edit::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(22, 24, 29, 0.45) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='4.5' width='17' height='15' rx='2.5'/%3E%3Ccircle cx='9' cy='10' r='1.8'/%3E%3Cpath d='M4 17l5-4.5 4 3.5 3-2.5 4 3.5'/%3E%3C/svg%3E") center / 45% no-repeat; opacity: 0; transition: opacity 0.15s; z-index: 2; }
.av-edit:hover::before, .av-edit:focus-visible::before { opacity: 1; }

.profile { text-align: center; padding: 18px 10px; }
.profile .av-edit { margin: 0 auto 12px; display: block; }
.profile h4 { margin: 0; font-size: 18px; }
.profile .role { color: var(--muted); font-size: 13.5px; margin: 6px 0 14px; line-height: 1.6; }
.profile .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.panel-foot { border-top: 1px solid var(--line); padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.ghost-danger { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; border: 1px solid #f3cfcc; color: var(--danger); background: var(--surface); border-radius: var(--r-sm); padding: 7px; font-size: 13.5px; }
.ghost-danger svg { width: 16px; height: 16px; }
.workdir { font-size: 11.5px; color: var(--faint); margin-top: 8px; word-break: break-all; font-family: ui-monospace, Menlo, monospace; }

/* 任务板 */
.task-group h4 { margin: 14px 4px 8px; font-size: 12.5px; color: var(--faint); font-weight: 500; display: flex; justify-content: space-between; }
.task-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 8px; }
.task-card.review { border-color: #f1d79c; background: #fffaf0; }
.task-card.done { opacity: 0.55; }
.task-top { display: flex; gap: 8px; align-items: baseline; }
.task-id { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: var(--faint); flex: none; }
.task-title { font-size: 14px; line-height: 1.5; }
.task-people { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.rounds { margin-left: auto; color: var(--working); font-size: 12px; }
.task-summary { font-size: 12.5px; color: var(--muted); margin-top: 6px; padding-left: 8px; border-left: 2px solid var(--line); }
.task-actions { display: flex; gap: 6px; margin-top: 10px; }
.task-actions button { flex: 1; border-radius: var(--r-sm); padding: 5px; font-size: 13px; border: 1px solid var(--line); background: var(--surface); }
.task-actions .ok { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-actions .no { color: var(--danger); }
.task-empty { color: var(--muted); font-size: 13.5px; padding: 28px 12px; line-height: 1.8; text-align: center; }
.task-empty code { background: var(--paper); padding: 2px 6px; border-radius: 4px; font-size: 12.5px; }

/* ---------- 对话框 ---------- */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(440px, 92vw); box-shadow: 0 24px 60px rgba(22, 24, 29, 0.22); color: var(--ink); }
dialog::backdrop { background: rgba(22, 24, 29, 0.35); }
dialog form { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
dialog h3 { margin: 0; font-size: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; color: var(--muted); }
.field input { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; font: inherit; font-size: 15px; color: var(--ink); outline: none; }
.field input:focus { border-color: var(--accent); }
.pick-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); color: var(--ink); font-size: 14.5px; cursor: pointer; }
.pick:hover { background: var(--paper); }
.pick input { margin: 0; accent-color: var(--accent); width: 16px; height: 16px; }
.pick small { color: var(--faint); margin-left: auto; font-size: 12px; max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint { margin: -8px 0 0; font-size: 12.5px; color: var(--faint); }
.hint.err { color: var(--danger); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 8px 18px; font-size: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.scrim { display: none; position: fixed; inset: 0; background: rgba(22, 24, 29, 0.3); z-index: 10; }

/* ---------- 窄屏 / 手机 ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(320px, 88vw); transform: translateX(100%); transition: transform 0.22s ease; z-index: 20; }
  .app.show-panel .panel { transform: none; box-shadow: -12px 0 40px rgba(22, 24, 29, 0.12); }
  .app.show-panel .scrim { display: block; }
  #closePanel { display: grid; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 88vw); transform: translateX(-100%); transition: transform 0.22s ease; z-index: 20; }
  .app.show-sidebar .sidebar { transform: none; box-shadow: 12px 0 40px rgba(22, 24, 29, 0.12); }
  .app.show-sidebar .scrim { display: block; }
  .only-narrow { display: grid; }
  .chat-head { padding-left: 8px; gap: 6px; }
  .head-avatar > .av { --size: 32px; }
  .messages { padding: 14px 12px 6px; }
  .msg-body { max-width: 84%; }
  .composer { padding-left: 10px; padding-right: 10px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip { flex: none; }
}

/* ---------- 账号 ---------- */
.av.human { background: #5b6170; }
.me-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.me-row .av { --size: 28px; font-size: 12px; }
.me-name { flex: 1; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.people-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 8px 6px; font-size: 12.5px; color: var(--faint); }
.people-head:first-child { margin-top: 4px; }
.acct-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; max-height: 260px; overflow-y: auto; }
.acct { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); }
.acct:hover { background: var(--paper); }
.acct .who { flex: 1; min-width: 0; }
.acct .who b { display: block; font-size: 14.5px; }
.acct .who small { color: var(--faint); font-size: 12.5px; }
.acct-empty { color: var(--faint); font-size: 13.5px; padding: 10px; }
.acct-new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.field input { width: 100%; min-width: 0; }
.secret { font-family: ui-monospace, Menlo, monospace; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 5px; user-select: all; }
@media (max-width: 520px) { .acct-new { grid-template-columns: 1fr; } }

/* =========================================================
   液态玻璃层：彩色柔光底 + 半透明毛玻璃面板 + 多层阴影
   ========================================================= */
:root {
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.74);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --glass-line: rgba(255, 255, 255, 0.55);
  --blur: blur(30px) saturate(185%);
  --shadow-1: 0 1px 2px rgba(28, 38, 60, 0.06), 0 4px 14px rgba(28, 38, 60, 0.07);
  --shadow-2: 0 2px 6px rgba(28, 38, 60, 0.06), 0 14px 40px rgba(28, 38, 60, 0.12);
  --shadow-3: 0 6px 18px rgba(28, 38, 60, 0.10), 0 30px 80px rgba(28, 38, 60, 0.22);
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  --line: rgba(28, 38, 60, 0.08);
  --hover: rgba(255, 255, 255, 0.55);
  --accent-soft: rgba(14, 124, 107, 0.11);
}
html, body {
  background:
    radial-gradient(900px 620px at 8% 6%, rgba(102, 205, 186, 0.42), transparent 62%),
    radial-gradient(760px 560px at 92% 12%, rgba(160, 150, 255, 0.34), transparent 60%),
    radial-gradient(820px 640px at 70% 96%, rgba(255, 186, 140, 0.34), transparent 60%),
    radial-gradient(700px 520px at 6% 92%, rgba(120, 180, 255, 0.30), transparent 60%),
    #eef1f6;
  background-attachment: fixed;
}
.glass, .sidebar, .chat, .panel, .menu, .mention-pop, dialog {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--hi), var(--shadow-2);
  border: 1px solid var(--glass-line);
}

/* 三块浮起来的玻璃面板 */
.app { padding: 14px; gap: 14px; }
.sidebar, .chat, .panel { border-radius: 26px; overflow: hidden; }
.sidebar { border-right: 1px solid var(--glass-line); background: rgba(255, 255, 255, 0.42); }
.panel { border-left: 1px solid var(--glass-line); background: rgba(255, 255, 255, 0.46); }
.chat { background: rgba(255, 255, 255, 0.34); }

/* 顶栏和输入区：更厚一层玻璃 */
.chat-head { background: var(--glass-strong); border-bottom: 1px solid var(--glass-line); box-shadow: 0 1px 0 rgba(255,255,255,0.7), 0 6px 20px rgba(28, 38, 60, 0.05); position: relative; z-index: 2; }
.brand-mark { background: linear-gradient(145deg, #19a58c, #0b6e5f); box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 4px 12px rgba(14, 124, 107, 0.35); border-radius: 10px; }

/* 会话列表 */
.conv { border-radius: 16px; transition: background 0.15s, box-shadow 0.15s; }
.conv:hover { background: rgba(255, 255, 255, 0.5); }
.conv.active { background: rgba(255, 255, 255, 0.82); box-shadow: var(--hi), var(--shadow-1); }
.conv.active .stack .av { box-shadow: 0 0 0 2px #fff; }
.stack .av { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9); }
.sidebar-foot { border-top: 1px solid var(--glass-line); background: rgba(255, 255, 255, 0.35); }
.me-row { border-bottom: 1px solid var(--line); }

/* 头像带一点立体感 */
.av { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 6px rgba(28, 38, 60, 0.16); }
.av.sm, .av.xs { box-shadow: 0 1px 3px rgba(28, 38, 60, 0.18); }
.av.has-img { box-shadow: 0 0 0 1px rgba(255,255,255,0.9), 0 2px 6px rgba(28, 38, 60, 0.16); }

/* 气泡 */
.bubble {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--hi), var(--shadow-1);
  border-radius: 6px 20px 20px 20px;
}
.msg.mine .bubble {
  background: linear-gradient(150deg, #17a58b 0%, #0d7a69 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 6px 18px rgba(14, 124, 107, 0.30);
  border-radius: 20px 6px 20px 20px;
}
.msg.mine .mention { color: #fff; }
.bubble pre { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 4px 14px rgba(0,0,0,0.18); border-radius: 12px; }
.notice.task { background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(255,255,255,0.7); box-shadow: var(--shadow-1); border-radius: 16px; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.notice.error { background: rgba(255, 236, 234, 0.8); border-radius: 16px; box-shadow: var(--shadow-1); }
.time-sep { color: var(--muted); }

/* 输入区：悬浮的玻璃胶囊 */
.composer { background: linear-gradient(to top, rgba(255,255,255,0.55), rgba(255,255,255,0)); }
.input-box {
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  border-radius: 24px;
  box-shadow: var(--hi), var(--shadow-2);
}
.input-box:focus-within { border-color: rgba(14, 124, 107, 0.45); box-shadow: var(--hi), 0 0 0 4px rgba(14, 124, 107, 0.12), var(--shadow-2); }
.send { border-radius: 50%; background: linear-gradient(150deg, #19a58c, #0b6e5f); box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 4px 12px rgba(14, 124, 107, 0.35); }
.chip { background: rgba(255, 255, 255, 0.66); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.chip:hover { background: #fff; }

/* 按钮 */
.icon-btn { border-radius: 12px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.7); box-shadow: var(--shadow-1); }
.icon-btn.on { background: rgba(255, 255, 255, 0.85); box-shadow: var(--hi), var(--shadow-1); }
.small-btn, .btn, .task-actions button, .ghost-danger { background: rgba(255, 255, 255, 0.7); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1); border-radius: 12px; }
.btn.primary, .task-actions .ok { background: linear-gradient(150deg, #19a58c, #0b6e5f); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 6px 16px rgba(14, 124, 107, 0.32); }
.ghost-danger { border-color: rgba(214, 69, 61, 0.25); }

/* 右侧面板 */
.tabs { background: rgba(28, 38, 60, 0.06); border-radius: 12px; }
.tab { border-radius: 9px; }
.tab.active { background: rgba(255, 255, 255, 0.92); box-shadow: var(--hi), var(--shadow-1); }
.member { border-radius: 14px; }
.member:hover { background: rgba(255, 255, 255, 0.55); }
.panel-foot { border-top: 1px solid var(--glass-line); }
.task-card { background: rgba(255, 255, 255, 0.7); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1); border-radius: 16px; }
.task-card.review { background: rgba(255, 248, 230, 0.85); border-color: rgba(241, 215, 156, 0.9); }

/* 弹窗、菜单 */
dialog { background: rgba(255, 255, 255, 0.78); border-radius: 26px; box-shadow: var(--hi), var(--shadow-3); }
dialog::backdrop { background: rgba(28, 38, 60, 0.22); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.menu, .mention-pop { background: rgba(255, 255, 255, 0.78); border-radius: 16px; box-shadow: var(--hi), var(--shadow-3); }
.field input, .field select { border-radius: 12px; background: rgba(255, 255, 255, 0.75); border: 1px solid var(--line); }
.pick-list, .acct-list { background: rgba(255, 255, 255, 0.5); border: 1px solid var(--glass-edge); border-radius: 16px; }
.pick:hover, .acct:hover { background: rgba(255, 255, 255, 0.8); }
.scrim { background: rgba(28, 38, 60, 0.2); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* 窄屏：抽屉也是玻璃 */
@media (max-width: 1100px) {
  .panel { top: 10px; bottom: 10px; right: 10px; border-radius: 26px; background: rgba(255,255,255,0.72); }
  .app.show-panel .panel { box-shadow: var(--hi), var(--shadow-3); }
  .panel { transform: translateX(calc(100% + 20px)); }
}
@media (max-width: 760px) {
  .app { padding: 0; gap: 0; }
  .chat { border-radius: 0; border: 0; box-shadow: none; background: transparent; }
  .sidebar { top: 10px; bottom: 10px; left: 10px; border-radius: 26px; background: rgba(255,255,255,0.72); transform: translateX(calc(-100% - 20px)); }
  .app.show-sidebar .sidebar { box-shadow: var(--hi), var(--shadow-3); }
  .chat-head { background: rgba(255, 255, 255, 0.6); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
  .composer { background: linear-gradient(to top, rgba(255,255,255,0.7) 40%, rgba(255,255,255,0)); }
}
@media (prefers-reduced-transparency: reduce) {
  .sidebar, .chat, .panel, dialog, .menu, .input-box { background: #fff; }
}

/* ---------- 未读 / @我 ---------- */
.conv-bottom { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.conv-bottom .conv-preview { flex: 1; min-width: 0; margin-top: 0; }
.badge { flex: none; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: linear-gradient(150deg, #8a909c, #6a7080); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 19px; text-align: center; box-shadow: 0 2px 6px rgba(28,38,60,0.2); }
.badge.at { background: linear-gradient(150deg, #ff6b5e, #e0392f); box-shadow: 0 2px 8px rgba(224, 57, 47, 0.4); }
.at-tag { color: #e0392f; font-weight: 600; }
.mention.me { background: rgba(255, 193, 7, 0.22); color: #9a6200; border-radius: 4px; padding: 0 3px; }
.msg.mine .mention.me { background: rgba(255,255,255,0.22); color: #fff; }
.msg.at-me .bubble { box-shadow: var(--hi), 0 0 0 2px rgba(255, 193, 7, 0.45), var(--shadow-1); }

/* ---------- 引用 / 操作 ---------- */
.msg-body { position: relative; }
.quote { display: block; text-align: left; border: 0; margin: 0 0 6px; max-width: 100%; padding: 6px 10px; font-size: 12.5px; color: var(--muted); background: rgba(255, 255, 255, 0.5); border-left: 3px solid rgba(14, 124, 107, 0.5); border-radius: 4px 12px 12px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--shadow-1); }
.quote b { color: var(--ink); margin-right: 6px; font-weight: 600; }
.msg.mine .quote { align-self: flex-end; border-left: 0; border-right: 3px solid rgba(14, 124, 107, 0.5); border-radius: 12px 4px 4px 12px; }
.msg-actions { display: flex; gap: 4px; margin-top: 5px; opacity: 0; pointer-events: none; transition: opacity 0.15s; height: 26px; }
.msg.mine .msg-actions { justify-content: flex-end; }
.msg:hover .msg-actions, .msg.show-actions .msg-actions { opacity: 1; pointer-events: auto; }
@media (hover: none) { .msg-actions { height: 0; overflow: hidden; margin-top: 0; } .msg.show-actions .msg-actions { height: 30px; margin-top: 6px; } }
.msg-actions button { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--glass-edge); background: rgba(255,255,255,0.75); border-radius: 999px; padding: 2px 10px 2px 8px; font-size: 12px; color: var(--muted); box-shadow: var(--shadow-1); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.msg-actions button:hover { color: var(--ink); background: #fff; }
.msg-actions button.done { color: var(--accent); }
.msg-actions svg { width: 14px; height: 14px; }
.msg-body .msg-head + .msg-actions { display: none; }
@keyframes flash { 0%, 60% { background: rgba(255, 193, 7, 0.22); } 100% { background: transparent; } }
.msg.flash { animation: flash 1.8s ease-out; border-radius: 16px; }
.reply-bar { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; padding: 6px 6px 6px 12px; font-size: 13px; color: var(--muted); background: rgba(255,255,255,0.7); border: 1px solid var(--glass-edge); border-radius: 14px; box-shadow: var(--shadow-1); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.reply-bar > svg { width: 16px; height: 16px; color: var(--accent); }
.reply-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar .icon-btn { width: 28px; height: 28px; }
.reply-bar .icon-btn svg { width: 16px; height: 16px; }

/* ---------- 代码块复制 ---------- */
.bubble pre { position: relative; }
.copy-code { position: absolute; top: 6px; right: 6px; border: 0; border-radius: 7px; background: rgba(255, 255, 255, 0.12); color: #e6e8ec; font-size: 11.5px; padding: 3px 9px; opacity: 0.75; }
.copy-code:hover { opacity: 1; background: rgba(255, 255, 255, 0.2); }
.copy-code.done { color: #7ee2c8; }

/* ---------- 附件 ---------- */
.files { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.msg.mine .files { justify-content: flex-end; }
.file-img { display: block; border-radius: 16px; overflow: hidden; box-shadow: var(--hi), var(--shadow-2); border: 1px solid rgba(255,255,255,0.8); line-height: 0; }
.file-img img { max-width: min(280px, 60vw); max-height: 280px; object-fit: cover; display: block; }
.file-card { display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 10px; min-width: 200px; max-width: 300px; border-radius: 16px; background: rgba(255, 255, 255, 0.82); border: 1px solid var(--glass-edge); box-shadow: var(--hi), var(--shadow-1); text-decoration: none; color: var(--ink); }
.file-card:hover { background: #fff; }
.file-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: linear-gradient(150deg, #19a58c, #0b6e5f); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.35); }
.file-meta { min-width: 0; display: flex; flex-direction: column; }
.file-meta b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta small { font-size: 12px; color: var(--faint); }
.attach-tray { display: flex; gap: 8px; overflow-x: auto; margin: 0 2px 8px; padding: 2px; scrollbar-width: none; }
.att { display: flex; align-items: center; gap: 8px; flex: none; max-width: 240px; padding: 5px 4px 5px 5px; border-radius: 14px; background: rgba(255,255,255,0.8); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1); }
.att img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; }
.att .file-icon { width: 36px; height: 36px; }
.att-meta { min-width: 0; display: flex; flex-direction: column; }
.att-meta b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.att-meta small { font-size: 11.5px; color: var(--faint); }
.att.err small { color: var(--danger); }
.att button { border: 0; background: none; color: var(--faint); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.att button svg { width: 15px; height: 15px; }
.att button:hover { background: rgba(28,38,60,0.06); color: var(--ink); }
.attach-btn { border: 0; background: none; color: var(--muted); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-left: -8px; }
.attach-btn:hover { background: rgba(28,38,60,0.06); color: var(--accent); }
.chat.dropping::after { content: "松开，把文件发到这个群"; position: absolute; inset: 10px; border-radius: 22px; border: 2px dashed rgba(14,124,107,0.55); background: rgba(226, 242, 239, 0.7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: grid; place-items: center; font-size: 16px; font-weight: 600; color: var(--accent); z-index: 10; pointer-events: none; }

/* ---------- 搜索 ---------- */
.search-dialog { width: min(600px, 94vw); padding: 0; top: 10vh; margin: 0 auto; max-height: 76vh; overflow: hidden; }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-box { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-box > svg { color: var(--faint); }
#searchInput { flex: 1; border: 0; outline: none; background: none; font: inherit; font-size: 17px; min-width: 0; }
.search-scope { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.search-results { overflow-y: auto; padding: 6px; }
.search-tabs { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.search-tab { border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--muted); padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.search-tab.on { background: rgba(255,255,255,0.85); color: var(--ink); box-shadow: var(--shadow-1); font-weight: 600; }
.search-where { margin-left: auto; font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.hit { cursor: pointer; align-items: center; }
.hit > .small-btn { flex: none; text-decoration: none; }
.hit .file-icon { flex: none; }
.search-empty { color: var(--faint); font-size: 14px; padding: 26px; text-align: center; }
.hit { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 14px; }
.hit:hover { background: rgba(255,255,255,0.8); box-shadow: var(--shadow-1); }
.hit-meta { min-width: 0; flex: 1; }
.hit-top { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--faint); }
.hit-top b { color: var(--ink); font-size: 13.5px; }
.hit-top time { margin-left: auto; }
.hit-text { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hit mark { background: rgba(255, 193, 7, 0.35); color: var(--ink); border-radius: 3px; padding: 0 1px; }
@media (max-width: 760px) { input, textarea, select { font-size: 16px !important; } }

/* ---------- 开关 ---------- */
.switch-row { cursor: pointer; user-select: none; }
.switch-row > span { flex: 1; }
.switch-row.disabled { cursor: default; opacity: 0.6; }
.switch {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 46px; height: 28px; border-radius: 999px; position: relative; cursor: inherit;
  background: rgba(28, 38, 60, 0.16);
  box-shadow: inset 0 1px 3px rgba(28, 38, 60, 0.18);
  transition: background 0.25s ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(180deg, #fff, #f4f5f7);
  box-shadow: 0 2px 6px rgba(28, 38, 60, 0.25), 0 0 0 0.5px rgba(28, 38, 60, 0.08);
  transition: transform 0.25s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch:checked { background: linear-gradient(150deg, #19a58c, #0b6e5f); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.foot-btn.switch-row:hover { background: rgba(255, 255, 255, 0.5); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
.chat-name.editable { cursor: pointer; border-radius: 6px; }
.chat-name.editable:hover { text-decoration: underline dotted rgba(28, 38, 60, 0.35); text-underline-offset: 4px; }
.brand-mark { display: block; background: none; padding: 0; width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 4px 12px rgba(14, 124, 107, 0.3); }
.brand-name { letter-spacing: 0; font-weight: 750; }

/* ---------- SVG 预览 ---------- */
.svg-preview { margin: 8px 0 4px; line-height: 0; }
.svg-preview img { width: min(220px, 55vw); height: auto; border-radius: 14px; box-shadow: var(--shadow-2); background: repeating-conic-gradient(#eef0f3 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.svg-code summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin: 4px 0; user-select: none; }
.svg-code[open] summary { margin-bottom: 0; }
.msg.mine .svg-code summary { color: rgba(255,255,255,0.8); }

/* ---------- 模型 ---------- */
.model-chip { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; line-height: 18px; vertical-align: 1px; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(14, 124, 107, 0.18); cursor: pointer; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-chip:hover { background: rgba(14, 124, 107, 0.18); }
.model-chip.off { color: var(--faint); background: rgba(28, 38, 60, 0.05); border-color: transparent; cursor: default; }
.profile .row .model-chip { margin-left: 4px; }
.model-list { max-height: 320px; overflow-y: auto; }
.model-opt { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.model-opt .model-id { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.model-opt .model-label { grid-column: 2; font-size: 12px; color: var(--faint); }

.effort-list { display: flex; flex-wrap: wrap; gap: 6px; }
.effort { border: 1px solid var(--glass-edge); background: rgba(255,255,255,0.7); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); box-shadow: var(--shadow-1); }
.effort:hover { background: #fff; color: var(--ink); }
.effort.on { background: linear-gradient(150deg, #19a58c, #0b6e5f); color: #fff; border-color: transparent; }

/* 右侧「文件」标签页 */
.file-filter { width: 100%; box-sizing: border-box; border: 1px solid var(--line); background: rgba(255,255,255,0.7); border-radius: 12px; padding: 8px 12px; font: inherit; font-size: 16px; outline: none; margin-bottom: 8px; }
.ftab-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
.ftab-item:hover { background: rgba(255,255,255,0.8); box-shadow: var(--shadow-1); }
.ftab-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; flex: none; }
.ftab-item .file-icon { flex: none; }
.ftab-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ftab-meta b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftab-meta small { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftab-item > .small-btn { flex: none; text-decoration: none; }
