    /* ── 主区 ────────────────────────────── */
    main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0; /* 允许内部 .skills-view / .messages 正确形成独立滚动区域 */
      background: var(--bg);
    }

    .topbar {
      padding: 12px 24px;
      display: flex;
      align-items: center;
      gap: 14px;
      background: var(--bg);
      border-bottom: 1px solid var(--border);
    }
    .model-badge {
      font-size: var(--fs-13);
      color: var(--fg-soft);
      padding: 6px 12px;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius-pill);
      display: inline-flex;
      align-items: center;
      gap: 6px;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    }
    .model-badge::before {
      content: "";
      width: 6px;
      height: 6px;
      background: var(--mint-deep);
      border-radius: 50%;
      box-shadow: 0 0 6px rgba(77, 199, 147, 0.6);
    }
    .status {
      font-size: var(--fs-13);
      color: var(--fg-dim);
      padding: 6px 12px;
      border-radius: var(--radius-pill);
    }
    .status.busy { background: var(--accent-soft); color: var(--brand-deep); font-weight: 500; }
    .status.err { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); font-weight: 500; }

    .messages {
      flex: 1;
      overflow-y: auto;
      padding: 0;
      display: flex;
      flex-direction: column;
      min-height: 0;
    }
    .msg-wrap {
      max-width: 960px;
      margin: 0 auto;
      padding: 0 28px;
      /* flex 列布局，让用户靠右、AI 靠左；只影响直接子气泡，
         activity-body 等嵌套里的 .bubble.assistant 不受影响 */
      display: flex;
      flex-direction: column;
    }

    .bubble {
      padding: 16px 20px;
      border-radius: var(--radius-lg);
      margin-bottom: 14px;
      word-wrap: break-word;
      overflow-wrap: anywhere;
      position: relative;
    }
    .bubble.user {
      background: var(--panel-alt);
      color: var(--fg);
      max-width: 78%;
      border: 1px solid var(--border);
      box-shadow: none;
    }
    /* 只让顶层 msg-wrap 里的 user 气泡真的靠右；嵌到其它容器里的 user 保持默认 */
    .msg-wrap > .bubble.user { align-self: flex-end; }
    .bubble.user .role { color: var(--fg-dim); }
    [data-theme="dark"] .bubble.user {
      background: var(--panel-alt);
      border-color: var(--border);
    }
    .bubble.assistant {
      background: var(--panel);
      border: 1px solid var(--border);
      box-shadow: none;
    }
    .msg-wrap > .bubble.assistant {
      align-self: flex-start;
      max-width: 85%;
    }
    .bubble .role {
      font-size: var(--fs-11);
      font-weight: var(--fw-semibold);
      letter-spacing: var(--ls-uppercase);
      margin-bottom: 6px;
      text-transform: uppercase;
    }
    .bubble.assistant .role {
      color: var(--brand-deep);
      letter-spacing: var(--ls-uppercase);
    }

    /* AI 正文中由 postProcess 注入的本地路径缩略图 */
    .bubble.assistant .content .assistant-inline-thumb {
      display: inline-block;
      max-width: 200px;
      height: auto;
      border-radius: 8px;
      cursor: pointer;
      vertical-align: middle;
      margin: 4px 0;
    }

    .bubble .content {
      font-size: var(--fs-14);
      line-height: var(--lh-relaxed);
      font-weight: var(--fw-regular);
    }
    /* ── 段落 ── */
    .bubble .content p { margin: 0.6em 0; }
    .bubble .content p:first-child { margin-top: 0; }
    .bubble .content p:last-child { margin-bottom: 0; }
    /* ── 标题 ── */
    .bubble .content h1,
    .bubble .content h2,
    .bubble .content h3,
    .bubble .content h4 {
      margin: 0.8em 0 0.4em;
      line-height: var(--lh-tight);
      font-weight: var(--fw-semibold);
      color: var(--fg);
    }
    .bubble .content h1 { font-size: var(--fs-20); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
    .bubble .content h2 { font-size: var(--fs-18); }
    .bubble .content h3 { font-size: var(--fs-16); }
    .bubble .content h4 { font-size: var(--fs-15); }
    .bubble .content h1:first-child,
    .bubble .content h2:first-child,
    .bubble .content h3:first-child,
    .bubble .content h4:first-child { margin-top: 0; }
    /* ── 水平分割线 ── */
    .bubble .content hr {
      border: none;
      border-top: 1px solid var(--border);
      margin: 1em 0;
    }
    /* ── 代码 ── */
    .bubble .content pre {
      background: var(--code-bg);
      border: 1px solid var(--code-border);
      border-radius: 10px;
      padding: 12px 14px;
      overflow-x: auto;
      font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
      font-size: var(--fs-13);
      line-height: var(--lh-base);
      margin: 12px 0;
      color: var(--fg);
    }
    .bubble .content code {
      background: var(--code-bg);
      padding: 2px 6px;
      border-radius: 4px;
      font-size: 0.9em;
      font-family: ui-monospace, Menlo, Consolas, monospace;
      color: var(--brand-deep);
    }
    .bubble .content pre code {
      background: transparent;
      padding: 0;
      color: inherit;
    }
    /* ── 列表 ── */
    .bubble .content ul,
    .bubble .content ol {
      padding-left: 20px;
      margin: 0.5em 0;
    }
    .bubble .content li {
      margin: 0.3em 0;
      line-height: var(--lh-relaxed);
    }
    /* 嵌套列表 */
    .bubble .content ul ul,
    .bubble .content ol ol,
    .bubble .content ul ol,
    .bubble .content ol ul {
      margin: 0.2em 0;
    }
    /* ── 带 emoji/icon 的列表项保持对齐 ── */
    .bubble .content ul.task-list {
      list-style: none;
      padding-left: 4px;
    }
    .bubble .content ul.task-list li {
      display: flex;
      align-items: flex-start;
      gap: 6px;
    }
    .bubble .content ul.task-list li input[type="checkbox"] {
      margin-top: 3px;
    }
    /* ── 链接 ── */
    .bubble .content a {
      color: var(--brand-deep);
      text-decoration: none;
      border-bottom: 1px solid rgba(15,15,19,0.25);
    }
    .bubble .content a:hover { border-bottom-color: var(--brand-deep); }
    /* ── 引用 ── */
    .bubble .content blockquote {
      border-left: 3px solid var(--brand-deep);
      color: var(--fg-dim);
      margin: 12px 0;
      background: var(--accent-soft);
      padding: 10px 14px;
      border-radius: 8px;
    }
    .bubble .content blockquote p { margin: 0.3em 0; }
    /* ── 表格 ── */
    .bubble .content table {
      border-collapse: collapse;
      width: 100%;
      margin: 0.6em 0;
      font-size: var(--fs-13);
    }
    .bubble .content th,
    .bubble .content td {
      padding: 8px 12px;
      text-align: left;
      border: 1px solid var(--border);
    }
    .bubble .content th {
      background: var(--bg-soft);
      font-weight: var(--fw-semibold);
    }
    .bubble .content tr:nth-child(even) td {
      background: var(--bg-soft);
    }
    /* ── 内联图片 ── */
    .bubble .content img {
      max-width: 100%;
      border-radius: 8px;
      margin: 8px 0;
    }
    /* ── 标签 / hashtag 样式 ── */
    .bubble .content a.tag-hashtag,
    .bubble .content a[href^="#"] {
      display: inline-block;
      padding: 2px 10px;
      margin: 2px 3px 2px 0;
      background: var(--accent-soft);
      color: var(--brand-deep);
      border-radius: 14px;
      font-size: var(--fs-12);
      font-weight: var(--fw-medium);
      border: 1px solid transparent;
      text-decoration: none;
      transition: background 0.15s, border-color 0.15s;
    }
    .bubble .content a.tag-hashtag:hover {
      background: color-mix(in srgb, var(--brand-deep) 12%, transparent);
      border-color: color-mix(in srgb, var(--brand-deep) 30%, transparent);
    }
    /* ── 粗体/斜体 ── */
    .bubble .content strong { font-weight: var(--fw-semibold); color: var(--fg); }
    .bubble .content em { font-style: italic; }
    .bubble.user .content code {
      background: rgba(255,255,255,0.2);
      color: #fff;
    }
    .bubble.user .content pre {
      background: rgba(0,0,0,0.08);
      border-color: rgba(255,255,255,0.2);
      color: rgba(255,255,255,0.95);
    }
    .bubble.user .content a { color: #fff; border-bottom-color: rgba(255,255,255,0.5); }
    .bubble.user .content blockquote {
      background: rgba(255,255,255,0.12);
      border-left-color: rgba(255,255,255,0.5);
      color: rgba(255,255,255,0.92);
    }

    .cursor-blink::after {
      content: "▍";
      color: var(--brand-deep);
      animation: blink 1s infinite;
      margin-left: 2px;
      font-weight: 400;
    }
    @keyframes blink { 50% { opacity: 0; } }

    /* ── 工具卡片 ────────────────────────── */
    .tool-card {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      margin: 10px 0;
      overflow: hidden;
      font-size: var(--fs-14);
      box-shadow: none;
    }
    .tool-header {
      padding: 10px 14px;
      display: flex;
      align-items: center;
      gap: 10px;
      cursor: pointer;
      user-select: none;
      background: var(--panel-alt);
    }
    .tool-header:hover { background: var(--bg-soft); }
    .tool-icon {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: var(--fs-12);
    }
    .tool-card.running .tool-icon {
      background: var(--accent-soft);
    }
    .tool-card.running .tool-icon::after {
      content: "";
      width: 12px;
      height: 12px;
      border: 2px solid var(--brand-deep);
      border-right-color: transparent;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    .tool-card.done .tool-icon {
      background: var(--mint-soft);
      color: var(--mint-deep);
      font-weight: 700;
    }
    .tool-card.done .tool-icon::before { content: "✓"; font-size: var(--fs-14); }
    @keyframes spin { to { transform: rotate(360deg); } }

    .tool-name {
      font-weight: var(--fw-semibold);
      color: var(--fg);
      font-size: var(--fs-13);
      letter-spacing: var(--ls-tight);
    }
    .tool-summary {
      color: var(--fg-dim);
      font-size: var(--fs-13);
      margin-left: auto;
      font-family: ui-monospace, monospace;
      max-width: 380px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .tool-body {
      padding: 12px 14px;
      border-top: 1px solid var(--divider);
      color: var(--fg-soft);
      font-family: ui-monospace, Menlo, Consolas, monospace;
      font-size: var(--fs-13);
      white-space: pre-wrap;
      max-height: 400px;
      overflow-y: auto;
      background: var(--panel);
    }
    .tool-body .args {
      color: var(--fg);
      margin-bottom: 8px;
    }
    .tool-body .result {
      border-top: 1px dashed var(--divider);
      padding-top: 10px;
      margin-top: 10px;
      color: var(--fg-soft);
    }

    .thinking {
      font-size: var(--fs-13);
      color: var(--fg-dim);
      padding: 8px 12px;
      font-style: italic;
      background: var(--panel);
      border: 1px dashed var(--border);
      border-radius: 10px;
      margin: 6px 0;
    }
    .thinking::before {
      content: "";
      display: inline-block;
      width: 13px; height: 13px;
      margin-right: 6px;
      vertical-align: -2px;
      background-color: currentColor;
      -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8 14a5 5 0 1 1 3-9 5 5 0 0 1 7 5c0 2.5-2 5-5 5h-2'/><circle cx='6' cy='18' r='1.2' fill='black' stroke='none'/><circle cx='3' cy='20.5' r='0.8' fill='black' stroke='none'/></svg>") no-repeat center / contain;
              mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8 14a5 5 0 1 1 3-9 5 5 0 0 1 7 5c0 2.5-2 5-5 5h-2'/><circle cx='6' cy='18' r='1.2' fill='black' stroke='none'/><circle cx='3' cy='20.5' r='0.8' fill='black' stroke='none'/></svg>") no-repeat center / contain;
    }

    /* ── Activity（处理中容器） ─────────────────────
       把一次 turn 里的工具调用 / thinking / 中间文本统一收纳。
       默认折叠，头部显示最新状态（单行省略号）。 */
    .activity {
      margin: 10px 0;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: none;
      overflow: hidden;
      max-width: 50%;
      align-self: flex-start;
    }
    @media (max-width: 960px) {
      .activity { max-width: 100%; }
    }
    .activity-head {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      cursor: pointer;
      user-select: none;
      background: var(--panel-alt);
      transition: background 0.15s;
    }
    .activity-head:hover { background: var(--bg-soft); }
    .act-icon {
      width: 24px;
      height: 24px;
      border-radius: 7px;
      background: var(--accent-soft);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      color: var(--brand-deep);
      font-size: var(--fs-12);
    }
    .activity.running .act-icon::after {
      content: "";
      width: 11px;
      height: 11px;
      border: 2px solid var(--brand-deep);
      border-right-color: transparent;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    .activity.done .act-icon {
      background: var(--mint-soft);
      color: var(--mint-deep);
    }
    .activity.done .act-icon::before { content: "✓"; font-weight: 700; font-size: var(--fs-13); }
    .act-title {
      font-weight: 600;
      font-size: var(--fs-13);
      color: var(--fg);
      flex-shrink: 0;
    }
    .act-steps {
      font-size: var(--fs-12);
      color: var(--fg-muted);
      background: var(--bg-soft);
      padding: 2px 8px;
      border-radius: 999px;
      flex-shrink: 0;
    }
    .act-latest {
      flex: 1;
      min-width: 0;
      color: var(--fg-dim);
      font-size: var(--fs-13);
      font-family: ui-monospace, Menlo, Consolas, monospace;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .act-latest .al-ico { flex: 0 0 auto; display: inline-flex; align-items: center; width: 14px; height: 14px; }
    .act-latest .al-ico > .ico { width: 14px; height: 14px; }
    .act-latest .al-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .act-toggle {
      color: var(--fg-muted);
      font-size: var(--fs-12);
      flex-shrink: 0;
      transition: transform 0.2s;
    }
    .activity:not(.collapsed) .act-toggle { transform: rotate(180deg); }
    /* 展开时不必再重复展示最新行 */
    .activity:not(.collapsed) .act-latest { display: none; }

    .activity-body {
      padding: 6px 12px 10px;
      border-top: 1px solid var(--divider);
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .activity.collapsed .activity-body { display: none; }

    /* ── 右侧文件面板 ───────────────────────── */
    .file-panel {
      width: 460px;
      flex-shrink: 0;
      background: var(--panel);
      border-left: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      transition: width 0.2s ease, margin 0.2s ease;
    }
    body.file-panel-closed .file-panel {
      width: 0;
      border-left: none;
      overflow: hidden;
    }
    /* 非对话视图：顶栏的文件按钮 + 右侧文件面板都隐藏，
       避免在技能库 / IMS / 商品库 等功能页上干扰。 */
    body.non-chat-view #filePanelToggle { display: none !important; }
    body.non-chat-view .file-panel {
      width: 0 !important;
      border-left: none !important;
      overflow: hidden !important;
    }
    .fp-head {
      padding: 14px 16px 10px;
      border-bottom: 1px solid var(--divider);
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .fp-head h3 {
      font-size: var(--fs-14);
      font-weight: var(--fw-semibold);
      letter-spacing: var(--ls-tight);
      color: var(--fg);
      margin: 0;
      flex: 1;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .fp-count {
      font-size: var(--fs-11);
      font-weight: var(--fw-semibold);
      color: var(--fg-dim);
      background: var(--bg-soft);
      padding: 2px 8px;
      border-radius: 999px;
      letter-spacing: var(--ls-normal);
    }
    .fp-close {
      border: none;
      background: transparent;
      color: var(--fg-muted);
      cursor: pointer;
      width: 26px;
      height: 26px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .fp-close:hover { background: var(--bg-soft); color: var(--fg); }

    .fp-tabs {
      display: inline-flex;
      margin: 10px 12px 4px;
      padding: 3px;
      gap: 2px;
      background: var(--bg-soft);
      border: 1px solid var(--border);
      border-radius: 10px;
      align-self: flex-start;
    }
    .fp-tab {
      padding: 5px 14px;
      min-width: 58px;
      font-family: inherit;
      font-size: var(--fs-12);
      font-weight: var(--fw-medium);
      border: none;
      background: transparent;
      color: var(--fg-dim);
      border-radius: 7px;
      cursor: pointer;
      letter-spacing: var(--ls-normal);
      white-space: nowrap;
      transition: color 0.15s, background 0.15s, box-shadow 0.15s;
    }
    .fp-tab:hover { color: var(--fg); }
    .fp-tab.active {
      background: var(--panel);
      color: var(--fg);
      font-weight: var(--fw-semibold);
      box-shadow: var(--shadow-sm);
    }

    .fp-body {
      flex: 1;
      overflow-y: auto;
      padding: 10px 12px 16px;
    }
    .fp-grid {
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    .fp-group {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .fp-group-time {
      font-size: var(--fs-11);
      color: var(--fg-dim);
      font-weight: var(--fw-semibold);
      letter-spacing: var(--ls-uppercase);
      text-transform: uppercase;
      padding: 4px 2px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }
    .fp-group-time::before {
      content: "";
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--brand-deep, #7a6cff);
      opacity: 0.55;
    }
    .fp-group-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
    }
    .fp-empty {
      color: var(--fg-muted);
      font-size: var(--fs-13);
      text-align: center;
      padding: 40px 12px;
      line-height: 1.7;
    }

    .file-card {
      background: var(--panel-alt);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
      position: relative;
    }
    .file-card:hover {
      transform: translateY(-2px);
      border-color: var(--brand-deep);
      box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    }
    .file-card .fc-thumb {
      width: 100%;
      aspect-ratio: 1/1;
      background: var(--bg-soft);
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      position: relative;
    }
    .file-card .fc-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .file-card .fc-icon {
      font-size: var(--fs-28);
      color: var(--fg-muted);
      font-family: ui-monospace, Menlo, Consolas, monospace;
      font-weight: 700;
      letter-spacing: 1px;
      text-transform: uppercase;
      font-size: var(--fs-14);
      padding: 4px 10px;
      background: var(--panel);
      border-radius: 6px;
      color: var(--brand-deep);
    }
    .file-card .fc-meta {
      padding: 6px 8px 8px;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .file-card .fc-name {
      font-size: var(--fs-12);
      color: var(--fg);
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .file-card .fc-sub {
      font-size: var(--fs-11);
      color: var(--fg-muted);
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .file-card .fc-kind {
      position: absolute;
      top: 6px;
      left: 6px;
      font-size: var(--fs-10);
      padding: 2px 6px;
      border-radius: 4px;
      font-weight: 600;
      letter-spacing: 0.3px;
      text-transform: uppercase;
    }
    .file-card .fc-kind.upload {
      background: var(--accent-soft);
      color: var(--fg);
      border: 1px solid var(--border-strong);
    }
    .file-card .fc-kind.ai {
      background: var(--panel);
      color: var(--fg-soft);
      border: 1px solid var(--border-strong);
    }
    [data-theme="dark"] .file-card .fc-kind.ai { background: var(--panel-alt); }
    /* 顶部右上的删除按钮（始终单独一个） */
    .file-card .fc-del {
      position: absolute;
      top: 6px;
      right: 6px;
      z-index: 3;
      width: 24px;
      height: 24px;
      border: none;
      padding: 0;
      border-radius: 6px;
      background: rgba(0,0,0,0.55);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: var(--fs-13);
      cursor: pointer;
      line-height: 1;
      opacity: 0;
      transition: opacity 0.15s, background 0.15s;
    }
    .file-card:hover .fc-del,
    .file-card:focus-within .fc-del { opacity: 1; }
    .file-card .fc-del:hover { background: #d9534f; }

    /* 缩略图区域中央的 3 按钮覆盖层 */
    .file-card .fc-hover-mask {
      position: absolute;
      inset: 0;
      background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.55) 100%);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      opacity: 0;
      transition: opacity 0.15s;
      z-index: 2;
      pointer-events: none;
    }
    .file-card .fc-hover-btn { min-width: 72px; justify-content: center; }
    .file-card:hover .fc-hover-mask,
    .file-card:focus-within .fc-hover-mask {
      opacity: 1;
      pointer-events: auto;
    }
    .file-card .fc-hover-btn {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 6px 10px;
      border: none;
      border-radius: 999px;
      background: rgba(255,255,255,0.94);
      color: #1a1a1a;
      font: inherit;
      font-size: var(--fs-12);
      font-weight: 600;
      cursor: pointer;
      line-height: 1;
      box-shadow: 0 2px 8px rgba(0,0,0,0.28);
      transition: transform 0.1s, background 0.12s;
      white-space: nowrap;
    }
    .file-card .fc-hover-btn:hover {
      background: #fff;
      transform: translateY(-1px);
    }
    .file-card .fc-hover-btn:active { transform: translateY(0); }
    .file-card .fc-hover-btn .fhb-icon {
      font-size: var(--fs-13);
      line-height: 1;
    }
    /* 移动端：把覆盖层"常驻"显示，删除按钮也一样；按钮缩小一号避免挤爆 */
    @media (max-width: 960px) {
      .file-card .fc-hover-mask {
        opacity: 1;
        pointer-events: auto;
        background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.35) 100%);
      }
      .file-card .fc-del { opacity: 1; }
      .file-card .fc-hover-btn { padding: 5px 8px; font-size: var(--fs-11); min-width: 64px; }
    }

    /* ── 图片放大 lightbox ── */
    .lightbox-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.82);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      padding: 32px;
      animation: fade-in 0.15s ease;
    }
    .lightbox-overlay.show { display: flex; z-index: 9999; }
    .lightbox-box {
      position: relative;
      max-width: 95vw;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
    }
    .lightbox-box img {
      max-width: 95vw;
      max-height: 80vh;
      border-radius: 10px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.6);
      object-fit: contain;
      background: #1a1a1a;
    }
    .lightbox-meta {
      display: flex;
      align-items: center;
      gap: 10px;
      color: #eee;
      font-size: var(--fs-13);
      background: rgba(0,0,0,0.4);
      padding: 8px 14px;
      border-radius: 999px;
      max-width: 95vw;
    }
    .lightbox-meta .lb-name {
      max-width: 50vw;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-weight: 600;
    }
    .lightbox-meta .lb-sep {
      width: 1px;
      height: 14px;
      background: rgba(255,255,255,0.25);
    }
    .lightbox-meta .lb-dl {
      color: #fff;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 10px;
      border-radius: 999px;
      background: rgba(255,255,255,0.16);
      font-size: var(--fs-13);
      transition: background 0.12s;
    }
    .lightbox-meta .lb-dl:hover { background: rgba(255,255,255,0.28); }
    .lightbox-close {
      position: absolute;
      top: -44px;
      right: -4px;
      width: 36px;
      height: 36px;
      border: none;
      border-radius: 50%;
      background: rgba(255,255,255,0.14);
      color: #fff;
      font-size: var(--fs-20);
      line-height: 1;
      cursor: pointer;
      transition: background 0.12s, transform 0.1s;
    }
    .lightbox-close:hover { background: rgba(255,255,255,0.28); transform: scale(1.05); }
    @media (max-width: 960px) {
      .lightbox-overlay { padding: 12px; }
      .lightbox-box img { max-height: 72vh; }
      .lightbox-close {
        top: 8px; right: 8px;
        background: rgba(0,0,0,0.5);
      }
      .lightbox-meta .lb-name { max-width: 60vw; }
    }
    .file-card .fc-play {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: rgba(0,0,0,0.55);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: var(--fs-14);
      padding-left: 3px;
      pointer-events: none;
      backdrop-filter: blur(2px);
    }

    /* file-panel 的切换按钮放顶栏 */
    .topbar .icon-tool-btn {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--panel);
      color: var(--fg-soft);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-left: 6px;
    }
    .topbar .icon-tool-btn:hover { color: var(--brand-deep); border-color: var(--brand-deep); }
    .topbar .icon-tool-btn.active {
      background: var(--accent-soft);
      color: var(--brand-deep);
      border-color: var(--brand-deep);
    }

    /* @ 提示弹层 */
    .mention-popup {
      position: absolute;
      z-index: 60;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: var(--shadow-md);
      max-height: 280px;
      width: 320px;
      overflow-y: auto;
      display: none;
    }
    .mention-popup.show { display: block; }
    .mention-item {
      display: flex;
      gap: 10px;
      padding: 8px 10px;
      align-items: center;
      cursor: pointer;
      border-radius: 8px;
    }
    .mention-item:hover,
    .mention-item.active { background: var(--bg-soft); }
    .mention-thumb {
      width: 36px;
      height: 36px;
      border-radius: 6px;
      background: var(--bg-soft);
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .mention-thumb img { width: 100%; height: 100%; object-fit: cover; }
    .mention-thumb .mt-icon {
      font-size: var(--fs-10);
      font-weight: 700;
      color: var(--brand-deep);
      letter-spacing: 0.5px;
    }
    .mention-meta { min-width: 0; flex: 1; }
    .mention-name {
      font-size: var(--fs-13);
      color: var(--fg);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .mention-sub {
      font-size: var(--fs-11);
      color: var(--fg-muted);
    }
    .mention-empty {
      padding: 18px 14px;
      text-align: center;
      color: var(--fg-muted);
      font-size: var(--fs-13);
    }

    /* chip 上增加"引用"样式 */
    .chip.reused {
      border-style: dashed;
    }

    /* 移动端：文件面板变成 drawer */
    @media (max-width: 960px) {
      .file-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(360px, 88vw);
        z-index: 45;
        transform: translateX(100%);
        transition: transform 0.22s ease;
      }
      body:not(.file-panel-closed) .file-panel {
        transform: translateX(0);
        box-shadow: -14px 0 40px rgba(0,0,0,0.28);
      }
      .fp-group-grid {
        grid-template-columns: repeat(2, 1fr);
      }
    }

    /* 嵌套进 activity 时，压缩外边距让它们更紧凑 */
    .activity-body .tool-card,
    .activity-body .thinking,
    .activity-body .bubble.assistant {
      margin: 6px 0;
      box-shadow: none;
    }
    .activity-body .bubble.assistant {
      padding: 8px 14px;
      font-size: var(--fs-14);
      background: var(--panel-alt);
    }
    .activity-body .bubble.assistant .role { display: none; }

    /* ── 输入区（Manus 风格见文件末尾补充规则） ────────────────────────── */
    .composer-wrap {
      padding: 0 24px 24px;
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    .composer {
      max-width: 720px;
      width: 100%;
      margin: 0 auto;
      position: relative;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 12px 16px;
      display: flex;
      flex-direction: column;
      transition: border-color 0.15s;
      box-shadow: none;
    }
    .composer:focus-within {
      border-color: var(--border-strong);
    }
    .composer textarea {
      width: 100%;
      background: transparent;
      color: var(--fg);
      border: none;
      padding: 0;
      font-family: inherit;
      font-size: var(--fs-14);
      font-weight: var(--fw-regular);
      letter-spacing: var(--ls-normal);
      resize: none;
      max-height: 200px;
      min-height: 24px;
      outline: none;
      line-height: 1.5;
    }
    .composer textarea::placeholder { color: var(--fg-muted); }

    .composer.dragging {
      border-color: var(--brand-deep);
      background: var(--accent-soft);
    }
    .composer.dragging::after {
      content: "拖拽到此处上传";
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      color: var(--brand-deep);
      background: color-mix(in srgb, var(--panel) 85%, transparent);
      border-radius: var(--radius-lg);
      pointer-events: none;
      font-size: var(--fs-15);
      letter-spacing: 0.3px;
    }

    .attachments {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 8px;
      padding: 0;
    }
    .attachments:empty { display: none; }

    .chip {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px 6px 8px;
      background: var(--bg-soft);
      border: 1px solid var(--border);
      border-radius: 10px;
      font-size: var(--fs-13);
      color: var(--fg-soft);
      max-width: 300px;
    }
    .chip .chip-icon {
      width: 26px;
      height: 26px;
      border-radius: 7px;
      background: var(--accent-soft);
      color: var(--brand-deep);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: var(--fs-13);
    }
    .chip.img .chip-icon { background: var(--bg-soft); color: var(--fg-dim); overflow: hidden; padding: 0; }
    .chip.img .chip-icon img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      border-radius: inherit;
    }
    .chip.pending { opacity: 0.7; }
    .chip.pending .chip-icon {
      background: transparent;
      border: 2px solid var(--brand-deep);
      border-right-color: transparent;
      animation: spin 0.8s linear infinite;
    }
    .chip.pending .chip-icon::before { content: ""; }
    .chip.err {
      border-color: var(--err);
      color: var(--err);
      background: color-mix(in srgb, var(--err) 10%, transparent);
    }
    .chip.err .chip-icon { background: transparent; color: var(--err); }
    .chip .chip-meta {
      display: flex;
      flex-direction: column;
      min-width: 0;
      line-height: 1.25;
    }
    .chip .chip-name {
      font-weight: 500;
      color: var(--fg);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      max-width: 200px;
    }
    .chip .chip-sub {
      font-size: var(--fs-11);
      color: var(--muted);
      font-family: ui-monospace, monospace;
    }
    .chip .chip-del {
      cursor: pointer;
      color: var(--muted);
      font-size: var(--fs-16);
      padding: 0 2px;
      line-height: 1;
      user-select: none;
    }
    .chip .chip-del:hover { color: var(--err); }

    .composer-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px solid var(--divider);
    }

    .icon-btn {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      border: none;
      background: transparent;
      color: var(--fg-muted);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.15s, color 0.15s;
    }
    .icon-btn:hover { background: var(--panel-alt); color: var(--fg-soft); }
    .icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
    .icon-btn svg {
      width: 16px;
      height: 16px;
      stroke: currentColor;
      fill: none;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .send-btn {
      width: 36px;
      height: 36px;
      border-radius: 8px;
      background: var(--fg);
      color: var(--bg);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: opacity 0.15s;
      font-size: var(--fs-16);
      box-shadow: none;
    }
    .send-btn:hover:not(:disabled) { opacity: 0.85; }
    .send-btn:active:not(:disabled) { opacity: 0.75; }
    .send-btn:disabled {
      opacity: 0.35;
      cursor: not-allowed;
      background: var(--muted);
    }

    /* 任务进行时：发送按钮切成"停止"按钮，视觉上用红色实心方块，明确表达
       点它会中止任务。禁用态（stopping）降低饱和度避免二次点击。 */
    .send-btn.stop-mode {
      background: var(--err, #d14343);
      color: #fff;
      box-shadow: 0 3px 10px rgba(209, 67, 67, 0.28);
    }
    .send-btn.stop-mode:hover:not(:disabled) {
      background: var(--err, #d14343);
      filter: brightness(1.08);
    }
    .send-btn.stop-mode:disabled {
      opacity: 0.55;
      background: var(--err, #d14343);
      color: #fff;
    }
    .send-btn .send-icon,
    .send-btn .stop-icon { display: none; }
    .send-btn:not(.stop-mode) .send-icon { display: inline; }
    .send-btn.stop-mode .stop-icon { display: inline-flex; }
    .send-btn .send-icon {
      font-size: 18px;
      font-weight: 700;
      transform: rotate(0deg);
    }
    .send-btn .stop-icon {
      width: 12px;
      height: 12px;
      background: currentColor;
      border-radius: 2px;
      align-items: center;
      justify-content: center;
    }

    .composer-hint {
      font-size: var(--fs-11);
      color: var(--fg-muted);
      text-align: center;
      margin-top: 8px;
    }

    /* 用户气泡里的附件 */
    .msg-attachments {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 10px;
    }
    .msg-attachments .chip {
      background: rgba(255, 255, 255, 0.15);
      border-color: rgba(255, 255, 255, 0.25);
      color: rgba(255, 255, 255, 0.95);
    }
    .msg-attachments .chip .chip-name { color: #fff; }
    .msg-attachments .chip .chip-sub { color: rgba(255,255,255,0.7); }
    .msg-attachments .chip .chip-icon {
      background: rgba(255,255,255,0.22);
      color: #fff;
    }

    ::-webkit-scrollbar { width: 8px; height: 8px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb {
      background: rgba(15, 15, 19, 0.14);
      border-radius: 4px;
      border: 2px solid transparent;
      background-clip: padding-box;
      transition: background 0.2s ease;
    }
    ::-webkit-scrollbar-thumb:hover { background: rgba(15, 15, 19, 0.28); background-clip: padding-box; }
    ::-webkit-scrollbar-corner { background: transparent; }
    * { scrollbar-width: thin; scrollbar-color: rgba(15,15,19,0.16) transparent; }
    [data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.10); background-clip: padding-box; }
    [data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); background-clip: padding-box; }
    [data-theme="dark"] * { scrollbar-color: rgba(255,255,255,0.12) transparent; }

    /* ── Manus-style：空状态、composer 扩展与侧栏 ───────────────────────── */
    /* Manus-style empty state - centered hero */
    .empty-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      flex: 1;
      padding: 60px 24px;
      text-align: center;
    }

    .hero-card {
      max-width: 680px;
      background: transparent;
      border: none;
      box-shadow: none;
      padding: 0;
      text-align: center;
    }

    .hero-card .eyebrow {
      font-size: var(--fs-11);
      color: var(--fg-muted);
      letter-spacing: 2px;
      text-transform: uppercase;
      margin-bottom: 16px;
      font-weight: 500;
    }

    .hero-card h2 {
      font-size: 36px;
      font-weight: 400;
      color: var(--fg);
      line-height: 1.3;
      margin-bottom: 12px;
      letter-spacing: -0.5px;
    }

    .hero-card p {
      font-size: var(--fs-14);
      color: var(--fg-dim);
      max-width: 480px;
      margin: 0 auto 32px;
      line-height: 1.6;
    }

    /* Suggested prompt cards */
    .examples {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      justify-content: center;
      max-width: 680px;
      margin: 0 auto;
    }

    .example {
      flex: 1;
      min-width: 200px;
      max-width: 220px;
      padding: 14px 16px;
      background: var(--panel-alt);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--fg-soft);
      font-size: var(--fs-12);
      line-height: 1.5;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
      text-align: left;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .example:hover {
      background: #333;
      border-color: var(--border-strong);
    }

    .example .ex-icon {
      font-size: 16px;
      color: var(--fg-muted);
    }

    .example .ex-text {
      color: var(--fg-dim);
      font-size: var(--fs-12);
    }

    /* Composer wrap - centered input card */
    .composer-wrap {
      padding: 0 24px 24px;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .composer {
      max-width: 720px;
      width: 100%;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 12px 16px;
      display: flex;
      flex-direction: column;
      transition: border-color 0.15s;
    }

    .composer:focus-within {
      border-color: var(--border-strong);
    }

    .composer textarea {
      width: 100%;
      border: none;
      background: transparent;
      color: var(--fg);
      font-size: var(--fs-14);
      line-height: 1.5;
      resize: none;
      outline: none;
      min-height: 24px;
      max-height: 200px;
      padding: 0;
      font-family: inherit;
    }

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

    .composer-actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px solid var(--divider);
    }

    .composer-actions-left {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .composer-actions-right {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .icon-btn {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      background: transparent;
      border: none;
      color: var(--fg-muted);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.15s, color 0.15s;
    }

    .icon-btn:hover {
      background: var(--panel-alt);
      color: var(--fg-soft);
    }

    .icon-btn svg {
      width: 16px;
      height: 16px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .send-btn {
      width: 36px;
      height: 36px;
      border-radius: 8px;
      background: var(--fg);
      color: var(--bg);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: opacity 0.15s;
    }

    .send-btn:hover {
      opacity: 0.85;
    }

    .send-btn .send-icon {
      font-size: 18px;
      font-weight: 700;
      transform: rotate(0deg);
    }

    .composer-hint {
      font-size: var(--fs-11);
      color: var(--fg-muted);
      text-align: center;
      margin-top: 8px;
    }

    .attachments {
      margin-bottom: 8px;
    }

    /* Quick action pills - centered below composer */
    .quick-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: center;
      margin-top: 16px;
    }

    .quick-action {
      padding: 6px 14px;
      background: transparent;
      border: 1px solid var(--border);
      border-radius: var(--radius-pill);
      color: var(--fg-dim);
      font-size: var(--fs-12);
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .quick-action:hover {
      background: var(--panel-alt);
      border-color: var(--border-strong);
      color: var(--fg-soft);
    }

    .quick-action .qa-icon {
      width: 14px;
      height: 14px;
      opacity: 0.7;
    }

    /* Download promo card */
    .download-card {
      max-width: 640px;
      width: 100%;
      margin: 40px auto 0;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }

    .download-card-text {
      flex: 1;
    }

    .download-card-title {
      font-size: var(--fs-13);
      color: var(--fg);
      font-weight: 500;
      margin-bottom: 4px;
    }

    .download-card-sub {
      font-size: var(--fs-11);
      color: var(--fg-muted);
      line-height: 1.4;
    }

    .download-card-preview {
      width: 80px;
      height: 50px;
      background: var(--panel-alt);
      border-radius: 6px;
      border: 1px solid var(--border);
      flex-shrink: 0;
    }

    /* Plan tag */
    .plan-tag {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: var(--panel-alt);
      border: 1px solid var(--border);
      border-radius: var(--radius-pill);
      padding: 4px 12px 4px 4px;
      font-size: var(--fs-11);
      margin-bottom: 20px;
    }

    .plan-tag-free {
      background: var(--panel);
      color: var(--fg-soft);
      padding: 2px 10px;
      border-radius: var(--radius-pill);
      font-weight: 500;
    }

    .plan-tag-trial {
      color: var(--blue-accent);
      cursor: pointer;
    }

    .plan-tag-trial:hover {
      text-decoration: underline;
    }

    /* Right side topbar actions */
    .topbar-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-left: auto;
    }

    .topbar-action-btn {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      background: transparent;
      border: none;
      color: var(--fg-muted);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.15s, color 0.15s;
    }

    .topbar-action-btn:hover {
      background: var(--panel-alt);
      color: var(--fg-soft);
    }

    .topbar-action-btn svg {
      width: 18px;
      height: 18px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .credit-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: var(--panel-alt);
      border: 1px solid var(--border);
      border-radius: var(--radius-pill);
      padding: 4px 10px;
      font-size: var(--fs-11);
      color: var(--fg-soft);
    }

    .credit-badge svg {
      width: 14px;
      height: 14px;
    }

    /* Sidebar invite card */
    .invite-card {
      margin: 8px 12px;
      padding: 12px;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius);
    }

    .invite-card-title {
      font-size: var(--fs-11);
      color: var(--fg-soft);
      font-weight: 500;
      margin-bottom: 2px;
    }

    .invite-card-sub {
      font-size: var(--fs-10);
      color: var(--fg-muted);
      line-height: 1.4;
      margin-bottom: 8px;
    }

    .invite-card-arrow {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      color: var(--fg-muted);
    }

    /* Sidebar empty state */
    .sidebar-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 24px 16px;
      color: var(--fg-muted);
      font-size: var(--fs-11);
      text-align: center;
      gap: 8px;
    }

    .sidebar-empty-icon {
      width: 40px;
      height: 40px;
      border: 1px dashed var(--border);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0.5;
    }

    /* File panel update */
    .file-panel {
      background: var(--panel);
      border-left: 1px solid var(--border);
    }

    /* Activity / Tool cards - reduce shadow */
    .activity, .tool-card {
      box-shadow: none;
      border: 1px solid var(--border);
    }
