        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            /* ChatGPT-inspired color palette */
            --primary-text: #202123;
            --secondary-text: #6e6e80;
            --message-bg: #f7f7f8;
            --sidebar-bg: #f9f9f9;
            --border-light: #e5e5e7;
            --border-lighter: #ececec;
            --white: #ffffff;
            --hover-bg: #f0f0f0;
            --user-msg-bg: #343541;
            --user-msg-text: #ececf1;
            --btn-primary: #19c37d;
            --btn-hover: #1a7f5a;
            --pdf-viewer-bg: #f7f7f8;
            --header-bg: #ffffff;
            --input-border: #d9d9e3;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            margin: 0;
            padding: 0;
            height: 100vh;
            background: var(--white);
            color: var(--primary-text);
            overflow: hidden;
        }

        .container {
            display: flex;
            height: 100vh;
            overflow: hidden;
        }

        /* Chat Panel */
        .chat-panel {
            flex: 0 0 auto;
            width: 50%;
            min-width: 320px;
            display: flex;
            flex-direction: column;
            background: var(--white);
        }

        .panel-resizer {
            width: 8px;
            background: var(--border-light);
            cursor: col-resize;
            flex-shrink: 0;
            position: relative;
            transition: background 0.2s;
        }

        .panel-resizer::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 2px;
            height: 40px;
            background: var(--secondary-text);
            border-radius: 1px;
            opacity: 0.6;
        }

        .panel-resizer:hover,
        body.resizing .panel-resizer {
            background: rgba(25, 195, 125, 0.2);
        }

        body.resizing {
            cursor: col-resize;
            user-select: none;
        }

        body.resizing * {
            cursor: col-resize !important;
        }

        .chat-header {
            padding: 18px 24px;
            border-bottom: 1px solid var(--border-light);
            background: var(--header-bg);
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 60px;
            box-sizing: border-box;
        }

        .chat-header h1 {
            font-size: 18px;
            font-weight: 600;
            color: var(--primary-text);
        }

        .chat-header button {
            padding: 8px 16px;
            background: var(--white);
            border: 1px solid var(--border-light);
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            color: var(--primary-text);
            transition: all 0.2s;
        }

        .chat-header button:hover {
            background: var(--hover-bg);
            border-color: var(--primary-text);
        }

        /* Progress Indicator */
        .progress-container {
            padding: 12px 24px;
            background: var(--white);
            border-top: 1px solid var(--border-light);
            display: none;
        }

        .progress-container.active {
            display: block;
        }

        .progress-steps {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
        }

        .progress-step {
            flex: 1;
            text-align: center;
            position: relative;
            font-size: 12px;
            color: var(--secondary-text);
        }

        .progress-step.active {
            color: var(--btn-primary);
            font-weight: 600;
        }

        .progress-step.completed {
            color: var(--btn-primary);
        }

        .progress-step::before {
            content: '';
            display: block;
            width: 24px;
            height: 24px;
            margin: 0 auto 6px;
            border-radius: 50%;
            background: var(--border-light);
            border: 2px solid var(--border-light);
        }

        .progress-step.active::before {
            background: var(--white);
            border-color: var(--btn-primary);
            animation: pulse 2s infinite;
        }

        .progress-step.completed::before {
            background: var(--btn-primary);
            border-color: var(--btn-primary);
            content: '✓';
            color: white;
            line-height: 20px;
            font-size: 14px;
        }

        .progress-step:not(:last-child)::after {
            content: '';
            position: absolute;
            top: 12px;
            left: 60%;
            width: 80%;
            height: 2px;
            background: var(--border-light);
        }

        .progress-step.completed:not(:last-child)::after {
            background: var(--btn-primary);
        }

        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.1); }
        }

        .progress-bar {
            height: 4px;
            background: var(--border-light);
            border-radius: 2px;
            overflow: hidden;
        }

        .progress-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--btn-primary), var(--btn-hover));
            width: 0%;
            transition: width 0.5s ease;
        }

        /* Messages Area */
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 24px;
            background: var(--white);
        }

        .message {
            margin-bottom: 24px;
            display: flex;
            gap: 16px;
            align-items: flex-start;
        }

        .message-avatar {
            width: 60px;
            height: 32px;
            border-radius: 4px;
            background: var(--btn-primary);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 600;
            font-size: 12px;
            flex-shrink: 0;
        }

        .message-user .message-avatar {
            background: var(--user-msg-bg);
        }

        .message-content {
            flex: 1;
            line-height: 1.6;
            white-space: pre-wrap;
            word-wrap: break-word;
            text-align: left;
            padding: 16px;
        }

        .message-user {
            padding: 0;
        }

        .message-user .message-content {
            background: var(--message-bg);
            border-radius: 12px;
        }

        .message-assistant {
            padding: 0;
        }

        .file-attachment {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 4px 8px;
            background: var(--white);
            border: 1px solid var(--border-light);
            border-radius: 6px;
            margin-top: 8px;
            font-size: 13px;
            color: var(--secondary-text);
        }

        /* Status Messages */
        .status-message {
            background: var(--message-bg);
            border-left: 3px solid var(--btn-primary);
            padding: 12px 16px;
            margin: 16px 0;
            border-radius: 0 8px 8px 0;
            font-size: 14px;
            color: var(--secondary-text);
        }

        .status-message.error {
            border-left-color: #dc3545;
            background: #fff5f5;
        }

        .status-message.processing {
            border-left-color: #ffc107;
            background: #fffbf0;
        }

        /* Input Area */
        .chat-input-container {
            padding: 16px 24px 24px;
            border-top: 1px solid var(--border-light);
            background: var(--white);
        }

        .input-wrapper {
            display: flex;
            align-items: flex-end;
            gap: 12px;
            padding: 12px;
            background: var(--white);
            border: 1px solid var(--input-border);
            border-radius: 12px;
            box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
            transition: border-color 0.2s;
        }

        .input-wrapper:focus-within {
            border-color: var(--btn-primary);
            box-shadow: 0 0 0 1px var(--btn-primary);
        }

        .attach-btn {
            width: 32px;
            height: 32px;
            padding: 6px;
            background: none;
            border: none;
            cursor: pointer;
            color: var(--secondary-text);
            transition: color 0.2s;
            flex-shrink: 0;
        }

        .attach-btn:hover {
            color: var(--primary-text);
        }

        #chatInput {
            flex: 1;
            border: none;
            outline: none;
            font-size: 15px;
            resize: none;
            min-height: 24px;
            max-height: 200px;
            line-height: 1.5;
            font-family: inherit;
            background: transparent;
        }

        .send-btn {
            width: 32px;
            height: 32px;
            padding: 6px;
            background: var(--btn-primary);
            border: none;
            border-radius: 6px;
            cursor: pointer;
            color: white;
            transition: background 0.2s;
            flex-shrink: 0;
        }

        .send-btn:hover {
            background: var(--btn-hover);
        }

        .send-btn:disabled {
            background: var(--border-light);
            cursor: not-allowed;
        }

        /* PDF Viewer Panel - Responsive width */
        .pdf-panel {
            flex: 1 1 auto;   /* Allow grow and shrink */
            width: auto;      /* Auto width based on flex */
            min-width: 400px; /* Minimum width */
            max-width: none;  /* No max limit */
            background: #f7f7f8;
            display: flex;
            flex-direction: column;
            border-left: 1px solid var(--border-light);
        }

        .pdf-header {
            padding: 18px 24px;
            background: var(--white);
            border-bottom: 1px solid var(--border-light);
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 60px;
            box-sizing: border-box;
        }

        .pdf-title {
            font-size: 18px;  /* 与左侧标题大小一致 */
            font-weight: 600;  /* 与左侧标题粗细一致 */
            color: var(--primary-text);
            display: flex;
            align-items: center;
            gap: 16px;
        }

        /* View toggle buttons */
        .view-toggle {
            display: flex;
            gap: 8px;
            background: var(--message-bg);
            padding: 4px;
            border-radius: 8px;
        }

        .view-toggle button {
            padding: 6px 16px !important;
            background: transparent !important;
            border: none !important;
            border-radius: 6px !important;
            cursor: pointer;
            font-size: 14px !important;
            color: var(--secondary-text) !important;
            transition: all 0.2s;
            font-weight: 500;
        }

        .view-toggle button.active {
            background: var(--white) !important;
            color: var(--primary-text) !important;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

        .view-toggle button:hover:not(.active) {
            color: var(--primary-text) !important;
        }

        .view-toggle button[disabled],
        .view-toggle button.unavailable {
            opacity: 0.4 !important;
            cursor: not-allowed !important;
            color: var(--border-light) !important;
            box-shadow: none !important;
        }

        .pdf-controls {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .pdf-controls button {
            padding: 6px 12px;
            background: var(--white);
            border: 1px solid var(--border-light);
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            transition: all 0.2s;
            white-space: nowrap;
            min-width: fit-content;
        }
        
        /* 缩放按钮特殊样式 */
        #zoomInBtn, #zoomOutBtn {
            padding: 6px 10px;
            font-weight: bold;
        }
        
        #fitBtn {
            padding: 6px 10px;
        }
        
        #zoomLevel {
            font-weight: bold;
            min-width: 50px;
            text-align: center;
        }

        .pdf-controls button:hover:not(:disabled) {
            background: var(--hover-bg);
        }

        .pdf-controls button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .page-info {
            font-size: 13px;
            color: var(--secondary-text);
            padding: 0 12px;
        }

        /* File Upload Area */
        .file-upload-area {
            margin-bottom: 12px;
            padding: 12px;
            background: var(--message-bg);
            border-radius: 12px;
            border: 1px dashed var(--border-light);
        }
        
        /* Dropdown menu for upload button */
        .upload-dropdown {
            position: relative;
            display: inline-block;
        }
        
        .upload-menu {
            display: none;
            position: absolute;
            bottom: 100%;
            left: 0;
            background: var(--white);
            border: 1px solid var(--border-light);
            border-radius: 6px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            margin-bottom: 4px;
            min-width: 180px;  /* 增大最小宽度，防止换行 */
            z-index: 1000;
        }
        
        .upload-menu.show {
            display: block;
        }
        
        .upload-menu button {
            display: block;
            width: 100%;
            padding: 12px 16px;  /* 增大内边距 */
            border: none;
            background: none;
            text-align: left;
            cursor: pointer;
            font-size: 15px;  /* 增大字体 */
            color: var(--primary-text);
            white-space: nowrap;  /* 防止文字换行 */
        }
        
        .upload-menu button:hover {
            background: var(--hover-bg);
        }
        
        /* Drag and drop overlay */
        .drag-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(25, 195, 125, 0.1);
            border: 3px dashed var(--btn-primary);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            pointer-events: none;
        }
        
        .drag-overlay.active {
            display: flex;
        }
        
        .drag-overlay-content {
            background: var(--white);
            padding: 20px 40px;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
            text-align: center;
        }
        
        .drag-overlay-content svg {
            width: 48px;
            height: 48px;
            color: var(--btn-primary);
            margin-bottom: 12px;
        }
        
        .drag-overlay-content p {
            font-size: 16px;
            color: var(--primary-text);
            margin: 0;
        }

        .file-list {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .file-item {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            background: var(--white);
            border: 1px solid var(--border-light);
            border-radius: 6px;
            font-size: 13px;
        }

        .file-item button {
            background: none;
            border: none;
            color: var(--secondary-text);
            cursor: pointer;
            padding: 0;
            margin-left: 4px;
        }

        .file-item button:hover {
            color: #dc3545;
        }

        /* Canvas - 优化显示质量 */
        #pdfCanvas {
            max-width: 100%;
            height: auto;
            display: block;
            margin: 0 auto;
            image-rendering: crisp-edges;  /* 确保清晰的边缘 */
            image-rendering: -webkit-optimize-contrast;  /* Safari */
            -ms-interpolation-mode: nearest-neighbor;  /* IE */
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);  /* 添加阴影增加立体感 */
        }

        #pdfViewer {
            flex: 1;
            overflow-y: auto;
            overflow-x: auto;  /* 允许横向滚动如果PDF太宽 */
            padding: 20px;
            display: flex;
            align-items: flex-start;  /* 从顶部开始对齐而不是居中 */
            justify-content: center;
            background: #f7f7f8;
            position: relative;  /* 为滚轮事件定位 */
            cursor: grab;  /* 显示可以交互 */
        }

        #pdfViewer:active {
            cursor: grabbing;  /* 拖动时的光标 */
        }

        .empty-state {
            text-align: center;
            color: #999;
            padding: 40px;
        }

        .empty-state svg {
            width: 64px;
            height: 64px;
            margin-bottom: 16px;
            opacity: 0.3;
        }

        /* File Browser */
        #fileBrowser {
            display: none;
            flex: 1;
            background: var(--white);
            overflow: hidden;
        }

        .file-browser-container {
            display: flex;
            height: 100%;
        }

        .file-tree {
            width: 300px;
            border-right: 1px solid var(--border-light);
            overflow-y: auto;
            padding: 12px;
            background: var(--sidebar-bg);
        }

        .file-tree-item {
            padding: 6px 8px;
            cursor: pointer;
            border-radius: 6px;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 6px;
            user-select: none;
        }

        .file-tree-item:hover {
            background: var(--hover-bg);
        }

        .file-tree-item.selected {
            background: var(--message-bg);
            color: var(--btn-primary);
            font-weight: 500;
        }

        .file-tree-item.directory {
            font-weight: 500;
        }

        .file-tree-children {
            margin-left: 16px;
        }

        .file-tree-toggle {
            width: 16px;
            height: 16px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            transition: transform 0.2s;
        }

        .file-tree-toggle.expanded {
            transform: rotate(90deg);
        }

        .file-content-viewer {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: var(--white);
        }

        .file-content-header {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border-light);
            background: var(--message-bg);
            font-size: 13px;
            color: var(--secondary-text);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .file-content-body {
            flex: 1;
            overflow: auto;
            padding: 16px;
        }

        .file-content-code {
            background: #f6f8fa;
            border: 1px solid var(--border-light);
            border-radius: 6px;
            padding: 16px;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 13px;
            line-height: 1.6;
            white-space: pre-wrap;
            word-wrap: break-word;
            color: #24292f;
        }

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

        /* VTK Viewer */
        #vtkViewer {
            flex: 1;
            background: var(--white);
            overflow: hidden;
        }

        .vtk-viewer-container {
            display: grid;
            grid-template-columns: 264px 1fr;
            grid-template-rows: auto 1fr;
            width: 100%;
            height: 100%;
            gap: 0;
        }

        /* VTK左侧文件列表 */
        .vtk-file-list {
            grid-column: 1;
            grid-row: 1 / 3;
            border-right: 1px solid var(--border-light);
            background: var(--sidebar-bg);
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }

        .vtk-file-list-header {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border-light);
            background: var(--white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 47px;
            box-sizing: border-box;
        }

        .vtk-file-list-header h3 {
            font-size: 14px;
            font-weight: 600;
            margin: 0;
            color: var(--primary-text);
        }

        .vtk-file-list-header span {
            font-size: 12px;
            color: var(--secondary-text);
        }

        .vtk-file-tree {
            flex: 1;
            padding: 8px;
        }

        .vtk-file-item {
            padding: 8px 12px;
            margin: 2px 0;
            cursor: pointer;
            border-radius: 6px;
            font-size: 13px;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: background 0.2s;
        }

        .vtk-file-item:hover {
            background: var(--hover-bg);
        }

        .vtk-file-item.selected {
            background: var(--message-bg);
            color: var(--btn-primary);
            font-weight: 500;
        }

        /* VTK渲染窗口 */
        .vtk-render-window {
            grid-column: 2;
            grid-row: 2;
            position: relative;
            background: #f7f7f8;
        }

        .vtk-container {
            width: 100%;
            height: 100%;
        }

        .vtk-loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: white;
            display: none;
        }

        .vtk-loading.active {
            display: block;
        }

        .spinner {
            display: flex;
            gap: 8px;
            justify-content: center;
            align-items: center;
            height: 40px;
            margin: 0 auto 16px;
        }

        .spinner::before {
            content: 'Generating...';
            color: #666;
            font-size: 14px;
            animation: none;
        }

        .spinner::after {
            display: none;
        }

        @keyframes bounce {
            0%, 80%, 100% {
                transform: scale(0);
                opacity: 0.5;
            }
            40% {
                transform: scale(1);
                opacity: 1;
            }
        }

        .panel-loading {
            display: none !important;  /* 使用骨架屏代替，不再显示旧的spinner */
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 10px;
            width: 100%;
            padding: 32px 16px;
            color: var(--secondary-text);
            text-align: center;
        }

        .panel-loading.active {
            display: none !important;  /* 强制隐藏，使用骨架屏 */
        }

        .panel-loading .spinner {
            height: 22px;
            margin: 0;
        }

        .panel-loading .spinner::before,
        .panel-loading .spinner::after {
            width: 8px;
            height: 8px;
            background: var(--btn-primary);
        }

        /* Skeleton Loading Styles */
        .skeleton {
            background: linear-gradient(
                90deg,
                var(--message-bg) 0%,
                var(--border-lighter) 50%,
                var(--message-bg) 100%
            );
            background-size: 200% 100%;
            animation: skeleton-loading 1.5s ease-in-out infinite;
            border-radius: 6px;
        }

        @keyframes skeleton-loading {
            0% {
                background-position: 200% 0;
            }
            100% {
                background-position: -200% 0;
            }
        }

        .skeleton-container {
            padding: 20px;
            display: none;
        }

        .skeleton-container.active {
            display: block;
        }

        /* PDF Report Skeleton */
        .skeleton-pdf {
            width: 100%;
            max-width: 800px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .skeleton-pdf-header {
            height: 40px;
            width: 60%;
            margin-bottom: 20px;
        }

        .skeleton-pdf-page {
            height: 600px;
            width: 100%;
        }

        .skeleton-pdf-footer {
            height: 20px;
            width: 40%;
            margin: 20px auto 0;
        }

        /* File Browser Skeleton */
        .skeleton-files {
            display: flex;
            gap: 16px;
            height: 100%;
        }

        .skeleton-files-tree {
            width: 300px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 12px;
        }

        .skeleton-file-item {
            height: 32px;
            width: 100%;
        }

        .skeleton-file-item:nth-child(2),
        .skeleton-file-item:nth-child(4) {
            width: 90%;
            margin-left: 20px;
        }

        .skeleton-file-item:nth-child(3),
        .skeleton-file-item:nth-child(6) {
            width: 85%;
            margin-left: 20px;
        }

        .skeleton-files-content {
            flex: 1;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .skeleton-file-content-header {
            height: 40px;
            width: 50%;
        }

        .skeleton-file-content-line {
            height: 16px;
            width: 100%;
        }

        .skeleton-file-content-line:nth-child(2) {
            width: 95%;
        }

        .skeleton-file-content-line:nth-child(3) {
            width: 88%;
        }

        .skeleton-file-content-line:nth-child(4) {
            width: 92%;
        }

        .skeleton-file-content-line:nth-child(5) {
            width: 80%;
        }

        /* VTK Viewer Skeleton */
        .skeleton-vtk {
            display: flex;
            height: 100%;
            gap: 0;
        }

        .skeleton-vtk-sidebar {
            width: 264px;
            border-right: 1px solid var(--border-light);
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .skeleton-vtk-file {
            height: 36px;
            width: 100%;
        }

        .skeleton-vtk-viewer {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f7f7f8;
        }

        .skeleton-vtk-3d {
            width: 300px;
            height: 300px;
            border-radius: 12px;
        }

        #pdfViewer.loading {
            align-items: center;
        }

        #pdfViewer.loading .empty-state,
        #pdfViewer.loading canvas {
            display: none !important;
        }

        #fileBrowser.loading,
        #vtkViewer.loading {
            display: flex !important;
            flex-direction: column;
        }

        #fileBrowser.loading .file-browser-container,
        #vtkViewer.loading .vtk-viewer-container {
            display: none;
        }

        /* VTK顶部控制面板 */
        .vtk-controls {
            grid-column: 2;
            grid-row: 1;
            border-bottom: 1px solid var(--border-light);
            background: var(--white);
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            overflow-x: auto;
            height: 47px;
            box-sizing: border-box;
        }

        .vtk-controls button {
            padding: 6px 16px;
            background: var(--white);
            border: 1px solid var(--border-light);
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .vtk-controls button:hover {
            background: var(--hover-bg);
            border-color: var(--btn-primary);
        }

        .vtk-controls select {
            padding: 6px 12px;
            border: 1px solid var(--border-light);
            border-radius: 6px;
            font-size: 13px;
            background: var(--white);
            cursor: pointer;
            min-width: 150px;
        }

        .vtk-controls .control-group {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .vtk-controls .control-label {
            font-size: 13px;
            color: var(--secondary-text);
            font-weight: 500;
        }

        /* VTK Mode Button Active State */
        .vtk-controls .control-group button.active {
            background: var(--btn-primary);
            color: white;
            border-color: var(--btn-primary);
        }

        .vtk-controls .control-group button.active:hover {
            background: var(--btn-hover);
            border-color: var(--btn-hover);
        }

        /* VTK Toast Notification */
        .vtk-toast {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: rgba(0, 0, 0, 0.85);
            color: white;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            z-index: 10001;
            pointer-events: none;
            opacity: 0;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            white-space: nowrap;
        }

        .vtk-toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }

        /* VTK Help Overlay */
        .vtk-help-overlay {
            position: fixed;
            top: 80px;
            right: 20px;
            background: white;
            border: 1px solid var(--border-light);
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
            padding: 20px 24px;
            max-width: 400px;
            z-index: 10002;
            opacity: 0;
            visibility: hidden;
            transform: scale(0.95) translateY(-10px);
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .vtk-help-overlay.show {
            opacity: 1;
            visibility: visible;
            transform: scale(1) translateY(0);
        }

        .vtk-help-content {
            position: relative;
        }

        .vtk-help-close {
            position: absolute;
            top: -8px;
            right: -8px;
            background: var(--border-light);
            border: none;
            border-radius: 50%;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: var(--secondary-text);
            font-size: 16px;
            transition: all 0.2s;
        }

        .vtk-help-close:hover {
            background: var(--btn-primary);
            color: white;
        }

        .vtk-help-content h4 {
            margin: 0 0 16px 0;
            font-size: 16px;
            color: var(--primary-text);
            font-weight: 600;
        }

        .vtk-help-content ul {
            list-style: none;
            padding: 0;
            margin: 0 0 16px 0;
        }

        .vtk-help-content ul li {
            padding: 8px 0;
            font-size: 14px;
            line-height: 1.6;
            color: var(--primary-text);
            border-bottom: 1px solid var(--border-lighter);
        }

        .vtk-help-content ul li:last-child {
            border-bottom: none;
        }

        .vtk-help-content ul li strong {
            color: var(--btn-primary);
            font-weight: 600;
            display: inline-block;
            min-width: 60px;
        }

        .vtk-help-tip {
            background: var(--message-bg);
            padding: 10px 12px;
            border-radius: 6px;
            font-size: 13px;
            line-height: 1.5;
            color: var(--secondary-text);
            margin: 8px 0;
            border-left: 3px solid var(--btn-primary);
        }

        .vtk-help-tip:last-child {
            margin-bottom: 0;
        }

        /* VTK Quick Hint Button */
        .vtk-quick-hint {
            position: absolute;
            bottom: 20px;
            right: 20px;
            z-index: 1000;
        }

        .vtk-quick-hint button {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: var(--btn-primary);
            color: white;
            border: none;
            cursor: pointer;
            font-size: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(25, 195, 125, 0.3);
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .vtk-quick-hint button:hover {
            background: var(--btn-hover);
            transform: scale(1.1);
            box-shadow: 0 6px 16px rgba(25, 195, 125, 0.4);
        }

        .vtk-quick-hint button:active {
            transform: scale(0.95);
        }

        /* VTK浮动控制面板 */
        .vtk-floating-panel {
            position: absolute;
            top: 60px;
            right: 20px;
            background: white;
            border: 1px solid var(--border-light);
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
            padding: 16px;
            min-width: 320px;
            z-index: 1001;
            opacity: 0;
            visibility: hidden;
            transform: scale(0.95) translateY(-10px);
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .vtk-floating-panel.show {
            opacity: 1;
            visibility: visible;
            transform: scale(1) translateY(0);
        }

        .panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border-lighter);
        }

        .panel-title {
            font-size: 15px;
            font-weight: 600;
            color: var(--primary-text);
        }

        .panel-close {
            background: var(--border-light);
            border: none;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: var(--secondary-text);
            font-size: 14px;
            transition: all 0.2s;
        }

        .panel-close:hover {
            background: #dc3545;
            color: white;
        }

        .panel-body {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .panel-row {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .panel-row label {
            font-size: 13px;
            font-weight: 500;
            color: var(--secondary-text);
        }

        .panel-inputs {
            display: flex;
            gap: 8px;
        }

        .panel-inputs input {
            flex: 1;
            padding: 8px 10px;
            border: 1px solid var(--border-light);
            border-radius: 6px;
            font-size: 13px;
            transition: border-color 0.2s;
        }

        .panel-inputs input:focus {
            outline: none;
            border-color: var(--btn-primary);
        }

        .panel-inputs input::placeholder {
            color: var(--secondary-text);
            opacity: 0.6;
        }

        .panel-apply {
            padding: 10px 16px;
            background: var(--btn-primary);
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: background 0.2s;
        }

        .panel-apply:hover {
            background: var(--btn-hover);
        }

        .panel-apply:active {
            transform: scale(0.98);
        }

        /* Slice/Clip按钮激活状态 */
        #sliceBtn.active,
        #clipBtn.active {
            background: rgba(25, 195, 125, 0.1);
            border-color: var(--btn-primary);
            color: var(--btn-primary);
        }

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

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

        ::-webkit-scrollbar-thumb {
            background: rgba(0, 0, 0, 0.1);
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: rgba(0, 0, 0, 0.2);
        }

        /* SVG Icons */
        svg {
            width: 20px;
            height: 20px;
        }

        /* Responsive */
        @media (max-width: 768px) {
            .container {
                flex-direction: column;
            }
            
            .panel-resizer {
                display: none;
            }

            .pdf-panel {
                display: none;
            }
            
            .chat-panel {
                min-width: unset;
            }

            refreshViewToggleState();
        }

        /* Login Modal Styles */
        .login-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #1a1a2e 0%, #0f0f23 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
        }

        .login-container {
            background: #1e1e2e;
            border-radius: 12px;
            padding: 40px;
            width: 100%;
            max-width: 400px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            border: 1px solid #2a2a3e;
        }

        .login-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .login-header h2 {
            color: #fff;
            font-size: 24px;
            margin-bottom: 8px;
        }

        .login-header p {
            color: #888;
            font-size: 14px;
        }

        .login-form {
            margin-bottom: 20px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            color: #888;
            font-size: 12px;
            margin-bottom: 8px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .form-group input {
            width: 100%;
            padding: 12px;
            background: #252535;
            border: 1px solid #3a3a4a;
            border-radius: 6px;
            color: #fff;
            font-size: 14px;
            transition: all 0.3s;
            box-sizing: border-box;
        }

        .form-group input:focus {
            outline: none;
            border-color: #4a9eff;
            background: #2a2a3a;
        }

        .login-button {
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, #4a9eff, #3a8eef);
            color: #fff;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .login-button:hover {
            background: linear-gradient(135deg, #5aafff, #4a9fff);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
        }

        .login-error {
            color: #ff6b6b;
            font-size: 12px;
            margin-top: 10px;
            margin-bottom: 10px;
            text-align: center;
            min-height: 20px;
        }

        .login-footer {
            text-align: center;
            color: #666;
            font-size: 11px;
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid #2a2a3e;
        }
        
        /* Header button styles */
        .header-btn {
            background: none !important;
            border: none !important;
            color: #888 !important;
            font-size: 18px !important;
            font-weight: normal !important;
            cursor: pointer !important;
            padding: 0 !important;
            transition: color 0.3s !important;
        }
        
        .header-btn:hover {
            color: #ccc !important;
        }

        /* History Sidebar Styles */
        .history-sidebar {
            width: 260px;
            background: #f7f7f8;
            color: #202123;
            display: flex;
            flex-direction: column;
            border-right: 1px solid #e5e5e7;
        }

        .sidebar-header {
            padding: 12px;
            border-bottom: 1px solid #e5e5e7;
            height: 60px;
            box-sizing: border-box;
            display: flex;
            align-items: center;
        }

        .new-chat-btn {
            width: 100%;
            padding: 12px;
            background: transparent;
            border: 1px solid #d9d9e3;
            border-radius: 6px;
            color: #202123;
            cursor: pointer;
            font-size: 14px;
        }

        .new-chat-btn:hover {
            background: #e5e5e7;
        }

        .conversation-list {
            flex: 1;
            overflow-y: auto;
            padding: 12px;
        }

        .time-group {
            margin-bottom: 20px;
        }

        .time-group-title {
            font-size: 12px;
            color: #6e6e80;
            margin-bottom: 8px;
            padding: 0 8px;
        }

        .conversation-item {
            padding: 10px 12px;
            border-radius: 6px;
            cursor: pointer;
            margin-bottom: 4px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: relative;
            transition: all 0.15s ease;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        .conversation-item:hover {
            background: #e5e5e7;
            transform: translateX(2px);
        }

        .conversation-item:active {
            background: #d9d9e3;
            transform: scale(0.98);
        }

        .conversation-item.active {
            background: #d9d9e3;
            font-weight: 500;
        }

        .conversation-item:focus {
            outline: 2px solid #19c37d;
            outline-offset: 1px;
        }

        .conversation-title {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-right: 8px;
            pointer-events: none;
        }

        .conversation-menu-btn {
            opacity: 0;
            padding: 4px 8px;
            border: none;
            background: transparent;
            cursor: pointer;
            font-size: 16px;
            color: #565869;
            transition: opacity 0.2s;
        }

        .conversation-item:hover .conversation-menu-btn {
            opacity: 1;
        }

        .conversation-menu-btn:hover {
            background: #d9d9e3;
            border-radius: 4px;
        }

        .conversation-menu {
            position: absolute;
            right: 12px;
            bottom: 100%;
            margin-bottom: 4px;
            background: white;
            border: 1px solid #d9d9e3;
            border-radius: 6px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            z-index: 10005;
            display: none;
            min-width: 150px;
        }

        .conversation-menu.active {
            display: block;
        }

        .conversation-menu-item {
            padding: 10px 16px;
            cursor: pointer;
            font-size: 14px;
            color: #202123;
            border: none;
            background: transparent;
            width: 100%;
            text-align: left;
        }

        .conversation-menu-item:hover {
            background: #f7f7f8;
        }

        .conversation-menu-item:first-child {
            border-radius: 6px 6px 0 0;
        }

        .conversation-menu-item:last-child {
            border-radius: 0 0 6px 6px;
        }

        .conversation-menu-item.delete {
            color: #d11a2a;
        }

        .version-badge {
            position: fixed;
            left: 16px;
            bottom: 16px;
            background: rgba(32, 33, 35, 0.25);
            color: rgba(110, 110, 128, 0.6);
            border-radius: 6px;
            padding: 6px 12px;
            font-size: 12px;
            letter-spacing: 0.3px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
            z-index: 4000;
            pointer-events: none;
        }

        /* 鼠标尾巴效果 - 前粗后细蓝色流线 */
        /* Toast 通知系统 */
        .toast-container {
            position: fixed;
            top: 80px;
            right: 24px;
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 12px;
            pointer-events: none;
        }

        .toast {
            background: white;
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
            padding: 16px 20px;
            display: flex;
            align-items: flex-start;
            gap: 12px;
            min-width: 320px;
            max-width: 420px;
            border-left: 4px solid;
            opacity: 0;
            transform: translateX(400px);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            pointer-events: all;
            position: relative;
            overflow: hidden;
        }

        .toast.show {
            opacity: 1;
            transform: translateX(0);
        }

        .toast.hiding {
            opacity: 0;
            transform: translateX(400px) scale(0.95);
        }

        /* Toast 类型样式 */
        .toast.success {
            border-left-color: #10b981;
        }

        .toast.error {
            border-left-color: #ef4444;
        }

        .toast.warning {
            border-left-color: #f59e0b;
        }

        .toast.info {
            border-left-color: #3b82f6;
        }

        /* Toast 图标 */
        .toast-icon {
            flex-shrink: 0;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            font-size: 14px;
            font-weight: bold;
        }

        .toast.success .toast-icon {
            background: #d1fae5;
            color: #10b981;
        }

        .toast.error .toast-icon {
            background: #fee2e2;
            color: #ef4444;
        }

        .toast.warning .toast-icon {
            background: #fef3c7;
            color: #f59e0b;
        }

        .toast.info .toast-icon {
            background: #dbeafe;
            color: #3b82f6;
        }

        /* Toast 内容 */
        .toast-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .toast-title {
            font-size: 14px;
            font-weight: 600;
            color: var(--primary-text);
            line-height: 1.4;
        }

        .toast-message {
            font-size: 13px;
            color: var(--secondary-text);
            line-height: 1.5;
        }

        /* Toast 关闭按钮 */
        .toast-close {
            flex-shrink: 0;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: none;
            background: transparent;
            color: var(--secondary-text);
            cursor: pointer;
            border-radius: 4px;
            font-size: 18px;
            line-height: 1;
            padding: 0;
            transition: all 0.2s;
        }

        .toast-close:hover {
            background: var(--hover-bg);
            color: var(--primary-text);
        }

        /* Toast 进度条 */
        .toast-progress {
            position: absolute;
            bottom: 0;
            left: 0;
            height: 3px;
            background: linear-gradient(90deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.15));
            transform-origin: left;
            transition: transform linear;
        }

        .toast.success .toast-progress {
            background: linear-gradient(90deg, #10b981, #059669);
        }

        .toast.error .toast-progress {
            background: linear-gradient(90deg, #ef4444, #dc2626);
        }

        .toast.warning .toast-progress {
            background: linear-gradient(90deg, #f59e0b, #d97706);
        }

        .toast.info .toast-progress {
            background: linear-gradient(90deg, #3b82f6, #2563eb);
        }

        /* Toast 图标内容 */
        .toast-icon-content {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
        }

        /* 响应式：移动端调整 */
        @media (max-width: 768px) {
            .toast-container {
                right: 12px;
                left: 12px;
                top: 70px;
            }

            .toast {
                min-width: unset;
                max-width: unset;
                width: 100%;
            }
        }

        /* ============================================ */
        /* Trame Viewer - Full Height Optimization */
        /* ============================================ */
        /* v1.70.10: Maximize Trame iframe to fill available screen space */

        #trameViewer {
            flex: 1 !important;              /* Fill remaining parent container space */
            overflow: hidden !important;     /* Prevent scrollbars */
            /* display controlled by JavaScript - removed display: flex !important */
            flex-direction: column !important;
            min-height: 0 !important;        /* Allow flex to shrink */
            height: 100% !important;         /* Full height */
        }

        /* v1.70.13: Trame viewer container with file list (Grid layout) */
        #trameViewer .trame-viewer-container {
            display: grid !important;
            grid-template-columns: 264px 1fr !important;
            width: 100% !important;
            height: 100% !important;
            flex: 1 !important;
            overflow: hidden !important;
        }

        /* Trame file list (left sidebar) */
        .trame-file-list {
            grid-column: 1;
            border-right: 1px solid var(--border-light);
            background: var(--sidebar-bg);
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }

        .trame-file-list-header {
            padding: 12px;
            border-bottom: 1px solid var(--border-light);
            background: var(--white);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .trame-file-list-header h3 {
            margin: 0;
            font-size: 14px;
            font-weight: 600;
            color: var(--primary-text);
        }

        .trame-file-list-header span {
            font-size: 12px;
            color: #999;
        }

        .trame-file-tree {
            flex: 1;
            overflow-y: auto;
            padding: 8px;
        }

        /* Trame file items (reuse VTK styles) */
        .trame-file-item {
            cursor: pointer;
            padding: 6px 8px;
            border-radius: 4px;
            transition: background 0.2s;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .trame-file-item:hover {
            background: var(--hover-bg);
        }

        .trame-file-item.selected {
            background: rgba(25, 195, 125, 0.1);
            color: var(--btn-primary);
            font-weight: 500;
        }

        /* Trame iframe (right panel) */
        #trameViewer iframe,
        #trameIframe {
            grid-column: 2;
            width: 100% !important;
            height: 100% !important;
            border: none;
            background: #1a1a1a;
        }
