:root {
  --bg: #080a0e;
  --rail: #0c0f14;
  --panel: #11151c;
  --panel-2: #151a22;
  --panel-3: #1a202a;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #edf0f5;
  --muted: #8a93a6;
  --faint: #5c6577;
  --accent: #e8b86d;
  --accent-soft: rgba(232, 184, 109, 0.12);
  --accent-line: rgba(232, 184, 109, 0.34);
  --teal: #6ed3b6;
  --blue: #8fa8ff;
  --danger: #ff7a7a;
  /* 表面/控件主题 token（弹窗、输入区、附件条不再写死深色）
     原值是 --soft: var(--soft) 这类自引用，CSS 会判为循环无效值，
     导致默认深色主题下所有 var(--soft) 全部失效。这里补成真实色值。 */
  --soft: rgba(255, 255, 255, 0.035);
  --hover-bg: rgba(255, 255, 255, 0.055);
  --active-bg: rgba(255, 255, 255, 0.09);
  /* 深度思考等组件引用的 token 未定义时，主题绑定不生效 */
  --border: var(--line);
  --border-strong: var(--line-2);
  --text-2: #c9d3e3;
  --modal-bg: linear-gradient(180deg, #151a22, #10141b);
  --composer-bg: rgba(8, 10, 14, 0.78);
  --field-bg: rgba(21, 26, 34, 0.92);
  --field-bg-focus: rgba(24, 29, 38, 0.96);
  --radius: 14px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.app {
  display: flex;
  height: 100vh;
  min-width: 760px;
  overflow: hidden;
  background:
    radial-gradient(900px 540px at 74% -12%, rgba(232, 184, 109, 0.06), transparent 62%),
    radial-gradient(760px 520px at 6% 112%, rgba(110, 211, 182, 0.05), transparent 60%),
    var(--bg);
}

/* 桌面端标题条（方案 B）：titleBarStyle:'hidden' + titleBarOverlay 下，
   右上角三个按钮由系统绘制，整块客户区归网页，系统 caption 区不存在，
   所以顶部必须有一条可拖拽带，否则窗口拖不动。
   高度 36px 与主进程 TITLEBAR_H 一致；背景留空，让 .app 的渐变自然透上来。 */
 .titlebar-drag {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  /* 右侧 3×46px 留给自绘按钮；拖拽带与按钮不重叠，避免 again 出现
     「悬停出 Snap 面板、点下去没反应」的命中区打架。 */
  width: calc(100% - 138px);
  height: 36px;
  z-index: 40;
  -webkit-app-region: drag;
  background: transparent;
}

/* 自绘窗口按钮：位置与 .titlebar-drag 的 138px 预留严格对齐。
   按钮本身 no-drag，否则会被 Windows 当成 caption 拖拽区吞掉点击。 */
.win-controls {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  display: flex;
  height: 36px;
  -webkit-app-region: no-drag;
}
.win-controls[hidden] { display: none; }
.wc-btn {
  width: 46px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text, #1a1712);
  display: grid;
  place-items: center;
  cursor: default;
  -webkit-app-region: no-drag;
  transition: background-color .12s ease, color .12s ease;
}
.wc-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 1.1;
  fill: none;
  pointer-events: none;
}
.wc-btn:hover { background: rgba(26, 23, 18, .07); }
.wc-btn:active { background: rgba(26, 23, 18, .12); }
.wc-btn.wc-close:hover { background: #e81123; color: #fff; }
.wc-btn.wc-close:active { background: #c50f1f; color: #fff; }
/* 点关闭时把按钮自身的描边也调亮，深色主题下不糊成一团 */
[data-theme="glacier"] .wc-btn:hover { background: rgba(234, 240, 251, .10); }
[data-theme="glacier"] .wc-btn:active { background: rgba(234, 240, 251, .16); }
[data-theme="glacier"] .wc-btn.wc-close:hover { background: #e81123; }
.wc-ic-restore { display: none; }
body.win-maximized .wc-ic-max { display: none; }
body.win-maximized .wc-ic-restore { display: block; }

/* 给顶栏让位：.app 自身高度不变，内容区从标题条高度开始，
   避免右上角系统按钮压住市场页搜索框、会话页头部操作。 */
body.has-titlebar .app {
  padding-top: 36px;
}

/* 输入框 + 号与挂载 chip：+ 里挑技能，选中后在输入框上方成一条 chip */
.plus-btn { flex: none; }
.mount-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 16px 0;
  margin-top: 0;
}
.mount-row[hidden] { display: none; }
.mount-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  padding: 5px 8px 5px 10px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 12px;
}
.mount-chip .icon { width: 13px; height: 13px; color: var(--accent); flex: none; }
.mount-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mount-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.mount-remove .icon { width: 12px; height: 12px; color: var(--muted); }

.plus-menu {
  position: absolute;
  left: 14px;
  bottom: calc(100% + 8px);
  z-index: 60;
  width: 288px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.plus-menu[hidden] { display: none; }
.plus-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.plus-item:hover { background: var(--hover-bg); }
.plus-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent);
}
.plus-ic .icon { width: 15px; height: 15px; }
.plus-item div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plus-item strong { font-size: 13px; font-weight: 600; }
.plus-item span { font-size: 11px; color: var(--muted); }
.plus-skills {
  margin: 6px 4px 2px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}
.plus-skills[hidden] { display: none; }
.plus-skill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.plus-skill:hover { background: var(--hover-bg); }
.plus-skill.on { border-color: var(--accent-line); background: var(--accent-soft); }
.plus-skill-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent);
}
.plus-skill-ic .icon { width: 15px; height: 15px; }
.plus-skill-ic.skill-tile { background: var(--tile, var(--soft)); color: var(--fg, var(--accent)); }
.plus-skill-ic.skill-tile .icon { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.plus-skill-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plus-skill-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plus-skill-desc {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plus-empty { padding: 8px 10px; font-size: 11px; color: var(--muted); }

/* ------------------------------- rail ------------------------------- */
.rail {
  width: 74px;
  flex: 0 0 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 18px 0 16px;
  background: linear-gradient(180deg, #0d1016, #0a0d12);
  border-right: 1px solid var(--line);
}

/* 品牌色卡 —— 与 Q 图标同源的「色卡 + 大 Q」。
   底色/字色/投影都走主题变量：深色默认暖金、冰川冷蓝、宣纸琥珀，
   切换主题时自动换装，不再是一张固定图片。 */
:root {
  --brand-grad: linear-gradient(145deg, #f0c987 0%, #cf9a45 55%, #b07c2f 100%);
  --brand-ink: #1a1206;
  --brand-glow: rgba(232, 184, 109, 0.24);
  --brand-ring: rgba(255, 255, 255, 0.42);
}

[data-theme='glacier'] {
  --brand-grad: linear-gradient(145deg, #9cc4ff 0%, #5b91e8 55%, #3669b8 100%);
  --brand-ink: #06101f;
  --brand-glow: rgba(127, 178, 255, 0.26);
  --brand-ring: rgba(255, 255, 255, 0.38);
}

[data-theme='paper'] {
  --brand-grad: linear-gradient(145deg, #f4cd92 0%, #e0a556 55%, #c47f2c 100%);
  --brand-ink: #241703;
  --brand-glow: rgba(196, 127, 44, 0.22);
  --brand-ring: rgba(255, 255, 255, 0.55);
}

.rail-brand {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--brand-grad);
  color: var(--brand-ink);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 1;
  /* Q 字形的尾巴本身就是这个字符自带的，不需要额外描边；
     这里只补一点下沉阴影 + 顶部高光，和 App 图标同一套观感。 */
  text-shadow: 0 1px 0 var(--brand-ring);
  box-shadow: 0 8px 22px var(--brand-glow), inset 0 1px 0 var(--brand-ring);
}

.rail-nav,
.rail-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.rail-foot {
  margin-top: auto;
}

.rail-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 58px;
  padding: 8px 0 7px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  transition: background 160ms ease, color 160ms ease;
}

.rail-item:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.rail-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.rail-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.me-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2a3140, #171c25);
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* ------------------------------- shell ------------------------------- */

.shell {
  flex: 1;
  min-width: 0;
  display: grid;
  /* 右栏从固定 296px 放宽为弹性区间，让协作看板文字能横向铺开 */
  grid-template-columns: 296px minmax(460px, 1fr) minmax(340px, 400px);
  height: 100%;
  min-height: 0;
}

/* --------------------------- conversations --------------------------- */

.conv-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(180deg, rgba(17, 21, 28, 0.92), rgba(13, 16, 22, 0.96));
  border-right: 1px solid var(--line);
}

.conv-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 18px 14px;
}

.conv-header h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.conv-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.icon-btn:hover {
  background: var(--hover-bg);
  border-color: var(--line);
  color: var(--text);
}

.search-box,
.market-search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  margin: 0 18px 12px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--faint);
  transition: border-color 150ms ease, background 150ms ease;
}

.search-box:focus-within,
.market-search:focus-within {
  border-color: var(--accent-line);
  background: rgba(232, 184, 109, 0.05);
}

.search-box input,
.market-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
}

.search-box input::placeholder,
.market-search input::placeholder {
  color: var(--faint);
}

.conv-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 12px;
}

.conv-section {
  margin-top: 10px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 6px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-head .count {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--hover-bg);
  color: var(--muted);
  text-align: center;
  font-size: 10px;
  letter-spacing: 0;
}

.conv-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: calc(100% - 16px);
  margin: 0 8px 2px;
  padding: 10px 10px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.conv-delete {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.conv-row:hover .conv-delete {
  opacity: 1;
}

.conv-delete:hover {
  background: rgba(255, 80, 80, 0.2);
  color: #ff6b6b;
}

.conv-delete .icon {
  width: 14px;
  height: 14px;
}

/* 分组头折叠开关 + 列表折叠态 */
.section-head {
  cursor: pointer;
  user-select: none;
}

.section-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-chev {
  display: inline-block;
  color: var(--faint);
  font-size: 11px;
  transition: transform 160ms ease;
}

.section-head.collapsed .section-chev {
  transform: rotate(-90deg);
}

#groupList.hidden,
#privateList.hidden {
  display: none;
}

.conv-row:hover {
  background: rgba(255, 255, 255, 0.035);
}

.conv-row.active {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(232, 184, 109, 0.11), rgba(232, 184, 109, 0.02));
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 13px;
  border: 1px solid var(--line-2);
  color: #12151b;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.avatar.group {
  position: relative;
  overflow: hidden;
  color: #10131a;
  background:
    radial-gradient(circle at 28% 24%, rgba(232, 184, 109, 0.95), transparent 48%),
    radial-gradient(circle at 72% 34%, rgba(110, 211, 182, 0.9), transparent 50%),
    radial-gradient(circle at 50% 78%, rgba(143, 168, 255, 0.9), transparent 52%),
    #202633;
}

/* 群头像宫格（成员头像拼图）。
   与单人头像共用 .avatar 的尺寸档（40 / sm 32 / lg 64），
   内部按 --ga-cols 自动排布，3 人时第一格 span 2 行，形成左大右二布局。 */
.avatar.group.grid-avatar {
  padding: 0;
  border-radius: 13px;
  background: var(--panel-3);
  color: var(--muted);
}

.ga-grid {
  display: grid;
  grid-template-columns: repeat(var(--ga-cols, 3), 1fr);
  grid-auto-rows: 1fr;
  gap: 1px;
  padding: 1px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.ga-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 3px;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  font-style: normal;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
}

.ga-cell.has-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ga-cell.ga-more {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 8px;
  text-shadow: none;
}

.avatar.sm .ga-cell { font-size: 7px; }
.avatar.lg .ga-cell { font-size: 12px; border-radius: 5px; }

.avatar.sm {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  border-radius: 10px;
  font-size: 11px;
}

.avatar.lg {
  width: 64px;
  height: 64px;
  flex-basis: 64px;
  border-radius: 20px;
  font-size: 20px;
}

.conv-copy {
  flex: 1;
  min-width: 0;
}

.conv-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.conv-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-row.active .conv-name {
  color: var(--accent);
}

.conv-time {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.conv-preview {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-preview .who {
  color: var(--faint);
}

.unread {
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1206;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

/* 正在协作的会话：绿色徽标，切走也能一眼看到哪条在跑。
   去掉 runPulse 呼吸动画——renderConvList 每个事件都重建 DOM，
   动画反复重启视觉上「一直在闪」。改静态徽标，状态一眼可辨不晃眼。 */
.unread.run {
  background: #3fb950;
  color: #06210f;
}

/* 有待确认授权的会话：琥珀色徽标；切进该会话再弹审批浮层 */
.unread.approval {
  margin-left: 6px;
  background: #d97706;
  color: #1f1300;
}

@keyframes runPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* 执行中发送键变停止入口 */
.send-btn.stop-mode {
  background: var(--danger);
  color: #1a1206;
}

/* 聊天内思考强度快捷档位 */
/* 每成员独立的思考强度档位条。横向排布、可折行，放输入框上方显眼处。 */
.member-effort-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 24px 2px;
  flex: 0 0 auto;
}
.meb-label {
  flex: 0 0 auto;
  margin-top: 6px;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.03em;
}
.meb-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  min-width: 0;
}
.meb-member {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.meb-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.meb-name {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
}
.effort-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  background: rgba(20, 24, 30, 0.6);
}
.effort-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  line-height: 1;
  padding: 5px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.effort-switch button:hover { color: var(--text-2); }
.effort-switch button.active {
  background: var(--accent, #b8935a);
  color: #1a1206;
  font-weight: 600;
}

/* 档位折叠卡（从主区输入框上方沉入右侧「协作方式」面板） */
.effort-collapse {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--soft);
  overflow: hidden;
}
.effort-collapse > summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.effort-collapse > summary::-webkit-details-marker { display: none; }
.effort-collapse > summary::after {
  content: '▾';
  color: var(--faint);
  font-size: 10px;
  transition: transform 0.16s ease;
}
.effort-collapse:not([open]) > summary::after { transform: rotate(-90deg); }
.effort-collapse[open] > summary { border-bottom: 1px solid var(--border); }
.meb-inline { padding: 10px 12px; }
.meb-empty { font-size: 11.5px; color: var(--faint); }

/* 右上角三点菜单 */
.chat-panel { position: relative; }
.chat-menu {
  position: absolute;
  top: 58px;
  right: 18px;
  z-index: 40;
  min-width: 176px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #1c1f26;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.chat-menu[hidden] { display: none; }
.chat-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.chat-menu-item:hover { background: var(--hover-bg); }
.chat-menu-item .icon { width: 15px; height: 15px; }
.chat-menu-item.danger { color: #e88; }
.chat-menu-item.danger:hover { background: rgba(232, 100, 100, 0.12); }

.conv-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.dot.online {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(110, 211, 182, 0.12);
}

/* ------------------------------- chat ------------------------------- */

.chat-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background:
    radial-gradient(720px 420px at 78% -8%, rgba(232, 184, 109, 0.045), transparent 62%),
    linear-gradient(180deg, rgba(10, 13, 18, 0.98), rgba(8, 10, 14, 0.99));
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 18, 0.72);
  backdrop-filter: blur(14px);
}

.chat-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-avatars {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-avatars .avatar {
  border: 0;
}

.avatar-more {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.chat-title {
  min-width: 0;
}

.chat-title h2 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.chat-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 10.5px;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-pill .dot {
  background: var(--teal);
}

.model-pill.warn .dot {
  background: var(--accent);
}

.model-pill.err .dot {
  background: var(--danger);
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 0 10px;
  scroll-behavior: smooth;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  /* 过去固定 900px 宽又水平居中，宽屏下左侧凭空多出 200+px 空白，
     且与贴边的 header/composer 不对齐。改为左对齐铺满、统一内距，收窄左侧留白；
     用户消息本身靠 justify-content:flex-end 仍贴右。 */
  max-width: 1180px;
  margin: 0 0 18px;
  padding: 0 24px;
  animation: rise 220ms ease both;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-row.user .msg-main {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.msg-row.user .msg-meta {
  justify-content: flex-end;
}

.system-row span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.msg-main {
  min-width: 0;
  max-width: 680px;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 1px 0 5px;
}

.msg-name {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 680;
}

.role-chip {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.msg-time {
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

/* 排队中的消息 —— 让「已经收下、还没轮到发」这件事在时间线里可见 */
.role-chip.queue-chip {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.queue-hint {
  margin-top: 5px;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.bubble {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  /* 不再写死深色内衬，跟随主题 surface，宣纸主题下不再发黑 */
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.68;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-row.user .bubble {
  border-color: var(--accent-line);
  border-radius: 14px 4px 14px 14px;
  /* 跟随主题强调色：写死颜色会和深色主题冲突 */
  background: var(--accent-soft);
  color: var(--text);
}

/* 宣纸（浅色）下用户消息：金字配浅底几乎看不见，需提高对比度 */
[data-theme='paper'] .msg-row.user .bubble {
  border-color: rgba(181, 101, 29, 0.35);
  background: linear-gradient(145deg, rgba(181, 101, 29, 0.16), rgba(181, 101, 29, 0.07));
  color: #4a3517;
}

.system-row {
  display: flex;
  align-items: center;
  gap: 10px;
  /* 与 .msg-row 一起左对齐，避免居中留白 */
  max-width: 1180px;
  margin: 4px 0 18px;
  padding: 0 24px;
  color: var(--faint);
  font-size: 10.5px;
}

.system-row::before,
.system-row::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.artifact-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin-top: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  /* 默认底色跟随主题 surface：写死深色时宣纸主题不 hover 就发黑 */
  background: var(--panel-2);
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.artifact-card:hover {
  border-color: var(--accent-line);
  background: rgba(232, 184, 109, 0.06);
  transform: translateY(-1px);
}

.artifact-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  background: rgba(143, 168, 255, 0.12);
  color: var(--blue);
}

.artifact-thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--hover-bg);
  border: 1px solid var(--line);
}

.artifact-copy {
  flex: 1;
  min-width: 0;
}

.artifact-copy strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.artifact-open {
  color: var(--faint);
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}

/* 给三点一个固定占位盒，尺寸恒定，不随内容/成员切换抖动 */
.typing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: none;
  width: 21px;
  height: 6px;
}

.typing i {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
  /* 只做透明度呼吸，不再位移/缩放（点上下跳正是「乱跳」的观感来源）；
     配合 renderLive 的稳定节点，动画不会被重建打断。三点错相位 0 / 0.2s / 0.4s。 */
  animation: typing 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.2s;
}

.typing i:nth-child(3) {
  animation-delay: 0.4s;
}

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  /* 去掉胶囊外圈（边框/圆角/底色/内边距），只留绿点 + 文字 + 停止按钮；
     整体右移一点点，仍跟随消息流。 */
  align-self: flex-start;
  width: fit-content;
  max-width: calc(100% - 88px);
  margin: 0 0 8px 60px;
  color: var(--muted);
  font-size: 11px;
}

.status-strip .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(110, 211, 182, 0.45);
}

.status-strip strong {
  color: var(--text);
  font-weight: 650;
}

/* ------------------------------ composer ------------------------------ */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  /* 输入容器整体加宽（收窄两侧留白） */
  padding: 12px 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--composer-bg);
  backdrop-filter: blur(14px);
}

/* 待发送附件行——选完文件、上传中就出现，发送后清空 */
.attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 14px 8px;
  margin-top: 8px;
}
.attach-row[hidden] { display: none; }

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text);
  font-size: 12px;
}
.attach-chip .icon { width: 13px; height: 13px; color: var(--sub); flex: none; }
.attach-chip .attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-chip.uploading { opacity: 0.7; }
.attach-chip .attach-state { color: var(--sub); font-size: 11px; }

/* 图片附件的发送前预览：不再显示文件名，改成缩略图小方块 */
.attach-chip-img {
  position: relative;
  width: 52px;
  height: 52px;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--field-bg);
}
.attach-chip-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.attach-chip-img .attach-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.attach-chip-img .attach-remove .icon { width: 10px; height: 10px; color: #fff; }
.attach-remove {
  display: inline-flex;
  border: 0;
  background: transparent;
  color: var(--sub);
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
}
.attach-remove .icon { width: 12px; height: 12px; }
.attach-remove:hover { color: var(--danger, #ff6b6b); }

/* 已发出消息里的附件按钮（点开在工作区预览） */
.msg-skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.msg-attach {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--hover-bg);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.msg-attach .icon { width: 13px; height: 13px; color: var(--sub); }
.msg-attach:hover { border-color: var(--accent-line); }
/* 图片附件在气泡里显示缩略图，直观确认「这轮带了哪张图给模型」 */
.msg-attach-thumb {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 5px;
  flex: none;
  background: var(--hover-bg);
}
/* 图片附件在气泡内以大图缩略图块呈现，点击进预览 */
.msg-attach-img {
  display: block;
  width: min(132px, 62vw);
  height: min(132px, 62vw);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--hover-bg);
  padding: 0;
  cursor: pointer;
}
.msg-attach-img:hover { border-color: var(--accent-line); }
.msg-attach-thumb-lg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.composer textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 56px;
  max-height: 200px;
  padding: 14px 16px 10px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  resize: none;
  transition: background 150ms ease;
}

.composer textarea:focus {
  border-color: var(--accent-line);
  background: var(--field-bg-focus);
}

.composer textarea::placeholder {
  color: var(--faint);
}

.send-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, #f1c67f, #d9a04f);
  color: #211506;
  box-shadow: 0 8px 22px rgba(232, 184, 109, 0.18);
  transition: transform 150ms ease, filter 150ms ease;
}

.send-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.send-btn:active {
  transform: translateY(0);
}

/* ------------------------------ context ------------------------------ */

.context-panel {
  min-width: 0;
  min-height: 0;
  /* 收紧左右留白，把宽度让给看板文字 */
  padding: 18px 16px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(17, 21, 28, 0.72), rgba(13, 16, 22, 0.9));
  border-left: 1px solid var(--line);
}

.context-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 14px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.context-title .icon {
  width: 14px;
  height: 14px;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 7px;
  border-radius: 10px;
}

.member-row:hover {
  background: var(--soft);
}

.member-copy {
  flex: 1;
  min-width: 0;
}

.member-copy strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-copy small {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(110, 211, 182, 0.1);
}

.member-status.away {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 184, 109, 0.1);
}

.context-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* 协作看板：四栏实时派生，块级流式横向铺满右栏。 */
.collab-board {
  display: block;
  margin: 10px 0 4px;
}
.board-col {
  display: flex;
  flex-direction: column;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}
.board-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}
.board-col-head .board-ic .icon { width: 13px; height: 13px; color: var(--sub); }
.board-col-head .board-title { font-size: 12px; font-weight: 600; color: var(--text); }
.board-col-head .board-count {
  margin-left: auto;
  min-width: 18px;
  padding: 0 6px;
  text-align: center;
  border-radius: 9px;
  background: var(--active-bg);
  color: var(--muted);
  font-size: 11px;
}
.board-col-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px;
  max-height: 168px;
  overflow-y: auto;
}
.board-empty {
  padding: 8px 4px;
  color: var(--sub);
  font-size: 11px;
}
.board-item {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--hover-bg);
  color: var(--text);
  font-size: 11.5px;
  cursor: pointer;
}
.board-item .icon { width: 12px; height: 12px; color: var(--sub); flex: none; }
.board-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-item:hover { border-color: var(--accent-line); }

/* 看板跳转到消息时的高亮 */
.msg-row.msg-flash {
  animation: msgFlash 1.3s ease;
}
@keyframes msgFlash {
  0%, 100% { background: transparent; }
  20%, 60% { background: rgba(99, 179, 237, 0.16); }
}

/* 真实协作看板（CollabBoard） */
.rb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 6px;
  flex-wrap: wrap;
}
.rb-phase {
  padding: 3px 9px;
  border-radius: 9px;
  background: rgba(99, 179, 237, 0.14);
  color: var(--accent, #63b3ed);
  font-size: 11.5px;
  font-weight: 600;
}
.rb-progress { color: var(--muted); font-size: 11.5px; }
.rb-bar {
  height: 4px;
  border-radius: 3px;
  background: var(--active-bg);
  overflow: hidden;
  margin-bottom: 10px;
}
.rb-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #4fd1a5, #63b3ed);
  transition: width 0.5s ease;
}
.rb-section {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  padding: 9px 10px;
  margin-bottom: 8px;
}
.rb-sec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.rb-sec-head .icon { width: 13px; height: 13px; color: var(--sub); }
.rb-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  max-height: 180px;
  overflow-y: auto;
}
.rb-task {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--soft);
  padding: 7px 9px;
  margin-bottom: 6px;
}
.rb-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.rb-task-head strong { font-size: 12px; color: var(--text); }
.rb-worker {
  flex: none;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--active-bg);
  color: var(--muted);
  font-size: 10.5px;
}
.rb-sub {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 0;
  font-size: 11.5px;
  color: var(--muted);
}
.rb-sub .rb-mark { flex: none; }
.rb-sub.done .rb-sub-title { color: var(--sub); text-decoration: line-through; }
.rb-sub.blocked .rb-sub-title { color: #f28b82; }
.rb-gate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 11.5px;
}
.rb-gate-name { flex: none; color: var(--text); font-weight: 600; }
.rb-gate-reason {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--sub);
}
.rb-gate-mark { flex: none; }
.rb-gate.ok .rb-gate-mark { color: #4fd1a5; }
.rb-gate.no .rb-gate-mark { color: var(--sub); }
.rb-disc {
  display: flex;
  gap: 8px;
  padding: 2px 0;
  font-size: 11.5px;
  color: var(--muted);
}
.rb-disc-who { flex: none; color: var(--sub); font-weight: 600; }
.rb-disc span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  color: var(--muted);
  font-size: 11px;
}

.info-row strong {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

.notice-box {
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px 18px;
  text-align: center;
}

.profile-card .avatar {
  margin-bottom: 10px;
}

.profile-card h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.profile-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.chip:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ------------------------------- market ------------------------------- */

.market-view {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 44px 54px 56px;
}

.market-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  max-width: 1220px;
  margin: 0 auto;
}

.market-head h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.market-head p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.market-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.market-search {
  width: 300px;
  height: 42px;
  margin: 0;
  flex: 0 0 auto;
}

/* 顶部「已安装」入口按钮：搜索框旁独立带数量按钮 */
.market-installed-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.market-installed-btn:hover { border-color: var(--line-2); }
.market-installed-btn.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}
.mi-inline-count { font-size: 11px; color: var(--faint); }

/* 投稿表单 */
.submit-card {
  width: min(620px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
}
.submit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.submit-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11.5px;
}
.submit-field.wide { grid-column: 1 / -1; }
.submit-field em { color: var(--accent); font-style: normal; }
.submit-field i { color: var(--faint); font-style: normal; }
.submit-field input,
.submit-field select,
.submit-field textarea {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.55;
}
.submit-field textarea { resize: vertical; }
.submit-field input:focus,
.submit-field select:focus,
.submit-field textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  background: var(--field-bg-focus);
}
.submit-confirm {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
  cursor: pointer;
}
.submit-confirm input {
  width: auto;
  margin-top: 2px;
  accent-color: var(--accent);
}
.submit-error {
  padding: 8px 10px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.08);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.5;
}
@media (max-width: 560px) {
  .submit-form { grid-template-columns: 1fr; }
  .submit-field.wide,
  .submit-confirm.wide,
  .submit-error.wide { grid-column: auto; }
}

.market-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: 1220px;
  margin: 16px auto 14px;
}

.market-cat {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  transition: all 150ms ease;
}

.market-cat:hover,
.market-cat.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* 技能两段式子页签：目录 / 已安装 */
/* 二级分类：横排单行可横向滚动，不换行堆成一片 chips */
.market-sub {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 1220px;
  margin: 0 auto 4px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.market-sub::-webkit-scrollbar { display: none; }
.market-sub-btn {
  flex: none;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  transition: all 150ms ease;
}
.market-sub-btn:hover { color: var(--text); border-color: var(--line-2); }
.market-sub-btn.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* 已安装技能独立页：返回箭头 + 标题 + 数量 + 自己的搜索框 */
.market-installed { display: block; }
.mi-head {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1220px;
  margin: 0 auto 16px;
}
.mi-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
.mi-back:hover { color: var(--text); border-color: var(--line-2); }
.mi-back .icon { width: 15px; height: 15px; transform: rotate(180deg); }
.mi-head h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text);
}
.mi-count { font-size: 11px; color: var(--faint); }
.mi-head .market-search { margin-left: auto; }

.market-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  max-width: 1220px;
  margin: 0 auto;
}

.market-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 108px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    var(--panel);
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.market-card:hover {
  border-color: var(--line-2);
  background:
    linear-gradient(150deg, rgba(232, 184, 109, 0.07), rgba(255, 255, 255, 0.012)),
    var(--panel);
  transform: translateY(-2px);
}

.market-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--accent);
  flex: none;
}

.skill-tile {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: var(--tile, rgba(255, 255, 255, 0.06));
  color: var(--fg, var(--text));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 6px 14px rgba(0, 0, 0, 0.18);
}

.skill-tile .icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
  stroke-width: 0;
}

.skill-main .skill-tile.market-icon { margin-bottom: 0; }

.market-card h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 680;
}

.market-card p {
  flex: 1;
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.market-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.market-tag {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.market-state {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9.5px;
}

.market-state.ready {
  border-color: rgba(110, 211, 182, 0.24);
  background: rgba(110, 211, 182, 0.08);
  color: var(--teal);
}

.market-state.soon {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* 工具真实状态：缺依赖 / 待配置用琥珀色，网络不可用用红色 */
.market-state.warn {
  border-color: rgba(230, 169, 92, 0.32);
  background: rgba(230, 169, 92, 0.1);
  color: #d79a49;
}

.market-state.offline {
  border-color: rgba(226, 106, 106, 0.32);
  background: rgba(226, 106, 106, 0.1);
  color: #d96969;
}

/* 技能二级分组标题 */
.skill-group-title {
  grid-column: 1 / -1;
  margin: 18px 0 4px;
  font-size: 12px;
  font-weight: 680;
  color: var(--faint);
  letter-spacing: 0.04em;
}
.skill-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

/* 技能卡：左侧主体（图标 + 文案），右侧作用域勾选 + 启用开关 */
/* 工具卡：左图标 + 右文案，横排紧凑 */
.tool-card {
  flex-direction: row;
  gap: 12px;
  min-height: 104px;
}
.tool-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.tool-card .market-icon { margin-bottom: 0; }
.tool-card p { flex: 0; margin: 5px 0 8px; }
.tool-card .market-foot { justify-content: flex-end; }

.skill-card {
  flex-direction: row;
  gap: 12px;
  min-height: 132px;
}
.skill-card.off { opacity: 0.55; }
.skill-main {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 12px;
  cursor: pointer;
}
.skill-body { flex: 1; min-width: 0; }
.skill-body p { margin-bottom: 10px; }
.skill-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.skill-roles { color: var(--muted); font-size: 10px; }
.skill-scope {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.skill-scope.disabled { opacity: 0.4; cursor: not-allowed; }
.skill-scope input { accent-color: var(--accent); }

/* 启用开关 */
.skill-toggle {
  position: relative;
  width: 38px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  transition: background 180ms ease, border-color 180ms ease;
  flex-shrink: 0;
}
.skill-toggle.on {
  background: var(--teal);
  border-color: rgba(110, 211, 182, 0.4);
}
.skill-toggle-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 180ms ease;
}
.skill-toggle.on .skill-toggle-dot { transform: translateX(16px); }

/* 目录卡：安装按钮 / 已安装标记 */
.market-install {
  padding: 6px 13px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  flex-shrink: 0;
  transition: all 150ms ease;
}
.market-install:hover { border-color: var(--accent); }
.market-installed-tag {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--faint);
  font-size: 10.5px;
  flex-shrink: 0;
}
/* 已安装卡：开关与移除横排 */
.skill-side-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.skill-remove {
  border: none;
  background: transparent;
  color: var(--faint);
  font-size: 10.5px;
  cursor: pointer;
  padding: 4px 2px;
}
.skill-remove:hover { color: var(--danger); }

/* 技能详情弹层 */
.skill-modal { max-width: 620px; }
.skill-modal .modal-head { gap: 14px; }
.skill-modal .modal-head > div:nth-child(2) { flex: 1; min-width: 0; }
.skill-detail-icon { display: flex; align-items: center; flex: none; }
.skill-detail-icon .skill-tile { width: 44px; height: 44px; border-radius: 12px; }
.skill-detail-icon .skill-tile .icon { width: 27px; height: 27px; }
.skill-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 14px 21px 0;
}
.skill-detail-body { max-height: 52vh; overflow-y: auto; padding: 14px 21px 20px; }
/* 详情卡只展示介绍与归属信息，不渲染技能正文；下面这套是它的排版原语 */
.skill-detail-kicker {
  margin: 0 0 7px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.skill-detail-kicker.inline {
  display: inline-flex;
  align-items: center;
  margin: 0 2px 0 0;
  line-height: 24px;
}
.skill-detail-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--hover-bg);
  color: var(--sub);
  font-size: 11.5px;
}
.skill-detail-desc {
  margin: 0 0 22px;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.skill-detail-actions { display: flex; gap: 9px; }

/* ------------------------------- modal ------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(9px);
  animation: fade 160ms ease both;
}

.modal {
  width: min(520px, 100%);
  max-height: 86vh;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  animation: modalIn 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* 意见反馈浮层 */
.feedback-card {
  width: min(520px, 94vw);
  padding: 22px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  animation: modalIn 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.feedback-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.feedback-head h3 {
  margin: 6px 0 6px;
  font-size: 18px;
}

.feedback-head .muted {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.6;
}

.feedback-input {
  width: 100%;
  min-height: 132px;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
  resize: vertical;
}

.feedback-input:focus {
  outline: none;
  border-color: var(--accent-line);
  background: var(--field-bg-focus);
}

.feedback-meta {
  margin-top: 8px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.6;
}

.feedback-mailrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
}

.feedback-mail-label {
  color: var(--muted);
  flex: none;
}

.feedback-mail {
  color: var(--accent-2, var(--accent));
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
}

.feedback-mail-copy {
  flex: none;
  padding: 5px 10px;
  font-size: 11.5px;
}

.feedback-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}

.feedback-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 检查更新浮层 */
.update-body {
  margin: 4px 0 2px;
}

.update-version {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.update-notes {
  white-space: pre-wrap;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--field-bg);
}

/* 下载进度反馈 */
.update-progress {
  margin-top: 12px;
}

.update-progress-track {
  height: 4px;
  border-radius: 999px;
  background: var(--line-2);
  overflow: hidden;
}

.update-progress-track > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}

.update-progress-meta {
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 为爱发电浮层 —— 一级还原爱发电平台视觉，二级是作者本人的赞赏码 */
.sponsor-card {
  width: min(392px, 92vw);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  animation: modalIn 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* 一级：紫色主视觉（爱发电的品牌色） */
.sp-cover {
  position: relative;
  padding: 26px 24px 20px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(255, 255, 255, 0.22), transparent 62%),
    linear-gradient(135deg, #a173f3 0%, #7d51da 58%, #6b3fc7 100%);
}

.sp-close {
  position: absolute;
  top: 10px;
  right: 12px;
  color: rgba(255, 255, 255, 0.9) !important;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  z-index: 2;
}

.sp-close:hover { background: rgba(255, 255, 255, 0.22); }

.sp-avatar {
  width: 68px;
  height: 68px;
  margin: 4px auto 10px;
  border-radius: 50%;
  padding: 3px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(45, 20, 90, 0.28);
}

.sp-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.sp-name {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.sp-bio {
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

.sp-body {
  padding: 18px 22px 16px;
}

.sp-desc {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.72;
  text-align: center;
}

.sp-qr-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  border: 1px solid rgba(147, 51, 234, 0.28);
  border-radius: 11px;
  background: rgba(147, 51, 234, 0.09);
  color: #7c3aed;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.sp-qr-link:hover {
  background: rgba(147, 51, 234, 0.15);
  border-color: rgba(147, 51, 234, 0.42);
}

.sp-qr-link .icon { width: 15px; height: 15px; }

.sp-pay {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.04em;
}

.sp-platform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.sp-platform-name {
  font-size: 12.5px;
  font-weight: 750;
  color: #8a5ce0;
  letter-spacing: 0.04em;
}

.sp-platform-desc {
  font-size: 10.5px;
  color: var(--faint);
}

/* 二级：赞赏码 */
.sp-qr-view { text-align: center; }

.sp-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.sp-back .icon { width: 14px; height: 14px; transform: rotate(180deg); }
.sp-back:hover { color: var(--text); }

.sp-qr-box {
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 14px;
  background: #0e0f13;
  border: 1px solid var(--line);
}

.sp-qr-box img {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 8px;
}

.sp-qr-tip {
  margin: 12px 0 4px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.sp-qr-thanks {
  margin: 0;
  font-size: 11px;
  color: var(--faint);
}

/* 群聊改名浮层 —— 与 .modal 同一套表面材质，但更窄更轻。 */
.rename-card {
  width: min(420px, 92vw);
  padding: 22px 22px 18px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  animation: modalIn 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.rename-head h3 {
  margin: 6px 0 6px;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.rename-head .muted {
  margin: 0 0 16px;
  font-size: 12.5px;
  line-height: 1.6;
}

.rename-input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.rename-input:focus {
  outline: none;
  border-color: var(--accent-line);
  background: var(--field-bg-focus);
}

.rename-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 21px 15px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 5px 0 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.modal-head p {
  margin: 5px 0 0;
  font-size: 11.5px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 18px 21px;
  overflow-y: auto;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
}

.field input {
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--field-bg);
  color: var(--text);
  font-size: 12.5px;
}

.field input:focus {
  border-color: var(--accent-line);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 21px 18px;
  border-top: 1px solid var(--line);
}

.ghost,
.primary,
.danger {
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 650;
  transition: filter 150ms ease, background 150ms ease, border-color 150ms ease;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.ghost:hover {
  border-color: var(--line-2);
  background: var(--hover-bg);
  color: var(--text);
}

.primary {
  border: 0;
  background: linear-gradient(145deg, #f1c67f, #d9a04f);
  color: #211506;
}

.primary:hover {
  filter: brightness(1.04);
}

.danger {
  border: 1px solid rgba(255, 122, 122, 0.28);
  background: rgba(255, 122, 122, 0.1);
  color: var(--danger);
}

/* 确认浮层的主操作按钮：实心红，一眼能认出这是不可恢复操作 */
.danger-solid {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: #d2564f;
  color: #fff;
  font-size: 11.5px;
  font-weight: 650;
  transition: filter 150ms ease;
}

.danger-solid:hover {
  filter: brightness(1.06);
}

.danger-solid:focus-visible {
  outline: 2px solid rgba(210, 86, 79, 0.5);
  outline-offset: 2px;
}

.error-box {
  padding: 9px 11px;
  border: 1px solid rgba(255, 122, 122, 0.24);
  border-radius: 9px;
  background: rgba(255, 122, 122, 0.08);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.5;
}

.cfg-path {
  font-size: 10px;
  word-break: break-all;
}

.artifact-modal {
  width: min(780px, 100%);
}

.artifact-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 21px 0;
}

.artifact-body {
  max-height: 62vh;
  margin-top: 12px;
  padding: 0 21px 21px;
  overflow: auto;
}

.artifact-body .preview-frame,
.artifact-body .preview-code {
  margin: 0;
  width: 100%;
}

/* 弹窗内文本回退保持旧的可读配色 */
.artifact-body .preview-code {
  background: #0a0d12;
  color: #c9d3e3;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.new-group-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease;
}

.new-group-btn:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.new-group-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.new-group-btn > span:nth-child(2) {
  flex: 1;
}

.new-group-btn strong {
  display: block;
  font-size: 12.5px;
}

.new-group-btn small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.modal-sub {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.private-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.private-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.private-pick:hover {
  background: var(--hover-bg);
}

.private-pick strong {
  display: block;
  font-size: 12px;
}

.private-pick small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10.5px;
}

/* ------------------------------- toast ------------------------------- */

/* 设置页：安全策略分区 */
.policy-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.policy-mode {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-2); color: var(--text); cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.policy-mode strong { font-size: 12.5px; }
.policy-mode small { font-size: 10.5px; line-height: 1.6; color: var(--sub); }
.policy-mode:hover { border-color: var(--accent-line); }
.policy-mode.active { border-color: var(--accent); background: var(--accent-soft); }
.policy-mode.active strong { color: var(--accent); }
.policy-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.settings-card textarea[data-field="policy-hosts"] {
  width: 100%; margin-top: 10px; padding: 10px 12px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2);
  color: var(--text); font-size: 11.5px; line-height: 1.6; resize: vertical;
}

/* 策略沙箱：高危工具执行确认浮层 */
.approval-overlay { z-index: 120; }
.approval-card {
  width: min(460px, calc(100vw - 40px));
  padding: 22px 22px 18px;
  border: 1px solid var(--accent-line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
.approval-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.approval-head h3 { margin: 3px 0 0; font-size: 16px; font-weight: 700; }
.approval-shield {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 11px; background: var(--accent-soft); color: var(--accent);
}
.approval-shield .icon { width: 20px; height: 20px; }
.approval-card > .muted { font-size: 12px; line-height: 1.7; margin: 0 0 12px; }
.approval-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.approval-chip {
  font-size: 10.5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--sub); background: var(--panel-2);
}
.approval-args {
  max-height: 130px; overflow: auto; margin: 0 0 16px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2);
  font-size: 10.5px; line-height: 1.6; color: var(--sub);
  white-space: pre-wrap; word-break: break-all;
}
.approval-summary {
  margin: 0 0 10px; padding: 10px 12px;
  border-left: 2px solid var(--accent-line); border-radius: 7px;
  background: var(--panel-2); color: var(--text);
  font-size: 12px; line-height: 1.6; word-break: break-word;
}
.approval-chip[hidden] { display: none; }
.approval-details {
  margin: 0 0 14px; color: var(--sub); font-size: 11px;
}
.approval-details summary {
  cursor: pointer; padding: 3px 0; user-select: none;
}
.approval-details .approval-args { margin: 8px 0 0; max-height: 180px; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.approval-foot { font-size: 10px; margin: 12px 0 0; text-align: center; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  max-width: min(520px, calc(100vw - 48px));
  padding: 10px 15px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  /* 跟随主题：写死深色在宣纸主题下会成黑块 */
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 11.5px;
  transform: translateX(-50%);
  animation: toastIn 200ms ease both;
}

/* ----------------------------- animations ----------------------------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 三点 loading 改为平滑「呼吸」而非生硬闪烁——透明度与位移用缓动连续过渡，
   不再在 0%/60% 硬切，避免消息发送中一直突兀地闪。三点错相位形成连贯的波浪。 */
/* 纯淡入淡出，去掉 translateY/scale，三点不再上下跳 */
@keyframes typing {
  0%,
  100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(110, 211, 182, 0.4);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(110, 211, 182, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(110, 211, 182, 0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ----------------------------- scrollbars ----------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  background-clip: padding-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* ----------------------------- responsive ----------------------------- */

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 280px minmax(420px, 1fr);
  }

  .context-panel {
    display: none;
  }

  .market-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .skill-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .market-view {
    padding: 36px 36px 48px;
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .conv-panel {
    display: none;
  }

  .rail {
    width: 64px;
    flex-basis: 64px;
  }

  .rail-item {
    width: 52px;
  }

  .market-view {
    padding: 28px 24px 40px;
  }

  .market-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .market-search {
    width: 100%;
  }

  .market-grid {
    grid-template-columns: 1fr;
  }
  .skill-group {
    grid-template-columns: 1fr;
  }

  .msg-row {
    padding: 0 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------- settings center  --------------------------- */

.settings-overlay {
  padding: 34px;
}

.settings-center {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  width: min(1080px, 100%);
  height: min(82vh, 800px);
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  animation: modalIn 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 46%);
}

.settings-brand {
  padding: 4px 10px 18px;
}

.settings-brand h2 {
  margin: 5px 0 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.settings-tab {
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}

.settings-tab:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.settings-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.settings-nav-foot {
  margin-top: auto;
  padding: 14px 8px 2px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.6;
}

.settings-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.settings-head h2 {
  margin: 5px 0 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.settings-head p {
  margin: 5px 0 0;
  font-size: 11.5px;
}

.settings-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 22px;
  padding: 20px 24px 30px;
  overflow-y: auto;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-head h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.settings-badge {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}

.settings-badge.ok {
  border-color: rgba(110, 211, 182, 0.3);
  background: rgba(110, 211, 182, 0.07);
  color: var(--teal);
}

.settings-badge.warn {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.field select,
.field textarea {
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--field-bg);
  color: var(--text);
  font-size: 12.5px;
}

.field select {
  height: 42px;
}

.field textarea {
  padding: 9px 10px;
  line-height: 1.5;
  resize: vertical;
}

.field select:focus,
.field textarea:focus {
  border-color: var(--accent-line);
}

.default-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--soft);
}

.default-row .primary {
  height: 42px;
  white-space: nowrap;
}

.provider-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.provider-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.provider-card:hover {
  border-color: var(--line-2);
}

.provider-card.new-provider {
  border-style: dashed;
  border-color: var(--accent-line);
  background: rgba(232, 184, 109, 0.035);
}

.provider-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.provider-title {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.provider-title strong {
  font-size: 13px;
}

.provider-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.provider-note {
  max-width: 520px;
  overflow: hidden;
  color: var(--faint);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-state {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}

.provider-state.ok {
  border-color: rgba(110, 211, 182, 0.28);
  background: rgba(110, 211, 182, 0.06);
  color: var(--teal);
}

.provider-state.warn {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.provider-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: 10px 12px;
}

.provider-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.provider-actions button {
  height: 34px;
  padding: 0 14px;
  font-size: 11.5px;
}

.provider-result {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
  word-break: break-all;
}

.provider-result.ok {
  background: rgba(110, 211, 182, 0.06);
  color: var(--teal);
}

.provider-result.err {
  background: rgba(255, 122, 122, 0.06);
  color: var(--danger);
}

/* ── 一键开通引导 ────────────────────────────────────────────── */
.ob-section .section-head p {
  max-width: 720px;
}

.ob-hint {
  padding: 10px 13px;
  margin-bottom: 14px;
  border: 1px solid rgba(110, 211, 182, 0.22);
  border-radius: 10px;
  background: rgba(110, 211, 182, 0.055);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.ob-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.ob-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.ob-card:hover {
  border-color: var(--line-2);
}

.ob-card.ob-configured {
  border-color: rgba(110, 211, 182, 0.3);
}

.ob-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ob-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.ob-title strong {
  font-size: 13px;
}

.ob-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.ob-badge-free {
  border: 1px solid rgba(110, 211, 182, 0.28);
  background: rgba(110, 211, 182, 0.08);
  color: var(--teal);
}

.ob-badge-paid {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
}

.ob-check {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(110, 211, 182, 0.14);
  color: var(--teal);
  font-size: 10px;
  font-weight: 650;
}

.ob-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  min-height: 34px;
}

.ob-actions,
.ob-keyrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ob-actions button,
.ob-keyrow button {
  height: 32px;
  padding: 0 12px;
  font-size: 11.5px;
}

.ob-keyrow input {
  flex: 1 1 150px;
  min-width: 130px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-size: 11.5px;
}

.ob-subhead {
  margin: 20px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.ob-advanced-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.ob-advanced-toggle:hover {
  border-color: var(--line-2);
  color: var(--text);
}

.ob-chevron {
  color: var(--faint);
  font-size: 11px;
}

.ob-advanced-hint {
  margin: 12px 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.6;
}

.ob-advanced-actions {
  margin-top: 12px;
}

@media (max-width: 720px) {
  .ob-group {
    grid-template-columns: 1fr;
  }
}

.agent-model-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-model-row {
  /* 统一 grid 布局——头像在左，编辑区在右，按钮贴底。
     不再嵌套 agent-profile / agent-model-line / details.agent-extra，
     所有字段直接在 agent-edit-grid 里。
     展开态改为单列卡片流（摘要行 → 编辑区 → 操作排），
     去掉独立 avatar 列后不再出现第二个头像位。 */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "summary";
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.agent-model-row.open {
  grid-template-areas:
    "summary"
    "edit"
    "actions";
  gap: 12px 0;
}

.agent-model-row > .agent-summary { grid-area: summary; }

.agent-model-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-bottom: 3px;
}

.agent-model-id > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.agent-model-id strong {
  font-size: 12.5px;
}

.agent-model-id small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.settings-row strong {
  font-size: 12.5px;
}

.settings-row small {
  color: var(--muted);
  font-size: 10.5px;
}

.settings-row.danger-row {
  background: rgba(255, 122, 122, 0.03);
}

.path-text {
  max-width: 54%;
  overflow-wrap: anywhere;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  text-align: right;
}

@media (max-width: 900px) {
  .settings-overlay {
    padding: 16px;
  }

  .settings-center {
    grid-template-columns: 1fr;
    height: min(88vh, 860px);
  }

  .settings-nav {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-brand,
  .settings-nav-foot {
    display: none;
  }

  .settings-tab {
    padding: 8px 12px;
    white-space: nowrap;
  }

  .settings-head,
  .settings-body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .default-row,
  .provider-grid,
  .agent-model-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .provider-note {
    display: none;
  }

  .settings-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .path-text {
    max-width: 100%;
    text-align: left;
  }
}

.status-strip .stop-chip {
  margin-left: 2px;
  font-size: 10.5px;
}

/* ---------------------- right details panel  ---------------------- */

.shell.details-closed {
  grid-template-columns: 296px minmax(460px, 1fr) 0;
}

.shell.details-closed .context-panel {
  display: none;
}

.context-tabs {
  display: flex;
  gap: 2px;
  margin: -6px -3px 14px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.context-tab {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  padding: 0 4px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
}

.context-tab span {
  color: var(--faint);
  font-size: 9.5px;
}

.context-tab:hover {
  color: var(--text);
}

.context-tab.active {
  background: rgba(232, 184, 109, 0.12);
  color: var(--accent);
  font-weight: 650;
}

.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  align-items: stretch;
}

/* 紧凑卡片布局，铺满面板宽度，消除右侧大片留白 */
.file-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.file-row:hover {
  background: var(--hover-bg);
  border-color: var(--line-2);
}

.file-row:disabled {
  cursor: default;
  opacity: 0.78;
}

.fr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.fr-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  line-height: 1.3;
}

.fr-meta {
  color: var(--faint);
  font-size: 9.5px;
}

/* 无包围框、坐标固定（span/button 两种形态统一，避免 UA 默认按钮边框造成"框住"） */
.file-menu-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  border: none;
  appearance: none;
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.file-menu-btn:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.file-menu-btn .icon { width: 15px; height: 15px; }

.file-ext {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--hover-bg);
  color: var(--muted);
}

.file-ext .icon { width: 16px; height: 16px; }

.file-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-copy strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy small {
  color: var(--faint);
  font-size: 9.5px;
}

.context-empty {
  padding: 14px 8px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.6;
}

.preview-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.preview-title {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.preview-title strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-title small {
  flex: none;
  color: var(--faint);
  font-size: 9.5px;
}

.preview-code {
  max-height: calc(100vh - 230px);
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  /* 原来写死深色底 + var(--muted)，宣纸主题下变成浅底浅字/深底深字，
     现在底和字都跟着主题走，保证任何主题下都够对比。 */
  background: var(--soft);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-frame {
  width: 100%;
  height: calc(100vh - 230px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.preview-img {
  max-width: 100%;
  max-height: calc(100vh - 230px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    repeating-conic-gradient(#1a1d24 0% 25%, #14161c 0% 50%) 50% / 18px 18px;
  object-fit: contain;
}

.preview-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.preview-actions .ghost.sm {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 7px;
  text-decoration: none;
  line-height: 1.4;
}

.preview-actions .ghost.sm:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 安全策略快捷入口 —— composer 底部左侧胶囊 + 上弹菜单 */
/* 输入框容器——文本区 + 底部内嵌「安全策略」三档分段控件（横向，输入框内部底部，不遮挡文字与发送） */
.input-box {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--field-bg);
  overflow: hidden;
  transition: border-color 150ms ease, background 150ms ease;
}
.input-box:focus-within { border-color: var(--accent-line); }
/* ——输入框左下角：+ 号与安全策略胶囊同一排，垂直对齐输入框底部 —— */
.composer-left {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: none;
}
.composer-left .sec-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}
.composer-left .sec-pill .icon { width: 12px; height: 12px; }
.composer-left .sec-pill .sp-chev { transition: transform 160ms ease; }
.composer-left .sec-pill:hover { border-color: var(--line-2); color: var(--text); }
.composer-left .sec-pill.open { border-color: var(--accent-line); color: var(--accent); }
.composer-left .sec-pill.open .sp-chev { transform: rotate(180deg); }

.sec-pop {
  z-index: 70;
  min-width: 236px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.22);
}
.sec-pop .sp-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 130ms ease;
}
.sec-pop .sp-item:hover { background: var(--hover-bg); }
.sec-pop .sp-item.active { background: var(--accent-soft); }
.sec-pop .sp-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
}
.sec-pop .sp-dot.on { border-color: var(--accent); background: var(--accent); }
.sec-pop .sp-text { display: flex; flex-direction: column; gap: 1px; }
.sec-pop .sp-text strong { font-size: 12px; font-weight: 650; }
.sec-pop .sp-text small { color: var(--faint); font-size: 10.5px; }

/* 发送按钮 + 推理强度胶囊右侧簇，同一行、垂直居中 */
.send-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: center;
  flex: none;
}
.composer .effort-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field-bg);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

/* ── 新的统一 grid 内部样式 ── */

.agent-model-row > .agent-edit-grid {
  grid-area: edit;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  min-width: 0;
  padding-top: 2px;
}

/* 头像色只占第一列 → 和"一句话说明"同左对齐 */
.agent-model-row > .agent-edit-grid .color-field {
  grid-column: 1;
}

/* 人设 / 长期记忆全宽展开在最后两行 */
.agent-model-row > .agent-edit-grid .persona-field {
  grid-column: 1 / -1;
}

.agent-model-row > .agent-edit-grid .persona-field textarea {
  min-height: 72px;
}

.agent-model-row > .agent-actions {
  grid-area: actions;
  display: flex;
  gap: 6px;
  justify-self: end;
  align-self: end;
}

.agent-model-row > .agent-actions button {
  height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.agent-model-row.new-agent {
  grid-area: auto;
  border-style: dashed;
  border-color: var(--accent-line);
  background: rgba(232, 184, 109, 0.035);
  grid-template-columns: minmax(170px, 1.1fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
  grid-template-areas: none;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.swatch {
  width: 21px;
  height: 21px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.swatch.active {
  border-color: rgba(255, 255, 255, 0.9);
  transform: scale(1.08);
}

@media (max-width: 900px) {
  .agent-model-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "avatar"
      "edit"
      "actions";
  }

  .agent-model-row > .agent-edit-grid {
    grid-template-columns: 1fr;
  }

  .agent-model-row > .agent-edit-grid .color-field {
    grid-column: 1;
  }

  .agent-model-row > .agent-actions {
    justify-self: end;
  }

  .agent-model-row.new-agent {
    grid-template-columns: 1fr;
  }
}

/* 旧样式彻底废弃：.agent-profile / .agent-model-line / .agent-extra / 旧 .agent-edit-grid
   全部被上面的统一 grid 取代 */

/* ======================= 头像 / 插话 / 思考进度卡 ======================= */

/* 图片头像（成员头像可上传 png / jpg / webp / gif） */
.avatar.has-img {
  overflow: hidden;
  padding: 0;
  background: transparent;
}

.avatar.has-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.avatar.md {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
  border-radius: 16px;
  font-size: 16px;
}

/* 插话小标（协作进行中用户发的消息） */
.interject-chip {
  border-color: rgba(232, 184, 109, 0.45);
  color: var(--accent-line, #e8b86d);
}

/* 右栏成员行：hover 出「编辑」提示，点一下进设置改名字 / 头像 / 角色 */
.member-edit-hint {
  color: var(--faint);
  font-size: 10px;
  opacity: 0;
  transition: opacity 150ms ease;
}

.member-row:hover .member-edit-hint {
  opacity: 1;
}

/* 状态条：阶段文案截断；停止键固定右端 */
.status-strip > span:not(.pulse) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-strip .stop-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  /* 停止按钮一并去掉胶囊外圈，只留红色文字 + 图标 */
  color: #f07575;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  height: auto;
}

.status-strip .stop-chip .icon {
  width: 12px;
  height: 12px;
}

.status-strip .stop-chip:hover {
  color: #f07575;
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
}

/* 层1思考进度卡：消息列表和状态条之间的稳定节点，不随消息列表重建 */
.think-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  /* 与 .msg-row（1180px + 左对齐 + 24px 内距）保持同一套几何参数，
     否则头像和正文会比消息往右缩一截。 */
  max-width: 1180px;
  margin: 0 0 10px;
  padding: 0 24px;
}

.think-card[hidden] {
  display: none;
}

.think-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.think-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 11.5px;
  flex-wrap: wrap;
}

.think-meta .think-text {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.think-bubble {
  width: fit-content;
  padding: 2px 4px;
  background: var(--hover-bg);
}

.think-card .typing {
  padding: 6px 8px;
}

/* ======================= 设置页可滚动 / 不再截断底部 ======================= */

.settings-center {
  max-height: calc(100vh - 68px);
}

.settings-nav {
  min-height: 0;
  overflow-y: auto;
}

.settings-main {
  min-height: 0;
  height: 100%;
}

.settings-body {
  min-height: 0;
  overscroll-behavior: contain;
}

@media (max-width: 900px) {
  .settings-center {
    grid-template-rows: auto minmax(0, 1fr);
    max-height: calc(100vh - 32px);
  }
}



/* 直播块就是一条普通消息行（头像 / 名字 / 正文列同宽），不是贴底悬浮条 */
.think-card {
  margin-bottom: 10px;
}

.think-main {
  flex: 1;
  min-width: 0;
  max-width: 680px;
}

.think-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.think-head .think-title {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 680;
}

.think-elapsed {
  color: var(--faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.think-chev {
  display: inline-flex;
  color: var(--faint);
  transform: rotate(90deg);
}

.think-box {
  display: block;
  width: 100%;
  max-width: 680px;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  /* 跟随主题：写死深色在宣纸主题下背景发黑 */
  background: var(--soft);
  color: var(--text-2);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.68;
  text-align: left;
  cursor: pointer;
}

.think-box:hover {
  border-color: var(--border-strong);
}

.think-body-text {
  display: block;
  max-height: 132px;
  /* 改成可滚动 + JS 跟随增量滚到底，思考变长时不再"钉在顶部、底部被裁" */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 未贴底时才用渐隐提示"下面还有"，贴底后去掉，避免遮住最新一行 */
.think-box:not(.at-bottom) .think-body-text {
  -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 82%, transparent 100%);
}

.think-body-text[hidden],
.think-empty[hidden] {
  display: none;
}

.think-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11.5px;
}

/* 工具调用记录行（只在直播块内存里，结束即清） */
.tool-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tool-lines[hidden] {
  display: none;
}

.tool-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

.tool-line .tool-name {
  font-family: var(--mono);
  color: var(--text-2);
}

.tool-line .tool-verb {
  color: var(--faint);
}

.tool-line.running .tool-verb {
  color: var(--accent);
}

.tool-line.ok .tool-verb {
  color: var(--teal);
}

.tool-line.warn .tool-verb {
  color: #b7791f;
}

.tool-line.warn {
  color: #8a5a12;
}

.tool-line.fail,
.tool-line.fail .tool-verb {
  color: var(--danger);
}

.think-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  min-height: 14px;
  color: var(--faint);
  font-size: 10.5px;
}

.think-chars {
  color: var(--accent-line, #e8b86d);
}

.think-hint {
  opacity: 0.85;
}

/* 历史消息下的「深度思考」小条 */
.think-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  padding: 4px 10px;
  /* 整组绑定主题色，移除硬写死的 rgba(21,26,34,.6) 黑底。
     宣纸主题下会切成浅米灰底 + 深棕字 + 极淡描边（见下方 paper 覆盖）。 */
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--soft);
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
}

.think-chip:hover {
  color: var(--text);
  border-color: var(--accent-line);
}

[data-theme='paper'] .think-chip,
[data-theme='paper'] .think-box {
  background: rgba(120, 100, 70, 0.075);
  border-color: rgba(120, 100, 70, 0.17);
  color: #544b3d;
}

[data-theme='paper'] .think-chip small {
  color: #5d5341;
}

.think-chip small {
  color: var(--faint);
  font-size: 10px;
}

.think-chip .icon {
  width: 12px;
  height: 12px;
}

/* 直播中的正文气泡沿用正式消息气泡样式，时间位显示「正在输入」 */
.live-reply {
  flex: 0 0 auto;
}

.live-reply .msg-row {
  margin-bottom: 6px;
}

.live-bubble {
  white-space: pre-wrap;
  word-break: break-word;
}

/* 完整思考弹层 */
.thinking-modal {
  width: min(720px, 92vw);
  max-height: 82vh;
}

.thinking-content {
  max-height: 62vh;
  overflow-y: auto;
  padding: 18px 22px 22px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  scrollbar-width: thin;
}

/* 输入区：元素统一垂直居中、间距一致，输入框内不再挤出一条滚动条 */
.composer {
  align-items: center;
  gap: 10px;
  padding: 12px 24px 16px;
}

.composer textarea {
  min-width: 0;
  min-height: 46px;
  padding: 12px 14px;
  scrollbar-width: none;
}

.composer textarea::-webkit-scrollbar {
  display: none;
}

.composer .icon-btn {
  flex: 0 0 auto;
}

/* =========================================================================
   个性化：主题变量覆盖
   只保留 宣纸（默认，浅色）/ 冰川（深色）两套；旧主题块已删除，
   旧 id 由前端迁移逻辑回落宣纸。组件一律吃变量，不写死色值。
   ========================================================================= */

[data-theme='glacier'] {
  --bg: #070a12;
  --rail: #0a0e18;
  --panel: #0e1320;
  --panel-2: #131a2b;
  --panel-3: #182032;
  --line: rgba(140, 170, 255, 0.08);
  --line-2: rgba(140, 170, 255, 0.15);
  --text: #eaf0fb;
  --muted: #8294b4;
  --faint: #56688a;
  --accent: #7fb2ff;
  --accent-soft: rgba(127, 178, 255, 0.12);
  --accent-line: rgba(127, 178, 255, 0.34);
  --teal: #5fd6c0;
  --blue: #7fb2ff;
  --danger: #ff8a9a;
}

/* 浅色主题：覆盖主要容器背景，组件内部仍尽量复用变量；
   个别硬编码深色内衬（气泡等）此处一并反向，保证浅色可读。 */
[data-theme='paper'] {
  --bg: #f4f1ea;
  --rail: #eceae2;
  --panel: #ffffff;
  --panel-2: #f3f0e9;
  --panel-3: #ece8df;
  --line: rgba(40, 30, 15, 0.1);
  --line-2: rgba(40, 30, 15, 0.16);
  /* 文字全面改深炭黑，拉开与宣纸底的对比（背景纹理不动） */
  --text: #1a1712;
  --muted: #464032;
  --faint: #6b6353;
  --accent: #b5651d;
  --accent-soft: rgba(181, 101, 29, 0.1);
  --accent-line: rgba(181, 101, 29, 0.3);
  --teal: #2f8f6e;
  --blue: #3a6ad4;
  --danger: #c23b3b;

  /* 宣纸（浅色）下的表面/控件 token —— 弹窗、输入区、附件随主题走 */
  --soft: rgba(40, 30, 15, 0.035);
  --hover-bg: rgba(40, 30, 15, 0.055);
  --active-bg: rgba(40, 30, 15, 0.09);
  /* 宣纸下的次级文字/描边 —— 次级文字同步加深 */
  --text-2: #332e24;
  --border: rgba(40, 30, 15, 0.12);
  --border-strong: rgba(40, 30, 15, 0.2);
  --modal-bg: linear-gradient(180deg, #ffffff, #faf7f0);
  --composer-bg: rgba(244, 241, 234, 0.82);
  --field-bg: rgba(255, 255, 255, 0.92);
  --field-bg-focus: rgba(255, 255, 255, 1);

  --shadow: 0 22px 60px rgba(60, 50, 30, 0.18);
}

[data-theme='paper'] .app {
  background:
    radial-gradient(900px 540px at 74% -12%, rgba(181, 101, 29, 0.05), transparent 62%),
    radial-gradient(760px 520px at 6% 112%, rgba(47, 143, 110, 0.05), transparent 60%),
    var(--bg);
}

[data-theme='paper'] .rail {
  background: linear-gradient(180deg, #f1efe8, #e7e4db);
}

[data-theme='paper'] .conv-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 241, 234, 0.96));
}

[data-theme='paper'] .chat-panel {
  background:
    radial-gradient(720px 420px at 78% -8%, rgba(181, 101, 29, 0.04), transparent 62%),
    linear-gradient(180deg, rgba(248, 246, 240, 0.98), rgba(244, 241, 234, 0.99));
}

[data-theme='paper'] .context-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(244, 241, 234, 0.9));
}

[data-theme='paper'] .chat-header {
  background: rgba(248, 246, 240, 0.72);
}

[data-theme='paper'] .composer,
[data-theme='paper'] .conv-foot {
  background: rgba(244, 241, 234, 0.78);
}

[data-theme='paper'] .bubble {
  background: rgba(241, 238, 230, 0.92);
  color: #232019;
  border-color: var(--line);
}

/* Token 用量 —— me 菜单摘要栏 + 二级详情 */
.me-usage { justify-content: flex-start; }
.me-usage-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.me-usage-text small {
  color: var(--faint);
  font-size: 9.5px;
}
.me-usage-total {
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.me-usage-detail { display: block; }
.me-usage-back { margin-bottom: 10px; }

/* 设置面板内的 Token 用量分区（沿用设置/个性化面板布局） */
.usage-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.usage-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}
.usage-card small { color: var(--faint); font-size: 10px; letter-spacing: 0.04em; }
.usage-card strong {
  font-size: 24px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.usage-card .usage-sub { color: var(--muted); font-size: 10px; }
.usage-model-row { border-bottom: none; }
.usage-model-bar {
  height: 4px;
  margin: -2px 0 10px;
  border-radius: 999px;
  background: var(--hover-bg);
  overflow: hidden;
}
.usage-model-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4d93f8, #9333ea);
}

/* ── 个性化视图 ── */

.pz-view {
  display: block;
  overflow-y: auto;
}

.pz-head {
  max-width: 1220px;
  margin: 0 auto 8px;
}

.pz-head h1 {
  margin: 8px 0 8px;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-weight: 760;
}

.pz-head p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.pz-block {
  max-width: 1220px;
  margin: 34px auto 0;
}

.pz-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.pz-block-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.pz-hint {
  color: var(--faint);
  font-size: 11.5px;
}

.pz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 13px;
}

.theme-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.theme-card:hover {
  border-color: var(--line-2);
  transform: translateY(-2px);
}

.theme-card.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-line) inset;
}

/* ---- 主题预览 = 主界面迷你缩影（非纯色块） ----
   直观呈现：背景色 + 侧栏/控件底色 + 文字对比度 + 强调色。
   圆角 + 轻阴影，标题与描述放在缩略图下方。 */
.theme-thumb {
  display: block;
  border-radius: 12px;
}

.tt-window {
  display: flex;
  flex-direction: column;
  height: 118px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 10px 24px rgba(0, 0, 0, 0.16);
}

.tt-topbar {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 14px;
  flex: none;
  padding: 0 7px;
}

.tt-topbar i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.tt-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.tt-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 22px;
  flex: none;
  padding-top: 8px;
}

.tt-rail i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.tt-rail .tt-rail-dot {
  border-radius: 50%;
}

.tt-chat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
}

.tt-bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 78%;
  border-radius: 8px;
  padding: 6px 8px;
}

.tt-bubble.tt-in {
  align-self: flex-start;
}

.tt-bubble.tt-out {
  align-self: flex-end;
  width: 34%;
  height: 14px;
  border-radius: 8px;
  padding: 0;
}

.tt-line {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 2px;
}

.tt-line.short {
  width: 62%;
}

.tt-input {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 5px;
}

.tt-input i {
  width: 34%;
  height: 4px;
  border-radius: 2px;
}

.tt-input b {
  width: 12px;
  height: 10px;
  border-radius: 4px;
}

.theme-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.theme-meta strong {
  font-size: 13.5px;
  font-weight: 680;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.theme-meta strong small {
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.theme-desc {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

/* 开屏动画卡片 */
.splash-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
  transition: border-color 180ms ease, background 180ms ease;
}

.splash-card:hover {
  border-color: var(--line-2);
}

.splash-thumb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 11px;
  background: radial-gradient(circle at 50% 38%, #14181f, #0a0c11);
  border: 1px solid var(--line);
}

.splash-meta {
  flex: 1;
  min-width: 0;
}

.splash-meta strong {
  display: block;
  font-size: 13.5px;
  font-weight: 680;
}

.splash-meta small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.splash-play {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.splash-play:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* --------------------------- 开屏动画（Metal Reveal） --------------------------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 14, 0.96);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.42s ease;
}

.splash.splash-active {
  opacity: 1;
}

.splash-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.splash-mark {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 20px;
  background: linear-gradient(145deg, #cfd6e0, #7f8a9c);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  opacity: 0;
  animation: splashMarkIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.splash-diamond {
  width: 38px;
  height: 38px;
  transform: rotate(45deg);
  border-radius: 7px;
  background: linear-gradient(135deg, #ffffff, #9fb4cf 55%, #6f86a8);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.splash-word {
  position: relative;
  overflow: hidden;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #eef2f8;
  opacity: 0;
  animation: splashWordIn 0.5s ease 0.6s forwards;
}

/* 18° 斜向流光，每 3.2s 一道，峰值不透明度 0.18 级别（白色微光） */
.splash-word::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 55%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
  animation: splashShimmer 3.2s ease-in-out 1.1s infinite;
}

@keyframes splashMarkIn {
  from {
    opacity: 0;
    transform: scale(0.86) translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes splashWordIn {
  to {
    opacity: 1;
  }
}

@keyframes splashShimmer {
  0% {
    left: -60%;
  }
  55%,
  100% {
    left: 120%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-mark,
  .splash-word,
  .splash-word::after {
    animation: none !important;
    opacity: 1;
  }
}

/* ───── web 预览三档独立舞台（与桌面开屏三范式对应） ───── */
.splash-stage > * { opacity: 0; animation: wsFade .7s ease forwards; }
@keyframes wsFade { to { opacity: 1; } }

/* 星云：粒子轨道 */
.ws-orbital { position: relative; width: 230px; height: 230px; display: grid; place-items: center; }
.ws-o { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.07); }
.ws-o1 { width: 230px; height: 230px; animation: wsSpin 13s linear infinite; }
.ws-o2 { width: 162px; height: 162px; top: 34px; left: 34px; animation: wsSpin 8.5s linear infinite reverse; }
.ws-o3 { width: 104px; height: 104px; top: 63px; left: 63px; animation: wsSpin 5.5s linear infinite; }
.ws-o i { position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, var(--accent, #c7ccd4)); box-shadow: 0 0 10px var(--accent, #c7ccd4); }
.ws-core { width: 46px; height: 46px; transform: rotate(45deg); border-radius: 11px;
  background: linear-gradient(135deg, var(--accent, #c7ccd4), #6f86a8 60%, #3a4a66);
  box-shadow: inset 0 1px 3px rgba(255,255,255,.6), 0 8px 24px rgba(0,0,0,.55); animation-delay: .3s; }
.ws-brand { margin-top: 26px; font: 700 22px/1 -apple-system,sans-serif; letter-spacing: .42em; text-indent: .42em; color: #eef2f8; animation-delay: .8s; }
@keyframes wsSpin { to { transform: rotate(360deg); } }

/* 极光：终端开机 */
.ws-term { width: min(520px, 86vw); padding: 20px 24px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(20,28,48,.55), rgba(8,12,22,.62));
  border: 1px solid rgba(120,150,255,.16); backdrop-filter: blur(3px);
  font: 13px/1.95 ui-monospace, Menlo, Consolas, monospace; color: #cdd6e6; text-align: left; }
.ws-term .ws-row { opacity: 0; white-space: pre; animation: wsShow .4s ease forwards; }
.ws-term .ws-r1 { animation-delay: .3s; } .ws-term .ws-r2 { animation-delay: .8s; }
.ws-term .ws-r3 { animation-delay: 1.4s; } .ws-term .ws-r4 { animation-delay: 2.0s; } .ws-term .ws-r5 { animation-delay: 2.6s; }
.ws-term .p { color: var(--accent, #c7ccd4); } .ws-term .ok { color: #6ed3b6; }
.ws-cur { display: inline-block; width: 8px; height: 15px; background: var(--accent, #c7ccd4); vertical-align: -2px; animation: wsBlink 1s steps(1) infinite; }
@keyframes wsShow { to { opacity: 1; } } @keyframes wsBlink { 50% { opacity: 0; } }

/* 金属：铬质故障 */
.ws-glitch { position: relative; display: grid; place-items: center; }
.ws-cglyph { width: 78px; height: 78px; transform: rotate(45deg) scale(.3); border-radius: 16px; opacity: 0;
  background: linear-gradient(135deg, #f4f7fb, #9aa6b6 46%, #4a566b 70%, #cdd6e2);
  box-shadow: inset 0 2px 4px rgba(255,255,255,.8), inset 0 -3px 6px rgba(0,0,0,.4), 0 10px 40px rgba(0,0,0,.6);
  animation: wsPop .8s cubic-bezier(.2,.8,.2,1) .3s forwards, wsGlitch 2.6s steps(2,end) 1.4s infinite; }
@keyframes wsPop { to { opacity: 1; transform: rotate(45deg) scale(1); } }
@keyframes wsGlitch { 0%,90% { filter: none; } 92% { filter: drop-shadow(3px 0 #ff3b6b) drop-shadow(-3px 0 #37e0ff); transform: rotate(45deg) scale(1) translate(2px,-1px); }
  95% { filter: drop-shadow(-3px 0 #ff3b6b) drop-shadow(3px 0 #37e0ff); transform: rotate(45deg) scale(1) translate(-3px,2px); }
  98% { filter: drop-shadow(2px 0 #ff3b6b) drop-shadow(-2px 0 #37e0ff); transform: rotate(45deg) scale(1) translate(1px,1px); } 100% { filter: none; } }
.ws-word { position: relative; margin-top: 34px; font: 800 32px/1 -apple-system,sans-serif; letter-spacing: .4em; text-indent: .4em; color: #eef2f8; }
.ws-word::before, .ws-word::after { content: attr(data-t); position: absolute; left: 0; top: 0; }
.ws-word::before { color: #ff3b6b; mix-blend-mode: screen; animation: wsGlx 2.6s steps(2,end) 1.4s infinite; }
.ws-word::after { color: #37e0ff; mix-blend-mode: screen; animation: wsGlx 2.6s steps(2,end) 1.4s infinite reverse; }
@keyframes wsGlx { 0%,88% { transform: translate(0,0); } 91% { transform: translate(-3px,1px); } 95% { transform: translate(3px,-1px); } 100% { transform: translate(0,0); } }
.ws-tag { margin-top: 12px; font: 500 12px/1.4 -apple-system,"PingFang SC",sans-serif; letter-spacing: .1em; color: rgba(230,236,246,.6); }

/* ───────────────── 左下角「我」面板 ───────────────── */
.me-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: #7C8CF8;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.me-avatar:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(124, 140, 248, 0.3);
}

.me-overlay {
  align-items: flex-start;
  justify-content: flex-start;
  background: transparent;
}

.me-panel {
  position: absolute;
  left: 76px;
  bottom: 18px;
  width: 264px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  animation: modalIn 160ms ease;
}

.me-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.me-avatar-lg {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  padding: 0; /* 必须归零 —— 默认 padding 会让预览图四周露出底色块 */
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: #7C8CF8;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  transition: filter 150ms ease;
}

.me-avatar-lg:hover {
  filter: brightness(1.06);
}

.me-avatar-img {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.me-profile-edit {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.me-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.me-field span {
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.me-field input {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  outline: 0;
  transition: border-color 150ms ease;
}

.me-field input:focus {
  border-color: var(--accent-line);
}

.me-avatar-editor {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.me-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.me-swatches .swatch {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.me-swatches .swatch:hover {
  transform: scale(1.12);
}

.me-swatches .swatch.active {
  border-color: #fff;
}

.me-menu {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.me-menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
}

.me-menu-item:hover {
  background: var(--hover-bg);
}

.me-menu-item .icon {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.me-menu-item .me-soon {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

/* 检查更新旁的新版本角标：跟随主题强调色，看过一次即消失 */
.update-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--accent);
}
.update-dot[hidden] { display: none; }
.me-menu-item .me-soon + .update-dot,
.me-menu-item .update-dot + .me-soon { margin-left: 0; }
.update-dot + .me-soon { margin-left: 8px; }

/* ======================= 输入区 / 强度控件 / 我菜单 ======================= */

/* 消息框整体做大：composer 允许换行，强度 pill 独占一行居中（Codex 风格） */
.composer-wrap {
  position: relative;
}

.composer {
  flex-wrap: wrap;
  row-gap: 8px;
}

/* 推理强度触发器移到发送按钮右侧、同一行 */
.composer .effort-pill .icon { width: 13px; height: 13px; }
.composer .effort-pill .effort-pill-chev { transition: transform 160ms ease; }
.composer .effort-pill:hover { border-color: var(--line-2); color: var(--text); }
.composer .effort-pill.open { border-color: var(--accent-line); color: var(--accent); }
.composer .effort-pill.open .effort-pill-chev { transform: rotate(180deg); }
/* 未识别模型的兜底态：保留按钮位置，只表示“自动”，不可点 */
.composer .effort-pill.disabled { opacity: .55; cursor: default; }
.composer .effort-pill.disabled:hover { border-color: var(--line-1); color: var(--muted); }
.composer .effort-pill.disabled .effort-pill-chev { display: none; }

/* 思考强度浮层：成员下拉 + 渐变滑块（星点标档位，圆点为当前值） */
.effort-panel {
  position: fixed;
  z-index: 60;
  width: min(330px, 92%);
  padding: 13px 14px 12px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.14);
  animation: efIn 170ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
/* 底部小箭头，指向触发按钮中心（--ef-arrow-x 由 JS 按按钮实时注入） */
.effort-panel::after {
  content: "";
  position: absolute;
  top: 100%;
  left: var(--ef-arrow-x, 50%);
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: var(--panel);
  filter: drop-shadow(0 1px 0 var(--line-2));
}

@keyframes efIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ef-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.ef-bolt {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.ef-bolt .icon { width: 14px; height: 14px; }

.ef-title {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.ef-title strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.ef-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--faint);
  font-size: 11px;
  margin-top: 1px;
}

.ef-refresh {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.ef-refresh .icon { width: 14px; height: 14px; }
.ef-refresh:hover { color: var(--accent); background: var(--hover-bg); }

.ef-members {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 11px 0 13px;
  flex-wrap: wrap;
}

.ef-member {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.ef-member .ef-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.ef-member:hover { border-color: var(--line-2); color: var(--text); }
.ef-member.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}


/* 左下角「我」昵称常显 —— 换衬线字体，加字重与字间距提升辨识度 */
.me-name {
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-family: 'Georgia', 'Songti SC', 'SimSun', 'Noto Serif SC', serif;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-align: center;
}

/* 个性化弹窗（复用 settings-center 骨架，左栏窄一点） */
.pz-center {
  grid-template-columns: 180px minmax(0, 1fr);
  height: min(72vh, 660px);
}

.pz-nav-note {
  padding: 4px 10px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.7;
}

/* =========================================================================
   样式
   ========================================================================= */

/* --- 会话条目：hover 时时间 → 三点更多（同位不重叠），删除收进菜单 --- */
.conv-more {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}
.conv-more .icon { width: 15px; height: 15px; }
.conv-more:hover { background: var(--hover-bg); color: var(--text); }
.conv-row:hover .conv-time,
.conv-row.active .conv-time { display: none; }
.conv-row:hover .conv-more,
.conv-row.active .conv-more { opacity: 1; }
[data-theme='paper'] .conv-row:hover { background: rgba(40, 30, 15, 0.045); }
[data-theme='paper'] .conv-row.active {
  background: linear-gradient(90deg, rgba(181, 101, 29, 0.1), rgba(181, 101, 29, 0.02));
}

/* --- 通用轻量上下文菜单（会话三点 / 气泡右键复制共用） --- */
.ctx-menu {
  position: fixed;
  z-index: 999;
  min-width: 132px;
  padding: 5px;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.14);
  animation: efIn 140ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.ctx-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.ctx-item:hover { background: var(--hover-bg); }
.ctx-item.off { opacity: 0.38; cursor: default; }
.ctx-item.off:hover { background: transparent; }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: rgba(255, 90, 90, 0.12); }

/* --- 技能市场：当前环境状态栏（放板块下方，右对齐不突兀） --- */
.market-env {
  /* 移到标题下方后左对齐，不再右浮 */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 6px 0 0;
  padding: 0 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.market-env strong { color: var(--text); font-weight: 650; }
.market-env strong { color: var(--text); font-weight: 650; }
.env-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px var(--teal);
}

/* --- 协作看板四列（需求 / 进行中 / 已交付 / 产物） --- */
.collab-board:has(> .board-cols) { display: block; }
.board-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}
.board-task { display: block; cursor: default; }
.board-task .bt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}
.board-task .bt-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 650;
}
.board-task .bt-progress {
  flex: none;
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.board-task .rb-sub { font-size: 10.5px; }
.board-task .rb-sub.done .rb-sub-title { text-decoration: line-through; }
.board-req {
  display: block;
  cursor: default;
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: normal;
  border-left: 2px solid var(--accent);
}
.board-empty-inline { color: var(--faint); font-size: 10.5px; }

/* --- 个性化：桌面宽弹窗（无左栏、无手机留白），主题卡 = 桌面缩影 --- */
.pz-modal {
  display: flex;
  flex-direction: column;
  width: min(880px, 92vw);
  height: min(76vh, 700px);
  padding: 22px 26px;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: var(--modal-bg, var(--panel));
  box-shadow: var(--shadow, 0 24px 70px rgba(0, 0, 0, 0.4));
  overflow: hidden;
}
.pz-modal .settings-head { margin-bottom: 6px; }
.pz-modal .settings-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.pz-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.theme-thumb .tt-window { height: 148px; }
.theme-thumb .tt-rail { width: 30px; }
.theme-thumb .tt-topbar { height: 18px; }

.ef-bolt.ultra {
  background: linear-gradient(135deg, rgba(77, 147, 248, 0.25), rgba(147, 51, 234, 0.3));
  color: #a855f7;
}
.ef-tier {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
}
.ef-tier.ultra {
  background: linear-gradient(90deg, rgba(77, 147, 248, 0.22), rgba(147, 51, 234, 0.26));
  color: #a855f7;
}
/* 只在颜色/透明度上做 ≤90ms 的过渡，不再改 font-weight
   （字重一变，字符宽度跟着变，视觉上就像文字在追着滑块跳）。 */
.ef-labels b.on { color: var(--text); }
.ef-foot {
  margin-top: 10px;
  color: var(--faint);
  font-size: 10.5px;
  text-align: center;
}

/* --- 协作看板：需求 / 方案 两卡布局（精简） --- */
.board-cards {
  /* 自适应流式布局，卡片横向铺满可用区域，不设固定窄 width */
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
}
.board-card {
  width: 100%;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--soft);
}
.board-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
}
.board-card-head .icon { width: 14px; height: 14px; color: var(--accent); }
.board-card .rb-text {
  width: 100%;
  max-width: none;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text);
  max-height: 320px;
  overflow-y: auto;
}
/* 成员条目折叠 */
.agent-summary {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.agent-summary:hover { background: var(--hover-bg); }
.agent-summary-text { flex: 1; min-width: 0; }
.agent-summary-text strong { display: block; font-size: 13px; }
.agent-summary-text small { color: var(--muted); font-size: 11px; }
.agent-chev { flex: none; color: var(--faint); font-size: 11px; }
.agent-model-row.collapsed { padding: 2px; }
.agent-model-row.open { border: 1px solid var(--line); border-radius: 13px; padding: 10px; }

/* --- 主题页：桌面窗口横版样机 + 等宽多列自适应 --- */
.pz-modal { width: min(1180px, 96vw); height: auto; max-height: 88vh; }
.pz-grid {
  /* 横向铺满页面，消除两侧大片留白；卡片等宽、列数随宽度自适应 */
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 16px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 11px;
  padding: 13px !important;
}
.theme-thumb {
  flex: none;
  width: 100%;
  max-width: none;
}
.theme-thumb .tt-window {
  width: 100%;
  height: auto;
  /* 桌面 16:10，而不是手机 9:19.5 竖屏比例 */
  aspect-ratio: 16 / 10;
}
.theme-thumb .tt-topbar { height: 13%; min-height: 13px; }
.theme-thumb .tt-rail { width: 11%; }
.theme-thumb .tt-chat { padding: 6% 5%; gap: 4px; }
.theme-card .theme-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  text-align: left;
}
.pz-block { margin-bottom: 18px; }
.pz-block:last-child { margin-bottom: 4px; }

/* 桌面窗口内部新增：顶栏标题条 / 会话列表 / 右侧详情栏 */
.tt-topbar-title {
  flex: 1;
  height: 4px;
  margin-left: 8px;
  border-radius: 3px;
}
.tt-list,
.tt-detail {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: none;
  min-width: 0;
  padding: 8px 5px;
  border-right: 1px solid;
}
.tt-list { width: 18%; }
.tt-detail {
  width: 14%;
  border-right: 0;
  border-left: 1px solid;
}
.tt-list i,
.tt-detail i {
  display: block;
  height: 4px;
  border-radius: 3px;
}

/* 文件行改为紧凑卡片 + 三点菜单，旧行内「打开提示 / 删除」规则已移除 */

/* ─────────────────────────────────────────────────────────────
   右下角头像弹窗取消背景高斯模糊
   .overlay 全局带 backdrop-filter: blur(9px)，.me-overlay 原只覆盖了
   background 没覆盖 blur，主画布仍被糊掉。这里显式关掉，弹窗只保留
   自身圆角 + 主题底色，背景页面保持原样清晰。
   ───────────────────────────────────────────────────────────── */
.me-overlay {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: transparent;
}

/* ─────────────────────────────────────────────────────────────
   产物预览改为右侧内置面板
   HTML / PDF / MD 都在这个面板里用 Electron 内置 Chromium 渲染，
   不调用系统浏览器；右上角三点菜单挂载文件动作。
   ───────────────────────────────────────────────────────────── */
#artifactOverlay {
  place-items: stretch;
  justify-items: end;
  padding: 0;
  background: rgba(4, 6, 10, 0.34);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#artifactOverlay .artifact-modal {
  width: min(860px, 56vw);
  max-width: 100%;
  height: 100vh;
  max-height: 100vh;
  border: 0;
  border-left: 1px solid var(--line-2);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: drawerIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes drawerIn {
  from { transform: translateX(28px); opacity: 0.45; }
  to { transform: none; opacity: 1; }
}

#artifactOverlay .artifact-actions {
  flex: none;
  align-items: center;
  padding: 10px 21px 4px;
}

/* 文档预览改为「可读宽度 + 内部滚动」。
   长 Markdown / HTML / PDF 不再整篇缩放到一屏，iframe 保持容器尺寸，
   由 iframe 自身的滚动条承载长内容；图片仍按 contain 完整放进可视区。 */
#artifactOverlay .artifact-body {
  position: relative;
  flex: 1;
  min-height: 0;
  max-height: none;
  margin-top: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#artifactOverlay .preview-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: auto;
  border-radius: 10px;
}

#artifactOverlay .preview-code {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

#artifactOverlay .preview-img {
  display: block;
  margin: auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* 折叠产物栏后，消息行 / 系统行 / 思考卡跟着列宽撑满，
   不再因为 1180px 的硬上限在右侧留下一大片空白。 */
.shell.details-closed .msg-row,
.shell.details-closed .system-row,
.shell.details-closed .think-card {
  max-width: none;
}

/* 预览容器只负责裁剪边框；长内容由 iframe 内部滚动，不再做整篇等比缩放。 */
/* 音视频与二进制文件的预览容器 */
#artifactOverlay .preview-media {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

#artifactOverlay .preview-media video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #000;
}

#artifactOverlay .preview-media.preview-audio { background: var(--soft); }

#artifactOverlay .preview-media audio {
  width: min(560px, 100%);
}

#artifactOverlay .preview-binary {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  text-align: center;
}

#artifactOverlay .preview-binary .pb-icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--chip-bg, rgba(128,128,128,0.10));
  color: var(--faint);
  margin-bottom: 2px;
}

#artifactOverlay .preview-binary strong { color: var(--text); font-size: 14px; }
#artifactOverlay .preview-binary p { margin: 0; font-size: 12px; color: var(--faint); }
#artifactOverlay .preview-binary .pb-dot { margin: 0 6px; opacity: .5; }

#artifactOverlay .preview-binary .pb-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

#artifactOverlay .preview-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

#artifactOverlay .preview-stage .preview-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  transform-origin: top left;
  background: #fff;
}

.artifact-menu { position: relative; margin-left: auto; }

.artifact-menu-btn {
  min-width: 34px;
  font-size: 17px;
  line-height: 1;
  letter-spacing: 2px;
  padding: 4px 10px;
}

.artifact-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 12;
  min-width: 232px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel-2, var(--panel));
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
}

.artifact-menu-pop[hidden] { display: none; }

.artifact-menu-pop button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.artifact-menu-pop button:hover { background: var(--hover-bg); }

.artifact-menu-pop button small {
  color: var(--faint);
  font-size: 10px;
  font-weight: 400;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-missing {
  padding: 18px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
}


/* ---------------- UI ---------------- */

/* 主题/开屏卡片：横向多列铺满，杜绝竖向堆叠与两侧大片留白 */
.pz-modal .pz-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  grid-auto-flow: row !important;
  width: 100% !important;
  align-content: start;
}
/* 真凶修复：.pz-block 的左右 auto 边距在 flex 列容器里使其收缩为 fit-content(300px)，
   必须拉回满宽，网格才有可用的多列空间 */
.pz-modal .pz-block {
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.pz-modal .pz-grid .theme-card,
.pz-modal .pz-grid .splash-card {
  width: 100% !important;
  max-width: none !important;
}

/* 开屏动画：卡片选中态 + 三种缩略图 + web 预览的 nebula/aurora 变体 */
.splash-card { text-align: left; cursor: pointer; font: inherit; color: inherit; }
.splash-card.active { border-color: var(--accent); background: var(--accent-soft); }
.splash-inuse {
  font-style: normal;
  font-size: 10px;
  font-weight: 650;
  color: var(--accent);
  border: 1px solid var(--accent-line, var(--accent));
  border-radius: 99px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: 1px;
}
/* 缩略图：星河（蓝紫星点） / 极光（底部极光带） */
.splash-thumb-nebula {
  background:
    radial-gradient(2px 2px at 30% 30%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1.6px 1.6px at 66% 60%, rgba(180,200,255,.8), transparent 60%),
    radial-gradient(1.8px 1.8px at 78% 26%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.4px 1.4px at 44% 76%, rgba(200,215,255,.7), transparent 60%),
    radial-gradient(circle at 50% 45%, rgba(88,120,255,.35), rgba(120,80,220,.14) 55%, #0a0c11 78%);
}
.splash-thumb-aurora {
  background:
    radial-gradient(circle at 50% 40%, rgba(110,140,255,.22), #0a0c11 72%),
    linear-gradient(12deg, rgba(64,110,255,.42), rgba(120,80,230,.30) 40%, rgba(60,190,220,.26) 62%, transparent 80%);
}
/* 金属（默认）：与星河/极光同构的深色径向底，避免缩略图风格不一致 */
.splash-thumb-metal {
  background:
    radial-gradient(circle at 50% 45%, rgba(199,204,212,.32), rgba(120,140,170,.14) 55%, #0a0c11 78%),
    linear-gradient(135deg, rgba(160,170,190,.18), transparent 60%);
}
/* web 端预览变体：数据属性驱动背景层 */
.splash[data-splash='nebula']::before {
  content: "";
  position: absolute; inset: -12%;
  background-image:
    radial-gradient(2px 2px at 18% 26%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1.6px 1.6px at 42% 68%, rgba(190,205,255,.85), transparent 60%),
    radial-gradient(2.2px 2.2px at 66% 22%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1.4px 1.4px at 82% 58%, rgba(170,190,255,.8), transparent 60%),
    radial-gradient(1.8px 1.8px at 30% 84%, rgba(255,255,255,.7), transparent 60%);
  background-size: 640px 480px;
  animation: splashDrift 7s linear infinite;
}
.splash[data-splash='nebula']::after {
  content: "";
  position: absolute; left: 50%; top: 44%; width: 900px; height: 600px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(88,120,255,.28), rgba(120,80,220,.12) 55%, transparent 75%);
  animation: splashGlow 2.6s ease-in-out infinite;
}
.splash[data-splash='aurora']::before {
  content: "";
  position: absolute; left: -30%; right: -30%; bottom: -42%; height: 120%;
  background: conic-gradient(from 250deg at 50% 100%, rgba(64,110,255,.30), rgba(120,80,230,.22) 25%, rgba(60,190,220,.18) 50%, rgba(64,110,255,.28) 75%, rgba(64,110,255,.30));
  filter: blur(46px);
  animation: splashAurora 5.2s ease-in-out infinite;
}
.splash[data-splash='aurora']::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 44%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(110,140,255,.5) 35%, rgba(170,130,255,.5) 65%, transparent);
}
/* 金属（默认）web 预览层：主题色氛围光，与其他两档视觉对齐 */
.splash[data-splash='metal']::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(420px 300px at 50% 42%, rgba(199,204,212,.22), transparent 60%);
}
@keyframes splashDrift { from { transform: translate(2.4%, 1.6%); } to { transform: translate(-2.4%, -1.6%); } }
@keyframes splashGlow { 0%, 100% { opacity: .55; transform: translate(-50%, -50%) scale(.94); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); } }
@keyframes splashAurora { 0%, 100% { transform: translateX(-6%) skewX(-8deg) scaleY(1); } 50% { transform: translateX(6%) skewX(10deg) scaleY(1.14); } }

/* splash 卡片在窄列内改竖排，避免 thumb/meta/预览按钮挤压折行 */
.pz-modal .pz-grid .splash-card {
  flex-direction: column;
  align-items: stretch;
}
.pz-modal .pz-grid .splash-card .splash-thumb {
  width: 100%;
  height: 110px;
  border-radius: 12px;
}
.pz-modal .pz-grid .splash-card .splash-play {
  width: 100%;
  margin-top: 10px;
}

/* ── Token 用量独立面板（与设置同风格，单栏无左导航） ── */
.usage-center {
  display: flex;
  flex-direction: column;
  width: min(680px, 92vw);
  height: min(72vh, 640px);
  padding: 22px 26px;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.usage-center .settings-head { margin-bottom: 6px; }
.usage-center .settings-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}


/* 开屏卡片——关闭项 + Quorum 视频缩略图 */
.splash-thumb-off {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 20px;
}
.splash-thumb-off::after { content: "⃠"; }
.splash-thumb-video { overflow: hidden; }
.splash-thumb-video img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 协作状态条改为消息流里的一行 —— 与 .msg-row 共用栏宽与左内距，
   左缘和 PM 气泡/头像列对齐。 */
.status-strip {
  max-width: 1180px;
  margin: 0 0 12px 60px;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.5;
}
.status-strip .pulse {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(110, 211, 182, 0.45);
  animation: statusPulse 1.8s ease-out infinite;
}
@keyframes statusPulse {
  0% { box-shadow: 0 0 0 0 rgba(110, 211, 182, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(110, 211, 182, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 211, 182, 0); }
}

/* ═══ 开屏动画卡片布局修正 ═══
   根因：卡片外层原本是 <button>，里面又塞了「预览」<button> —— 非法嵌套，
   浏览器会把内层按钮提到卡片外，于是出现「关闭卡片窄 / Quorum 卡片宽 / 预览飘到右边空白」。
   现在外层改成 div[role=button]，卡片统一竖排：缩略图满宽 132px + 文案 + 满宽预览按钮。 */
.pz-modal #splashGrid,
.pz-modal .pz-grid#splashGrid {
  /* 固定 300px 列宽：16:9 缩略图才能整帧显示，又不会把弹窗撑到要滚动 */
  grid-template-columns: repeat(auto-fit, 300px) !important;
  justify-content: start;
  align-items: stretch;
  gap: 14px;
}
.pz-modal #splashGrid .splash-card,
.pz-modal .pz-grid .splash-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100% !important;
  max-width: none !important;
  height: 100%;
  padding: 10px;
  border-radius: 16px;
  text-align: left;
  cursor: pointer;
}
.pz-modal #splashGrid .splash-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.pz-modal #splashGrid .splash-card .splash-thumb,
.pz-modal .pz-grid .splash-card .splash-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(128, 128, 128, 0.10);
}
.pz-modal #splashGrid .splash-card .splash-meta {
  flex: 1 1 auto;
  padding: 0 2px;
}
.pz-modal #splashGrid .splash-card .splash-play,
.pz-modal .pz-grid .splash-card .splash-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 30px;
  margin: 0;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 650;
}
.pz-modal #splashGrid .splash-card .splash-play:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* 缩略图统一 16:9 裁切，视频类与关闭占位同高。 */
.pz-modal #splashGrid .splash-thumb-video img {
  width: 100%;
  height: 100%;
  /* 视频源本身是 2560×1440 的 16:9，用 contain 保证预览图完整不裁切 */
  object-fit: contain;
  display: block;
}

/* ══════════════════════════════════════════════════════════════════════
   推理强度滑块 · 唯一实现
   · 轨道为胶囊形（radius 999px），高 28px
   · 旋钮为 28×28 正圆白块，无白圈、无彩色光晕
   · 填充段左端恒蓝、右端随位置色；高能量时叠加紫色星云层（左深右浅）
   · 星尘为 3px 小圆点横穿填充段，亮度 0.55~1，数量 = round(能量×22)
   · 不使用白色扫光条
   ══════════════════════════════════════════════════════════════════════ */
.ef-slider {
  --ef-pos: 50%;
  position: relative;
  /* 轨高 28px（旋钮直径与之相同，
     所以 pct=1 时圆正好填满管口、右端不再留 1~2px 缝）。 */
  height: 28px;
  width: 100%;
  max-width: none;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* 轨道：胶囊形 */
.ef-slider .ef-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin-top: 0;
  border-radius: 999px;
  transform: none;
  overflow: hidden;
  background: rgba(128, 128, 128, 0.20);
  /* 能量 > 0 时给整条轨道一层紫色外发光（0 → 16px，强度随能量） */
  box-shadow:
    inset 0 0 0 1px rgba(128, 128, 128, 0.10),
    0 0 calc(var(--ef-energy, 0) * 16px) rgba(168, 85, 247, 0.5);
  transition: box-shadow 200ms ease;
}
[data-theme='paper'] .ef-slider .ef-track {
  background: rgba(30, 25, 15, 0.11);
  box-shadow: inset 0 0 0 1px rgba(30, 25, 15, 0.08);
}

/* 填充段：左端恒蓝 → 右端当前位置色 */
.ef-slider .ef-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  margin-top: 0;
  width: var(--ef-pos);
  transform: none;
  border-radius: 0;
  background: var(--ef-fill-bg, linear-gradient(90deg, #4d93f8, #4d93f8));
  box-shadow: none;
  overflow: hidden;
  z-index: 1;
}
/* 关闭白色扫光条 */
.ef-slider .ef-fill::before,
.ef-slider .ef-fill::after { content: none; display: none; }

/* 能量层：紫色星云，只覆盖已填充段，透明度 = 能量（左深右浅，Max 档即参照图效果） */
.ef-slider .ef-energy {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  margin-top: 0;
  width: var(--ef-pos);
  border-radius: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--ef-energy, 0);
  transition: opacity 0.2s ease;
  background: linear-gradient(90deg, #3b1178 0%, #6d28d9 30%, #9333ea 62%, #c084fc 100%);
  z-index: 1;
}
.ef-slider .ef-energy::after { content: none; display: none; }

/* 星尘宿主：宽度=填充段，裁掉溢出；不跟星云淡入（否则会被压暗） */
.ef-slider .ef-stars {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  margin-top: 0;
  width: var(--ef-pos);
  border-radius: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
/* 星尘节点样式 ——
   不是原位呼吸闪烁，而是**整条宽度的轨道自己在向左连续横穿**，
   圆点在最右端出生、向左穿出；两端淡出发生在可视区之外，所以看起来「从不消失」。
   时长与负延迟写在元素上（写进样式表时负相位不生效）。 */
.ef-slider .ef-star {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  margin-top: -1.5px;
  pointer-events: none;
  animation-name: efStarSweep;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  /* 越靠右越快。速度由 applySliderFx 通过 WAAPI 的 playbackRate 实时下发，
     这里不再写 animation-playback-rate（CSS 无此属性，会被整条忽略）。 */
}
.ef-slider .ef-star__dot {
  position: absolute;
  left: 100%;
  top: 0;
  width: 3px;
  height: 3px;
  margin-left: -1.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.85);
  transform: scale(var(--ef-b, 1));
}
/* 深色主题下用略偏紫的白点 + 紫色光晕，在紫星云上更清楚 */
[data-theme='glacier'] .ef-slider .ef-star__dot,
:root:not([data-theme='paper']) .ef-slider .ef-star__dot {
  background: #f5f3ff;
  box-shadow: 0 0 5px rgba(216, 180, 254, 0.95);
}
@keyframes efStarSweep {
  0%   { transform: translate3d(0, 0, 0); opacity: 0; }
  6%   { opacity: 1; }
  94%  { opacity: 1; }
  100% { transform: translate3d(-100%, 0, 0); opacity: 0; }
}

/* 旋钮为 28×28 的正圆（直径 = 轨高），
   圆心走 14px 内缩几何，因此 pct=1 时右缘正好落在轨道右端，不会再留一条缝。 */
.ef-slider .ef-thumb {
  position: absolute;
  top: 50%;
  left: var(--ef-pos);
  transition: left 120ms cubic-bezier(0.2, 0.8, 0.2, 1);
  width: 28px;
  height: 28px;
  margin: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.34), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  z-index: 3;
}

/* 最高档不外扩描边、不给填充段加彩色光晕 */
.ef-slider.ultra { outline: none; }
.ef-slider.ultra .ef-fill { filter: none; box-shadow: none; }
.ef-slider.ultra .ef-thumb { box-shadow: 0 1px 5px rgba(0, 0, 0, 0.34), 0 0 0 0.5px rgba(0, 0, 0, 0.06); }
.ef-slider.ultra .ef-track {
  box-shadow:
    inset 0 0 0 1px rgba(128, 128, 128, 0.10),
    0 0 calc(var(--ef-energy, 0) * 16px) rgba(168, 85, 247, 0.5);
}
.ef-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }

/* 拖动 / 吸附 */
.ef-slider.dragging .ef-thumb { transition: none; cursor: grabbing; }
.ef-slider.dragging .ef-fill,
.ef-slider.dragging .ef-energy,
.ef-slider.dragging .ef-stars { transition: none !important; }
.ef-slider.snapping .ef-thumb { transition: left 160ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.ef-slider.snapping .ef-fill,
.ef-slider.snapping .ef-energy,
.ef-slider.snapping .ef-stars { transition: width 160ms cubic-bezier(0.2, 0.8, 0.2, 1); }

/* 数值气泡：悬浮在轨道上方的小标签（不是铺满轨道的条）。
   之前它的定位规则在历次清理中被删掉，退化成宽度 100% 的矩形块，
   正是用户看到的「拖动时蓝色条铺满、上沿变直角、下面露一条空白」。 */
.ef-slider .ef-bubble {
  position: absolute;
  bottom: calc(100% + 9px);
  left: var(--ef-pos);
  transform: translateX(-50%);
  min-width: 34px;
  padding: 4px 9px;
  height: auto;
  border-radius: 7px;
  background: var(--ef-color, #4d93f8);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.26), 0 2px 5px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 4;
}
.ef-slider .ef-bubble[hidden] { display: none; }
/* 小三角：指向下方旋钮 */
.ef-slider .ef-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ef-color, #4d93f8);
}

/* 刻度（档位小点，只在内部，不画白圈） */
.ef-slider .ef-tick { display: none; }

@media (prefers-reduced-motion: reduce) {
  .ef-slider .ef-energy { transition: none; }
  .ef-slider .ef-stars { transition: none; }
  .ef-slider .ef-star { animation-duration: 6s !important; }
}

/* 侧栏品牌位换成正式 Logo（原「Q」文字标） */
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  object-fit: cover;
  background: #fff;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  user-select: none;
  -webkit-user-drag: none;
}

/* 个性化弹窗高度固定为 92vh，内容区可滚动；
   开屏缩略图为完整 16:9，内容变高后需要保留底部「预览」按钮。 */
.pz-modal {
  height: 92vh;
  max-height: 92vh;
}
.pz-modal .settings-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
}

/* 压缩主题/开屏两块的高度，让「预览」按钮完整落在可视区内 */
.pz-modal .tt-window { height: 92px; }
.pz-modal #splashGrid { grid-template-columns: repeat(auto-fit, 272px) !important; }
.pz-modal .pz-block { margin-bottom: 10px; }
.pz-modal .pz-grid { gap: 12px; }
.pz-modal .splash-meta small { line-height: 1.45; }


/* 档位标签排成三等分布 —— 低=左下、中=正下、高=右下。 */
.ef-slider + .ef-labels,
.ef-labels {
  position: relative;
  /* 等宽三列：低贴左、中正好居中、高贴右（用 flex space-between 时中间那颗会偏） */
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: baseline;
  width: 100%;
  margin: 6px 0 0;
  padding: 0 2px;
  height: auto;
}
.ef-labels b {
  position: static;
  left: auto;
  transform: none;
  white-space: nowrap;
  min-width: 0;
  overflow: visible;
  font-size: clamp(10px, 3.2vw, 11.5px);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  line-height: 1.2;
  /* 跟着滑块逐帧点亮，短过渡只为消除锯齿，不再有滞后 */
  transition: color 80ms linear, opacity 80ms linear;
  will-change: color, opacity;
}
.ef-labels b.on { color: var(--text); font-weight: 750; }
.ef-labels b { text-align: center; }
.ef-labels b:first-child { text-align: left; }
.ef-labels b:last-child { text-align: right; }

/* 拖动/吸附时不做任何尺寸过渡，避免拖动过程中各层错位（下半截空、边角变形） */
.ef-slider.dragging .ef-fill,
.ef-slider.dragging .ef-energy,
.ef-slider.dragging .ef-stars {
  transition: none !important;
}

/* 右侧边栏的预览复用全屏预览那套分支，这里补几何 + 加载转圈。
   原先后两套各写各的，侧栏只认图片/HTML/文本，Word 与二进制只能落到空 <pre>。 */
.preview-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
  color: var(--muted);
}

.preview-loading p {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.01em;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: wsSpin 0.8s linear infinite;
}

#contextPanel .preview-stage {
  position: relative;
  overflow: hidden;
  height: min(58vh, 520px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

#contextPanel .preview-stage .preview-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

#contextPanel .preview-img {
  max-width: 100%;
  border-radius: 10px;
}

#contextPanel .preview-code {
  max-height: min(58vh, 520px);
  overflow: auto;
}

#contextPanel .preview-binary {
  min-height: 220px;
}

#contextPanel .preview-media video,
#contextPanel .preview-media audio {
  width: 100%;
}

/* 爱发电一级界面 —— Quorum 字标 + 爱发电二维码 */
.sp-bio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.sp-wordmark {
  font-family: "Segoe UI", -apple-system, "Helvetica Neue", "PingFang SC", sans-serif;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding-left: 0.18em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(45, 20, 90, 0.3);
}

.sp-q {
  color: #ffd9a8;
}

.sp-tagline {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.78);
}

.sp-afdian {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.sp-afdian-box {
  width: 150px;
  height: 150px;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(45, 20, 90, 0.12);
}

.sp-afdian-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sp-afdian-tip {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.06em;
}

/* ===================== 手机端单栏适配 ===================== */
/* 桌面端保持原三栏；768px 以下切单栏栈式：
   会话列表 ⇄ 聊天页切换（返回箭头），rail 沉底当 tab bar，
   右侧成员/产物面板改成从右侧滑入的抽屉，输入区吃安全区。 */

.chat-back { display: none; }

@media (max-width: 768px) {
  .app {
    min-width: 0;
    height: 100dvh;
    flex-direction: column-reverse;
    overflow-x: hidden;
  }

  .rail {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    height: 54px;
    padding: 0 8px calc(env(safe-area-inset-bottom, 0px));
    gap: 6px;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .rail-brand { display: none; }

  .rail-nav {
    flex: 1;
    flex-direction: row;
    gap: 4px;
  }

  .rail-foot {
    width: auto;
    margin-top: 0;
    flex-direction: row;
  }

  .rail-item {
    flex: 1;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    width: auto;
    height: 40px;
    padding: 0 8px;
  }

  .me-name { display: none; }

  /* 主区单栏：列表 / 聊天二选一 */
  .shell {
    display: flex;
    flex: 1;
    height: auto;
    min-height: 0;
  }

  .conv-panel {
    /* 覆盖 900px 断点里的 display:none——手机上是「列表页」的主体 */
    display: flex;
    flex: 1;
    min-height: 0;
    border-right: 0;
  }

  .app[data-mobile-view="chat"] .conv-panel { display: none; }
  .app:not([data-mobile-view="chat"]) .chat-panel { display: none; }

  .chat-panel {
    flex: 1;
    height: auto;
    min-height: 0;
  }

  .chat-back { display: inline-grid; flex: 0 0 auto; }

  .chat-header {
    min-height: 60px;
    padding: 0 10px;
  }

  .chat-head-left { gap: 8px; }

  .header-avatars .avatar {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
    border-radius: 8px;
  }

  .chat-title h2 { font-size: 15px; }

  .messages { padding: 14px 0 8px; }

  .composer { padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }

  /* iOS 输入框字号 <16px 会自动放大整页 */
  .composer textarea { font-size: 16px; }

  /* 右侧详情面板 → 抽屉 */
  .shell.details-closed .context-panel { display: block; }

  .context-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    width: min(86vw, 360px);
    padding: calc(18px + env(safe-area-inset-top, 0px)) 14px calc(18px + env(safe-area-inset-bottom, 0px));
    border-left: 1px solid var(--line-2);
    box-shadow: -18px 0 42px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    transition: transform 220ms ease;
  }

  .shell:not(.details-closed) .context-panel { transform: translateX(0); }

  /* 触屏没有 hover，补 :active 反馈 */
  .conv-row:active { background: var(--soft); }
  .icon-btn:active { background: var(--soft); }
  .rail-item:active { background: var(--soft); }
}

/* 长期记忆管理面板 */
.mem-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 16px 0;
}
.mem-tab {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.mem-tab:hover { background: var(--hover-bg); color: var(--text); }
.mem-tab.active { border-color: var(--accent); color: var(--accent); background: var(--hover-bg); }
.memory-group { display: flex; flex-direction: column; gap: 8px; }
.memory-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.memory-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.memory-group-title em { font-style: normal; font-size: 10px; color: var(--faint); }
.memory-group-head .ghost { font-size: 10.5px; padding: 3px 9px; }
.memory-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.memory-empty {
  font-size: 11px;
}
.memory-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field-bg);
}
.memory-text {
  font-size: 12.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.memory-meta {
  font-size: 10px;
}
.memory-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.memory-add {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.memory-add textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--field-bg);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}
.memory-add textarea:focus {
  border-color: var(--accent-line);
}
.memory-add-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   手机端布局 v2（≤768px）
   按主流 Agent App 的信息架构重排：底部三 tab、顶栏返回 + 群名、
   输入区两行、浮层改底部抽屉、设置全屏页、市场单列。
   只在窄屏生效，桌面三栏布局不受影响。
   ========================================================================== */

/* 900px 以下先收几何：成员卡的格线区名必须和 DOM 一致 */
@media (max-width: 900px) {
  .agent-model-row,
  .agent-model-row.open {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "summary"
      "edit"
      "actions";
  }

  .agent-model-row.collapsed {
    grid-template-areas: "summary";
  }

  /* 普通消息、协作直播块、系统提示共用同一左右内距，
     否则 .think-card 的 24px 会把「正在读需求」整块右缩 */
  .msg-row,
  .think-card,
  .system-row {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }

  /* ---------------- 底部 tab bar：会话 / 市场 / 我 ---------------- */

  .rail {
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    padding: 0 6px env(safe-area-inset-bottom, 0px);
    gap: 0;
    align-items: stretch;
    background: rgba(11, 14, 19, 0.94);
    backdrop-filter: blur(18px);
  }

  .rail-nav {
    flex: 1 1 0;
    align-items: stretch;
    gap: 0;
  }

  .rail-foot {
    flex: 1 1 0;
    width: auto;
    margin-top: 0;
    align-items: center;
    justify-content: center;
  }

  .rail-item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: auto;
    height: 48px;
    padding: 0;
    border-radius: 12px;
    font-size: 10.5px;
  }

  .rail-item .icon {
    width: 21px;
    height: 21px;
  }

  /* 竖条改成激活胶囊，别在底部 tab 上留一根左竖线 */
  .rail-item.active::before {
    display: none;
  }

  .me-avatar {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .me-name {
    display: none;
  }

  /* ---------------- 会话列表页 ---------------- */

  .conv-header {
    align-items: center;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 10px;
  }

  .conv-header h1 {
    font-size: 21px;
  }

  .conv-header p {
    margin-top: 3px;
  }

  .search-box {
    height: 40px;
    margin: 0 16px 10px;
    border-radius: 12px;
  }

  .search-box input {
    font-size: 16px;
  }

  .conv-row {
    min-height: 62px;
    padding: 10px 16px;
  }

  .conv-foot {
    display: none;
  }

  /* ---------------- 聊天顶栏 ---------------- */

  .chat-header {
    min-height: calc(54px + env(safe-area-inset-top, 0px));
    padding: 0 8px 0 4px;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .chat-back {
    display: inline-grid;
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .chat-head-left {
    gap: 8px;
  }

  .chat-head-right {
    gap: 4px;
  }

  .header-avatars .avatar {
    width: 26px;
    height: 26px;
    border-radius: 9px;
  }

  .chat-title h2 {
    font-size: 15.5px;
  }

  .chat-title p {
    margin-top: 2px;
    font-size: 11px;
  }

  .chat-header .icon-btn {
    width: 36px;
    height: 36px;
  }

  /* ---------------- 消息区：头像与气泡落在同一条竖线 ---------------- */

  .messages {
    padding: 12px 0 4px;
    overscroll-behavior: contain;
  }

  .msg-row,
  .think-card,
  .system-row {
    padding-left: 12px;
    padding-right: 12px;
  }

  .msg-row {
    gap: 9px;
    margin-bottom: 14px;
  }

  .msg-row .avatar,
  .msg-row .avatar.sm {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 11px;
  }

  .msg-main,
  .think-main {
    max-width: 100%;
  }

  .bubble {
    padding: 10px 12px;
    border-radius: 4px 12px 12px 12px;
    font-size: 14px;
  }

  .msg-row.user .bubble {
    border-radius: 12px 4px 12px 12px;
  }

  .msg-name {
    font-size: 12px;
  }

  .role-chip {
    font-size: 9.5px;
    padding: 1px 5px;
  }

  .think-head {
    gap: 6px;
  }

  .think-box {
    padding: 9px 11px;
    border-radius: 12px;
  }

  .system-row {
    font-size: 10px;
  }

  .status-strip {
    margin: 0 0 10px 55px;
    max-width: calc(100% - 67px);
    gap: 6px;
    font-size: 11px;
    white-space: nowrap;
  }

  .attach-row,
  .mount-row {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* ---------------- 输入区：两行结构 ----------------
     第一行整宽输入框，第二行左侧 + / 安全策略、右侧强度 + 发送。
     桌面版把三组控件挤在一行，390px 下输入框会被压成一条竖缝，
     占位文字「任务进行中…」就被拆成一字一行。 */

  .composer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
  }

  .composer .input-box {
    order: 1;
    flex: 1 1 100%;
    width: 100%;
    border-radius: 14px;
  }

  .composer textarea {
    min-height: 42px;
    max-height: 128px;
    padding: 10px 12px;
    font-size: 16px;
    line-height: 1.45;
  }

  .composer .composer-left {
    order: 2;
    align-items: center;
    gap: 6px;
    padding-bottom: 2px;
  }

  .composer .send-cluster {
    order: 3;
    margin-left: auto;
    align-self: center;
    gap: 6px;
  }

  .composer .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .composer .send-btn {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 13px;
  }

  .composer .sec-pill {
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .composer .effort-pill {
    max-width: 42vw;
    height: 32px;
    padding: 0 9px;
  }

  .composer .effort-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ---------------- 浮层改底部抽屉，避免窄屏裁切 ---------------- */

  .plus-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    width: auto;
    max-height: min(60vh, 420px);
    overflow-y: auto;
    padding: 10px;
    border-radius: 16px;
    z-index: 72;
  }

  /* 安全策略与推理强度同样挂在输入区上方：
     抽屉压住触发按钮的话，点第二次就关不掉了。 */
  .sec-pop,
  .effort-panel {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: calc(177px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 16px;
    transform: none !important;
    z-index: 72;
  }

  .effort-panel {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(100% + 6px) !important;
    max-height: min(60vh, 420px);
  }

  /* 底部抽屉不需要指向触发按钮的小箭头 */
  .effort-panel::before,
  .effort-panel::after {
    display: none;
  }

  /* ---------------- 设置：整屏页，标签横滑 ---------------- */

  .settings-overlay {
    padding: 0;
    place-items: stretch;
  }

  .settings-center {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    border: 0;
    border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .settings-nav {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 6px 10px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }

  .settings-nav::-webkit-scrollbar {
    display: none;
  }

  .settings-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 12.5px;
  }

  .settings-head {
    padding: 12px 16px 10px;
  }

  /* 外层标签已经写着「成员模型」，内层再叠一个 MEMBERS 大标题只占高度 */
  .settings-head .eyebrow {
    display: none;
  }

  .settings-head h2 {
    font-size: 17px;
  }

  .settings-head p {
    font-size: 11.5px;
    line-height: 1.5;
  }

  .settings-body {
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    gap: 16px;
  }

  /* ---------------- 成员卡片：三张卡同一套几何 ---------------- */

  .agent-model-row,
  .agent-model-row.collapsed,
  .agent-model-row.open {
    width: 100%;
    border-radius: 14px;
    background: var(--soft);
  }

  .agent-model-row.collapsed {
    padding: 0;
  }

  .agent-model-row.open {
    padding: 12px;
  }

  .agent-summary {
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
  }

  .agent-summary .avatar,
  .agent-summary .avatar.md {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 14px;
  }

  .agent-summary-text strong {
    font-size: 14px;
  }

  .agent-summary-text small {
    font-size: 11.5px;
  }

  .agent-chev {
    min-width: 52px;
    text-align: right;
    font-size: 11.5px;
  }

  /* ---------------- 市场：单列、搜索常驻 ---------------- */

  .market-view {
    padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 24px;
  }

  .market-head {
    gap: 10px;
  }

  /* 「已安装」按钮 + 搜索框横排会把搜索顶出屏幕，搜索独占第二行 */
  .market-head-right {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .market-head-right .market-search {
    flex: 1 1 100%;
    width: auto;
    min-width: 0;
  }

  .market-head h1 {
    font-size: 21px;
  }

  .market-cats {
    margin: 12px 0;
    gap: 6px;
  }

  .market-search {
    height: 40px;
    margin: 0 0 12px;
    border-radius: 12px;
  }

  .market-search input {
    font-size: 16px;
  }

  /* 已安装页头部：标题 + 已安装 + 搜索一行放不下，搜索独占一行 */
  .mi-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .mi-head .market-search {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .market-grid,
  .skill-group {
    gap: 10px;
  }

  /* ---------------- 其余弹窗：铺满可用宽度，别在 390 下挤成窄条 ---------------- */

  .overlay {
    padding: 12px;
  }

  .modal,
  .usage-center,
  .thinking-modal,
  .pz-modal {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 24px);
  }

  /* 「我」面板走底部抽屉，拇指够得着，也不遮住顶栏 */
  .me-overlay {
    z-index: 120;
    padding: 0;
    place-items: end stretch;
    background: rgba(10, 12, 16, 0.38);
  }

  .me-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 82dvh;
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }

  /* 右侧产物/成员抽屉：只在聊天页、且用户点开时才显示。
     旧规则在关闭态给了 display:block，进聊天页会被一块透明面板挡住点击。 */
  .context-panel {
    display: none !important;
    /* 纸色主题下基础规则是半透明渐变，抽屉会透出聊天正文，这里改成实底 */
    background: var(--panel) !important;
    backdrop-filter: none !important;
    /* 让出聊天顶栏：返回箭头和「产物」按钮留在外面，再点一次就能收起抽屉 */
    top: calc(54px + env(safe-area-inset-top, 0px));
    padding-top: 14px;
  }

  .app[data-mobile-view='chat'] .shell:not(.details-closed) .context-panel {
    display: block !important;
    transform: translateX(0);
    box-shadow: -18px 0 42px rgba(0, 0, 0, 0.22);
  }
}

/* 问答卡片：模型停下来问用户时，在对话流里出一张可点/可填的卡片。
   颜色全部走主题 token，明暗两套都自适应；窄屏下按钮自动换行。 */
.msg-row.ask .ask-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel-2);
}

.msg-row.ask .ask-card.locked {
  opacity: 0.84;
  border-style: dashed;
}

.msg-row.ask .ask-header {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.msg-row.ask .ask-question {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

.msg-row.ask .ask-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.msg-row.ask .ask-opt {
  padding: 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.msg-row.ask .ask-opt:hover:not(:disabled) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.msg-row.ask .ask-opt.picked {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.msg-row.ask .ask-opt:disabled {
  cursor: default;
}

.msg-row.ask .ask-confirm {
  padding: 7px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
}

.msg-row.ask .ask-free {
  display: flex;
  gap: 8px;
}

.msg-row.ask .ask-input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}

.msg-row.ask .ask-input:focus {
  outline: none;
  border-color: var(--accent-line);
}

.msg-row.ask .ask-send {
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.msg-row.ask .ask-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ============ WorkBuddy 板块（Agent 广场里加入私聊后进入，占主聊天区） ============ */
.wb-pane {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

/* 进入 WorkBuddy 私聊时，主聊天区原有的标题/消息流/输入框整体让位 */
.chat-panel.wb-mode > .chat-header,
.chat-panel.wb-mode > .messages,
.chat-panel.wb-mode > .attach-row,
.chat-panel.wb-mode > .composer-wrap { display: none !important; }

.wb-avatar {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; overflow: hidden;
  background: transparent; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.wb-avatar img { width: 100%; height: 100%; object-fit: contain; display: block; }
.wb-head-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.wb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 30px 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.wb-head-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.wb-head-left h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .2px; }

.wb-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sub); max-width: 320px; }
.wb-status > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-abort {
  margin-left: 4px; padding: 2px 8px; border-radius: 999px; cursor: pointer;
  font-size: 11px; line-height: 1.5; color: var(--sub);
  background: transparent; border: 1px solid var(--line-2);
}
.wb-abort:hover { color: var(--text); border-color: var(--text); }
.wb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sub); opacity: .6; flex: 0 0 auto; }
.wb-dot.on { background: #37b26c; opacity: 1; }
.wb-dot.bad { background: #d9534f; opacity: 1; }

.wb-head-right { display: inline-flex; align-items: center; gap: 8px; }
.wb-chip {
  font-size: 11px; line-height: 1; padding: 6px 9px; border-radius: 999px;
  background: var(--panel-3); color: var(--text); border: 1px solid var(--line);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wb-chip.ghost { background: transparent; color: var(--sub); }
.wb-ghost-btn {
  font-size: 12px; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--sub); border: 1px solid var(--line-2);
}
.wb-ghost-btn:hover { color: var(--text); border-color: var(--line-2); }

/* 推理强度 pill：与主聊天输入框旁那枚同款，放在 WB 发送按钮旁 */
.wb-effort-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field-bg);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}
.wb-effort-pill .icon { width: 13px; height: 13px; }
.wb-effort-pill .effort-pill-chev { transition: transform 160ms ease; }
.wb-effort-pill:hover { border-color: var(--line-2); color: var(--text); }
.wb-effort-pill.open { border-color: var(--accent-line); color: var(--accent); }
.wb-effort-pill.open .effort-pill-chev { transform: rotate(180deg); }
.wb-effort-pill.disabled { opacity: .55; cursor: default; }

/* 面板挂在 pill 下方，箭头朝上（主聊天那枚在输入框上方，箭头朝下） */
.effort-panel[data-below="1"]::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--panel);
  filter: drop-shadow(0 -1px 0 var(--line-2));
}

/* 模型 / 推理强度：紧凑放进头部，不抢正文 */
.wb-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--sub); }
.wb-pick-label { color: var(--sub); }

/* 模型下拉按钮：原生 WorkBuddy 那颗的等价物，展开后是带倍率 / 权益标签的列表 */
.wb-model-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field-bg);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}
.wb-model-btn:hover { border-color: var(--line-2); }
.wb-model-btn.open { border-color: var(--accent-line); color: var(--accent); }
.wb-model-btn:disabled { opacity: .55; cursor: default; }
.wb-model-btn .effort-pill-chev { width: 12px; height: 12px; transition: transform 160ms ease; }
.wb-model-btn.open .effort-pill-chev { transform: rotate(180deg); }
.wb-model-btn-name { overflow: hidden; text-overflow: ellipsis; }

.wb-model-menu {
  z-index: 80;
  width: 336px;
  max-height: 64vh;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .35), 0 4px 12px rgba(0, 0, 0, .22);
  scrollbar-width: thin;
}
.wb-model-menu[hidden] { display: none; }
.wb-model-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.wb-model-row:hover { background: var(--hover-bg); }
.wb-model-row.active { background: var(--accent-soft); }
.wb-model-ic { flex: none; display: grid; place-items: center; width: 16px; height: 16px; color: var(--sub); }
.wb-model-ic .icon { width: 14px; height: 14px; }
.wb-model-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-model-tag {
  flex: none;
  font-size: 10px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  color: #22b8a6;
  border: 1px solid rgba(34, 184, 166, .35);
  background: rgba(34, 184, 166, .1);
  white-space: nowrap;
}
.wb-model-rate { flex: none; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.wb-model-check { flex: none; display: inline-flex; color: var(--accent); }
.wb-model-check .icon { width: 13px; height: 13px; }
.wb-model-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.wb-model-row.ghost { color: var(--sub); }
.wb-model-empty { padding: 12px; font-size: 12px; color: var(--sub); }

/* 权限胶囊在引擎没回传多档时整体隐藏（类里的 display 会压过 [hidden]，必须显式写） */
.composer-left .sec-pill[hidden] { display: none; }
.sec-pop[hidden] { display: none; }
.sec-pop .sp-empty { padding: 10px; font-size: 12px; color: var(--sub); }
.wb-pick select {
  font-size: 12px; padding: 4px 6px; border-radius: 8px; max-width: 170px;
  background: var(--panel-3); color: var(--text); border: 1px solid var(--line);
}
.wb-pick input[type=range] { width: 92px; accent-color: var(--accent); cursor: pointer; }
.wb-pick-val {
  min-width: 26px; font-size: 11px; color: var(--text);
  background: var(--panel-3); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 7px; text-align: center;
}
.wb-pick select:disabled, .wb-pick input:disabled { opacity: .55; cursor: default; }

/* 正文区与主聊天 .messages 同参数：左右不留面板内距，交给消息行自己的 24px */
.wb-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 24px 0 10px; }

/* 登录卡：凭证只留在本次运行的引擎内存里，重启 Quorum 后需再登一次 */
.wb-login {
  max-width: 640px; margin: 0 auto 18px; padding: 18px 20px;
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 12px;
}
.wb-login-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.wb-login-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; color: #c46a00;
  background: rgba(255, 168, 0, .14); border: 1px solid rgba(255, 168, 0, .3); white-space: nowrap;
}
.wb-login h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.wb-login-desc { margin: 0 0 12px; font-size: 12.5px; line-height: 1.75; color: var(--sub); }
.wb-login-url {
  margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: var(--panel);
  border: 1px solid var(--line); font-size: 11.5px; color: var(--sub);
  word-break: break-all; line-height: 1.6; user-select: text;
}
.wb-login-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wb-login-state { margin-top: 10px; font-size: 12px; color: var(--sub); line-height: 1.6; }

.wb-empty { max-width: 560px; margin: 8vh auto 0; text-align: center; color: var(--sub); }
.wb-empty-mark { width: 46px; height: 46px; margin: 0 auto 16px; border-radius: 14px; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); }
.wb-empty-mark .icon { width: 22px; height: 22px; }
.wb-empty h2 { font-size: 16px; color: var(--text); margin: 0 0 8px; font-weight: 600; }
.wb-empty p { font-size: 13px; line-height: 1.7; margin: 0 auto 8px; max-width: 460px; }
.wb-empty-hint { font-size: 12px; opacity: .8; }

.wb-thread { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
/* 直播思考卡与消息行沿用主聊天的同一套几何（1180 + 24px 内距），不再自己收窄 */
.wb-thread .think-card { max-width: 1180px; }
.wb-thread .think-main { max-width: 680px; }

/* WB 面板里的消息行按主聊天同一套样式：同宽、同内距、同间距 */
.wb-thread .msg-row { max-width: 1180px; margin: 0 0 18px; }
.wb-thread .msg-main { max-width: 680px; }
.wb-thread .tool-lines { margin-top: 7px; }
.wb-extras { display: flex; flex-direction: column; gap: 11px; margin-top: 11px; }
.wb-approval-card { margin: 0; }
/* 消息流里的审批只剩一行：工具名 + 状态 + 查看 */
.wb-approval-line {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0; padding: 7px 10px;
  max-width: 460px;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--panel-2);
  font-size: 12px; color: var(--sub);
}
.wb-approval-line .icon { width: 14px; height: 14px; flex: 0 0 auto; }
.wb-al-text { color: var(--text); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-al-state { margin-left: auto; font-size: 11px; white-space: nowrap; }
.wb-al-state.ok { color: #2f9e68; }
.wb-al-state.deny { color: #d4553f; }
/* 模型菜单二级：上下文档位 */
.wb-model-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 6px; font-size: 12px; color: var(--sub);
}
.wb-model-back {
  display: grid; place-items: center; width: 22px; height: 22px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--panel-3);
  color: var(--text); cursor: pointer;
}
.wb-model-back .icon { width: 13px; height: 13px; transform: rotate(180deg); }
/* 文件卡右上角三点：进菜单，不再直接弹系统程序 */
.wb-artifact .artifact-open { display: none; }
.wb-artifact-more { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.wb-artifact { position: relative; }
.file-row .wb-artifact-more { position: absolute; right: 6px; top: 6px; }
.file-row { position: relative; }
.wb-approval-card .approval-foot { margin: 8px 0 0; font-size: 11.5px; }
.wb-ava { background: transparent !important; }
.wb-ava img { object-fit: cover; transform: scale(1.14); }
/* 推理档位标签：绝对定位到档位对应位置，两字档位不再被等分格挤变形 */
.ef-labels.abs {
  position: relative;
  display: block;
  height: 20px;
  margin-top: 6px;
}
.ef-labels.abs b {
  position: absolute;
  top: 0;
  margin: 0;
  white-space: nowrap;
  font-size: clamp(10px, 3vw, 11.5px);
  line-height: 20px;
}
.wb-artifact { width: 100%; max-width: 460px; }
.wb-error-text {
  font-size: 12px; line-height: 1.6; color: var(--danger, #d4553f);
  background: color-mix(in srgb, var(--danger, #d4553f) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger, #d4553f) 26%, transparent);
  border-radius: 10px; padding: 9px 11px; white-space: pre-wrap; word-break: break-word;
}
.wb-turn-note { font-size: 11px; line-height: 1.6; color: var(--faint); }
.wb-extras { display: flex; flex-direction: column; gap: 8px; }
.wb-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wb-tool-chip { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--panel-3); color: var(--sub); border: 1px solid var(--line); }
.wb-tool-chip.blocked { color: #d9534f; border-color: rgba(217, 83, 79, .35); }
.wb-err { margin-top: 8px; font-size: 12px; color: #d9534f; line-height: 1.6; }

.wb-composer { position: relative; flex: 0 0 auto; border-top: 1px solid var(--line); padding: 12px 24px 16px; background: var(--composer-bg); backdrop-filter: blur(14px); }
.wb-composer-row { display: flex; align-items: flex-end; gap: 7px; }
.wb-composer-left { display: flex; align-items: flex-end; flex: none; }
.wb-input-box {
  display: flex; flex: 1; min-width: 0; flex-direction: column;
  border: 1px solid var(--line); border-radius: 16px; background: var(--field-bg);
  overflow: hidden; transition: border-color 150ms ease, background 150ms ease;
}
.wb-input-box:focus-within { border-color: var(--accent-line); }
.wb-composer textarea {
  width: 100%; resize: none; border: 0; border-radius: 0; padding: 11px 13px; font: inherit; font-size: 13.5px;
  background: transparent; color: var(--text); outline: none; min-height: 44px;
}
.wb-composer .send-cluster { display: flex; align-items: center; gap: 8px; align-self: center; flex: none; }
.wb-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.wb-foot-note { flex: 1 1 auto; min-width: 0; font-size: 11.5px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-composer-foot .send-cluster { flex: none; }
/* 历史用户轮里已发送的附件缩略条 */
.wb-history-atts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.wb-allow-badge {
  flex: none; font-size: 11px; line-height: 1; padding: 5px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); white-space: nowrap;
}
.wb-allow-badge[hidden] { display: none; }
.wb-send {
  flex: 0 0 auto; font-size: 13px; padding: 7px 18px; border-radius: 9px; cursor: pointer;
  background: var(--accent); color: #fff; border: 1px solid transparent;
}
.wb-send:disabled, .wb-send.busy { opacity: .6; cursor: default; }

/* 审批卡片：它举手 → 你点允许 / 本轮都允许 / 拒绝 */
.wb-approval {
  width: 100%; border-radius: 12px; padding: 14px 16px; margin: 2px 0;
  background: var(--panel-2); border: 1px solid rgba(181, 101, 29, .45);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .06);
}
.wb-approval-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); flex-wrap: wrap; }
.wb-approval-tool { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.wb-approval-queue { margin-left: auto; font-size: 11.5px; color: var(--sub); font-weight: 400; }
.wb-approval-target { margin-top: 8px; font-size: 12px; color: var(--sub); word-break: break-all; line-height: 1.6; }
.wb-approval-pre {
  margin-top: 8px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font-size: 12px; line-height: 1.62; color: var(--text); background: var(--panel-1);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.wb-approval-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.wb-btn {
  font-size: 12.5px; padding: 7px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
}
.wb-btn:hover { border-color: var(--accent); }
.wb-btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.wb-btn.primary:hover { opacity: .92; }
.wb-btn.danger { color: #d9534f; border-color: rgba(217, 83, 79, .4); }
.wb-btn:disabled { opacity: .5; cursor: default; }
.wb-approval-note { margin-top: 10px; font-size: 11.5px; color: var(--sub); line-height: 1.6; }
.wb-approval-decision { margin-top: 10px; font-size: 12px; color: var(--sub); }

/* 写出的文件：做成可直接定位的产物条 */
.wb-file {
  display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-1);
}
.wb-file-ic {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 7px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 700;
}
.wb-file-main { min-width: 0; flex: 1 1 auto; }
.wb-file-name { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-file-meta { font-size: 11px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-file-open {
  flex: 0 0 auto; font-size: 11.5px; padding: 5px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--sub);
}
.wb-file-open:hover { color: var(--text); border-color: var(--accent); }

/* ============ Agent 广场 ============ */
.rail-item.wide span { font-size: 10px; letter-spacing: -.3px; white-space: nowrap; }

.agents-view {
  flex: 1; min-width: 0; min-height: 0; overflow-y: auto;
  background: var(--bg); color: var(--text);
  padding: 26px 30px 40px;
}
.agents-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.agents-head h1 { font-size: 22px; margin: 0 0 6px; font-weight: 600; letter-spacing: .2px; }
.agents-sub { font-size: 12.5px; color: var(--sub); margin: 0; }
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; max-width: 1100px; }

.agent-card {
  display: flex; flex-direction: column; gap: 12px; padding: 18px;
  border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line);
}
.agent-card:hover { border-color: var(--line-2); }
.agent-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.agent-avatar {
  width: 52px; height: 52px; flex: 0 0 auto; border-radius: 13px; overflow: hidden;
  background: transparent; display: grid; place-items: center; color: #fff; font-weight: 700;
}
.agent-avatar img { width: 100%; height: 100%; object-fit: contain; display: block; }
.agent-name { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.agent-tag { font-size: 10.5px; font-weight: 400; padding: 2px 7px; border-radius: 999px; background: var(--panel-3); color: var(--sub); border: 1px solid var(--line); }
.agent-role { font-size: 12px; color: var(--sub); margin: 0; }
.agent-desc { font-size: 12.5px; line-height: 1.7; color: var(--sub); margin: 0; }
.agent-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; flex-wrap: wrap; }
.agent-chips { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--sub); }
.agent-actions { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; margin-left: auto; flex-wrap: wrap; }
.agent-act {
  font-size: 12px; padding: 6px 11px; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--sub); border: 1px solid var(--line-2);
}
.agent-act:hover { color: var(--text); border-color: var(--text); }
.agent-act.danger:hover { color: #e5484d; border-color: #e5484d; }
.agent-join {
  flex: 0 0 auto; font-size: 12.5px; padding: 7px 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; background: var(--accent); color: #fff;
}
.agent-join.joined { background: transparent; border-color: var(--line-2); color: var(--sub); }
.agent-join:hover { opacity: .92; }

/* 图标接口拿不到时回落到字母底：图片 onerror 自己 remove，字母就在底下。
   绿色底只画在这层兜底上，图片在位时不露出底色块 */
.ava-ini { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; background: #16c79a; border-radius: inherit; }
.wb-avatar, .agent-avatar, .avatar.has-img { position: relative; }
.wb-avatar img, .agent-avatar img, .avatar.has-img img { position: relative; z-index: 1; }

/* WB 视图保留右侧产物 / 文件栏，不再收回列宽 */

/* 会话行上的连接状态小标 */
.wb-state {
  font-size: 10.5px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--sub); background: var(--panel-3); flex: 0 0 auto;
}
.wb-state.on { color: #2f9e68; border-color: rgba(47, 158, 104, .35); background: transparent; }
.wb-state.bad { color: #c46a00; border-color: rgba(255, 168, 0, .3); background: rgba(255, 168, 0, .1); }

/* 会话列表里 WorkBuddy 那条私聊：头像换成官方图标，底色只由字母兜底层提供 */
.conv-row.wb-row .avatar.has-img { background: transparent; }

@media (max-width: 720px) {
  .wb-head { padding: 14px 16px 12px; flex-wrap: wrap; gap: 10px; }
  .wb-body { padding: 18px 16px 4px; }
  .wb-composer { padding: 10px 16px 14px; }
  .wb-approval { padding: 12px 12px; }
  .wb-approval-pre { max-height: 160px; }
  .agents-view { padding: 18px 16px 28px; }
  .agents-grid { grid-template-columns: 1fr; }
}
