    .sidebar-search-inline { display: none; align-items: center; gap: 6px; padding: 28px 8px 8px; overflow: hidden; min-width: 0; }
    .sidebar-search-mode .sidebar-search-inline { display: flex; }
    .sidebar-search-back { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text-primary); cursor: pointer; border-radius: 6px; flex-shrink: 0; transition: background 0.15s; }
    .sidebar-search-back:hover { background: rgba(255,255,255,0.08); }
    .sidebar-search-input-wrap { flex: 1; display: flex; align-items: center; background: rgba(255,255,255,0.06); border-radius: 18px; padding: 0 10px; height: 32px; min-width: 0; }
    .sidebar-search-input-wrap svg { flex-shrink: 0; opacity: 0.5; margin-right: 6px; width: 14px; height: 14px; }
    .sidebar-search-input { flex: 1; background: none; border: none; outline: none; color: var(--text-primary); font-size: 0.82rem; min-width: 0; }
    .sidebar-search-input::placeholder { color: var(--text-secondary); }
    .sidebar-search-mode .sidebar-section { display: none; }
    .sidebar-search-results { display: none; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 8px; }
    .sidebar-search-mode .sidebar-search-results { display: block; }
    .search-hint { padding: 12px 10px 6px; font-size: 0.75rem; color: var(--text-secondary); opacity: 0.7; }
    /* 第一层：对话列表项 */
    .search-conv-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; cursor: pointer; transition: background 0.15s; }
    .search-conv-item:hover { background: rgba(255,255,255,0.06); }
    .search-conv-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; overflow: hidden; }
    .search-conv-avatar img { width: 100%; height: 100%; object-fit: cover; }
    .search-conv-info { flex: 1; min-width: 0; }
    .search-conv-name { font-size: 0.88rem; color: var(--text-primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .search-conv-name mark { background: rgba(162,155,254,0.3); color: var(--accent-color); border-radius: 2px; padding: 0 1px; }
    .search-conv-count { font-size: 0.72rem; color: var(--accent-color); opacity: 0.8; flex-shrink: 0; white-space: nowrap; }
    .search-conv-hint { font-size: 0.7rem; color: var(--text-secondary); opacity: 0.5; flex-shrink: 0; }
    /* 第二层：详情头部 */
    .search-detail-header { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 4px; }
    .search-detail-back { display: flex; align-items: center; gap: 2px; color: var(--accent-color); font-size: 0.8rem; cursor: pointer; flex-shrink: 0; padding: 4px 6px; border-radius: 6px; transition: background 0.15s; }
    .search-detail-back:hover { background: rgba(255,255,255,0.06); }
    .search-detail-title { flex: 1; font-size: 0.88rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .search-detail-count { font-size: 0.72rem; color: var(--text-secondary); flex-shrink: 0; }
    /* 第二层：消息列表 */
    .search-msg-list { display: flex; flex-direction: column; gap: 2px; }
    .search-msg-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 10px 8px; border-radius: 8px; cursor: pointer; transition: background 0.15s; }
    .search-msg-item:hover { background: rgba(255,255,255,0.06); }
    .search-msg-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
    .search-msg-sender { font-size: 0.72rem; font-weight: 500; }
    .search-msg-text { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }
    .search-msg-text mark { background: rgba(162,155,254,0.3); color: var(--text-primary); border-radius: 2px; padding: 0 2px; }
    .search-msg-time { font-size: 0.68rem; color: var(--text-secondary); opacity: 0.4; flex-shrink: 0; margin-top: 2px; }
    /* 消息跳转高亮 */
    .message-bubble.search-highlight { box-shadow: 0 0 0 2px var(--accent-color), 0 0 20px rgba(162,155,254,0.3); transition: box-shadow 0.3s; }

    @media (max-width: 768px) {
      body { overflow: hidden; position: fixed; inset: 0; }
      .app-wrapper { flex-direction: column; gap: 0; position: fixed; inset: 0; overflow: hidden; }

      /* 移动端：侧边栏 = 主界面，全屏聊天列表 */
      .sidebar { position: fixed; inset: 0; width: 100%; border-radius: 0; z-index: 10; transform: translateX(0); transition: transform 0.3s ease; }
      .sidebar.collapsed { transform: translateX(0); width: 100%; opacity: 1; visibility: visible; }
      .collapse-sidebar-btn, .expand-sidebar-btn, .mobile-back-btn { display: none !important; }

      /* 移动端：聊天区 = 从右侧滑入的子页面 */
      .chat-main { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; border: none; z-index: 20; transform: translateX(100%); transition: transform 0.3s ease; }
      .chat-main.mobile-open { transform: translateX(0); }

      /* 移动端返回按钮 */
      .mobile-back-btn { display: flex !important; align-items: center; gap: 4px; background: none; border: none; color: var(--text-primary); font-size: 0.9rem; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
      .mobile-back-btn:active { background: rgba(255,255,255,0.1); }

      /* 移动端设置面板：全屏覆盖 */
      .settings-panel { left: 0; width: 100%; max-width: 100%; }

      .input-wrapper-outer { padding: 6px 1rem calc(4px + var(--safe-bottom)); margin-bottom: 8px; }
      .image-preview-bar { margin: 0 0.5rem; padding: 6px 10px; gap: 6px; }
      .image-preview-item { width: 48px; height: 48px; }
      .attach-btn { font-size: 1.3rem; padding: 6px; min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; }
      .message-image { max-width: 220px; max-height: 220px; border-radius: 10px; }
      .messages-area { padding: 1rem 1rem 10px; }
      .tts-indicator-wrapper { bottom: 95px; }
      .action-icon { width: 40px; height: 40px; font-size: 1.3rem; opacity: 1; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); }
      .agent-tabs { padding: 0.8rem 1rem 0.3rem; gap: 0.5rem; }
      .agent-tab { padding: 0.5rem 0.3rem; font-size: 0.78rem; }
      .chat-header { padding: 0.8rem 1rem 0; justify-content: center; }
      .chat-header-title { font-size: 1rem; }
      .chat-header-status { gap: 4px; }
      .header-badge { font-size: 0.6rem; padding: 1px 6px; }
      .chat-header-info { align-items: center; }

      .message { max-width: 92%; gap: 10px; }
      .message-bubble { padding: 0.8rem 1.2rem; font-size: 0.9rem; }
      .message-avatar { width: 36px; height: 36px; min-width: 36px; font-size: 1rem; }

      .settings-content { padding: 0.8rem; }
      .setting-group { padding: 0; }
      .param-row { margin-bottom: 12px; }
      .param-row label { font-size: 0.8rem; margin-bottom: 4px; }
      .param-row input, .param-row select, .param-row textarea { font-size: 16px; padding: 12px; }
      .switch-container { padding: 12px; }
      .ui-sub-card { padding: 12px; margin-bottom: 12px; }
      button.standard-btn, button.primary { padding: 14px 20px; font-size: 1rem; min-height: 48px; }

      textarea.message-input { min-height: 24px; max-height: 120px; overflow-y: auto; word-wrap: break-word; overflow-wrap: break-word; -webkit-overflow-scrolling: touch; }
      #fetchModelsBtn { padding: 10px 14px; font-size: 0.8rem; }
      .param-row > div[style*="flex"] { gap: 6px; }
      select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
      input[type="text"], input[type="password"], input[type="number"] { width: 100%; }
      .settings-header { padding: 1rem; }
      .settings-nav-wrapper { padding: 0.8rem; }
      .set-nav-btn { min-width: 70px; font-size: 0.75rem; padding: 10px 6px; }

      /* 引擎卡片移动端竖排 */
      .engine-mode-cards { flex-direction: column; gap: 8px; }
      .engine-card { flex-direction: row; gap: 10px; padding: 10px 12px; text-align: left; }
      .engine-card-icon { font-size: 1.2rem; margin-bottom: 0; }

      /* AOP 面板移动端适配 */
      .trace-filter-bar { flex-direction: column; gap: 6px; }
      .trace-filter-select, .trace-filter-input { width: 100%; }
      .trace-item { flex-wrap: wrap; }
      .trace-args { display: none; }
      .trace-fn { min-width: 100%; }
      .trace-list { font-size: 0.65rem; }

      /* 主题/颜色网格移动端 */
      .theme-grid { gap: 4px; }
      .theme-btn { flex: 1 1 calc(33.3% - 4px); }
      .color-grid { gap: 6px; }
      .color-picker-item { width: 28%; }
    }

    @media (max-width: 420px) {
      .agent-tab { font-size: 0.7rem; padding: 0.4rem 0.2rem; }
      .input-area { padding: 8px 10px; gap: 6px; }
      .image-preview-bar { margin: 0 0.3rem; padding: 5px 8px; }
      .image-preview-item { width: 44px; height: 44px; }
      .message-image { max-width: 180px; max-height: 180px; }
      .send-btn, .mic-btn, .call-btn { width: 36px; height: 36px; min-width: 36px; }
      textarea.message-input { font-size: 0.9rem; max-height: 100px; }
      .settings-panel { width: 92%; }
      .set-nav-btn { font-size: 0.7rem; padding: 8px 4px; min-width: 60px; }
    }

    /* 新增：超小屏幕（如 iPhone SE）的特殊处理 */
    @media (max-width: 320px) {
      .chat-header { padding: 0.6rem 0.8rem 0; }
      .chat-header-title { font-size: 0.9rem; }
      .agent-tabs { padding: 0.6rem 0.8rem 0.3rem; gap: 0.3rem; }
      .agent-tab { padding: 0.4rem 0.2rem; font-size: 0.65rem; }
      .input-wrapper-outer { padding: 8px 0.8rem calc(10px + var(--safe-bottom)); }
      textarea.message-input { font-size: 0.85rem; }
    }

    @media (min-width: 769px) and (max-height: 600px) {
      .messages-area { padding: 0.6rem 1.5rem 100px; gap: 0.8rem; }
      .chat-header { padding: 0.6rem 1.5rem 0; }
    }

    /* 新增：平板优化（iPad 等） */
    @media (min-width: 769px) and (max-width: 1024px) {
      .app-wrapper { max-width: 100%; margin: 0; }
      .settings-panel { width: var(--sidebar-width); }
      .messages-area { padding: 1rem 1.5rem 20px; }
    }

    /* 新增：横屏模式优化 */
    @media (orientation: landscape) and (max-height: 500px) {
      .chat-header { padding: 0.5rem 1rem 0; }
      .chat-header-title { font-size: 0.9rem; }
      .agent-tabs { padding: 0.4rem 1rem 0.2rem; gap: 0.3rem; }
      .agent-tab { padding: 0.3rem 0.2rem; font-size: 0.7rem; }
      .messages-area { padding: 0.5rem 1rem 10px; gap: 0.6rem; }
      .input-wrapper-outer { padding: 6px 1rem calc(8px + var(--safe-bottom)); }
    }
  
