/* 基础滚动条隐藏 */
      .no-scrollbar::-webkit-scrollbar {
        display: none;
      }

      .no-scrollbar {
        -ms-overflow-style: none;
        scrollbar-width: none;
      }

      /* 自定义滚动条样式 */
      .custom-scrollbar::-webkit-scrollbar {
        width: 6px;
        height: 6px;
      }

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

      .custom-scrollbar::-webkit-scrollbar-thumb {
        background-color: #cbd5e1;
        border-radius: 3px;
      }

      .custom-scrollbar::-webkit-scrollbar-thumb:hover {
        background-color: #94a3b8;
      }

      /* UI 交互状态 */
      .tool-btn.active {
        background-color: #fee2e2;
        color: #e11d48;
        border-color: #e11d48;
      }

      /* 画布区域背景 */
      #scrollContainer {
        background-image: radial-gradient(#ddd 1px, transparent 1px);
        background-size: 20px 20px;
        display: block;
        padding: 0px 20px 0px 40px;
      }

      #zoomViewport {
        margin: 40px auto 20px;
        transform-origin: center;
        overflow: hidden;
        border-radius: 2px;
        box-shadow:
          0 20px 25px -5px rgba(0, 0, 0, 0.1),
          0 10px 10px -5px rgba(0, 0, 0, 0.04);
      }

      .layer-item[draggable="true"] {
        cursor: grab;
      }
      .layer-item[draggable="true"]:active {
        cursor: grabbing;
      }
      .layer-item.dragging {
        opacity: 0.5;
        background-color: #f3f4f6;
        border: 2px dashed #cbd5e1;
      }
      /* 禁止背景层拖拽 */
      .layer-item.no-drag {
        cursor: default;
      }
      /* 模态框与卡片 */
      .modal-backdrop {
        background-color: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
      }

      .template-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
      }

      /* 光标状态 */
      .canvas-container.grabbing-mode canvas {
        cursor: grabbing !important;
      }

      .canvas-container.grab-mode canvas {
        cursor: grab !important;
      }

      /* 紧凑型表单控件 */
      .compact-input {
        font-size: 12px;
        padding: 4px 6px;
        height: 28px;
      }

      .compact-label {
        color: #6b7280;
        margin-bottom: 2px;
        display: flex;
        column-gap: 5px;
        align-items: center;
      }

      /* 样式按钮 */
      .style-btn {
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
      }

      .style-btn.active {
        background-color: #e5e7eb;
        font-weight: bold;
        color: #000;
      }

      /* 下拉菜单 */
      .dropdown:hover .dropdown-menu {
        display: block;
      }

      .dropdown-menu {
        display: none;
        position: absolute;
        background-color: white;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        z-index: 50;
        padding: 0.5rem;
        top: 100%;
        left: 0;
        width: 120px;
      }

      /* 表格编辑器 */
      .table-editor-grid {
        border-collapse: collapse;
        width: 100%;
      }

      .table-editor-grid td {
        border: 1px solid #cbd5e1;
        min-width: 60px;
        height: 44px;
        text-align: center;
        cursor: text;
        padding: 4px;
        font-size: 12px;
        color: #0f172a;
        transition: background-color 0.15s ease;
      }

      .table-editor-grid td.selected {
        outline: 2px solid #f97316;
        outline-offset: -2px;
        box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.3);
      }

      .table-editor-grid td:focus {
        outline: 2px solid #2563eb;
        outline-offset: -2px;
      }

      .table-style-btn {
        border: 1px solid #e2e8f0;
        border-radius: 0.375rem;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        transition: all 0.15s ease;
      }

      .table-style-btn.active {
        background: #fee2e2;
        border-color: #f87171;
        color: #b91c1c;
        font-weight: 600;
      }
      /* 表格编辑器网格样式 */
      .table-editor-grid td {
        border: 1px solid #cbd5e1;
        min-width: 60px; /* 最小宽度，防止太扁 */
        cursor: text;
        padding: 4px;
        position: relative;
        transition: background-color 0.1s;
      }

      /* 选中高亮 */
      .table-editor-grid td.selected {
        background-color: rgba(59, 130, 246, 0.15) !important;
        box-shadow: inset 0 0 0 2px #3b82f6;
        z-index: 10;
      }

      .table-editor-grid td:focus {
        outline: none;
        background-color: #fff;
        box-shadow: inset 0 0 0 2px #2563eb;
        z-index: 20;
      }

      /* 悬浮工具栏 */
      #tableFloatMenu {
        pointer-events: auto;
        will-change: top, left;
      }

      .tool-icon-btn {
        width: 26px;
        height: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        color: #475569;
        transition: all 0.2s;
        border: 1px solid transparent;
      }

      .tool-icon-btn:hover:not(:disabled) {
        background-color: #f1f5f9;
        color: #0f172a;
        border-color: #cbd5e1;
      }

      .tool-icon-btn:active:not(:disabled) {
        background-color: #e2e8f0;
      }

      .tool-icon-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
        color: #94a3b8;
      }

      /* 标尺样式 */
      .ruler-canvas {
        position: absolute;
        background-color: #f8fafc;
        z-index: 40;
        pointer-events: none;
      }

      #ruler-h {
        top: 0px;
        left: 20px;
        width: calc(100% - 20px);
        height: 20px;
        border-bottom: 1px solid #cbd5e1;
      }

      #ruler-v {
        left: 0;
        width: 20px;
        top: 20px;
        height: calc(100% - 20px);
        border-right: 1px solid #cbd5e1;
      }

      #ruler-corner {
        position: absolute;
        left: 0;
        top: 0;
        width: 20px;
        height: 20px;
        background: #ffffff;
        z-index: 41;
        border-right: 1px solid #cbd5e1;
        border-bottom: 1px solid #cbd5e1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 8px;
        color: #64748b;
        font-weight: bold;
      }
      .editable-num {
        width: 2em;
        background: transparent;
        text-align: center;
        padding: 0;
      }
      .editable-num:focus {
        outline: none;
      }
      .editable-num::-webkit-inner-spin-button,
      .editable-num::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
      }
      *:focus,
      *:focus-visible {
        outline: none !important;
        box-shadow: none !important;
        border-color: transparent;
      }

      input:focus,
      select:focus,
      textarea:focus {
        border-color: #e11d48 !important;
      }

      @font-face {
        font-family: "SourceHanSerifCN-Bold";
        src: url("./static/SourceHanSerifCN-Bold.ttf") format("truetype");
        font-weight: normal;
        font-style: normal;
        font-display: swap;
      }

      /* ========================================= */
      /* 打印专用样式 */
      /* ========================================= */

      #printContainer {
        display: none;
      }

      @media print {
        body > *:not(#printContainer) {
          display: none !important;
        }

        #printContainer {
          display: block !important;
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          z-index: 99999;
          background: white;
        }

        #printContainer img {
          width: 100%;
          height: auto;
          display: block;
        }
      }