        /* --- 弹窗 Modal --- */
        .modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: var(--modal-overlay);
            backdrop-filter: blur(2px);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 100;
        }
        .modal {
            background: var(--bg-surface);
            padding: 24px;
            border-radius: 16px;
            width: 90vw; max-width: 620px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            display: flex;
            flex-direction: column;
            gap: 16px;
            max-height: 90vh;
        }
        .modal h2 { font-size: 18px; margin-bottom: 8px; }
        .modal label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
        .modal input { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 14px; outline: none; background: var(--bg-surface); color: var(--text-main); }
        .modal input:focus { border-color: var(--black-btn); }
        .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
        .modal-btn { padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; }
        .btn-cancel { background: var(--bg-gray); color: var(--text-main); }
        .btn-save { background: var(--black-btn); color: var(--text-on-dark); }

        svg:not(.mermaid *) { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
        .sidebar-brand svg, .sidebar-brand svg *,
        .sidebar-collapse-btn svg, .sidebar-collapse-btn svg * {
            fill: none !important;
            stroke: currentColor !important;
            stroke-width: 2 !important;
            stroke-linecap: round !important;
            stroke-linejoin: round !important;
        }
        .message-content svg:not(.mermaid *):not(.mermaid), .message-content svg:not(.mermaid *):not(.mermaid) * { fill: initial !important; stroke: initial !important; stroke-width: initial !important; stroke-linecap: initial !important; stroke-linejoin: initial !important; }
        .message-content svg { max-width: 100%; height: auto; }

        .settings-route-tabs { display: inline-flex; align-self: flex-start; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; background: var(--bg-surface); }
        .settings-route-tab { border: none; border-right: 1px solid var(--border-color); background: transparent; color: var(--text-muted); padding: 7px 14px; font-size: 13px; cursor: pointer; transition: background 0.15s, color 0.15s; }
        .settings-route-tab:last-child { border-right: none; }
        .settings-route-tab:hover { background: var(--bg-hover); color: var(--text-main); }
        .settings-route-tab.active { background: var(--text-main); color: var(--text-on-dark); }
        .settings-panels { display: flex; gap: 0; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; min-height: 320px; margin-bottom: 12px; }
        .settings-search-panel { display: none; flex-direction: column; gap: 10px; border: 1px solid var(--border-color); border-radius: 10px; min-height: 320px; max-height: 60vh; overflow-y: auto; padding: 16px; margin-bottom: 12px; background: var(--bg-surface); }
        .settings-search-panel label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
        .settings-search-panel input,
        .settings-search-panel select { width: 100%; padding: 7px 10px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 13px; outline: none; background: var(--bg-surface); color: var(--text-main); }
        .settings-search-panel input:focus,
        .settings-search-panel select:focus { border-color: var(--black-btn); }
        .settings-left { width: 180px; flex-shrink: 0; background: var(--bg-sidebar); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; }
        .settings-left-header { padding: 12px 14px; font-size: 12px; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border-color); }
        .settings-left-list { flex: 1; overflow-y: auto; }
        .provider-nav-item { padding: 10px 14px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; transition: background 0.15s; }
        .provider-nav-item:hover { background: var(--bg-hover); }
        .provider-nav-item.selected { background: var(--bg-active-chat); color: var(--text-main); font-weight: 500; }
        .provider-nav-item.active { color: var(--text-main); }
        .provider-nav-item .nav-badge { font-size: 10px; background: var(--bg-gray); padding: 1px 6px; border-radius: 8px; color: var(--text-muted); }
        .settings-left-footer { padding: 8px 10px; border-top: 1px solid var(--border-color); }
        .settings-left-footer button { width: 100%; padding: 7px; border: 1px dashed var(--border-color); background: transparent; color: var(--text-muted); border-radius: 6px; cursor: pointer; font-size: 12px; transition: all 0.2s; }
        .settings-left-footer button:hover { border-color: var(--text-main); color: var(--text-main); }

        #settingsModal {
            align-items: center;
        }
        .settings-modal {
            width: min(920px, 92vw);
            max-width: 920px;
            height: min(680px, 82vh);
            min-height: 560px;
            padding: 0;
            gap: 0;
            display: grid;
            grid-template-columns: 180px minmax(0, 1fr);
            grid-template-rows: auto minmax(0, 1fr) auto;
            overflow: hidden;
        }
        .settings-modal .modal-header-row {
            grid-column: 2;
            grid-row: 1;
            align-items: center;
            min-height: 60px;
            margin: 0;
            padding: 16px 20px;
            border-bottom: 1px solid var(--border-color);
        }
        .settings-modal .settings-route-tabs {
            grid-column: 1;
            grid-row: 1 / 4;
            align-self: stretch;
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding: 52px 8px 12px;
            border: none;
            border-right: 1px solid var(--border-color);
            border-radius: 0;
            background: var(--bg-sidebar);
        }
        .settings-modal .settings-route-tab {
            width: 100%;
            border: none;
            border-radius: 10px;
            padding: 9px 12px;
            text-align: left;
            background: transparent;
        }
        .settings-modal .settings-route-tab.active {
            background: var(--bg-active-chat);
            color: var(--text-main);
        }
        .settings-modal .settings-panels,
        .settings-modal .settings-search-panel,
        .settings-modal .settings-webdav-panel,
        .settings-modal .settings-appearance-panel {
            grid-column: 2;
            grid-row: 2;
            min-height: 0;
            max-height: none;
            height: 100%;
            margin: 0;
            border: none;
            border-radius: 0;
            background: var(--bg-surface);
        }
        .settings-modal .settings-search-panel,
        .settings-modal .settings-webdav-panel,
        .settings-modal .settings-appearance-panel {
            overflow-y: auto;
            padding: 20px;
        }
        .settings-modal .settings-panels {
            overflow: hidden;
        }
        .settings-modal .settings-left {
            width: 190px;
        }
        .settings-modal .settings-right {
            min-height: 0;
            padding: 20px;
        }
        .settings-modal .modal-actions {
            grid-column: 2;
            grid-row: 3;
            margin: 0;
            padding: 14px 20px;
            border-top: 1px solid var(--border-color);
            background: var(--bg-surface);
        }

        .settings-right { flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: var(--bg-surface); }
        .settings-right label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
        .settings-right input:not(.model-input) { width: 100%; padding: 7px 10px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 13px; outline: none; background: var(--bg-surface); color: var(--text-main); }
        .settings-right input:focus { border-color: var(--black-btn); }

        .models-section { display: flex; flex-direction: column; gap: 4px; }
        .models-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
        .model-tag { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; background: var(--bg-gray); border-radius: 16px; font-size: 13px; color: var(--text-main); cursor: default; transition: background 0.15s; border: 1px solid transparent; }
        .model-tag:hover { background: var(--border-color); }
        .model-tag .tag-x { font-size: 14px; cursor: pointer; color: var(--text-muted); opacity: 0; transition: opacity 0.15s, color 0.15s; line-height: 1; padding: 0 2px; margin-left: 2px; }
        .model-tag:hover .tag-x { opacity: 1; }
        .model-tag .tag-x:hover { color: #cc4444; }
        .tag-add-btn { display: inline-flex; align-items: center; padding: 5px 11px; border: 1px dashed var(--border-color); border-radius: 16px; font-size: 13px; color: var(--text-muted); cursor: pointer; background: transparent; transition: all 0.15s; }
        .tag-add-btn:hover { border-color: var(--text-main); color: var(--text-main); }
        .tag-add-input { padding: 5px 11px; border: 1px solid var(--border-color); border-radius: 16px; font-size: 13px; outline: none; width: 150px; background: var(--bg-surface); }
        .tag-add-input:focus { border-color: var(--black-btn); }

        .settings-right-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
        .settings-right-actions .del-btn { font-size: 11px; padding: 4px 10px; border-radius: 6px; border: 1px solid #e8d0d0; background: var(--bg-surface); cursor: pointer; color: #cc4444; transition: all 0.15s; }
        .settings-right-actions .del-btn:hover:not(:disabled) { background: #fee; border-color: #cc4444; }
        .settings-right-actions .del-btn:disabled { opacity: 0.3; cursor: not-allowed; }

        /* --- 自定义下拉选择器（替代原生 select） --- */
        .custom-select { position: relative; width: 100%; }
        .custom-select-trigger {
            display: flex; justify-content: space-between; align-items: center;
            padding: 7px 10px; border: 1px solid var(--border-color); border-radius: 6px;
            font-size: 13px; background: var(--bg-surface); color: var(--text-main);
            cursor: pointer; transition: border-color 0.15s; user-select: none; min-height: 33px;
        }
        .custom-select-trigger:hover { border-color: var(--text-muted); }
        .custom-select.open .custom-select-trigger { border-color: var(--black-btn); }
        .custom-select-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
        .custom-select-arrow { opacity: 0.4; flex-shrink: 0; transition: transform 0.2s; }
        .custom-select.open .custom-select-arrow { transform: rotate(180deg); }
        .custom-select-menu {
            position: fixed; z-index: 1000;
            background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 6px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.12); display: none;
            max-height: 220px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: transparent transparent;
        }
        .custom-select-menu:hover { scrollbar-color: var(--scrollbar-hover) transparent; }
        .custom-select.open .custom-select-menu { display: block; }
        .custom-select-item {
            padding: 8px 10px; font-size: 13px; cursor: pointer; transition: background 0.12s;
            color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .custom-select-item:hover { background: var(--bg-hover); }
        .custom-select-item.active { font-weight: 600; background: var(--bg-hover); }
        .custom-select-item.active::before { content: '✓ '; color: var(--text-muted); font-weight: 400; }

        /* --- 设置面板分区样式 --- */
        .settings-section-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
        .settings-field-group {
            display: flex; flex-direction: column; gap: 8px;
            border: 1px solid var(--border-light); border-radius: 8px;
            padding: 14px; background: var(--bg-gray);
        }
        .settings-field-group > label:first-child { font-weight: 600; font-size: 12px; color: var(--text-main); }
        .settings-toggle-row {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            color: var(--text-main) !important;
            cursor: pointer;
        }
        .settings-toggle-row input[type="checkbox"] {
            width: auto;
            flex: none;
        }
        .settings-inline-actions {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }
        .settings-field-tip {
            color: var(--text-muted);
            font-size: 12px;
            line-height: 1.5;
        }

        .modal-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
        .modal-header-row h2 { margin-bottom: 0; }

        .export-import-btns { display: flex; gap: 8px; }
        .export-import-btns button { font-size: 12px; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--bg-surface); cursor: pointer; color: var(--text-muted); transition: all 0.2s; }
        .export-import-btns button:hover { border-color: var(--text-main); color: var(--text-main); }
        .set-active-from-modal { font-size: 11px; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-muted); cursor: pointer; white-space: nowrap; transition: all 0.15s; }
        .set-active-from-modal:hover { border-color: var(--text-main); color: var(--text-main); }

        .add-provider-btn { align-self: flex-start; background: transparent; border: 1px dashed var(--border-color); color: var(--text-muted); padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all 0.2s; margin-bottom: 4px; }
        .add-provider-btn:hover { border-color: var(--text-main); color: var(--text-main); }

        .model-switcher { position: relative; transform: translateY(4.5px); }
        .model-info { cursor: pointer; padding: 5px 8px; border-radius: 6px; transition: background 0.2s; user-select: none; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
        .model-info:hover { background: rgba(128,128,128,0.1); }
        .model-info::after { content: ' ▾'; font-size: 10px; opacity: 0.5; line-height: 1; }
        .model-dropdown { position: fixed; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 260px; z-index: 99999; display: none; max-height: 340px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: transparent transparent; }
        .model-dropdown:hover { scrollbar-color: var(--scrollbar-hover) transparent; }
        .model-dropdown::-webkit-scrollbar { width: 5px; }
        .model-dropdown::-webkit-scrollbar-track { background: transparent; }
        .model-dropdown::-webkit-scrollbar-thumb { background: transparent; border-radius: 5px; }
        .model-dropdown:hover::-webkit-scrollbar-thumb { background: var(--scrollbar-hover); }
        .model-dropdown.show { display: block; }
        .model-search-wrap { padding: 8px 10px; border-bottom: 1px solid var(--border-light); position: sticky; top: 0; background: var(--bg-surface); z-index: 1; }
        .model-search-input { width: 100%; padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 13px; background: var(--bg-main); color: var(--text-main); outline: none; }
        .model-search-input:focus { border-color: var(--black-btn); }
        .model-dropdown-item { padding: 10px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; gap: 8px; transition: background 0.15s; }
        .model-dropdown-item:last-child { border-bottom: none; }
        .model-dropdown-item:hover { background: var(--bg-hover); }
        .model-dropdown-item.active { color: var(--text-main); font-weight: 600; background: var(--bg-hover); }
        .model-dropdown-item .provider-name { color: var(--text-muted); font-weight: normal; font-size: 11px; }
 
        /* --- 思考等级切换器 --- */
        .thinking-switcher { position: relative; transform: translateY(4.5px); }
        .thinking-info { cursor: pointer; padding: 5px 8px; border-radius: 6px; transition: background 0.2s; user-select: none; font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
        .thinking-info:hover { background: rgba(128,128,128,0.1); color: var(--text-main); }
        .thinking-info::after { content: ' ▾'; font-size: 10px; opacity: 0.5; line-height: 1; }
        .thinking-info svg { flex-shrink: 0; }
        .thinking-dropdown { position: fixed; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 150px; z-index: 99999; display: none; overflow-y: auto; scrollbar-width: none; }
        .thinking-dropdown.show { display: block; }
        .thinking-dropdown::-webkit-scrollbar { display: none; }
        .thinking-dropdown-item { padding: 10px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; gap: 8px; transition: background 0.15s; }
        .thinking-dropdown-item:last-child { border-bottom: none; }
        .thinking-dropdown-item:hover { background: var(--bg-hover); }
        .thinking-dropdown-item.active { color: var(--text-main); font-weight: 600; background: var(--bg-hover); }
        .thinking-dropdown-item .thinking-hint { color: var(--text-muted); font-weight: normal; font-size: 11px; }
        [data-mode="gen"] .thinking-switcher { display: none !important; }
 
        /* --- 网络搜索切换器 --- */
        .web-tools-switcher,
        .search-switcher { position: relative; transform: translateY(4.5px); display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: 10px; background: rgba(128,128,128,0.06); }
        .web-tools-info { cursor: pointer; padding: 5px 8px; border-radius: 6px; transition: background 0.2s; user-select: none; font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
        .web-tools-info:hover { background: rgba(128,128,128,0.1); color: var(--text-main); }
        .web-tools-info.active { color: #2a75e7; font-weight: 500; }
        .web-tools-info svg { flex-shrink: 0; }
        .web-tools-info::after { content: ' ▾'; font-size: 10px; opacity: 0.5; line-height: 1; }
        .web-tools-summary { color: var(--text-muted); font-size: 11px; font-weight: normal; }
        .web-tools-dropdown { position: fixed; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 200px; z-index: 99999; display: none; overflow-y: auto; scrollbar-width: none; }
        .web-tools-dropdown.show { display: block; }
        .web-tools-dropdown::-webkit-scrollbar { display: none; }
        .web-tools-dropdown-item { padding: 10px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; gap: 12px; transition: background 0.15s; }
        .web-tools-dropdown-item:last-child { border-bottom: none; }
        .web-tools-dropdown-item:hover { background: var(--bg-hover); }
        .web-tools-dropdown-item.active { color: var(--text-main); font-weight: 600; background: var(--bg-hover); }
        .web-tools-hint { color: var(--text-muted); font-weight: normal; font-size: 11px; }
        .search-panel-toggle {
            cursor: pointer;
            padding: 5px 8px;
            border-radius: 6px;
            transition: all 0.2s ease;
            color: var(--text-muted);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            background: transparent;
        }
        .search-panel-toggle:hover {
            background: rgba(128,128,128,0.1);
            color: var(--text-main);
        }
        .search-panel-toggle.active {
            color: #2a75e7;
            background: rgba(42, 117, 231, 0.1);
        }
        .search-panel-toggle svg {
            flex-shrink: 0;
            width: 14px;
            height: 14px;
        }
        .context-clear-divider {
            width: 1px;
            height: 18px;
            background: var(--border-color);
            margin: 0 2px;
        }
        .context-clear-btn {
            border: none;
            background: transparent;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 12px;
            padding: 5px 8px;
            border-radius: 6px;
            white-space: nowrap;
            transition: background 0.15s, color 0.15s;
        }
        .context-clear-btn:hover {
            background: rgba(128,128,128,0.1);
            color: var(--text-main);
        }
        [data-mode="gen"] .web-tools-switcher,
        [data-mode="gen"] .search-switcher { display: none !important; }

        /* --- 右侧搜索侧边栏 --- */
        .search-sidebar {
            width: 350px;
            height: 100%;
            background-color: var(--bg-sidebar);
            border-left: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            transition: width 0.3s ease, opacity 0.3s ease;
            overflow: hidden;
            flex-shrink: 0;
            z-index: 10;
        }
        .search-sidebar.hidden {
            width: 0;
            border-left: none;
            opacity: 0;
        }
        .search-sidebar-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            border-bottom: 1px solid var(--border-color);
            white-space: nowrap;
        }
        .search-sidebar-close {
            font-size: 20px;
            font-weight: bold;
            cursor: pointer;
            color: var(--text-muted);
            transition: color 0.15s;
            line-height: 1;
        }
        .search-sidebar-close:hover {
            color: var(--text-main);
        }
        .search-sidebar-content {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        .search-sidebar-empty {
            color: var(--text-muted);
            font-size: 13px;
            text-align: center;
            padding-top: 40px;
        }
        .search-step-card {
            background: var(--bg-surface, rgba(128,128,128,0.05));
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 12px;
            font-size: 13px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .search-step-title {
            font-weight: 600;
            color: var(--text-main);
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .search-step-title svg {
            flex-shrink: 0;
        }
        .search-step-detail {
            color: var(--text-muted);
            font-size: 12px;
            word-break: break-all;
            white-space: pre-wrap;
        }
        .search-step-url-list {
            margin-top: 4px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .search-step-url-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            font-size: 11px;
            background: rgba(128,128,128,0.08);
            padding: 6px 8px;
            border-radius: 4px;
        }
        .search-step-url-link {
            color: #2a75e7;
            text-decoration: none;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            flex: 1;
        }
        .search-step-url-link:hover {
            text-decoration: underline;
        }
        .search-step-url-status {
            color: var(--text-muted);
            font-size: 10px;
            white-space: nowrap;
        }

        .model-info-text { white-space: nowrap; line-height: 18px; }
        .model-logo { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; object-fit: contain; }
        [data-theme="dark"] .model-logo { filter: invert(0.85) hue-rotate(180deg) brightness(1.2); }
        .model-logo-fallback { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; background: var(--bg-gray); display: inline-flex; align-items: center; justify-content: center; font-size: 9px; color: var(--text-muted); }
        .model-dropdown-item .dropdown-left { display: flex; align-items: center; gap: 8px; }
        .msg-model-tag { display: inline-flex; align-items: center; gap: 5px; }

        /* --- 消息锚点导航 --- */
        .message-anchors {
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            z-index: 5;
            padding: 12px 14px;
            border-radius: 12px;
            transition: opacity 0.2s;
            max-height: calc(100vh - 200px);
            overflow-y: auto;
            scrollbar-width: none;
        }
        .message-anchors::-webkit-scrollbar { display: none; }
        .message-anchors.hidden { opacity: 0; pointer-events: none; }
        .message-anchors { pointer-events: auto; }
        .anchor-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--border-color);
            cursor: pointer;
            pointer-events: auto;
            transition: all 0.15s;
            flex-shrink: 0;
        }
        .anchor-dot.assistant {
            width: 7px;
            height: 7px;
            background: var(--text-muted);
        }
        .anchor-dot:hover {
            background: var(--text-main);
            transform: scale(1.5);
        }
        .anchor-dot.active {
            background: var(--text-main);
            transform: scale(1.4);
        }
        .anchor-dot.assistant.active {
            background: var(--text-main);
            transform: scale(1.5);
        }

        /* 锚点悬浮提示 */
        .anchor-tooltip {
            display: none;
            position: fixed;
            min-width: 180px;
            max-width: 320px;
            max-height: 400px;
            overflow-y: auto;
            background: var(--bg-surface);
            color: var(--text-main);
            font-size: 12px;
            line-height: 1.5;
            padding: 8px 0;
            border-radius: 8px;
            pointer-events: auto;
            z-index: 99;
            box-shadow: 0 4px 16px rgba(0,0,0,0.12);
            border: 1px solid var(--border-color);
            scrollbar-width: none;
        }
        .anchor-tooltip::-webkit-scrollbar { display: none; }
        .anchor-tooltip.show {
            display: block;
            transform: translateX(0);
        }
        .anchor-tooltip-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 4px 12px;
            cursor: pointer;
            transition: background 0.1s;
        }
        .anchor-tooltip-item:hover {
            background: #f0f4ff;
        }
        .anchor-tooltip-item .anchor-text {
            color: #3b82f6;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .anchor-tooltip-item .anchor-dash {
            color: var(--text-muted);
            margin-left: 10px;
            flex-shrink: 0;
        }
        .anchor-tooltip-item.current .anchor-text {
            font-weight: 600;
            color: #2563eb;
        }

        /* --- 搜索弹窗 --- */
        #searchInput:focus { border-color: var(--text-main); }
        #searchInput::placeholder { color: var(--text-muted); }
        .search-result-item {
            padding: 12px 14px;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.15s;
            border: 1px solid var(--border-color);
            margin-bottom: 8px;
        }
        .search-result-item:hover {
            border-color: var(--text-muted);
            background: var(--bg-hover);
        }
        .search-result-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
        }
        .search-result-icon {
            width: 20px;
            height: 20px;
            border-radius: 4px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 11px;
            background: var(--bg-gray);
            color: var(--text-muted);
        }
        .search-result-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--text-main);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex: 1;
            min-width: 0;
        }
        .search-result-role {
            font-size: 10px;
            color: var(--text-muted);
            flex-shrink: 0;
            background: var(--bg-gray);
            padding: 1px 7px;
            border-radius: 10px;
            white-space: nowrap;
        }
        .search-result-preview {
            font-size: 12px;
            color: var(--text-muted);
            line-height: 1.55;
            max-height: 37px;
            overflow: hidden;
            white-space: pre-wrap;
            padding-left: 28px;
        }
        .search-result-preview mark {
            background: transparent;
            color: #16a34a;
            font-weight: 600;
        }
        #searchStats {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        #searchStats .stats-count { color: var(--text-muted); }
        #searchStats .stats-close {
            cursor: pointer;
            color: var(--text-muted);
            padding: 3px 10px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            transition: all 0.15s;
            font-size: 11px;
        }
        #searchStats .stats-close:hover { color: var(--text-main); border-color: var(--text-muted); }
