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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: #f5f5f5;
            min-height: 100vh;
            overflow-x: hidden;
        }
        /* 主容器 */
        .main-container {
            padding-top: 0px;
            height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* Excel 风格选项卡工具栏 */
        .ribbon {
            background: #f3f2f1;
            border-bottom: 1px solid #d1d1d1;
            display: flex;
            flex-direction: column;
        }

        /* 选项卡头部 */
        .ribbon-tabs {
            display: flex;
            background: #f3f2f1;
            border-bottom: 1px solid #d1d1d1;
            padding: 0 8px;
        }

        .ribbon-tab {
            padding: 8px 16px;
            border: none;
            background: transparent;
            color: #333;
            font-size: 13px;
            cursor: pointer;
            border-bottom: 3px solid transparent;
            transition: all 0.15s ease;
        }

        .ribbon-tab:hover {
            background: #e1e1e1;
        }

        .ribbon-tab.active {
            background: #f3f2f1;
            border-bottom-color: #70ad47;
            color: #70ad47;
            font-weight: 600;
        }

        /* 折叠按钮 */
        .ribbon-collapse-btn {
            margin-left: auto;
            padding: 8px 12px;
            border: none;
            background: transparent;
            color: #666;
            font-size: 14px;
            cursor: pointer;
            border-bottom: 3px solid transparent;
            transition: all 0.15s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .ribbon-collapse-btn:hover {
            background: #e1e1e1;
            color: #333;
        }

        .ribbon-collapse-btn.collapsed {
            border-bottom-color: #70ad47;
            color: #70ad47;
        }

        .ribbon-collapse-btn.collapsed i {
            transform: rotate(180deg);
        }

        /* 工具栏内容区域 */
        .ribbon-content {
            padding: 8px 12px;
            display: flex;
            gap: 8px;
            align-items: stretch;
            min-height: 80px;
        }

        .ribbon-panel {
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding: 0 8px;
            border-right: 1px solid #d1d1d1;
            position: relative;
        }

        .ribbon-panel:last-child {
            border-right: none;
        }

        .ribbon-panel-title {
            font-size: 11px;
            color: #666;
            text-align: center;
            margin-top: auto;
            padding-top: 4px;
        }

        .ribbon-group {
            display: flex;
            gap: 2px;
            align-items: center;
        }

        .ribbon-group-vertical {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .ribbon-group-row {
            display: flex;
            gap: 2px;
        }

        /* 工具栏按钮 */
        .ribbon-btn {
            padding: 4px 8px;
            border: 1px solid transparent;
            background: transparent;
            color: #333;
            font-size: 12px;
            border-radius: 3px;
            cursor: pointer;
            transition: all 0.15s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 3px;
            white-space: nowrap;
            min-height: 28px;
        }

        .ribbon-btn:hover {
            background: #e1e1e1;
            border-color: #c6c6c6;
        }

        .ribbon-btn:active {
            background: #d5d5d5;
        }

        .ribbon-btn.active {
            background: #c6e0b4;
            border-color: #70ad47;
        }

        .ribbon-btn i {
            font-size: 14px;
        }

        .ribbon-btn-large {
            flex-direction: column;
            padding: 6px 12px;
            min-height: 56px;
            min-width: 48px;
        }

        .ribbon-btn-large i {
            font-size: 18px;
        }

        .ribbon-btn-large span {
            font-size: 11px;
        }

        /* 下拉框样式 */
        select.ribbon-btn {
            padding: 4px 6px;
            background: white;
            border: 1px solid #d1d1d1;
            min-width: 80px;
        }

        select.ribbon-btn:hover {
            background: white;
            border-color: #999;
        }

        /* 分隔线 */
        .ribbon-separator {
            width: 1px;
            background: #d1d1d1;
            margin: 0 4px;
        }

        /* 形状下拉面板 */
        .shape-more-btn {
            background: #e8e8e8;
            border: 1px solid #ccc;
        }

        .shape-more-btn:hover {
            background: #d8d8d8;
        }

        .shape-dropdown-panel {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            background: white;
            border: 1px solid #d1d1d1;
            border-radius: 4px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            z-index: 1000;
            max-height: 500px;
            overflow-y: auto;
            min-width: 320px;
            padding: 12px;
        }

        .shape-dropdown-panel.show {
            display: block;
        }

        .shape-category {
            margin-bottom: 16px;
        }

        .shape-category:last-child {
            margin-bottom: 0;
        }

        .shape-category-title {
            font-size: 12px;
            font-weight: 600;
            color: #333;
            margin-bottom: 8px;
            padding-bottom: 4px;
            border-bottom: 1px solid #e0e0e0;
        }

        .shape-grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 4px;
        }

        .shape-item {
            width: 36px;
            height: 36px;
            border: 1px solid transparent;
            background: transparent;
            border-radius: 3px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 4px;
            transition: all 0.15s ease;
        }

        .shape-item:hover {
            background: #f0f0f0;
            border-color: #c6c6c6;
        }

        .shape-item:active {
            background: #e0e0e0;
        }

        .shape-item svg {
            width: 100%;
            height: 100%;
        }

        /* 文本框编辑样式 */
        .textbox-edit-input {
            font-family: inherit;
            line-height: 1.4;
        }

        .textbox-edit-input:focus {
            background: rgba(255, 255, 255, 0.9) !important;
        }

        /* Office 风格公式栏 */
        .formula-bar {
            background: white;
            border-bottom: 1px solid #d1d1d1;
            padding: 6px 12px;
            display: flex;
            align-items: flex-start;
            gap: 8px;
            position: relative;
        }

        .cell-address {
            width: 70px;
            padding: 4px 8px;
            border: 1px solid #d1d1d1;
            border-radius: 2px;
            font-size: 12px;
            font-weight: 600;
            color: #333;
            text-align: center;
            background: white;
            margin-top: 2px;
        }

        .formula-input-wrapper {
            flex: 1;
            position: relative;
            display: flex;
            flex-direction: column;
        }

        .formula-input {
            width: 100%;
            min-height: 28px;
            max-height: 200px;
            padding: 4px 10px;
            border: 1px solid #d1d1d1;
            border-radius: 2px;
            font-size: 13px;
            font-family: 'Segoe UI', Arial, sans-serif;
            resize: none;
            overflow-y: auto;
            line-height: 1.4;
        }

        .formula-input:focus {
            outline: none;
            border-color: #70ad47;
        }

        /* 公式栏拖拽调整高度手柄 */
        .formula-resize-handle {
            position: absolute;
            bottom: -4px;
            left: 0;
            right: 0;
            height: 8px;
            cursor: row-resize;
            z-index: 100;
            background: transparent;
        }

        .formula-resize-handle:hover {
            background: rgba(112, 173, 71, 0.3);
        }

        .formula-resize-handle.dragging {
            background: rgba(112, 173, 71, 0.5);
        }

        .formula-icon {
            margin-top: 4px;
            font-size: 12px;
            color: #666;
            font-style: italic;
        }

        /* 文件名称栏 */
        .file-name-bar {
            background: #f8f9fa;
            border-bottom: 1px solid #d1d1d1;
            padding: 8px 16px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .file-name-icon {
            font-size: 18px;
        }

        .file-name-text {
            font-size: 14px;
            font-weight: 500;
            flex: 1;
            color: #333;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 4px;
            transition: all 0.2s;
        }

        .file-name-text:hover {
            background: #e8f5e9;
            color: #2e7d32;
        }

        /* 返回按钮 */
        .btn-back {
            background: #fff;
            border: 1px solid #d1d1d1;
            border-radius: 4px;
            padding: 4px 12px;
            font-size: 13px;
            color: #555;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
            transition: all 0.2s;
        }

        .btn-back:hover {
            background: #f0f0f0;
            border-color: #aaa;
        }

        .btn-back i {
            font-size: 12px;
        }

        /* 工具栏下拉菜单 */
        .toolbar-dropdown {
            position: relative;
            display: inline-block;
        }

        .toolbar-dropdown-menu {
            position: absolute;
            top: 100%;
            left: 0;
            background: white;
            border: 1px solid #d1d1d1;
            border-radius: 4px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            min-width: 180px;
            z-index: 1000;
            display: none;
            margin-top: 4px;
        }

        .toolbar-dropdown-menu.show {
            display: block;
        }

        .toolbar-dropdown-item {
            padding: 8px 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            color: #333;
            transition: background 0.15s;
        }

        .toolbar-dropdown-item:hover {
            background: #f3f2f1;
        }

        .toolbar-dropdown-item kbd {
            margin-left: auto;
            padding: 2px 6px;
            background: #f5f5f5;
            border: 1px solid #d1d1d1;
            border-radius: 3px;
            font-size: 11px;
            color: #666;
        }

        .toolbar-dropdown-separator {
            height: 1px;
            background: #e0e0e0;
            margin: 4px 0;
        }

        /* 颜色选择器弹窗 */
        .color-picker-popup {
            position: absolute;
            background: white;
            border: 1px solid #d1d1d1;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            padding: 16px;
            min-width: 220px;
            z-index: 1000;
            display: none;
        }

        .color-picker-popup.show {
            display: block;
        }

        .color-picker-title {
            font-size: 14px;
            font-weight: 600;
            margin-bottom: 12px;
            color: #333;
        }

        .color-picker-input {
            width: 100%;
            height: 40px;
            border: 1px solid #d1d1d1;
            border-radius: 4px;
            cursor: pointer;
            margin-bottom: 12px;
        }

        .color-picker-presets {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 8px;
            margin-bottom: 16px;
        }

        .color-preset {
            width: 32px;
            height: 32px;
            border-radius: 4px;
            cursor: pointer;
            border: 1px solid #e0e0e0;
            transition: transform 0.15s;
        }

        .color-preset:hover {
            transform: scale(1.1);
            border-color: #999;
        }

        .color-picker-actions {
            display: flex;
            gap: 8px;
            justify-content: flex-end;
        }

        .color-picker-btn {
            padding: 6px 16px;
            border: 1px solid #d1d1d1;
            border-radius: 4px;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.15s;
        }

        .color-picker-btn-cancel {
            background: #f5f5f5;
            color: #333;
        }

        .color-picker-btn-cancel:hover {
            background: #e8e8e8;
        }

        .color-picker-btn-confirm {
            background: #217346;
            color: white;
            border-color: #217346;
        }

        .color-picker-btn-confirm:hover {
            background: #1e623d;
        }

        /* 表格容器 */
        .spreadsheet-wrapper {
            flex: 1;
            overflow: auto;
            overflow-x: auto;
            overflow-y: auto;
            background: white;
            position: relative;
        }

        .spreadsheet-table {
            border-collapse: collapse;
            font-size: 11pt;
            font-family: 'Segoe UI', Calibri, Arial, sans-serif;
            width: auto;
        }

        .spreadsheet-table th,
        .spreadsheet-table td {
            border: 1px solid #d1d1d1;
            padding: 2px 4px;
            width: 64px;
            height: 20px;
            max-width: 64px;
            max-height: 20px;
            text-align: left;
            vertical-align: top;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            line-height: 1.4;
            box-sizing: border-box;
        }

        .spreadsheet-table td.cell {
            display: table-cell;
        }

        .spreadsheet-table th {
            background: #f3f2f1;
            font-weight: 500;
            color: #333;
            text-align: center;
            position: sticky;
            top: 0;
            z-index: 10;
            font-size: 10pt;
        }

        .spreadsheet-table th.row-header {
            position: sticky;
            left: 0;
            z-index: 11;
            min-width: 36px;
            cursor: default;
        }

        .spreadsheet-table th.corner-header {
            position: sticky;
            left: 0;
            top: 0;
            z-index: 12;
            min-width: 36px;
            cursor: pointer;
        }

        .spreadsheet-table th.col-header {
            cursor: default;
            position: relative;
        }

        .spreadsheet-table th.col-header:hover {
            cursor: default;
        }

        /* 列宽调整手柄 - 右侧边缘 */
        .spreadsheet-table th.col-header::after {
            content: '';
            position: absolute;
            right: 0;
            top: 0;
            bottom: 0;
            width: 6px;
            cursor: col-resize;
            z-index: 20;
        }

        /* 行高调整手柄 - 下侧边缘 */
        .spreadsheet-table th.row-header::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 6px;
            cursor: row-resize;
            z-index: 20;
        }

        /* 列宽调整手柄 */
        .col-resize-handle {
            position: absolute;
            right: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            cursor: col-resize;
            z-index: 20;
        }

        .col-resize-handle:hover {
            background: #70ad47;
        }

        /* 行高调整手柄 */
        .row-resize-handle {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 4px;
            cursor: row-resize;
            z-index: 20;
        }

        .row-resize-handle:hover {
            background: #70ad47;
        }

        /* 右键菜单 */
        .context-menu {
            position: fixed;
            background: white;
            border: 1px solid #d1d1d1;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            border-radius: 4px;
            padding: 4px 0;
            min-width: 180px;
            z-index: 10000;
            display: none;
            font-size: 13px;
        }

        .context-menu-item {
            padding: 8px 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: background 0.15s;
        }

        .context-menu-item:hover {
            background: #f3f2f1;
        }

        .context-menu-item.disabled {
            color: #a0a0a0;
            cursor: not-allowed;
        }

        .context-menu-separator {
            height: 1px;
            background: #e1e1e1;
            margin: 4px 0;
        }

        .context-menu-submenu {
            padding: 8px 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: background 0.15s;
            position: relative;
        }

        .context-menu-submenu:hover {
            background: #f3f2f1;
        }
        .context-menu-submenu::after {
            content: '▶';
            margin-left: auto;
            font-size: 10px;
            color: #666;
        }

        .context-menu-submenu-content {
            position: absolute;
            left: 100%;
            top: 0;
            background: white;
            border: 1px solid #d1d1d1;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            border-radius: 4px;
            padding: 4px 0;
            min-width: 150px;
            display: none;
            margin-left: 0;
        }

        /* 添加间隙填充区域，防止鼠标移过去时菜单隐藏 */
        .context-menu-submenu-content::before {
            content: '';
            position: absolute;
            left: -10px;
            top: 0;
            width: 10px;
            height: 100%;
            background: transparent;
        }

        .context-menu-submenu:hover .context-menu-submenu-content {
            display: block;
        }

        .spreadsheet-table td {
            background: white;
            cursor: cell;
            padding: 1px 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            position: relative;
        }

        .spreadsheet-table td:hover {
            background: #f9fafb;
        }

        .spreadsheet-table td.selected {
            background: #e8f5e9;
            outline: 2px solid #4caf50;
            outline-offset: -2px;
        }

        /* 格式刷激活时的鼠标样式 */
        body.format-painter-active .spreadsheet-table td {
            cursor: url('data:image/svg+xml;utf8,<svg width="17" height="17" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M290.4 70C288.9 66.4 285.4 64 281.5 64L262.5 64C258.6 64 255 66.4 253.6 70L232.9 121.7C229.7 129.7 218.3 129.7 215.1 121.7L194.4 70C192.9 66.4 189.4 64 185.5 64L176 64C149.5 64 128 85.5 128 112L128 320L512 320L512 112C512 85.5 490.5 64 464 64L358.5 64C354.6 64 351 66.4 349.6 70L328.9 121.7C325.7 129.7 314.3 129.7 311.1 121.7L290.4 70zM128 368L128 384C128 419.3 156.7 448 192 448L256 448L256 512C256 547.3 284.7 576 320 576C355.3 576 384 547.3 384 512L384 448L448 448C483.3 448 512 419.3 512 384L512 368L128 368zM320 528C311.2 528 304 520.8 304 512C304 503.2 311.2 496 320 496C328.8 496 336 503.2 336 512C336 520.8 328.8 528 320 528z"/></svg>') 9 9, auto;
        }
        
        /* 过滤按钮样式 */
        .filter-btn {
            display: inline-block;
            margin-left: 5px;
            font-size: 10px;
            color: #666;
            cursor: pointer;
            padding: 2px;
            border-radius: 2px;
        }
        
        .filter-btn:hover {
            background-color: #f0f0f0;
        }
        
        /* 有过滤条件的列标题 */
        .col-header.has-filter {
            background-color: #f5f5f5;
        }
        
        /* 过滤菜单样式 */
        .filter-menu {
            font-size: 14px;
        }
        
        .filter-menu label {
            cursor: pointer;
        }
        
        .filter-menu input[type="checkbox"] {
            margin-right: 5px;
        }


        body.format-painter-active #btnFormatPainter {
            background: #c6e0b4;
            border-color: #70ad47;
        }

        /* 复制时的虚线边框动画 - 行军蚂蚁效果 */
        .spreadsheet-table td.copied {
            position: relative;
        }

        /* 图形样式 */
        .shape-overlay {
            position: absolute;
            z-index: 100;
            cursor: move;
            border: 2px solid transparent;
        }

        .shape-overlay:hover {
            border-color: #666666;
        }

        .shape-overlay.selected {
            border-color: #333333;
        }

        .shape-svg {
            width: 100%;
            height: 100%;
            pointer-events: none;
        }

        /* 图片样式 */
        .image-overlay {
            position: absolute;
            z-index: 100;
            cursor: move;
            border: 2px solid transparent;
        }

        .image-overlay:hover {
            border-color: #70ad47;
        }

        .image-overlay.selected {
            border-color: #4472C4;
        }

        .image-overlay img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            pointer-events: none;
        }

        /* 调整大小手柄 */
        .resize-handle {
            position: absolute;
            width: 8px;
            height: 8px;
            background: #fff;
            border: 1px solid #4472C4;
            z-index: 101;
            display: none;
        }

        .shape-overlay.selected .resize-handle,
        .image-overlay.selected .resize-handle {
            display: block;
        }

        .resize-handle.nw { top: -4px; left: -4px; cursor: nw-resize; }
        .resize-handle.ne { top: -4px; right: -4px; cursor: ne-resize; }
        .resize-handle.sw { bottom: -4px; left: -4px; cursor: sw-resize; }
        .resize-handle.se { bottom: -4px; right: -4px; cursor: se-resize; }

        /* 旋转手柄 - 右上角，使用字体图标 */
        .rotate-handle {
            position: absolute;
            width: 20px;
            height: 20px;
            background: #fff;
            border: 1px solid #666;
            border-radius: 3px;
            z-index: 102;
            display: none;
            cursor: grab;
            top: -25px;
            right: -25px;
            left: auto;
            transform: none;
            font-size: 12px;
            color: #333;
            text-align: center;
            line-height: 18px;
        }

        .shape-overlay.selected .rotate-handle {
            display: block;
        }

        .rotate-handle:active {
            cursor: grabbing;
        }

        /* 移除旋转线 */
        .rotate-line {
            display: none !important;
        }

        /* 图形颜色选择器容器 - 左侧竖排 */
        .shape-color-pickers-container {
            position: absolute;
            left: -36px;
            top: 0;
            display: none;
            flex-direction: column;
            gap: 4px;
            z-index: 200;
        }

        .shape-overlay.selected .shape-color-pickers-container {
            display: flex;
        }

        /* 颜色选择器切换按钮 */
        .shape-color-picker-toggle {
            width: 28px;
            height: 28px;
            background: #fff;
            border: 1px solid #ccc;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            font-size: 14px;
            color: #666;
        }

        .shape-color-picker-toggle:hover {
            background: #f0f0f0;
            border-color: #4472C4;
        }

        .shape-color-picker-toggle.active {
            background: #4472C4;
            color: #fff;
            border-color: #4472C4;
        }

        /* 颜色选择器面板 - 紧凑布局 */
        .shape-color-picker-panel {
            position: absolute;
            left: 32px;
            background: #fff;
            border: 1px solid #ccc;
            border-radius: 3px;
            padding: 2px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            display: none;
            flex-direction: row;
            flex-wrap: wrap;
            gap: 1px;
            width: auto;
            max-width: 72px;
            z-index: 201;
        }

        .shape-color-picker-panel.show {
            display: flex;
        }

        .color-btn {
            width: 20px;
            height: 20px;
            border: 1px solid #ccc;
            border-radius: 1px;
            cursor: pointer;
            flex-shrink: 0;
            margin: 0;
        }

        .color-btn:hover {
            border-color: #4472C4;
            transform: scale(1.05);
        }

        /* 自定义颜色按钮 */
        .color-btn-custom {
            width: 20px;
            height: 20px;
            border: 1px solid #ccc;
            border-radius: 1px;
            cursor: pointer;
            background: linear-gradient(135deg, #ff0000 0%, #00ff00 50%, #0000ff 100%);
            position: relative;
            flex-shrink: 0;
            margin: 0;
        }

        .color-btn-custom:hover {
            border-color: #4472C4;
            transform: scale(1.1);
        }

        .color-btn-custom input[type="color"] {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0;
            cursor: pointer;
        }

        /* 文本框文字样式选择器面板 - 紧凑布局 */
        .text-style-panel {
            position: absolute;
            left: 32px;
            background: #fff;
            border: 1px solid #ccc;
            border-radius: 4px;
            padding: 6px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            display: none;
            flex-direction: column;
            gap: 6px;
            width: auto;
            min-width: 90px;
            max-width: 110px;
            z-index: 201;
        }

        .text-style-panel.show {
            display: flex;
        }

        .panel-section {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            gap: 3px;
            align-items: center;
        }

        .section-label {
            width: 100%;
            font-size: 10px;
            color: #666;
            margin-bottom: 1px;
        }

        .text-color-picker {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            gap: 3px;
        }

        .font-size-picker {
            width: 100%;
            padding-top: 2px;
            margin-top: 1px;
        }

        .font-size-picker select {
            width: 50px;
            height: 22px;
            font-size: 12px;
            border: 1px solid #ccc;
            border-radius: 3px;
            cursor: pointer;
            background: #fff;
            position: relative;
            z-index: 300;
        }

        .font-size-picker select:focus {
            outline: none;
            border-color: #4472C4;
        }

        /* 确保下拉选项可见 */
        .font-size-picker select option {
            background: #fff;
            color: #333;
            padding: 2px 4px;
        }

        /* 绘图选项卡样式 */
        .draw-mode-btn.active,
        .draw-tool-btn.active,
        .draw-color-btn.active,
        .draw-width-btn.active {
            background: #4472C4;
            color: #fff;
            border-color: #4472C4;
        }

        .draw-colors-container {
            display: flex;
            flex-direction: column;
        }

        .draw-colors-row {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 6px;
        }

        .draw-colors-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            grid-template-rows: repeat(2, 1fr);
            gap: 2px;
        }

        .draw-custom-color-wrapper {
            display: flex;
            align-items: center;
            justify-content: center;
            padding-left: 4px;
        }

        .draw-color-btn {
            width: 18px;
            height: 18px;
            padding: 1px;
            border: 1px solid #ccc;
            border-radius: 2px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .draw-color-btn:hover {
            border-color: #4472C4;
            transform: scale(1.1);
        }

        .draw-custom-color {
            width: 30px;
            height: 30px;
            border: 1px solid #ccc;
            border-radius: 3px;
            cursor: pointer;
            padding: 1px;
        }

        .draw-width-row {
            display: flex;
            gap: 4px;
        }

        .draw-width-btn {
            width: 32px;
            height: 24px;
            padding: 2px;
            border: 1px solid #ccc;
            border-radius: 3px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .draw-width-btn:hover {
            border-color: #4472C4;
        }

        /* 绘图画布 */
        .drawing-canvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 1000;
            background: transparent;
        }

        .drawing-canvas.active {
            pointer-events: auto;
            cursor: crosshair;
        }

        /* 墨迹路径样式 */
        .ink-path {
            fill: none;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        /* 绘图遮罩层 */
        .draw-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 9999;
            background: transparent;
            cursor: crosshair;
        }

        .draw-overlay-canvas {
            width: 100%;
            height: 100%;
        }

        .spreadsheet-table td.copied::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border: 2px dashed #4caf50;
            animation: marching-ants 0.5s linear infinite;
            pointer-events: none;
        }

        @keyframes marching-ants {
            0% {
                border-style: dashed;
                border-color: #4caf50;
            }
            50% {
                border-style: dashed;
                border-color: #81c784;
            }
            100% {
                border-style: dashed;
                border-color: #4caf50;
            }
        }

        /* 行列标题选中样式 */
        .spreadsheet-table th.row-header.selected,
        .spreadsheet-table th.col-header.selected {
            background: #c8e6c9;
            color: #2e7d32;
            font-weight: 600;
        }

        /* 填充手柄样式 */
        .fill-handle {
            position: fixed;
            width: 5px;
            height: 5px;
            background: #4caf50;
            border: 1px solid white;
            cursor: crosshair;
            z-index: 10000;
            display: none;
            
        }

        .fill-handle:hover {
            background: #388e3c;
            transform: scale(1.2);
        }

        .fill-handle.dragging {
            background: #388e3c;
            cursor: crosshair;
        }

        /* 填充范围高亮 */
        .fill-range {
            background: #e8f5e9 !important;
        }

        /* 填充预览线 */
        .fill-preview-line {
            position: fixed;
            background: #4caf50;
            opacity: 0.5;
            pointer-events: none;
            z-index: 9999;
        }

        /* 填充选项菜单 */
        .fill-options-menu {
            position: fixed;
            background: white;
            border: 1px solid #d1d1d1;
            border-radius: 4px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            z-index: 10001;
            display: none;
            min-width: 120px;
            padding: 4px 0;
        }

        .fill-options-item {
            padding: 8px 16px;
            cursor: pointer;
            font-size: 13px;
            color: #333;
            transition: background 0.15s;
        }

        .fill-options-item:hover {
            background: #f0f0f0;
        }

        /* 选择性粘贴菜单 */
        .paste-options-menu {
            position: fixed;
            background: white;
            border: 1px solid #d1d1d1;
            border-radius: 4px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            z-index: 10001;
            display: none;
            min-width: 150px;
            padding: 4px 0;
        }

        .paste-options-item {
            padding: 8px 16px;
            cursor: pointer;
            font-size: 13px;
            color: #333;
            transition: background 0.15s;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .paste-options-item:hover {
            background: #f0f0f0;
        }

        /* 粘贴按钮组 */
        .ribbon-btn-group {
            display: flex;
            border: 1px solid #d1d1d1;
            border-radius: 4px;
            overflow: hidden;
        }

        .ribbon-btn-group .ribbon-btn {
            border-radius: 0;
        }

        .ribbon-btn-group .ribbon-btn:first-child {
            border-right: 1px solid #d1d1d1;
        }

        .ribbon-dropdown-btn {
            padding: 8px 6px !important;
            min-width: auto !important;
        }

        .fill-options-item i {
            width: 20px;
            text-align: center;
            margin-right: 8px;
            color: #666;
        }

        /* 查找匹配高亮 */
        .find-match {
            background-color: #ffff00 !important;
            color: #000000 !important;
        }

        .find-match.current {
            background-color: #ffeb3b !important;
            border: 2px solid #fbc02d !important;
        }

        /* 填充选项图标按钮 */
        .fill-options-icon {
            position: fixed;
            width: 20px;
            height: 20px;
            background: #fff;
            border: 1px solid #999;
            border-radius: 2px;
            cursor: pointer;
            z-index: 10001;
            display: none;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            color: #333;
            box-shadow: 0 2px 4px rgba(0,0,0,0.15);
            opacity: 1;
            transition: opacity 0.5s ease;
        }

        .fill-options-icon.fading {
            opacity: 0.4;
        }

        .fill-options-icon:hover {
            background: #f0f0f0;
            border-color: #666;
            opacity: 1;
        }

        .fill-options-icon i {
            font-size: 12px;
        }

        /* 防止文本选中 */
        .spreadsheet-table {
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }

        /* 单元格样式 */
        .cell.bold {
            font-weight: bold;
        }

        .cell.italic {
            font-style: italic;
        }

        .cell.underline {
            text-decoration: underline;
        }

        .cell.double-underline {
            text-decoration: underline;
            text-decoration-style: double;
        }

        .cell.strikethrough {
            text-decoration: line-through;
        }

        .cell.align-left {
            text-align: left;
        }

        .cell.align-center {
            text-align: center;
        }

        .cell.align-right {
            text-align: right;
        }

        /* Office 风格工作表标签 */
        .sheet-tabs {
            background: #f3f2f1;
            border-top: 1px solid #d1d1d1;
            padding: 4px 8px;
            display: flex;
            gap: 2px;
            align-items: center;
        }

        .sheet-tab {
            padding: 6px 14px;
            border: 1px solid transparent;
            background: transparent;
            color: #333;
            font-size: 12px;
            border-radius: 3px 3px 0 0;
            cursor: pointer;
            transition: all 0.15s ease;
            border-bottom: none;
        }

        .sheet-tab:hover {
            background: #e1e1e1;
            border-color: #c6c6c6;
        }

        .sheet-tab.active {
            background: white;
            color: #333;
            border-color: #d1d1d1;
            border-bottom: 1px solid white;
            margin-bottom: -1px;
            font-weight: 500;
        }

        .sheet-tab.add-sheet {
            background: transparent;
            font-size: 16px;
            padding: 6px 10px;
            border: 1px solid transparent;
        }

        .sheet-tab-close {
            margin-left: 8px;
            padding: 0 4px;
            font-size: 12px;
            color: #666;
            cursor: pointer;
            border-radius: 2px;
        }

        .sheet-tab-close:hover {
            background: #d1d1d1;
            color: #333;
        }

        /* 隐藏文件输入 */
        #fileInput {
            display: none;
        }

        /* Toast 提示 */
        .toast {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: #1e293b;
            color: white;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 14px;
            opacity: 0;
            transition: all 0.3s ease;
            z-index: 99999;
        }

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

        /* Loading 遮罩层 */
        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255, 255, 255, 0.8);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 20000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .loading-overlay.show {
            opacity: 1;
            visibility: visible;
        }

        .loading-spinner {
            width: 50px;
            height: 50px;
            border: 4px solid #e0e0e0;
            border-top: 4px solid #70ad47;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .loading-text {
            margin-top: 16px;
            font-size: 14px;
            color: #333;
            font-weight: 500;
        }

        /* 响应式 */
        @media (max-width: 768px) {
            .navbar-container {
                height: 56px;
                padding: 0 16px;
            }

            .navbar-logo {
                margin-right: 20px;
            }

            .navbar-logo img {
                width: 80px;
                height: 32px;
            }

            .main-container {
                padding-top: 56px;
            }

            .toolbar {
                padding: 6px 12px;
            }

            .toolbar-btn {
                padding: 6px 10px;
                font-size: 12px;
            }

            .spreadsheet-table th,
            .spreadsheet-table td {
                min-width: 60px;
                font-size: 12px;
            }
        }

        /* ==================== 数据源和查询管理样式 ==================== */

        /* 数据表格样式 */
        .data-table th {
            font-weight: 600;
            background: #fafafa;
        }

        .data-table tr:hover {
            background: #f9f9f9;
        }

        /* 小按钮样式 */
        .btn-small {
            transition: all 0.2s;
        }

        .btn-small:hover {
            background: #f5f5f5;
        }

        .btn-small.btn-danger:hover {
            background: #ffebee;
        }

        /* 数据库对象样式 */
        .db-object:hover {
            background: #e3f2fd;
        }

        .db-object:active {
            background: #bbdefb;
        }

        /* 主按钮样式 */
        .btn-primary {
            transition: all 0.2s;
        }

        .btn-primary:hover {
            background: #5a9a3a;
        }

        .btn-primary:active {
            background: #4a8a2a;
        }