        :root {
            /* 品牌色 */
            --color-primary: #2563eb;
            --color-primary-hover: #1d4ed8;
            --color-primary-light: #eff6ff;
            --color-primary-bg: #e0e7ff;

            /* 文字 */
            --color-text: #1a1a1a;
            --color-text-secondary: #374151;
            --color-text-tertiary: #6b7280;
            --color-text-muted: #9ca3af;

            /* 背景 */
            --color-bg: white;
            --color-bg-hover: #f3f4f6;
            --color-bg-card: #f8f9fa;
            --color-bg-section: #f0f4f8;

            /* 邊框 */
            --color-border: #e5e5e5;
            --color-border-light: #e5e7eb;

            /* 狀態 */
            --color-success: #059669;
            --color-danger: #dc2626;
            --color-danger-bg: #fef2f2;
            --color-warning: #d97706;

            /* 陰影 */
            --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
            --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
            --shadow-lg: 0 20px 40px rgba(0,0,0,0.2);

            /* 圓角 */
            --radius-sm: 4px;
            --radius-md: 6px;
            --radius-lg: 8px;
            --radius-xl: 12px;

            /* z-index */
            --z-sidebar: 90;
            --z-sidebar-expand: 94;
            --z-left-sidebar: 95;
            --z-dropdown: 200;
            --z-modal: 1000;

            /* 字體 */
            --font-size-xs: 11px;
            --font-size-sm: 12px;
            --font-size-base: 13px;
            --font-size-md: 14px;
            --font-size-lg: 16px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', sans-serif;
            background: #f5f5f5;
            color: var(--color-text);
            line-height: 1.6;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 24px;
        }

        /* Header */
        header {
            background: white;
            border-bottom: 1px solid var(--color-border);
            padding: 16px 0;
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 20px;
            font-weight: 700;
            color: var(--color-primary);
        }

        .my-searches {
            color: #666;
            text-decoration: none;
            font-size: 14px;
            padding: 8px 16px;
            border-radius: 6px;
            transition: all 0.2s;
        }

        .my-searches:hover {
            background: #f5f5f5;
            color: var(--color-text);
        }

        .btn-new-thread {
            background: white;
            border: 1px solid var(--color-border);
            color: #666;
            font-size: 14px;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .btn-new-thread:hover {
            border-color: var(--color-primary);
            color: var(--color-primary);
        }

        /* Mode Toggle Buttons */
        .mode-toggle {
            display: flex;
            align-items: center;
            gap: 4px;
            background: white;
            padding: 4px;
            border-radius: 8px;
            border: 1px solid var(--color-border);
        }

        .mode-button {
            padding: 6px 14px;
            font-size: 13px;
            font-weight: 500;
            color: #666;
            background: transparent;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .mode-button:hover {
            background: #f5f5f5;
            color: var(--color-text);
        }

        .mode-button.active {
            background: var(--color-primary);
            color: white;
        }

        .mode-info-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #4a90e2;
            color: white;
            font-size: 11px;
            font-weight: bold;
            cursor: help;
            margin-left: 4px;
            position: relative;
        }

        .mode-info-icon:hover::after {
            content: attr(data-tooltip);
            position: absolute;
            bottom: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%);
            background: #333;
            color: white;
            padding: 8px 12px;
            border-radius: 6px;
            font-size: 12px;
            font-weight: normal;
            white-space: nowrap;
            z-index: 1000;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        }

        .mode-info-icon:hover::before {
            content: '';
            position: absolute;
            bottom: calc(100% + 2px);
            left: 50%;
            transform: translateX(-50%);
            border: 6px solid transparent;
            border-top-color: #333;
            z-index: 1000;
        }

        /* Research Mode Selector */
        .research-mode-selector {
            margin-top: 12px;
            padding: 12px;
            background: var(--color-bg-card);
            border-radius: 8px;
            border: 1px solid var(--color-border-light);
        }

        .research-mode-label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            color: var(--color-text-secondary);
            margin-bottom: 8px;
        }

        .research-mode-options {
            display: flex;
            gap: 8px;
        }

        .research-mode-option {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 12px;
            background: white;
            border: 2px solid var(--color-border-light);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .research-mode-option:hover {
            border-color: var(--color-primary);
            background: #f0f7ff;
        }

        .research-mode-option.active {
            border-color: var(--color-primary);
            background: var(--color-primary-light);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
        }

        .research-mode-icon {
            font-size: 20px;
            flex-shrink: 0;
        }

        .research-mode-content {
            flex: 1;
            text-align: left;
        }

        .research-mode-name {
            font-size: 13px;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 2px;
        }

        .research-mode-desc {
            font-size: 11px;
            color: var(--color-text-tertiary);
            line-height: 1.3;
        }

        .research-mode-option.active .research-mode-name {
            color: var(--color-primary);
        }

        .research-mode-option.active .research-mode-desc {
            color: var(--color-primary-hover);
        }

        /* KG Toggle */
        .kg-toggle-container {
            margin-top: 12px;
            padding: 10px 12px;
            background: var(--color-bg-card);
            border-radius: 8px;
            border: 1px solid var(--color-border-light);
        }

        .kg-toggle-label {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            user-select: none;
        }

        .kg-toggle-checkbox {
            width: 18px;
            height: 18px;
            cursor: pointer;
            flex-shrink: 0;
        }

        .kg-toggle-text {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 13px;
            color: var(--color-text-secondary);
            flex-wrap: wrap;
        }

        .kg-toggle-icon {
            font-size: 16px;
        }

        .kg-toggle-hint {
            font-size: 11px;
            color: var(--color-text-tertiary);
            font-style: italic;
        }

        .kg-toggle-label:hover .kg-toggle-text {
            color: var(--color-primary);
        }


        /* Main Content - 填滿左右側邊欄展開後之間的空間 */
        main {
            min-height: calc(100vh - 200px);
            padding: 48px 24px;
            /* 左側邊欄 200px，右側面板 200px + tab labels 約 40px */
            margin-left: 200px;
            margin-right: 240px;
            max-width: none;
        }

        /* main 內的 container 不需要額外限制 */
        main .container {
            max-width: none;
            padding: 0;
        }

        /* Initial State */
        .initial-state {
            max-width: 800px;
            margin: 120px auto 0;
            text-align: center;
        }

        .initial-state h1 {
            font-size: 32px;
            margin-bottom: 16px;
            color: var(--color-text);
        }

        .initial-state p {
            font-size: 16px;
            color: #666;
            margin-bottom: 48px;
        }

        /* Search Input */
        .search-container {
            margin: 0 auto 32px;
        }

        .search-box {
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            padding: 16px;
            transition: all 0.3s;
            position: relative;
        }

        .search-box:focus-within {
            box-shadow: 0 4px 16px rgba(37,99,235,0.15);
        }

        .search-input {
            width: 100%;
            border: none;
            outline: none;
            font-size: 16px;
            resize: none;
            min-height: 80px;
            font-family: inherit;
        }

        .search-input::placeholder {
            color: #999;
        }

        /* Search Box Bottom Bar - 搜尋框底部列 */
        .search-bottom-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px solid #f0f0f0;
        }

        .search-bottom-left {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .search-bottom-right {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* 圖片上傳按鈕 */
        .btn-upload-inline {
            display: none; /* 預設隱藏，僅在特定模式顯示 */
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            background: transparent;
            border: 1px solid var(--color-border);
            border-radius: 6px;
            color: #666;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-upload-inline:hover {
            border-color: var(--color-primary);
            color: var(--color-primary);
            background: #f0f7ff;
        }

        .btn-upload-inline.visible {
            display: flex;
        }

        /* 包含我的文件 checkbox（搜尋框底部） */
        .user-files-toggle {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            border-radius: 8px;
            background: #f8f9fa;
            font-size: 13px;
            color: var(--color-text-secondary);
            cursor: pointer;
            transition: all 0.2s;
            user-select: none;
        }

        .user-files-toggle:hover {
            background: #f0f0f0;
        }

        .user-files-toggle input[type="checkbox"] {
            accent-color: var(--color-primary);
            cursor: pointer;
        }

        /* 模式按鈕（搜尋框內） */
        .mode-toggle-inline {
            display: flex;
            align-items: center;
            gap: 4px;
            background: #f5f5f5;
            padding: 3px;
            border-radius: 6px;
        }

        .mode-btn-inline {
            padding: 6px 12px;
            font-size: 13px;
            font-weight: 500;
            color: #666;
            background: transparent;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
            position: relative;
        }

        .mode-btn-inline:hover {
            color: var(--color-text);
        }

        .mode-btn-inline.active {
            background: white;
            color: var(--color-primary);
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

        /* 進階搜尋 Popup - 置中 Modal */
        .advanced-search-popup {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 360px;
            max-width: 90vw;
            background: white;
            border-radius: 12px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.25);
            z-index: 1001;
            overflow: hidden;
        }

        .advanced-search-popup.visible {
            display: block;
        }

        .popup-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 14px 16px;
            background: var(--color-primary);
            color: white;
        }

        .popup-title {
            font-size: 14px;
            font-weight: 600;
        }

        .popup-close {
            background: none;
            border: none;
            color: white;
            font-size: 18px;
            cursor: pointer;
            padding: 0;
            line-height: 1;
            opacity: 0.8;
            transition: opacity 0.2s;
        }

        .popup-close:hover {
            opacity: 1;
        }

        .popup-content {
            padding: 16px;
        }

        .popup-section {
            margin-bottom: 16px;
        }

        .popup-section:last-child {
            margin-bottom: 0;
        }

        .popup-section-title {
            font-size: 12px;
            font-weight: 600;
            color: var(--color-text-secondary);
            margin-bottom: 10px;
        }

        /* Radio 樣式的研究模式 */
        .research-radio-group {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .research-radio-item {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 10px 12px;
            background: #f9fafb;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
            border: 1px solid transparent;
        }

        .research-radio-item:hover {
            background: #f0f7ff;
            border-color: var(--color-primary-bg);
        }

        .research-radio-item.active {
            background: var(--color-primary-light);
            border-color: var(--color-primary);
        }

        .research-radio-item input[type="radio"] {
            margin-top: 2px;
            accent-color: var(--color-primary);
        }

        .research-radio-content {
            flex: 1;
        }

        .research-radio-label {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 13px;
            font-weight: 500;
            color: #1f2937;
        }

        .research-radio-desc {
            font-size: 11px;
            color: var(--color-text-tertiary);
            margin-top: 2px;
        }

        /* Checkbox 樣式的進階設定 */
        .advanced-checkbox-group {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .advanced-checkbox-item {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            cursor: pointer;
        }

        .advanced-checkbox-item input[type="checkbox"] {
            margin-top: 2px;
            accent-color: var(--color-primary);
        }

        .advanced-checkbox-content {
            flex: 1;
        }

        .advanced-checkbox-label {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 13px;
            color: #1f2937;
        }

        .advanced-checkbox-hint {
            font-size: 11px;
            color: var(--color-text-muted);
            font-style: italic;
        }

        /* Popup 背景遮罩 - 半透明黑色 */
        .popup-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1000;
        }

        .popup-overlay.visible {
            display: block;
        }

        .search-actions {
            display: none; /* 隱藏舊的 search-actions */
            justify-content: flex-end;
            margin-top: 12px;
        }

        .btn-search {
            background: var(--color-primary);
            color: white;
            border: none;
            padding: 10px 24px;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-search:hover {
            background: var(--color-primary-hover);
        }

        .btn-search:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* Bug #23: Stop generation button */
        .btn-stop-generate {
            background: var(--color-danger);
            color: white;
            border: none;
            padding: 10px 24px;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-stop-generate:hover {
            background: #b91c1c;
        }

        /* Memory Notification */
        .memory-notification {
            background: linear-gradient(135deg, #e8f4f8 0%, #d4e9f2 100%);
            border-left: 4px solid var(--color-primary);
            padding: 16px 20px;
            border-radius: 8px;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
            transition: opacity 0.3s ease;
        }

        .memory-icon {
            font-size: 24px;
        }

        .memory-text {
            color: var(--color-text);
            font-weight: 500;
            font-size: 15px;
            flex: 1;
        }

        /* Time Filter Relaxed Warning */
        .time-filter-warning {
            background: linear-gradient(135deg, #fef2f2 0%, #fde8e8 100%);
            border-left: 4px solid #dc2626;
            padding: 12px 20px;
            border-radius: 8px;
            margin-bottom: 16px;
            box-shadow: 0 2px 8px rgba(220, 38, 38, 0.1);
        }

        .time-filter-warning .warning-text {
            color: #dc2626;
            font-weight: 500;
            font-size: 14px;
        }

        /* Knowledge Graph Display (Phase KG) */
        .kg-display-container {
            background: white;
            border-radius: 12px;
            padding: 0;
            margin-bottom: 24px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            border: 2px solid var(--color-primary-bg);
        }

        .kg-display-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            background: #f8fafc;
            border-bottom: 1px solid var(--color-border-light);
            border-radius: 12px 12px 0 0;
        }

        .kg-display-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 16px;
            font-weight: 600;
            color: #1e293b;
        }

        .kg-display-icon {
            font-size: 20px;
        }

        .kg-display-metadata {
            font-size: 12px;
            font-weight: 400;
            color: #64748b;
            margin-left: 8px;
        }

        .kg-toggle-button {
            background: transparent;
            border: 1px solid #cbd5e1;
            color: #64748b;
            padding: 6px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            transition: all 0.2s;
        }

        .kg-toggle-button:hover {
            background: #f1f5f9;
            color: #475569;
            border-color: #94a3b8;
        }

        .kg-display-content {
            padding: 20px;
            max-height: 600px;
            overflow-y: auto;
        }

        /* Bug #17: .collapsed rule removed — toggle now uses kgContentWrapper display */

        .kg-display-empty {
            padding: 40px 20px;
            text-align: center;
            color: #64748b;
            font-size: 14px;
        }

        .kg-section {
            margin-bottom: 20px;
        }

        .kg-section-title {
            font-size: 14px;
            font-weight: 600;
            color: #475569;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .kg-item {
            padding: 10px 12px;
            margin-bottom: 8px;
            background: #f8fafc;
            border-left: 3px solid #cbd5e1;
            border-radius: 4px;
            font-size: 13px;
            line-height: 1.6;
        }

        .kg-item-name {
            font-weight: 600;
            color: #1e293b;
        }

        .kg-item-type {
            display: inline-block;
            padding: 2px 8px;
            background: var(--color-primary-bg);
            color: #4338ca;
            border-radius: 4px;
            font-size: 11px;
            margin-left: 8px;
        }

        .kg-item-confidence {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 11px;
            margin-left: 4px;
        }

        .kg-item-confidence.high {
            background: #d1fae5;
            color: #065f46;
        }

        .kg-item-confidence.medium {
            background: #fef3c7;
            color: #92400e;
        }

        .kg-item-confidence.low {
            background: var(--color-border-light);
            color: var(--color-text-tertiary);
        }

        .kg-item-desc {
            color: #64748b;
            margin-top: 4px;
        }

        .kg-relationship-arrow {
            color: var(--color-primary);
            margin: 0 6px;
        }

        /* Chat UI for Free Conversation Mode */
        .chat-container {
            display: none;
            background: white;
            border-radius: 12px;
            padding: 24px;
            margin-bottom: 24px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        }

        .chat-container.active {
            display: block;
        }

        .chat-messages {
            max-height: 500px;
            overflow-y: auto;
            margin-bottom: 20px;
            padding: 16px;
            background: #f9fafb;
            border-radius: 8px;
        }

        .chat-message {
            margin-bottom: 16px;
            display: flex;
            flex-direction: column;
        }

        .chat-message.user {
            align-items: flex-end;
        }

        .chat-message.assistant {
            align-items: flex-start;
        }

        .chat-message-content-wrapper {
            display: inline-flex;
            align-items: flex-end;
            gap: 4px;
            max-width: 80%;
        }

        .chat-message.user .chat-message-content-wrapper {
            flex-direction: row-reverse;
        }

        .chat-message-header {
            font-size: 12px;
            color: #666;
            margin-bottom: 4px;
            font-weight: 600;
        }

        .chat-message-bubble {
            padding: 12px 16px;
            border-radius: 12px;
            line-height: 1.6;
        }

        .chat-message.user .chat-message-bubble {
            background: var(--color-primary);
            color: white;
        }

        .chat-message.assistant .chat-message-bubble {
            background: white;
            color: var(--color-text);
            border: 1px solid var(--color-border);
        }

        /* Markdown content styling inside chat bubbles */
        .chat-message.assistant .chat-message-bubble p {
            margin: 0 0 12px 0;
        }

        .chat-message.assistant .chat-message-bubble p:last-child {
            margin-bottom: 0;
        }

        .chat-message.assistant .chat-message-bubble ul,
        .chat-message.assistant .chat-message-bubble ol {
            margin: 8px 0;
            padding-left: 20px;
        }

        .chat-message.assistant .chat-message-bubble li {
            margin-bottom: 4px;
        }

        .chat-message.assistant .chat-message-bubble h1,
        .chat-message.assistant .chat-message-bubble h2,
        .chat-message.assistant .chat-message-bubble h3 {
            margin: 16px 0 8px 0;
            font-weight: 600;
        }

        .chat-message.assistant .chat-message-bubble h1:first-child,
        .chat-message.assistant .chat-message-bubble h2:first-child,
        .chat-message.assistant .chat-message-bubble h3:first-child {
            margin-top: 0;
        }

        .chat-message.assistant .chat-message-bubble code {
            background: var(--color-bg-hover);
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 0.9em;
        }

        .chat-message.assistant .chat-message-bubble pre {
            background: var(--color-bg-hover);
            padding: 12px;
            border-radius: 8px;
            overflow-x: auto;
            margin: 8px 0;
        }

        .chat-message.assistant .chat-message-bubble pre code {
            background: none;
            padding: 0;
        }

        .chat-message.assistant .chat-message-bubble a {
            color: var(--color-primary);
            text-decoration: underline;
        }

        .chat-message.assistant .chat-message-bubble blockquote {
            border-left: 3px solid #d1d5db;
            margin: 8px 0;
            padding-left: 12px;
            color: var(--color-text-tertiary);
        }

        .chat-reference-info {
            font-size: 11px;
            color: #999;
            margin-top: 8px;
            padding: 8px 12px;
            background: #f0f9ff;
            border-radius: 6px;
            border-left: 3px solid var(--color-primary);
        }

        /* Pin Button on Chat Messages */
        .chat-message-pin {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 14px;
            color: #d1d5db;
            opacity: 0.5;
            transition: opacity 0.15s, color 0.15s;
            padding: 4px;
            line-height: 1;
            flex-shrink: 0;
        }

        .chat-message-content-wrapper:hover .chat-message-pin {
            opacity: 1;
            color: var(--color-text-muted);
        }

        .chat-message-pin:hover {
            color: #f59e0b !important;
            opacity: 1 !important;
        }

        .chat-message-pin.pinned {
            color: #f59e0b;
            opacity: 1;
        }

        /* Highlight animation when scrolling to pinned message */
        .chat-message.highlight {
            animation: highlightPulse 2s ease-out;
        }

        @keyframes highlightPulse {
            0%, 15% {
                background-color: #fef3c7;
                box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.3);
            }
            100% {
                background-color: transparent;
                box-shadow: none;
            }
        }

        /* Pinned Messages Banner (Line-style) */
        .pinned-banner {
            background: #fffbeb;
            border-bottom: 1px solid #fcd34d;
            padding: 0;
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .pinned-banner-current {
            display: flex;
            align-items: center;
            padding: 10px 16px;
            cursor: pointer;
            transition: background 0.15s;
        }

        .pinned-banner-current:hover {
            background: #fef3c7;
        }

        .pinned-banner-icon {
            font-size: 14px;
            margin-right: 10px;
        }

        .pinned-banner-text {
            flex: 1;
            font-size: 13px;
            color: #92400e;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .pinned-banner-toggle {
            display: flex;
            align-items: center;
            gap: 6px;
            background: none;
            border: none;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 4px;
            transition: background 0.15s;
        }

        .pinned-banner-toggle:hover {
            background: rgba(0, 0, 0, 0.05);
        }

        .pinned-banner-count {
            background: #f59e0b;
            color: white;
            font-size: 11px;
            font-weight: 600;
            padding: 2px 6px;
            border-radius: 10px;
            min-width: 18px;
            text-align: center;
        }

        .pinned-banner-arrow {
            font-size: 10px;
            color: #92400e;
            transition: transform 0.2s;
        }

        .pinned-banner.expanded .pinned-banner-arrow {
            transform: rotate(180deg);
        }

        .pinned-banner-dropdown {
            display: none;
            border-top: 1px solid #fcd34d;
            max-height: 200px;
            overflow-y: auto;
        }

        .pinned-banner-dropdown.visible {
            display: block;
        }

        .pinned-dropdown-item {
            display: flex;
            align-items: center;
            padding: 10px 16px;
            cursor: pointer;
            transition: background 0.15s;
            border-bottom: 1px solid #fef3c7;
        }

        .pinned-dropdown-item:last-child {
            border-bottom: none;
        }

        .pinned-dropdown-item:hover {
            background: #fef3c7;
        }

        .pinned-dropdown-item-icon {
            font-size: 12px;
            margin-right: 10px;
            color: #f59e0b;
        }

        .pinned-dropdown-item-text {
            flex: 1;
            font-size: 13px;
            color: #78350f;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .pinned-dropdown-item-role {
            font-size: 11px;
            color: #b45309;
            margin-left: 8px;
            padding: 2px 6px;
            background: rgba(245, 158, 11, 0.15);
            border-radius: 4px;
        }

        .pinned-dropdown-item-unpin {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 12px;
            color: var(--color-warning);
            opacity: 0;
            transition: opacity 0.15s;
            padding: 4px;
        }

        .pinned-dropdown-item:hover .pinned-dropdown-item-unpin {
            opacity: 1;
        }

        .pinned-dropdown-item-unpin:hover {
            color: var(--color-danger);
        }

        /* ==================== Pinned News Cards ==================== */

        /* Footer row: "閱讀全文" + pin button side by side */
        .news-card-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: 8px;
        }

        /* Pin button on news cards */
        .news-card-pin {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 16px;
            color: #d1d5db;
            opacity: 0.6;
            transition: opacity 0.15s, color 0.15s, transform 0.15s;
            padding: 4px;
            line-height: 1;
        }

        .news-card:hover .news-card-pin {
            opacity: 1;
            color: var(--color-text-muted);
        }

        .news-card-pin:hover {
            color: #f59e0b !important;
            opacity: 1 !important;
            transform: scale(1.1);
        }

        .news-card-pin.pinned {
            color: #f59e0b;
            opacity: 1;
        }

        /* Pinned news list in right tab panel */
        .pinned-news-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .pinned-news-empty {
            color: var(--color-text-muted);
            font-size: 13px;
            text-align: center;
            padding: 20px 0;
        }

        .pinned-news-item {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            padding: 10px 12px;
            background: #f9fafb;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.15s;
        }

        .pinned-news-item:hover {
            background: var(--color-bg-hover);
        }

        .pinned-news-item-icon {
            font-size: 12px;
            color: #f59e0b;
            flex-shrink: 0;
            margin-top: 2px;
        }

        .pinned-news-item-title {
            flex: 1;
            font-size: 13px;
            color: var(--color-text-secondary);
            line-height: 1.4;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .pinned-news-item-unpin {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 12px;
            color: var(--color-text-muted);
            opacity: 0;
            transition: opacity 0.15s, color 0.15s;
            padding: 2px;
            flex-shrink: 0;
        }

        .pinned-news-item:hover .pinned-news-item-unpin {
            opacity: 1;
        }

        .pinned-news-item-unpin:hover {
            color: var(--color-danger);
        }

        /* ==================== End Pinned News Cards ==================== */

        /* Multi-dimensional Parallel Clarification Styles */
        .chat-message.clarification .chat-message-bubble {
            max-width: 90%;
            background: transparent;
            border: none;
            padding: 0;
        }

        .clarification-card {
            background: #fffbeb;
            border: 2px solid #fbbf24;
            border-radius: 12px;
            padding: 20px;
            margin: 0;
        }

        .clarification-header {
            font-size: 16px;
            font-weight: 600;
            color: #92400e;
            margin-bottom: 20px;
            line-height: 1.5;
        }

        .question-block {
            margin-bottom: 20px;
        }

        .question-label {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
            font-weight: 500;
            color: var(--color-text);
        }

        .question-icon {
            font-size: 20px;
            line-height: 1;
        }

        .question-text {
            font-size: 15px;
        }

        .required {
            color: var(--color-danger);
            margin-left: 4px;
            font-weight: 600;
        }

        .options-group {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .option-chip {
            padding: 8px 16px;
            border: 2px solid var(--color-border-light);
            border-radius: 20px;
            background: white;
            color: var(--color-text-secondary);
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.2s;
            outline: none;
        }

        .option-chip:hover {
            border-color: #3b82f6;
            background: var(--color-primary-light);
            transform: translateY(-1px);
        }

        .option-chip.selected {
            border-color: var(--color-primary);
            background: var(--color-primary);
            color: white;
        }

        .submit-clarification {
            width: 100%;
            padding: 12px 24px;
            margin-top: 16px;
            background: var(--color-primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            outline: none;
        }

        .submit-clarification:hover:not(:disabled) {
            background: var(--color-primary-hover);
            transform: translateY(-1px);
        }

        .submit-clarification:disabled {
            background: var(--color-text-muted);
            cursor: not-allowed;
            opacity: 0.6;
        }

        .chat-input-container {
            margin-top: 16px;
            border-top: 1px solid var(--color-border);
            padding-top: 16px;
        }

        .chat-loading {
            display: none;
            text-align: center;
            padding: 16px;
            color: #666;
        }

        .chat-loading.active {
            display: block;
        }

        .chat-loading-spinner {
            width: 24px;
            height: 24px;
            border: 3px solid var(--color-border);
            border-top-color: var(--color-primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 8px;
        }

        /* Typing indicator in chat */
        .chat-typing-indicator {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 12px 16px;
        }

        .chat-typing-indicator .dot {
            width: 8px;
            height: 8px;
            background: #94a3b8;
            border-radius: 50%;
            animation: typing-bounce 1.4s ease-in-out infinite;
        }

        .chat-typing-indicator .dot:nth-child(2) {
            animation-delay: 0.2s;
        }

        .chat-typing-indicator .dot:nth-child(3) {
            animation-delay: 0.4s;
        }

        @keyframes typing-bounce {
            0%, 60%, 100% {
                transform: translateY(0);
                opacity: 0.4;
            }
            30% {
                transform: translateY(-6px);
                opacity: 1;
            }
        }

        /* Loading State */
        .loading-state {
            text-align: center;
            padding: 48px 0;
            display: none;
        }

        .loading-state.active {
            display: block;
        }

        .loading-text {
            font-size: 18px;
            color: #666;
            margin-top: 16px;
        }

        .loading-spinner {
            width: 48px;
            height: 48px;
            border: 4px solid var(--color-border);
            border-top-color: var(--color-primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* === Skeleton Card System for Progressive Rendering === */
        .skeleton-card {
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            margin-bottom: 16px;
        }

        .skeleton-line {
            background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
            background-size: 200% 100%;
            animation: shimmer 1.5s infinite;
            border-radius: 4px;
        }

        .skeleton-title { height: 22px; width: 80%; margin-bottom: 12px; }
        .skeleton-meta { height: 14px; width: 60%; margin-bottom: 12px; }
        .skeleton-excerpt { height: 14px; width: 100%; margin-bottom: 8px; }
        .skeleton-excerpt:last-child { width: 70%; }

        @keyframes shimmer {
            0% { background-position: 200% 0; }
            100% { background-position: -200% 0; }
        }

        /* AI Typing Indicator for Summary */
        .ai-typing-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 12px 16px;
            background: #f8f9fa;
            border-radius: 8px;
            margin-top: 12px;
        }

        .ai-typing-dot {
            width: 8px;
            height: 8px;
            background: var(--color-primary);
            border-radius: 50%;
            animation: typing-bounce 1.4s infinite;
        }

        .ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
        .ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

        @keyframes typing-bounce {
            0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
            30% { transform: translateY(-4px); opacity: 1; }
        }

        /* Fade-in for progressive content */
        .progressive-fade-in {
            animation: fadeIn 0.3s ease-out;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* Content update pulse */
        .content-updated {
            animation: contentPulse 0.5s ease-out;
        }

        @keyframes contentPulse {
            0% { background: rgba(37, 99, 235, 0.1); }
            100% { background: transparent; }
        }

        /* Skeleton summary section */
        .skeleton-summary {
            background: white;
            border-radius: 12px;
            padding: 24px;
            margin-bottom: 32px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        }

        .skeleton-summary-header {
            height: 18px;
            width: 120px;
            margin-bottom: 20px;
        }

        .skeleton-summary-line {
            height: 16px;
            margin-bottom: 10px;
        }

        .skeleton-summary-line:nth-child(2) { width: 100%; }
        .skeleton-summary-line:nth-child(3) { width: 95%; }
        .skeleton-summary-line:nth-child(4) { width: 85%; }

        /* Results Section */
        .results-section {
            display: none;
        }

        .results-section.active {
            display: block;
        }

        /* AI Summary */
        .ai-summary {
            background: white;
            border-radius: 12px;
            padding: 24px;
            margin-bottom: 32px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        }

        .ai-summary-header {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 18px;
            font-weight: 700;
            margin-bottom: 20px;
            color: var(--color-primary);
        }

        .summary-section {
            margin-bottom: 20px;
        }

        .summary-section:last-of-type {
            margin-bottom: 0;
        }

        .summary-title {
            font-weight: 700;
            margin-bottom: 8px;
            color: var(--color-text);
        }

        .summary-content {
            color: #333;
            line-height: 1.7;
        }

        .timeline-item {
            display: flex;
            gap: 8px;
            margin-bottom: 8px;
        }

        .timeline-item:last-child {
            margin-bottom: 0;
        }

        .entity-item {
            display: flex;
            gap: 8px;
            margin-bottom: 8px;
        }

        .related-link {
            color: var(--color-primary);
            text-decoration: none;
            display: inline-block;
            margin-right: 16px;
            margin-bottom: 8px;
        }

        .related-link:hover {
            text-decoration: underline;
        }

        .summary-footer {
            margin-top: 20px;
            padding-top: 16px;
            border-top: 1px solid var(--color-border);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .source-info {
            font-size: 14px;
            color: #666;
        }

        .feedback-buttons {
            display: flex;
            gap: 16px;
        }

        .btn-feedback {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 14px;
            color: #666;
            padding: 4px 8px;
            border-radius: 4px;
            transition: all 0.2s;
        }

        .btn-feedback:hover {
            background: #f5f5f5;
        }

        /* Feedback Modal (Bug #14) */
        .feedback-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
        }

        .feedback-modal {
            background: #fff;
            border-radius: 12px;
            width: 420px;
            max-width: 90vw;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
            overflow: hidden;
        }

        .feedback-modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            border-bottom: 1px solid #e0e0e0;
            font-weight: 600;
            font-size: 15px;
        }

        .feedback-modal-close {
            background: none;
            border: none;
            font-size: 22px;
            cursor: pointer;
            color: #666;
            padding: 0 4px;
            line-height: 1;
        }

        .feedback-modal-close:hover {
            color: #333;
        }

        .feedback-modal-body {
            padding: 16px 20px;
        }

        .feedback-textarea {
            width: 100%;
            border: 1px solid #ddd;
            border-radius: 8px;
            padding: 10px 12px;
            font-size: 14px;
            font-family: inherit;
            resize: vertical;
            box-sizing: border-box;
        }

        .feedback-textarea:focus {
            outline: none;
            border-color: var(--color-primary);
        }

        .feedback-modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 8px;
            padding: 12px 20px;
            border-top: 1px solid #e0e0e0;
        }

        .feedback-cancel {
            padding: 8px 16px;
            border: 1px solid #ddd;
            border-radius: 6px;
            background: #fff;
            cursor: pointer;
            font-size: 14px;
        }

        .feedback-cancel:hover {
            background: #f5f5f5;
        }

        .feedback-submit {
            padding: 8px 16px;
            border: none;
            border-radius: 6px;
            background: var(--color-primary);
            color: #fff;
            cursor: pointer;
            font-size: 14px;
        }

        .feedback-submit:hover {
            opacity: 0.9;
        }

        .feedback-submit:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        /* View Tabs */
        .view-tabs {
            display: flex;
            gap: 16px;
            margin-bottom: 16px;
            border-bottom: 2px solid var(--color-border);
        }

        .tab {
            padding: 12px 24px;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            color: #666;
            position: relative;
            transition: all 0.2s;
        }

        .tab.active {
            color: var(--color-primary);
        }

        .tab.active::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            right: 0;
            height: 2px;
            background: var(--color-primary);
        }

        /* Summary Toggle */
        .summary-toggle {
            display: none;
            margin-bottom: 24px;
        }

        .summary-toggle.active {
            display: block;
        }

        .btn-toggle-summary {
            background: white;
            border: 1px solid var(--color-border);
            padding: 10px 20px;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 600;
            color: #666;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-toggle-summary:hover {
            border-color: var(--color-primary);
            color: var(--color-primary);
        }

        /* Summary Loading */
        .summary-loading {
            display: none;
            text-align: center;
            padding: 24px;
            background: white;
            border-radius: 12px;
            margin-bottom: 16px;
            color: #666;
        }

        .summary-loading.active {
            display: block;
        }

        /* News Cards */
        .news-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .news-card {
            position: relative;
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            transition: all 0.2s;
        }

        .news-card:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.12);
        }

        .news-title {
            font-size: 18px;
            font-weight: 700;
            margin-bottom: 12px;
            line-height: 1.4;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .news-meta {
            display: flex;
            align-items: center;
            gap: 16px;
            font-size: 14px;
            color: #666;
            margin-bottom: 12px;
        }

        .relevance {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .stars {
            color: #fbbf24;
        }

        .news-excerpt {
            color: #333;
            line-height: 1.7;
            margin-bottom: 16px;
            display: none;
        }

        .news-excerpt.visible {
            display: block;
        }

        .btn-read-more {
            color: var(--color-primary);
            text-decoration: none;
            font-weight: 600;
            font-size: 14px;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .btn-read-more:hover {
            text-decoration: underline;
        }

        /* Timeline View */
        .timeline-view {
            display: none;
        }

        .timeline-view.active {
            display: block;
        }

        /* Research View (Deep Research Report) */
        .research-view {
            display: none;
        }

        .research-view.active {
            display: block;
        }

        /* Collapsible Sections for Research Report */
        .research-section {
            margin-bottom: 16px;
            background: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

        .research-section-header {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 12px 16px;
            background: #f8f9fa;
            cursor: pointer;
            transition: background 0.2s;
            user-select: none;
        }

        .research-section-header:hover {
            background: #f0f0f0;
        }

        .research-section-header .collapse-icon {
            font-size: 12px;
            color: #666;
            transition: transform 0.2s;
        }

        .research-section-header .section-title {
            font-size: 16px;
            font-weight: 600;
            color: var(--color-text);
        }

        .research-section-content {
            padding: 16px 21px;
            transition: max-height 0.3s ease-out, padding 0.3s ease-out;
        }

        .research-section.collapsed .research-section-content {
            max-height: 0;
            padding-top: 0;
            padding-bottom: 0;
            overflow: hidden;
        }

        .research-section.collapsed .collapse-icon {
            transform: rotate(-90deg);
        }

        /* Toggle All Toolbar */
        .research-toggle-all-toolbar {
            display: flex;
            gap: 8px;
            margin-bottom: 12px;
        }

        .btn-toggle-all {
            padding: 4px 12px;
            font-size: var(--font-size-sm);
            color: var(--color-text-tertiary);
            background: var(--color-bg-card);
            border: 1px solid var(--color-border-light);
            border-radius: var(--radius-md);
            cursor: pointer;
            transition: background 0.15s, color 0.15s;
        }

        .btn-toggle-all:hover {
            background: var(--color-bg-hover);
            color: var(--color-text);
        }

        .timeline-date {
            position: relative;
            padding-left: 40px;
            margin-bottom: 32px;
        }

        .timeline-date::before {
            content: '';
            position: absolute;
            left: 12px;
            top: 12px;
            bottom: -32px;
            width: 2px;
            background: rgba(37,99,235,0.2);
        }

        .timeline-date:last-child::before {
            display: none;
        }

        .timeline-dot {
            position: absolute;
            left: 4px;
            top: 8px;
            width: 12px;
            height: 12px;
            background: var(--color-primary);
            border-radius: 50%;
            border: 3px solid white;
            box-shadow: 0 0 0 2px var(--color-primary);
        }

        .date-label {
            font-size: 16px;
            font-weight: 700;
            color: var(--color-primary);
            margin-bottom: 16px;
        }

        /* Bottom Actions */
        .bottom-actions {
            display: flex;
            justify-content: center;
            gap: 16px;
            margin-top: 48px;
            padding: 24px 0;
        }

        .btn-action {
            padding: 12px 24px;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-share {
            background: var(--color-primary);
            border: none;
            color: white;
        }

        .btn-share:hover {
            background: var(--color-primary-hover);
        }

        /* Modal */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }

        .modal-overlay.active {
            display: flex;
        }

        /* Reasoning chain share button */
        .btn-share-reasoning:hover {
            background: #f0f0f0 !important;
            border-color: #3b82f6 !important;
            color: #3b82f6 !important;
        }

        .modal {
            background: white;
            border-radius: 12px;
            padding: 32px;
            max-width: 500px;
            width: 90%;
        }

        .modal.modal-large {
            max-width: 700px;
        }

        /* Saved Sessions List */
        .saved-sessions-list {
            max-height: 400px;
            overflow-y: auto;
            margin-bottom: 24px;
        }

        .saved-session-item {
            padding: 10px;
            background: var(--color-bg-card);
            border-radius: var(--radius-md);
            cursor: pointer;
            position: relative;
            transition: background 0.2s;
        }

        .saved-session-item:hover {
            background: var(--color-border-light);
        }

        .saved-session-item .delete-btn {
            position: absolute;
            top: 6px;
            right: 6px;
            background: none;
            border: none;
            color: #999;
            cursor: pointer;
            font-size: var(--font-size-sm);
            padding: 2px 6px;
            transition: all 0.2s;
        }

        .saved-session-item .delete-btn:hover {
            color: var(--color-danger);
        }

        .saved-session-item .delete-btn.confirming {
            background: #ef4444;
            color: white;
            border-color: var(--color-danger);
            padding: 4px 12px;
            font-size: var(--font-size-sm);
        }

        .saved-session-item .delete-btn.confirming:hover {
            background: var(--color-danger);
        }

        .saved-session-item-title {
            font-size: var(--font-size-base);
            font-weight: 500;
            color: var(--color-text);
            margin-bottom: 4px;
            padding-right: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .saved-session-item-date {
            font-size: var(--font-size-xs);
            color: var(--color-text-tertiary);
        }

        .empty-sessions {
            color: var(--color-text-muted);
            font-size: var(--font-size-base);
            text-align: center;
            padding: 20px 0;
        }

        .modal-header {
            font-size: 20px;
            font-weight: 700;
            margin-bottom: 24px;
            text-align: center;
        }

        .modal-content {
            margin-bottom: 24px;
        }

        .modal-description {
            color: #666;
            margin-bottom: 16px;
        }

        .copy-options {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .btn-copy {
            padding: 12px 16px;
            border: 1px solid var(--color-border);
            border-radius: 8px;
            background: white;
            text-align: left;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 14px;
        }

        .btn-copy:hover {
            border-color: var(--color-primary);
            background: var(--color-primary-light);
        }

        .modal-tip {
            background: var(--color-primary-light);
            padding: 12px;
            border-radius: 8px;
            font-size: 14px;
            color: #666;
            margin-top: 16px;
        }

        .modal-actions {
            display: flex;
            justify-content: center;
        }

        .btn-close-modal {
            padding: 10px 32px;
            border: 1px solid var(--color-border);
            border-radius: 6px;
            background: white;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.2s;
        }

        .btn-close-modal:hover {
            background: #f5f5f5;
        }

        /* Styling for source links in generated answers */
        .source-link {
            color: #3b82f6;
            /* Blue color for links */
            text-decoration: none;
            font-weight: 500;
            padding: 2px 6px;
            border-radius: 4px;
            transition: all 0.2s ease;
            white-space: nowrap;
        }

        .source-link:hover {
            color: var(--color-primary);
            /* Darker blue on hover */
            background-color: #dbeafe;
            /* Light blue background on hover */
            text-decoration: underline;
        }

        /* Ensure summary content has proper spacing for line breaks */
        .summary-content {
            line-height: 1.8;
            /* Better readability */
        }

        /* Deep Research Progress Display - Log Style */
        .reasoning-progress-container {
            background: #1e293b;
            border-radius: 12px;
            padding: 16px 20px;
            margin: 20px 0;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
            max-height: 300px;
            overflow-y: auto;
        }

        .progress-header {
            font-weight: 600;
            font-size: 13px;
            margin-bottom: 12px;
            color: #94a3b8;
            display: flex;
            align-items: center;
            gap: 8px;
            border-bottom: 1px solid #334155;
            padding-bottom: 10px;
        }

        .progress-header::before {
            content: '';
            width: 8px;
            height: 8px;
            background: #22c55e;
            border-radius: 50%;
            animation: blink 1s infinite;
        }

        @keyframes blink {
            0%, 50% { opacity: 1; }
            51%, 100% { opacity: 0.3; }
        }

        .progress-log {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .log-entry {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            font-size: 13px;
            line-height: 1.5;
            animation: logFadeIn 0.3s ease-out;
        }

        @keyframes logFadeIn {
            from { opacity: 0; transform: translateX(-10px); }
            to { opacity: 1; transform: translateX(0); }
        }

        .log-entry .log-icon {
            flex-shrink: 0;
            width: 18px;
            text-align: center;
        }

        .log-entry .log-text {
            color: #e2e8f0;
        }

        .log-entry .log-detail {
            color: #64748b;
            font-size: 12px;
            margin-left: 28px;
            margin-top: 2px;
        }

        .log-entry.complete .log-icon { color: #22c55e; }
        .log-entry.active .log-icon { color: #3b82f6; }
        .log-entry.warning .log-icon { color: #f59e0b; }
        .log-entry.error .log-icon { color: #ef4444; }

        .log-entry.active .log-text {
            color: #93c5fd;
        }

        .log-entry.active .log-icon {
            animation: spin 1s linear infinite;
        }

        /* Log entry types */
        .log-entry.gap-search .log-text {
            color: #fbbf24;
        }

        .log-entry.cov .log-text {
            color: #a78bfa;
        }

        .log-entry .log-stats {
            display: inline-flex;
            gap: 8px;
            margin-left: 8px;
            font-size: 11px;
        }

        .log-entry .log-stats .stat {
            padding: 2px 6px;
            border-radius: 4px;
            background: rgba(255,255,255,0.1);
        }

        .log-entry .log-stats .stat.success { background: rgba(34, 197, 94, 0.2); color: #86efac; }
        .log-entry .log-stats .stat.warning { background: rgba(251, 191, 36, 0.2); color: #fde047; }
        .log-entry .log-stats .stat.error { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

        /* Citation Links */
        .citation-link {
            color: var(--color-primary);
            text-decoration: none;
            font-weight: 600;
            padding: 0 2px;
            transition: all 0.2s;
            border-bottom: 1px solid transparent;
        }

        .citation-link:hover {
            color: var(--color-primary-hover);
            border-bottom-color: var(--color-primary-hover);
            background: var(--color-primary-light);
        }

        /* Stage 5: URN Citation Styling (LLM Knowledge) */
        .citation-urn {
            color: #8b5cf6;
            font-weight: 600;
            padding: 0 2px;
            cursor: help;
            border-bottom: 1px dashed #8b5cf6;
        }

        .citation-urn sup {
            font-size: 9px;
            color: #6d28d9;
            margin-left: 1px;
        }

        /* Bug #13: Private Document Citation Styling */
        .citation-private {
            color: #059669;
            font-weight: 600;
            padding: 0 2px;
            cursor: help;
            border-bottom: 1px dashed #059669;
        }

        .citation-private sup {
            font-size: 9px;
            margin-left: 1px;
        }

        /* Bug #25: Citation without link (out-of-range or missing URL) */
        .citation-no-link {
            color: #9ca3af;
            font-weight: 600;
            padding: 0 2px;
            cursor: help;
            border-bottom: 1px dashed #9ca3af;
        }

        /* Citation Reference Section (appended at end of report) */
        .citation-reference-section {
            margin-top: 32px;
            padding-top: 24px;
            border-top: 2px solid var(--color-border-light);
        }

        /* Collapsible toggle button */
        .citation-reference-toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 16px;
            font-weight: 600;
            color: var(--color-text-secondary);
            background: none;
            border: 1px solid var(--color-border-light);
            border-radius: var(--radius-md);
            padding: 8px 14px;
            cursor: pointer;
            transition: all 0.2s;
            margin-bottom: 0;
        }

        .citation-reference-toggle:hover {
            border-color: var(--color-primary);
            color: var(--color-primary);
        }

        .citation-toggle-icon {
            font-size: 12px;
            transition: transform 0.2s;
        }

        .citation-reference-section.expanded .citation-toggle-icon {
            transform: rotate(90deg);
        }

        /* Hidden by default, shown when expanded */
        .citation-reference-section .citation-reference-list {
            display: none;
            flex-direction: column;
            gap: 8px;
            margin-top: 12px;
        }

        .citation-reference-section.expanded .citation-reference-list {
            display: flex;
        }

        .citation-reference-item {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            font-size: 13px;
            line-height: 1.5;
            padding: 8px 12px;
            background: #f8f9fa;
            border-radius: 6px;
            transition: background 0.2s;
        }

        .citation-reference-item:hover {
            background: #f0f4f8;
        }

        .citation-reference-number {
            color: var(--color-primary);
            font-weight: 600;
            flex-shrink: 0;
            min-width: 32px;
        }

        .citation-reference-link {
            color: var(--color-text-secondary);
            text-decoration: none;
            word-break: break-all;
            transition: color 0.2s;
        }

        .citation-reference-link:hover {
            color: var(--color-primary);
            text-decoration: underline;
        }

        .citation-reference-text {
            color: var(--color-text-secondary);
            word-break: break-all;
        }

        .citation-reference-type {
            display: inline-block;
            padding: 2px 6px;
            background: var(--color-primary-bg);
            color: var(--color-primary);
            border-radius: 4px;
            font-size: 11px;
            margin-right: 6px;
        }

        .citation-reference-domain {
            color: var(--color-text-tertiary);
        }

        /* Knowledge Graph D3 Visualization (Phase KG Enhanced) */
        .kg-graph-container {
            width: 100%;
            height: 400px;
            background: #fafbfc;
            border-radius: 8px;
            overflow: hidden;
            position: relative;
        }

        .kg-graph-container svg {
            width: 100%;
            height: 100%;
        }

        .kg-view-toggle {
            display: flex;
            gap: 4px;
            background: #f1f5f9;
            padding: 4px;
            border-radius: 8px;
        }

        .kg-view-btn {
            background: transparent;
            border: none;
            padding: 6px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            color: #64748b;
            transition: all 0.2s;
        }

        .kg-view-btn.active {
            background: white;
            color: #1e293b;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

        .kg-view-btn:hover:not(.active) {
            color: #475569;
        }

        .kg-node {
            cursor: pointer;
        }

        .kg-node circle {
            stroke: white;
            stroke-width: 2px;
            transition: all 0.2s;
        }

        .kg-node:hover circle {
            stroke-width: 3px;
            filter: brightness(1.1);
        }

        .kg-node text {
            font-size: 11px;
            fill: #1e293b;
            pointer-events: none;
            text-anchor: middle;
        }

        .kg-link {
            stroke-opacity: 0.6;
            fill: none;
        }

        .kg-link-label {
            font-size: 10px;
            fill: #64748b;
            pointer-events: none;
        }

        .kg-tooltip {
            position: absolute;
            background: white;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            padding: 12px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            font-size: 13px;
            max-width: 300px;
            z-index: 1000;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s;
        }

        .kg-tooltip.visible {
            opacity: 1;
        }

        .kg-tooltip-title {
            font-weight: 600;
            margin-bottom: 4px;
            color: #1e293b;
        }

        .kg-tooltip-type {
            display: inline-block;
            padding: 2px 6px;
            background: var(--color-primary-bg);
            color: #4338ca;
            border-radius: 4px;
            font-size: 11px;
            margin-bottom: 6px;
        }

        .kg-tooltip-desc {
            color: #64748b;
            line-height: 1.5;
        }

        .kg-legend {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            padding: 12px 0;
            border-top: 1px solid var(--color-border-light);
            margin-top: 12px;
        }

        .kg-legend-item {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: #64748b;
        }

        .kg-legend-color {
            width: 12px;
            height: 12px;
            border-radius: 50%;
        }

        /* Shared styles (used by right-tab panels) */
        .sidebar-toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px;
            background: var(--color-bg-card);
            border-radius: 6px;
            margin-bottom: 12px;
            cursor: pointer;
            user-select: none;
        }

        .sidebar-toggle input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
        }

        .sidebar-toggle-text {
            font-size: 13px;
            color: var(--color-text-secondary);
            flex: 1;
        }

        .file-list {
            margin-bottom: 16px;
        }

        .file-list-title {
            font-size: 12px;
            font-weight: 600;
            color: var(--color-text-tertiary);
            margin-bottom: 8px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .file-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px;
            background: var(--color-bg-card);
            border-radius: 4px;
            margin-bottom: 6px;
            font-size: 13px;
            color: var(--color-text-secondary);
        }

        .file-item-icon {
            font-size: 16px;
            flex-shrink: 0;
        }

        .file-item-name {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .file-item-status {
            font-size: 11px;
            color: var(--color-text-tertiary);
        }

        .file-item-status.processing {
            color: var(--color-primary);
        }

        .file-item-status.ready {
            color: var(--color-success);
        }

        .file-item-status.failed {
            color: var(--color-danger);
        }

        .file-item-delete {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 14px;
            padding: 2px 4px;
            border-radius: 4px;
            opacity: 0;
            transition: opacity 0.15s, background 0.15s;
            flex-shrink: 0;
            line-height: 1;
        }

        .file-item:hover .file-item-delete {
            opacity: 0.6;
        }

        .file-item-delete:hover {
            opacity: 1 !important;
            background: var(--color-danger-bg);
        }

        .upload-button {
            width: 100%;
            padding: 10px;
            background: var(--color-primary);
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .upload-button:hover {
            background: var(--color-primary-hover);
        }

        .upload-button:disabled {
            background: var(--color-text-muted);
            cursor: not-allowed;
        }

        /* Upload Progress Modal */
        .upload-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }

        .upload-modal.visible {
            display: flex;
        }

        .upload-modal-content {
            background: white;
            border-radius: 8px;
            padding: 24px;
            max-width: 400px;
            width: 90%;
        }

        .upload-modal-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 16px;
        }

        .upload-progress {
            margin: 16px 0;
        }

        .progress-bar {
            width: 100%;
            height: 8px;
            background: var(--color-border-light);
            border-radius: 4px;
            overflow: hidden;
        }

        .progress-bar-fill {
            height: 100%;
            background: var(--color-primary);
            transition: width 0.3s ease;
        }

        .progress-text {
            font-size: 14px;
            color: var(--color-text-tertiary);
            margin-top: 8px;
        }

        .site-filter-actions {
            display: flex;
            gap: 8px;
            margin-bottom: 12px;
        }

        .site-filter-btn {
            padding: 4px 8px;
            font-size: 12px;
            color: var(--color-primary);
            background: transparent;
            border: 1px solid var(--color-primary);
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .site-filter-btn:hover {
            background: var(--color-primary);
            color: white;
        }

        .site-filter-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .site-filter-item {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            padding: 8px;
            background: var(--color-bg-card);
            border-radius: 6px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .site-filter-item:hover {
            background: var(--color-border-light);
        }

        .site-filter-item input[type="checkbox"] {
            width: 16px;
            height: 16px;
            margin-top: 2px;
            cursor: pointer;
            flex-shrink: 0;
        }

        .site-filter-item-info {
            flex: 1;
            min-width: 0;
        }

        .site-filter-item-name {
            font-size: 13px;
            font-weight: 500;
            color: var(--color-text);
        }

        .site-filter-item-desc {
            font-size: 11px;
            color: var(--color-text-tertiary);
            margin-top: 2px;
            line-height: 1.3;
        }

        /* ==================== 右側 Tab 面板系統 ==================== */

        /* Tab 容器 - 固定在右側 */
        .right-tabs-container {
            position: fixed;
            right: 0;
            top: 60px;
            height: calc(100vh - 60px);
            display: flex;
            flex-direction: row;
            z-index: 90;
        }

        /* Tab 標籤列（垂直文字） */
        .right-tabs-labels {
            display: flex;
            flex-direction: column;
            background: var(--color-bg-card);
            border-left: 1px solid var(--color-border);
        }

        .right-tab-label {
            writing-mode: vertical-rl;
            text-orientation: mixed;
            padding: 16px 8px;
            font-size: 13px;
            font-weight: 500;
            color: #666;
            background: transparent;
            border: none;
            border-bottom: 1px solid var(--color-border);
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
            min-height: 15vh;
            max-height: 20vh;
        }

        .right-tab-label:hover {
            background: var(--color-border-light);
            color: var(--color-text);
        }

        .right-tab-label.active {
            background: white;
            color: var(--color-primary);
            border-left: 2px solid var(--color-primary);
            margin-left: -1px;
        }

        .right-tab-label-icon {
            font-size: 16px;
        }

        /* Tab 面板（向左滑出） */
        .right-tab-panel {
            position: absolute;
            right: 100%;
            top: 0;
            width: 200px;
            height: 100%;
            background: white;
            border-left: 1px solid var(--color-border);
            box-shadow: -4px 0 12px rgba(0,0,0,0.1);
            overflow-y: auto;
            transform: translateX(100%);
            opacity: 0;
            visibility: hidden;
            transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
        }

        .right-tab-panel.visible {
            transform: translateX(0);
            opacity: 1;
            visibility: visible;
        }

        .right-tab-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px;
            border-bottom: 1px solid var(--color-border);
            background: var(--color-bg-card);
        }

        .right-tab-panel-title {
            font-size: 15px;
            font-weight: 600;
            color: var(--color-text);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .right-tab-panel-close {
            background: none;
            border: none;
            font-size: 18px;
            color: #666;
            cursor: pointer;
            padding: 4px;
            line-height: 1;
            border-radius: 4px;
            transition: all 0.2s;
        }

        .right-tab-panel-close:hover {
            background: var(--color-border-light);
            color: var(--color-text);
        }

        .right-tab-panel-content {
            padding: 16px;
        }

        /* ==================== 左側邊欄系統 ==================== */

        /* 展開按鈕（固定在左側邊緣，header 下方） */
        .left-sidebar-expand-btn {
            position: fixed;
            left: 0;
            top: 70px; /* header 高度 (60px) + 10px 間距 */
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 12px 8px;
            background: white;
            border: 1px solid var(--color-border);
            border-left: none;
            border-radius: 0 8px 8px 0;
            cursor: pointer;
            font-size: 12px;
            color: #666;
            transition: all 0.2s;
            z-index: 94;
            box-shadow: 2px 0 8px rgba(0,0,0,0.1);
            writing-mode: vertical-rl;
            text-orientation: mixed;
        }

        .left-sidebar-expand-btn:hover {
            background: #f5f5f5;
            color: var(--color-text);
        }

        /* 側邊欄展開時隱藏展開按鈕 */
        .left-sidebar.visible ~ .left-sidebar-expand-btn,
        .left-sidebar-expand-btn.hidden {
            opacity: 0;
            pointer-events: none;
        }

        /* 左側邊欄 */
        .left-sidebar {
            position: fixed;
            left: 0;
            top: 60px;
            width: 200px;
            height: calc(100vh - 60px);
            background: white;
            border-right: 1px solid var(--color-border);
            z-index: 95;
            display: flex;
            flex-direction: column;
            transform: translateX(-100%);
            transition: transform 0.3s ease;
        }

        .left-sidebar.visible {
            transform: translateX(0);
        }

        /* 左側邊欄頂部 */
        .left-sidebar-header {
            padding: 16px;
            border-bottom: 1px solid var(--color-border);
        }

        .left-sidebar-collapse-btn {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            background: transparent;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 400;
            color: var(--color-text-secondary);
            transition: background 0.15s;
        }

        .left-sidebar-collapse-btn:hover {
            background: var(--color-bg-hover);
        }

        /* 左側邊欄內容 */
        .left-sidebar-content {
            flex: 1;
            overflow-y: auto;
            padding: 16px;
        }

        /* 左側邊欄按鈕共用樣式 - ChatGPT/Claude 風格 */
        .btn-share-sidebar,
        .btn-new-conversation,
        .btn-history-search {
            width: 100%;
            padding: 10px 12px;
            background: transparent;
            color: var(--color-text-secondary);
            border: none;
            border-radius: 6px;
            font-size: 13px;
            font-weight: 400;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 10px;
            transition: background 0.15s;
            margin-bottom: 2px;
        }

        .btn-share-sidebar:hover,
        .btn-new-conversation:hover,
        .btn-history-search:hover {
            background: var(--color-bg-hover);
        }

        /* 新對話按鈕 - 稍微突出 */
        .btn-new-conversation {
            border: 1px solid var(--color-border-light);
            margin-bottom: 16px;
        }

        .btn-new-conversation:hover {
            background: var(--color-bg-hover);
            border-color: #d1d5db;
        }

        /* 歷史搜尋 Popup */
        .history-popup-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 200;
            display: none;
            align-items: flex-start;
            justify-content: center;
            padding-top: 120px;
        }

        .history-popup-overlay.visible {
            display: flex;
        }

        .history-popup {
            background: white;
            border-radius: 12px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
            width: 480px;
            max-width: 90%;
            max-height: 400px;
            display: flex;
            flex-direction: column;
            animation: popupSlideIn 0.2s ease-out;
        }

        @keyframes popupSlideIn {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .history-popup-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 16px 20px;
            border-bottom: 1px solid var(--color-border-light);
        }

        .history-popup-title {
            font-size: 14px;
            font-weight: 600;
            color: var(--color-text-secondary);
        }

        .history-popup-close {
            background: none;
            border: none;
            font-size: 24px;
            color: var(--color-text-muted);
            cursor: pointer;
            line-height: 1;
            padding: 0;
            transition: color 0.2s;
        }

        .history-popup-close:hover {
            color: var(--color-text-secondary);
        }

        .history-popup-search {
            padding: 12px 20px;
            border-bottom: 1px solid var(--color-border-light);
        }

        .history-popup-search input {
            width: 100%;
            padding: 10px 14px;
            border: 1px solid var(--color-border-light);
            border-radius: 8px;
            font-size: 14px;
            outline: none;
            transition: border-color 0.2s;
        }

        .history-popup-search input:focus {
            border-color: var(--color-primary);
        }

        .history-popup-list {
            flex: 1;
            overflow-y: auto;
            padding: 8px 0;
            max-height: 260px;
        }

        .history-popup-empty {
            padding: 40px 20px;
            text-align: center;
            color: var(--color-text-muted);
            font-size: 14px;
        }

        .history-popup-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 20px;
            cursor: pointer;
            transition: background 0.15s;
        }

        .history-popup-item:hover {
            background: var(--color-bg-hover);
        }

        .history-popup-item-content {
            flex: 1;
            min-width: 0;
        }

        .history-popup-item-title {
            font-size: 14px;
            color: #1f2937;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            margin-bottom: 2px;
        }

        .history-popup-item-date {
            font-size: 12px;
            color: var(--color-text-muted);
        }

        .history-popup-item-icon {
            color: var(--color-text-muted);
            font-size: 12px;
            margin-left: 12px;
        }

        /* 區塊標題 */
        .left-sidebar-section {
            margin-bottom: 20px;
        }

        .left-sidebar-section-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
        }

        .left-sidebar-section-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--color-text-secondary);
            display: flex;
            align-items: center;
            gap: 6px;
        }

        /* 歷史搜尋輸入框 */
        .history-search-input {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid var(--color-border);
            border-radius: 6px;
            font-size: 13px;
            margin-bottom: 12px;
            outline: none;
            transition: border-color 0.2s;
        }

        .history-search-input:focus {
            border-color: var(--color-primary);
        }

        .history-search-input::placeholder {
            color: var(--color-text-muted);
        }

        /* 歷史記錄列表 */
        .history-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
            max-height: 300px;
            overflow-y: auto;
        }

        .history-item {
            padding: 10px 12px;
            background: var(--color-bg-card);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            position: relative;
        }

        .history-item:hover {
            background: var(--color-border-light);
        }

        .history-item-title {
            font-size: 13px;
            font-weight: 500;
            color: var(--color-text);
            margin-bottom: 4px;
            padding-right: 24px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .history-item-meta {
            font-size: 11px;
            color: var(--color-text-tertiary);
        }

        .history-item-delete {
            position: absolute;
            top: 8px;
            right: 8px;
            background: none;
            border: none;
            color: var(--color-text-muted);
            cursor: pointer;
            font-size: 12px;
            padding: 2px 6px;
            border-radius: 4px;
            opacity: 0;
            transition: all 0.2s;
        }

        .history-item:hover .history-item-delete {
            opacity: 1;
        }

        .history-item-delete:hover {
            background: #fee2e2;
            color: var(--color-danger);
        }

        /* 分類按鈕 */
        .btn-toggle-categories {
            width: 100%;
            padding: 10px 12px;
            background: transparent;
            border: none;
            border-radius: 6px;
            font-size: 13px;
            font-weight: 400;
            color: var(--color-text-secondary);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
            transition: background 0.15s;
        }

        .btn-toggle-categories:hover {
            background: var(--color-bg-hover);
        }

        .btn-toggle-categories .toggle-icon {
            margin-left: auto;
            transition: transform 0.2s;
        }

        .btn-toggle-categories.expanded .toggle-icon {
            transform: rotate(180deg);
        }

        /* 分類列表 */
        .categories-list {
            display: none;
            flex-direction: column;
            gap: 6px;
            margin-top: 12px;
            padding-left: 8px;
        }

        .categories-list.visible {
            display: flex;
        }

        .category-item {
            padding: 10px 12px;
            background: var(--color-bg-card);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 13px;
            color: var(--color-text-secondary);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .category-item:hover {
            background: var(--color-border-light);
        }

        .category-item-icon {
            color: var(--color-text-tertiary);
        }

        .btn-add-category {
            padding: 10px 12px;
            background: transparent;
            border: 1px dashed #d1d5db;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            color: var(--color-text-tertiary);
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.2s;
        }

        .btn-add-category:hover {
            border-color: var(--color-primary);
            color: var(--color-primary);
            background: #f0f7ff;
        }

        /* 左側邊欄分隔線 */
        .left-sidebar-divider {
            height: 1px;
            background: var(--color-border);
            margin: 8px 0;
        }

        /* 左側邊欄 Session 列表 */
        .left-sidebar-sessions {
            display: flex;
            flex-direction: column;
            gap: 1px;
        }

        .left-sidebar-session-item {
            padding: 8px 12px;
            font-size: 13px;
            color: var(--color-text-secondary);
            cursor: pointer;
            border-radius: 6px;
            transition: background 0.15s;
            position: relative;
            display: flex;
            align-items: center;
        }

        .left-sidebar-session-item:hover {
            background: var(--color-bg-hover);
        }

        .left-sidebar-session-item.active {
            background: var(--color-primary-light);
            color: var(--color-primary);
        }

        .left-sidebar-session-title {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            min-width: 0;
        }

        /* Session context menu trigger */
        .left-sidebar-session-menu-btn {
            display: none;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 14px;
            color: var(--color-text-muted);
            padding: 2px 6px;
            border-radius: 4px;
            flex-shrink: 0;
            line-height: 1;
        }

        .left-sidebar-session-item:hover .left-sidebar-session-menu-btn {
            display: block;
        }

        .left-sidebar-session-menu-btn:hover {
            background: var(--color-border-light);
            color: var(--color-text-secondary);
        }

        /* Session dropdown */
        .left-sidebar-session-dropdown {
            position: absolute;
            top: 100%;
            right: 4px;
            background: white;
            border: 1px solid var(--color-border);
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.12);
            min-width: 120px;
            z-index: 200;
            display: none;
            overflow: hidden;
        }

        .left-sidebar-session-dropdown.visible {
            display: block;
        }

        .left-sidebar-session-dropdown-item {
            display: block;
            width: 100%;
            padding: 8px 12px;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 13px;
            color: var(--color-text-secondary);
            text-align: left;
            transition: background 0.1s;
        }

        .left-sidebar-session-dropdown-item:hover {
            background: var(--color-bg-hover);
        }

        .left-sidebar-session-dropdown-item.danger {
            color: #ef4444;
        }

        .left-sidebar-session-dropdown-item.danger:hover {
            background: var(--color-danger-bg);
        }

        /* Sidebar session rename input */
        .left-sidebar-session-rename {
            flex: 1;
            font-size: 13px;
            color: var(--color-text);
            border: 1px solid var(--color-primary);
            border-radius: 4px;
            padding: 2px 6px;
            outline: none;
            min-width: 0;
            background: white;
        }

        /* 左側邊欄底部 */
        .left-sidebar-footer {
            padding: 16px;
            border-top: 1px solid var(--color-border);
        }

        .btn-settings {
            width: 100%;
            padding: 10px 12px;
            background: transparent;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 400;
            color: var(--color-text-secondary);
            display: flex;
            align-items: center;
            gap: 10px;
            transition: background 0.15s;
        }

        .btn-settings:hover {
            background: var(--color-bg-hover);
        }

        /* 空狀態提示 */
        .empty-history {
            color: var(--color-text-muted);
            font-size: 13px;
            text-align: center;
            padding: 20px 0;
        }

        /* 通知圖示 */
        .notification-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            background: transparent;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 18px;
            color: #666;
            transition: all 0.2s;
            position: relative;
        }

        .notification-btn:hover {
            background: #f5f5f5;
            color: var(--color-text);
        }

        /* ==================== Folder/Project System ==================== */

        .folder-page {
            max-width: 700px;
            margin: 0 auto;
            padding: 40px 20px;
        }

        .folder-page-title {
            font-size: 28px;
            font-weight: 700;
            color: var(--color-text);
            margin: 0 0 20px 0;
        }

        .folder-search-bar {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 14px;
            border: 1px solid var(--color-border);
            border-radius: 8px;
            background: white;
            margin-bottom: 16px;
        }

        .folder-search-icon {
            font-size: 16px;
            color: var(--color-text-muted);
        }

        .folder-search-bar input {
            flex: 1;
            border: none;
            outline: none;
            font-size: 14px;
            color: var(--color-text);
            background: transparent;
        }

        .folder-search-bar input::placeholder {
            color: var(--color-text-muted);
        }

        .folder-sort-tabs {
            display: flex;
            gap: 4px;
            margin-bottom: 20px;
            border-bottom: 1px solid var(--color-border);
            padding-bottom: 0;
        }

        .folder-sort-tab {
            padding: 8px 16px;
            background: transparent;
            border: none;
            border-bottom: 2px solid transparent;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            color: var(--color-text-tertiary);
            transition: all 0.15s;
        }

        .folder-sort-tab:hover {
            color: var(--color-text);
        }

        .folder-sort-tab.active {
            color: var(--color-text);
            border-bottom-color: var(--color-text);
        }

        .folder-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
            margin-bottom: 20px;
        }

        .folder-card {
            border: 1px solid var(--color-border);
            border-radius: 10px;
            padding: 20px;
            background: white;
            cursor: pointer;
            transition: box-shadow 0.15s, border-color 0.15s;
            position: relative;
        }

        .folder-card:hover {
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            border-color: #d1d5db;
        }

        .folder-card-name {
            font-size: 16px;
            font-weight: 600;
            color: var(--color-text);
            margin-bottom: 8px;
        }

        .folder-card-meta {
            font-size: 12px;
            color: var(--color-text-muted);
        }

        /* Folder context menu (rename/delete) */
        .folder-card-menu {
            position: absolute;
            top: 12px;
            right: 12px;
            opacity: 0;
            transition: opacity 0.15s;
        }

        .folder-card:hover .folder-card-menu {
            opacity: 1;
        }

        .folder-card-menu-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 18px;
            color: var(--color-text-muted);
            padding: 2px 6px;
            border-radius: 4px;
        }

        .folder-card-menu-btn:hover {
            background: var(--color-bg-hover);
            color: var(--color-text-secondary);
        }

        .folder-card-dropdown {
            position: absolute;
            top: 100%;
            right: 0;
            background: white;
            border: 1px solid var(--color-border);
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.12);
            min-width: 140px;
            z-index: 100;
            display: none;
            overflow: hidden;
        }

        .folder-card-dropdown.visible {
            display: block;
        }

        .folder-card-dropdown-item {
            display: block;
            width: 100%;
            padding: 10px 14px;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 13px;
            color: var(--color-text-secondary);
            text-align: left;
            transition: background 0.1s;
        }

        .folder-card-dropdown-item:hover {
            background: var(--color-bg-hover);
        }

        .folder-card-dropdown-item.danger {
            color: #ef4444;
        }

        .folder-card-dropdown-item.danger:hover {
            background: var(--color-danger-bg);
        }

        .folder-add-btn {
            display: inline-block;
            padding: 10px 20px;
            background: transparent;
            border: 1px dashed #d1d5db;
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            color: var(--color-text-tertiary);
            transition: all 0.15s;
        }

        .folder-add-btn:hover {
            border-color: var(--color-text-muted);
            color: var(--color-text-secondary);
            background: #f9fafb;
        }

        .folder-empty {
            text-align: center;
            color: var(--color-text-muted);
            font-size: 14px;
            padding: 40px 0;
            grid-column: 1 / -1;
        }

        /* Folder Detail View */
        .folder-detail {
            padding: 0;
        }

        .folder-back-btn {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 8px 12px;
            background: transparent;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            color: var(--color-text-tertiary);
            margin-bottom: 12px;
            transition: background 0.15s;
        }

        .folder-back-btn:hover {
            background: var(--color-bg-hover);
            color: var(--color-text-secondary);
        }

        .folder-detail-title {
            font-size: 24px;
            font-weight: 700;
            color: var(--color-text);
            margin: 0 0 20px 0;
        }

        .folder-detail-sessions {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .folder-session-item {
            padding: 14px 16px;
            border: 1px solid var(--color-border);
            border-radius: 8px;
            background: white;
            cursor: pointer;
            transition: background 0.15s, box-shadow 0.15s;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .folder-session-item:hover {
            background: #f9fafb;
            box-shadow: 0 1px 4px rgba(0,0,0,0.05);
        }

        .folder-session-info {
            flex: 1;
            min-width: 0;
        }

        .folder-session-title {
            font-size: 14px;
            font-weight: 500;
            color: var(--color-text);
            margin-bottom: 4px;
        }

        .folder-session-meta {
            font-size: 12px;
            color: var(--color-text-muted);
        }

        .folder-session-remove-btn {
            flex-shrink: 0;
            width: 28px;
            height: 28px;
            border: none;
            background: transparent;
            color: var(--color-text-muted);
            font-size: 18px;
            cursor: pointer;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.15s, background 0.15s, color 0.15s;
        }

        .folder-session-item:hover .folder-session-remove-btn {
            opacity: 1;
        }

        .folder-session-remove-btn:hover {
            background: #fee2e2;
            color: #dc2626;
        }

        .folder-detail-empty {
            text-align: center;
            color: var(--color-text-muted);
            font-size: 14px;
            padding: 40px 0;
        }

        /* Drag-and-drop visual feedback */
        .folder-card.drag-over {
            border-color: var(--color-primary);
            background: var(--color-primary-light);
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
        }

        .folder-card.drop-success {
            border-color: #22c55e;
            background: #f0fdf4;
            box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
            transition: all 0.3s;
        }

        .left-sidebar-session-item[draggable="true"] {
            cursor: grab;
        }

        .left-sidebar-session-item[draggable="true"]:active {
            cursor: grabbing;
        }

        .left-sidebar-session-item.dragging {
            opacity: 0.4;
        }

        /* Inline rename input */
        .folder-rename-input {
            font-size: 16px;
            font-weight: 600;
            color: var(--color-text);
            border: 1px solid var(--color-primary);
            border-radius: 4px;
            padding: 2px 6px;
            outline: none;
            width: 100%;
            background: white;
        }

        /* ==================== Large Font Mode ==================== */
        body.large-font {
            --font-size-xs: 14px;
            --font-size-sm: 15px;
            --font-size-base: 17px;
            --font-size-md: 18px;
            --font-size-lg: 20px;
        }

        /* News Cards */
        body.large-font .news-title {
            font-size: 24px;
        }

        body.large-font .news-meta {
            font-size: 18px;
        }

        body.large-font .news-excerpt {
            font-size: 17px;
        }

        body.large-font .btn-read-more {
            font-size: 17px;
        }

        /* AI Summary (search mode) */
        body.large-font .ai-summary-header {
            font-size: 22px;
        }

        body.large-font .summary-content {
            font-size: 17px;
        }

        body.large-font .summary-title {
            font-size: 19px;
        }

        /* Deep Research chat messages */
        body.large-font .chat-message-bubble {
            font-size: 17px;
        }

        body.large-font .chat-message.assistant .chat-message-bubble h1 {
            font-size: 24px;
        }

        body.large-font .chat-message.assistant .chat-message-bubble h2 {
            font-size: 21px;
        }

        body.large-font .chat-message.assistant .chat-message-bubble h3 {
            font-size: 19px;
        }

        /* Clarification card in large font */
        body.large-font .clarification-header {
            font-size: 20px;
        }

        body.large-font .question-text {
            font-size: 19px;
        }

        body.large-font .option-chip {
            font-size: 17px;
            padding: 10px 20px;
        }

        /* Deep Research collapsible sections */
        body.large-font .research-section-header .section-title {
            font-size: 20px;
        }

        body.large-font .research-section-content {
            font-size: 17px;
        }

        body.large-font .research-section-content h1 {
            font-size: 24px;
        }

        body.large-font .research-section-content h2 {
            font-size: 21px;
        }

        body.large-font .research-section-content h3 {
            font-size: 19px;
        }

        body.large-font .btn-toggle-all {
            font-size: 15px;
        }

        /* Timeline view */
        body.large-font .date-label {
            font-size: 18px;
        }

        /* Large Font Toggle Button */
        .btn-font-size {
            background: none;
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            cursor: pointer;
            font-size: 16px;
            font-weight: 700;
            color: var(--color-text-tertiary);
            padding: 4px 10px;
            transition: all 0.2s;
            font-family: serif;
            line-height: 1;
        }

        .btn-font-size:hover {
            border-color: var(--color-primary);
            color: var(--color-primary);
        }

        .btn-font-size.active {
            background: var(--color-primary);
            color: white;
            border-color: var(--color-primary);
        }

        /* ==================== KG Visibility Toggle ==================== */
        .kg-hide-btn {
            background: none;
            border: 1px solid var(--color-border-light);
            border-radius: var(--radius-md);
            cursor: pointer;
            font-size: 13px;
            color: var(--color-text-tertiary);
            padding: 4px 10px;
            transition: all 0.2s;
        }

        .kg-hide-btn:hover {
            border-color: var(--color-danger);
            color: var(--color-danger);
        }

        .kg-restore-bar {
            display: none;
            background: #f8fafc;
            border: 1px dashed var(--color-border);
            border-radius: var(--radius-lg);
            padding: 10px 16px;
            margin-bottom: 16px;
            text-align: center;
            cursor: pointer;
            color: var(--color-text-tertiary);
            font-size: 13px;
            transition: all 0.2s;
        }

        .kg-restore-bar:hover {
            background: var(--color-primary-light);
            border-color: var(--color-primary);
            color: var(--color-primary);
        }

        /* ==================== Clarification Multi-Select Hint ==================== */
        .multi-select-hint {
            font-size: 12px;
            color: var(--color-text-muted);
            font-weight: 400;
            margin-left: 6px;
        }

        body.large-font .multi-select-hint {
            font-size: 14px;
        }

        /* ==================== VS Code Style Tree View ==================== */

        /* Tree View 工具列 */
        .tree-view-toolbar {
            display: flex;
            align-items: center;
            gap: 2px;
            padding: 4px 8px;
            background: #f3f4f6;
            border-bottom: 1px solid var(--color-border);
            margin: -16px -16px 12px -16px;
        }

        .tree-toolbar-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            background: transparent;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            color: #6b7280;
            transition: all 0.15s;
        }

        .tree-toolbar-btn:hover {
            background: #e5e7eb;
            color: #374151;
        }

        .tree-toolbar-btn:active {
            background: #d1d5db;
        }

        .tree-toolbar-spacer {
            flex: 1;
        }

        /* Tree View 容器 */
        .tree-view-container {
            font-size: 13px;
            user-select: none;
        }

        .tree-view-loading,
        .tree-view-empty {
            color: var(--color-text-muted);
            font-size: 13px;
            text-align: center;
            padding: 24px 12px;
        }

        /* Tree 資料夾 */
        .tree-folder {
            margin-bottom: 2px;
        }

        .tree-folder-header {
            display: flex;
            align-items: center;
            padding: 4px 6px;
            border-radius: 4px;
            cursor: pointer;
            transition: background 0.1s;
            position: relative;
        }

        .tree-folder-header:hover {
            background: #e5e7eb;
        }

        .tree-folder-header.drag-over {
            background: #dbeafe;
            outline: 2px dashed var(--color-primary);
            outline-offset: -2px;
        }

        .tree-folder-chevron {
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #9ca3af;
            transition: transform 0.15s;
            flex-shrink: 0;
        }

        .tree-folder-chevron svg {
            width: 10px;
            height: 10px;
        }

        .tree-folder.collapsed .tree-folder-chevron {
            transform: rotate(-90deg);
        }

        .tree-folder-icon {
            width: 16px;
            height: 16px;
            margin-right: 6px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .tree-folder-icon svg {
            width: 14px;
            height: 14px;
        }

        .tree-folder-icon.open svg {
            color: #fbbf24;
        }

        .tree-folder-icon.closed svg {
            color: #9ca3af;
        }

        .tree-folder-name {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 13px;
            color: var(--color-text);
        }

        .tree-folder-name.uncategorized {
            color: var(--color-text-tertiary);
            font-style: italic;
        }

        .tree-folder-count {
            font-size: 11px;
            color: var(--color-text-muted);
            margin-left: 6px;
            flex-shrink: 0;
        }

        .tree-folder-actions {
            display: none;
            align-items: center;
            gap: 2px;
            margin-left: 4px;
            flex-shrink: 0;
        }

        .tree-folder-header:hover .tree-folder-actions {
            display: flex;
        }

        .tree-folder-action-btn {
            width: 18px;
            height: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            border-radius: 3px;
            cursor: pointer;
            color: #9ca3af;
            font-size: 12px;
            transition: all 0.1s;
        }

        .tree-folder-action-btn:hover {
            background: #d1d5db;
            color: #374151;
        }

        .tree-folder-action-btn.delete:hover {
            background: #fee2e2;
            color: #dc2626;
        }

        /* 三點選單 */
        .tree-folder-menu {
            position: relative;
        }

        .tree-folder-menu-btn {
            width: 18px;
            height: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            border-radius: 3px;
            cursor: pointer;
            color: #9ca3af;
            font-size: 14px;
            transition: all 0.1s;
        }

        .tree-folder-menu-btn:hover {
            background: #d1d5db;
            color: #374151;
        }

        .tree-folder-dropdown {
            position: absolute;
            top: 100%;
            right: 0;
            background: white;
            border: 1px solid var(--color-border);
            border-radius: 6px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.12);
            min-width: 100px;
            z-index: var(--z-dropdown);
            display: none;
            overflow: hidden;
        }

        .tree-folder-dropdown.visible {
            display: block;
        }

        .tree-folder-dropdown-item {
            display: block;
            width: 100%;
            padding: 8px 12px;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 12px;
            color: var(--color-text-secondary);
            text-align: left;
            transition: background 0.1s;
        }

        .tree-folder-dropdown-item:hover {
            background: var(--color-bg-hover);
        }

        .tree-folder-dropdown-item.danger {
            color: #ef4444;
        }

        .tree-folder-dropdown-item.danger:hover {
            background: var(--color-danger-bg);
        }

        /* Tree 資料夾重命名輸入框 */
        .tree-folder-rename-input {
            flex: 1;
            min-width: 0;
            font-size: 13px;
            padding: 2px 6px;
            border: 1px solid var(--color-primary);
            border-radius: 3px;
            outline: none;
            background: white;
        }

        /* Tree 資料夾內容 */
        .tree-folder-content {
            padding-left: 16px;
            overflow: hidden;
            transition: max-height 0.2s ease-out;
        }

        .tree-folder.collapsed .tree-folder-content {
            max-height: 0 !important;
            padding-top: 0;
            padding-bottom: 0;
        }

        /* Tree 項目 (來源/檔案) */
        .tree-item {
            display: flex;
            align-items: center;
            padding: 4px 6px 4px 8px;
            border-radius: 4px;
            cursor: pointer;
            transition: background 0.1s;
            position: relative;
        }

        .tree-item:hover {
            background: #f3f4f6;
        }

        .tree-item.dragging {
            opacity: 0.5;
            background: #e5e7eb;
        }

        .tree-item.drag-over {
            background: #dbeafe;
        }

        .tree-item-checkbox {
            width: 14px;
            height: 14px;
            margin-right: 8px;
            flex-shrink: 0;
            cursor: pointer;
            accent-color: var(--color-primary);
        }

        .tree-item-icon {
            width: 14px;
            height: 14px;
            margin-right: 6px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
        }

        .tree-item-name {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 13px;
            color: var(--color-text-secondary);
        }

        .tree-item-desc {
            font-size: 11px;
            color: var(--color-text-muted);
            margin-left: 8px;
            flex-shrink: 0;
            max-width: 80px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .tree-item-label {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 13px;
            color: var(--color-text-secondary);
        }

        /* Two-line tree item layout */
        .tree-item.tree-item-two-line {
            align-items: flex-start;
            padding: 6px 8px 6px 24px;
        }

        .tree-item-two-line .tree-item-checkbox {
            margin-top: 2px;
        }

        .tree-item-text {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .tree-item-main {
            font-size: 13px;
            color: var(--color-text-primary);
            font-weight: 500;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .tree-item-sub {
            font-size: 11px;
            color: var(--color-text-muted);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .tree-item-status {
            font-size: 10px;
            padding: 2px 6px;
            border-radius: 10px;
            margin-left: 6px;
            flex-shrink: 0;
        }

        .tree-item-status.ready {
            background: #d1fae5;
            color: #059669;
        }

        .tree-item-status.processing {
            background: #fef3c7;
            color: #d97706;
        }

        .tree-item-status.failed {
            background: #fee2e2;
            color: #dc2626;
        }

        .tree-item-actions {
            display: none;
            align-items: center;
            gap: 2px;
            margin-left: 4px;
            flex-shrink: 0;
        }

        .tree-item:hover .tree-item-actions {
            display: flex;
        }

        .tree-item-action-btn {
            width: 18px;
            height: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            border-radius: 3px;
            cursor: pointer;
            color: #9ca3af;
            font-size: 11px;
            transition: all 0.1s;
        }

        .tree-item-action-btn:hover {
            background: #e5e7eb;
            color: #374151;
        }

        .tree-item-action-btn.delete:hover {
            background: #fee2e2;
            color: #dc2626;
        }

        /* 拖曳視覺效果 */
        .tree-drag-preview {
            position: fixed;
            padding: 4px 10px;
            background: white;
            border: 1px solid var(--color-primary);
            border-radius: 4px;
            font-size: 12px;
            color: var(--color-text);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            pointer-events: none;
            z-index: 10000;
            max-width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        /* 新增資料夾輸入列 */
        .tree-new-folder-row {
            display: flex;
            align-items: center;
            padding: 4px 6px;
            gap: 6px;
        }

        .tree-new-folder-input {
            flex: 1;
            min-width: 0;
            font-size: 13px;
            padding: 4px 8px;
            border: 1px solid var(--color-primary);
            border-radius: 4px;
            outline: none;
        }

        .tree-new-folder-btn {
            padding: 4px 10px;
            font-size: 12px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.15s;
        }

        .tree-new-folder-btn.confirm {
            background: var(--color-primary);
            color: white;
        }

        .tree-new-folder-btn.confirm:hover {
            background: var(--color-primary-hover);
        }

        .tree-new-folder-btn.cancel {
            background: #e5e7eb;
            color: #374151;
        }

        .tree-new-folder-btn.cancel:hover {
            background: #d1d5db;
        }

        /* Large font mode */
        body.large-font .tree-view-container {
            font-size: 15px;
        }

        body.large-font .tree-folder-name,
        body.large-font .tree-item-name,
        body.large-font .tree-item-label,
        body.large-font .tree-item-main {
            font-size: 15px;
        }

        body.large-font .tree-folder-count,
        body.large-font .tree-item-desc,
        body.large-font .tree-item-sub {
            font-size: 13px;
        }
