/* 绘印云设计器样式 - v5.70.10 */
/* v5.70.10: 修复PDF/SVG表格文字导出 + PDF文字压扁 + 符号回退字体链补齐 */
/* v4.54.1: OCR-B 10 BT 已移除（版权风险），替换为 Libre Barcode 39 Extended Text（SIL OFL 免费商用） */
:root {
    /* 主题色 */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    /* 页面背景 */
    --bg: #f0f5ff;
    --card: #ffffff;
    --card-hover: #f9fafb;
    /* 文字（提升对比度，灰色→深灰） */
    --text: #111111;
    --text-secondary: #444444;
    --text-muted: #666666;
    /* 边框（加深，更清晰） */
    --border: #c5c5c5;
    --border-light: #dedede;
    /* 工具栏/面板 */
    --toolbar-bg: #ffffff;
    --toolbar-group-bg: #f5f5f5;
    --toolbar-group-border: #c5c5c5;
    --toolbar-sep: #c5c5c5;
    --toolbar-label: #222222;
    /* 输入框 */
    --input-bg: #ffffff;
    --input-border: #b0b0b0;
    --input-focus: #2563eb;
    /* 菜单栏（顶部） */
    --menubar-bg: linear-gradient(135deg, #1e293b, #2563eb);
    --menubar-text: #dbeafe;
    --menubar-hover-bg: rgba(255,255,255,0.18);
    --menubar-hover-text: #ffffff;
    --menubar-title: #ffffff;
    --menubar-sep: rgba(255,255,255,0.25);
    --menubar-highlight: #93c5fd;
    /* 菜单下拉 */
    --menu-panel-bg: #ffffff;
    --menu-panel-text: #1e293b;
    --menu-panel-border: #c5c5c5;
    --menu-item-hover-bg: #eff6ff;
    --menu-item-hover-text: #2563eb;
    --menu-shortcut: #777777;
    /* 按钮 */
    --btn-bg: #ffffff;
    --btn-border: #d1d5db;
    --btn-text: #374151;
    --btn-hover-bg: #f3f4f6;
    --btn-active-bg: #e5e7eb;
    /* 阴影 */
    --shadow: 0 2px 12px rgba(37,99,235,0.08);
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.2);
    /* 功能色 */
    --danger: #ef4444;
    --success: #10b981;
    --blue: #3b82f6;
    --warning: #f59e0b;
    /* 自动保存 */
    --autosave-color: #6ee7b7;
    --autosave-bg: rgba(110,231,183,0.12);
    /* Canvas区域 */
    --canvas-bg: #e2e8f0;
    --canvas-grid: #cbd5e1;
    /* 属性面板 */
    --prop-label: #333333;
    /* 图层面板 */
    --layer-hover-bg: #f9fafb;
    --layer-selected-bg: #dbeafe;
    /* toast */
    --toast-bg: #1e293b;
    --toast-text: #ffffff;
    /* 模态框 */
    --modal-overlay: rgba(0,0,0,0.5);
    --modal-bg: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* 全局字体高清渲染：抗锯齿 + 字距优化 */
html, body, * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 全局防御：隐藏残留的 __dsEditor 空白条（通过 JS 控制显示/隐藏） */
#__dsEditor.ds-stray { display: none !important; visibility: hidden !important; pointer-events: none !important; }

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* ====== 顶部菜单栏 ====== */
.top-menubar {
    display: flex;
    align-items: center;
    background: var(--menubar-bg);
    color: #dbeafe;
    height: 30px;
    padding: 0 12px;
    position: sticky;
    top: 0;
    z-index: 200;
    font-size: 13px;
    user-select: none;
    gap: 8px;
    box-shadow: 0 2px 12px rgba(37,99,235,0.3);
}
.menubar-left { display: flex; align-items: center; gap: 2px; }
.menubar-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; }
.menubar-right { display: flex; align-items: center; gap: 12px; }

.app-logo { display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px; }
.app-title { font-weight: 700; font-size: 17px; letter-spacing: 0.5px; color: var(--menubar-title); }
.app-subtitle { font-weight: 400; font-size: 12px; color: rgba(255,255,255,0.7); margin-left: 4px; letter-spacing: 0.3px; }
.menu-sep { color: var(--menubar-sep); margin: 0 4px; font-size: 14px; }

.menu-dropdown { position: relative; }
.menu-trigger {
    background: none; border: none; color: var(--menubar-text); font-size: 13px;
    padding: 6px 10px; border-radius: 4px; cursor: pointer;
    font-family: inherit; transition: all 0.15s;
}
.menu-trigger:hover { background: var(--menubar-hover-bg); color: var(--menubar-hover-text); }
.menu-panel {
    display: none;
    position: absolute; top: 100%; left: 0;
    background: var(--menu-panel-bg); color: var(--menu-panel-text);
    border-radius: 8px; box-shadow: var(--shadow-lg);
    min-width: 200px; padding: 6px 0; z-index: 1000;
    border: 1px solid var(--menu-panel-border);
}
.menu-dropdown:hover .menu-panel { display: block; }
.menu-dropdown:hover .menu-panel.mega-menu { display: grid; }

/* 增值服务：分栏大菜单，防止小屏笔记本下拉溢出 */
.menu-panel.mega-menu {
    display: none;
    grid-template-columns: repeat(3, minmax(190px, 1fr));
    min-width: 600px;
    max-width: 92vw;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 12px;
    gap: 10px;
}
.mega-menu-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mega-menu-title {
    padding: 6px 10px 8px;
    font-weight: 700;
    font-size: 12px;
    color: #6b7280;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--menu-panel-border);
    margin-bottom: 4px;
    pointer-events: none;
}

.menu-item {
    padding: 8px 16px; cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: space-between;
    transition: background 0.1s; white-space: nowrap;
}
.menu-item:hover { background: var(--menu-item-hover-bg); color: var(--menu-item-hover-text); }
.menu-item[data-shortcut]::after {
    content: attr(data-shortcut);
    font-size: 12px; color: var(--menu-shortcut); margin-left: 24px;
}
.menu-separator { height: 1px; background: var(--menu-panel-border); margin: 4px 12px; }

.project-name {
    font-size: 13px; color: var(--menubar-highlight); cursor: pointer;
    padding: 3px 8px; border-radius: 4px; transition: background 0.15s;
}
.project-name:hover { background: var(--menubar-hover-bg); }
.save-indicator { font-size: 12px; }
.auto-save-badge {
    font-size: 12px; color: var(--autosave-color); background: var(--autosave-bg);
    padding: 2px 8px; border-radius: 10px;
}

/* ====== Toolbar (两排分组布局) ====== */
.toolbar {
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 30px;
    z-index: 100;
    padding-top: 3px;
}
.toolbar-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 5px 16px;
    flex-wrap: nowrap;
    overflow: visible;
}
.toolbar-row:first-child {
    border-bottom: 1px solid var(--border-light);
    padding-top: 5px;
    padding-bottom: 3px;
}
.toolbar-row:last-child {
    padding-top: 3px;
    padding-bottom: 5px;
}

/* 工具分组 */
.tool-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px 4px;
    background: var(--toolbar-group-bg);
    border-radius: 8px;
    border: 1px solid var(--toolbar-group-border);
    white-space: nowrap;
    overflow: visible;
    isolation: auto;
}
.tool-group-label {
    font-size: 12px;
    color: var(--toolbar-label);
    font-weight: 700;
    padding: 0 4px;
    white-space: nowrap;
    letter-spacing: 0.5px;
}
/* 分隔线（加深加粗） */
.tool-sep {
    width: 1.5px;
    height: 28px;
    background: var(--toolbar-sep);
    margin: 0 8px;
    flex-shrink: 0;
}

.tool-btn {
    width: 32px; height: 32px;
    border: 1px solid #b0b0b0; border-radius: 3px;
    background: #f0f0f0; color: #1a1a1a;
    font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; position: relative;
    flex-shrink: 0;
}
/* 工具栏图标统一黑色 */
.tool-btn.color-draw { color: #000000; }
.tool-btn.color-transform { color: #000000; }
.tool-btn.color-text { color: #000000; }
.tool-btn.color-vtext { color: #2563eb; } /* v5.19.18: 竖排纵向对齐按钮紫色 */
.tool-btn.color-undo { color: #000000; }
.tool-btn.color-aux { color: #000000; }
.tool-btn.color-add { color: #000000; }
.tool-btn.color-clipboard { color: #000000; }
.tool-btn.color-group { color: #000000; }
.tool-btn.color-boolean { color: #000000; }
.tool-btn > * { pointer-events: none; }
/* SVG矢量图标（替换Font Awesome，任意缩放高清不失真） */
.ico { width: 16px; height: 16px; display: inline-block; flex-shrink: 0; vertical-align: middle; }
.ico-title { width: 18px; height: 18px; }
.tool-btn:hover { background: #d9d9d9; border-color: #888888; color: #000000; }
.tool-btn:active { background: #c5c5c5; border-color: #666666; transform: scale(0.96); }
.tool-btn.active { background: var(--primary); border-color: var(--primary-dark); color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,0.4); }
/* 默认tooltip向上显示（第二排用） */
.tool-btn[data-tip]::after {
    content: attr(data-tip);
    position: absolute; top: -28px; left: 50%; transform: translateX(-50%);
    font-size: 12px; white-space: nowrap;
    background: rgba(30,27,75,0.92); color: white;
    padding: 3px 8px; border-radius: 4px;
    opacity: 0; pointer-events: none; transition: opacity 0.15s;
    z-index: 9999;
    line-height: 1.2;
}
.tool-btn[data-tip]::before {
    content: '';
    position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(30,27,75,0.92);
    opacity: 0; pointer-events: none; transition: opacity 0.15s;
    z-index: 9999;
}
/* 第一排tooltip向下显示，避免被顶部裁剪 */
.toolbar-row:first-child .tool-btn[data-tip]::after {
    top: auto;
    bottom: -28px;
}
.toolbar-row:first-child .tool-btn[data-tip]::before {
    top: auto;
    bottom: -4px;
    border-top: none;
    border-bottom: 5px solid rgba(30,27,75,0.92);
}
.tool-btn:hover::after,
.tool-btn:hover::before { opacity: 1; }

/* 紧凑小按钮（页面设置区的数字输入等） */
.tool-compact {
    font-size: 12px;
    padding: 3px 5px;
    border: 1px solid #b0b0b0;
    border-radius: 5px;
    outline: none;
    background: #fff;
    color: #1a1a1a;
    text-align: center;
    height: 28px;
}
.tool-compact:focus { border-color: var(--primary); }

/* ====== 橡皮擦工具 ====== */
.eraser-popup {
    position: absolute; top: 100%; left: 0; margin-top: 6px;
    background: #fff; border: 1px solid #d1d5db; border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15); padding: 14px;
    min-width: 240px; z-index: 300;
}
.eraser-popup-title { font-size: 13px; font-weight: 700; color: #1e1b4b; margin-bottom: 12px; }
.eraser-popup-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.eraser-popup-label { font-size: 12px; color: #6b7280; min-width: 36px; }
.eraser-shape-btn {
    padding: 5px 12px; border: 1.5px solid #d1d5db; border-radius: 6px;
    background: #f9fafb; cursor: pointer; font-size: 12px; font-weight: 600;
    transition: all 0.15s; font-family: inherit;
}
.eraser-shape-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.eraser-shape-btn.active { background: #3b82f6; color: #fff; border-color: #2563eb; }
.eraser-size-val { font-size: 12px; font-weight: 700; color: #1d4ed8; min-width: 36px; }
.eraser-apply-btn, .eraser-cancel-btn {
    padding: 6px 16px; border: none; border-radius: 6px;
    cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit;
    transition: all 0.15s;
}
.eraser-apply-btn { background: #3b82f6; color: #fff; }
.eraser-apply-btn:hover { background: #2563eb; }
.eraser-cancel-btn { background: #f3f4f6; color: #6b7280; }
.eraser-cancel-btn:hover { background: #e5e7eb; }
#eraserSizeSlider { accent-color: #3b82f6; flex:1; }
body.eraser-mode canvas { cursor: crosshair; }
.tool-compact-sm { width: 52px; }
.tool-compact-md { width: 72px; }

.tool-select {
    font-size: 12px;
    padding: 3px 20px 3px 6px;
    border: 1px solid #b0b0b0;
    border-radius: 5px;
    outline: none;
    background: #fff;
    color: #1a1a1a;
    cursor: pointer;
    height: 28px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22 viewBox=%220 0 10 10%22><path fill=%22%23444444%22 d=%22M5 7L1 3h8z%22/></svg>');
    background-repeat: no-repeat;
    background-position: right 4px center;
}

.tool-icon-btn {
    width: 24px; height: 24px;
    border: 1px solid #b0b0b0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 0;
    color: #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.tool-icon-btn:hover { background: #e8e8e8; border-color: #888888; }
.tool-icon-btn.primary-action { border-color: #059669; background: #ecfdf5; color: #059669; font-weight: bold; }
.tool-icon-btn.primary-action:hover { background: #d1fae5; }
.tool-icon-btn.danger-action { border-color: #fca5a5; background: #fef2f2; color: #ef4444; }
.tool-icon-btn.danger-action:hover { background: #fee2e2; }

.tool-label {
    font-size: 12px;
    color: #333333;
    font-weight: 600;
    padding: 0 2px;
    white-space: nowrap;
}

.action-btn {
    padding: 6px 12px;
    border: none; border-radius: 6px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 4px;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.action-btn.primary { background: var(--primary); color: white; }
.action-btn.primary:hover { background: var(--primary-dark); }
.action-btn.outline { background: white; color: var(--text); border: 1px solid var(--border); }
.action-btn.outline:hover { background: #f9fafb; border-color: var(--primary); color: var(--primary-dark); }
.action-btn.success { background: var(--success); color: white; }
.action-btn.success:hover { background: #059669; }
.action-btn.print-btn { background: #f59e0b; color: white; }
.action-btn.print-btn:hover { background: #d97706; }
.action-btn.remote-print-btn { background: #06b6d4; color: white; }
.action-btn.remote-print-btn:hover { background: #0891b2; }

/* ====== Main Layout ====== */
.main-layout {
    width: 100vw;
    height: calc(100vh - 126px);  /* 36px菜单栏 + 90px工具栏 */
    position: relative;
    overflow: hidden;
}

/* ====== Left Panel (Properties) - 固定靠左 ====== */
.panel-toggle-btn {
    position: fixed;
    z-index: 55;
    width: 24px; height: 48px;
    border: none;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s ease;
    top: 50%; transform: translateY(-50%);
}
.panel-toggle-btn:hover { background: #1d4ed8; }
.panel-toggle-btn.collapsed { border-radius: 6px 0 0 6px; }

.left-toggle { left: 212px; }
.left-toggle.collapsed { left: 36px; }
.right-toggle { right: 212px; }
.right-toggle.collapsed { right: 36px; }

.prop-panel {
    width: 200px; flex-shrink: 0;
    display: flex; flex-direction: column; gap: 14px;
    position: fixed;  /* 固定定位，不被画布遮挡 */
    left: 12px;
    top: 136px;       /* 两排工具栏下方（+10mm） */
    bottom: 10px;
    overflow-y: auto;  /* 内容多时可滚动 */
    z-index: 50;      /* 在画布上方 */
    transition: transform 0.3s ease, opacity 0.3s ease;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}
.prop-panel.collapsed {
    transform: translateX(-220px);
    opacity: 0;
    pointer-events: none;
}
.prop-card {
    background: white; border-radius: 12px;
    padding: 16px; box-shadow: var(--shadow);
}
.prop-card h3 {
    font-size: 14px; font-weight: 700;
    color: var(--text); margin-bottom: 12px;
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap; overflow: visible;
}
.prop-card h3 i { color: var(--primary); font-size: 14px; }
/* 印创风格属性面板图标着色 */
.prop-card h3 .ico { color: #1d4ed8; }
.prop-card h3 .ico.color-prop-settings { color: #2563eb; }
.prop-card h3 .ico.color-prop-transform { color: #dc2626; }
.prop-card h3 .ico.color-prop-layers { color: #059669; }
.prop-card h3 .ico.color-prop-color { color: #d97706; }
.prop-card h3 .ico.color-prop-history { color: #0891b2; }
.prop-row label { color: #374151; font-weight: 600; }

.prop-row { margin-bottom: 10px; }
.prop-row label {
    display: block; font-size: 12px; color: var(--text-secondary);
    margin-bottom: 4px; font-weight: 500;
}
.prop-row input[type="text"],
.prop-row input[type="number"],
.prop-row input[type="color"],
.prop-row select,
.prop-row textarea {
    width: 100%; padding: 7px 10px;
    border: 1px solid var(--border); border-radius: 7px;
    font-size: 13px; outline: none;
    transition: border-color 0.15s;
}
.prop-row input:focus,
.prop-row select:focus,
.prop-row textarea:focus { border-color: var(--primary); }
.prop-row input[type="range"] { width: 100%; cursor: pointer; }
.prop-row .val-display {
    float: right; font-size: 12px; color: var(--primary-dark);
    font-weight: 600;
}
.color-input-row {
    display: flex; align-items: center; gap: 8px;
}
.color-input-row input[type="color"] {
    width: 32px; height: 32px; border: 2px solid var(--border);
    border-radius: 6px; cursor: pointer; padding: 0;
}
.color-input-row input[type="text"] { flex: 1; }

.font-families {
    max-height: 140px; overflow-y: auto;
}
.font-option {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: 6px; cursor: pointer;
    transition: background 0.15s; font-size: 13px;
}
.font-option:hover { background: #f3f4f6; }
.font-option.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.font-preview { flex: 1; }
.font-name { font-size: 12px; color: var(--text-secondary); }

.layers-list { list-style: none; max-height: 240px; overflow-y: auto; }

/* ====== 操作历史面板 ====== */
#historyPanel { max-height: 240px; overflow-y: auto; }
.history-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-light);
}
.history-item {
    padding: 3px 10px;
    font-size: 11px;
    margin: 2px 4px;
    cursor: default;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-done {
    color: var(--text);
    border-left-color: #8b5cf6;
}
.history-redo {
    color: var(--text-muted);
    border-left-color: #d1d5db;
}
.history-current {
    padding: 2px 10px;
    font-size: 10px;
    color: #8b5cf6;
    text-align: center;
}
.history-empty {
    padding: 8px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

[data-theme="dark"] .history-header { color: #94a3b8; border-bottom-color: #334155; }
[data-theme="dark"] .history-done { color: #e2e8f0; border-left-color: #8b5cf6; }
[data-theme="dark"] .history-redo { color: #94a3b8; border-left-color: #475569; }
[data-theme="dark"] .history-current { color: #a78bfa; }
[data-theme="dark"] .history-empty { color: #94a3b8; }
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 7px; cursor: pointer;
    transition: all 0.15s; margin-bottom: 2px;
    border: 1px solid transparent;
}
.layer-item:hover { background: #f9fafb; }
.layer-item.selected { background: var(--primary-light); border-color: var(--primary); }
.layer-item .layer-icon { width: 26px; height: 26px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: white; flex-shrink: 0; }
.layer-item .layer-icon.text { background: var(--blue); }
.layer-item .layer-icon.image { background: #f59e0b; }
.layer-item .layer-icon.shape { background: #10b981; }
.layer-item .layer-icon.bg { background: #ef4444; }
.layer-item .layer-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-item .layer-lock { cursor: pointer; font-size: 12px; opacity: 0; transition: opacity 0.15s; padding: 2px 4px; }
.layer-item:hover .layer-lock { opacity: 0.7; }
.layer-item .layer-lock:hover { opacity: 1 !important; }
.layer-item .layer-visibility { cursor: pointer; color: var(--text-secondary); font-size: 13px; }
.layer-item .layer-visibility.hidden { color: #b0b0b0; }
.layer-item .layer-delete { cursor: pointer; color: var(--danger); opacity: 0; font-size: 12px; }
.layer-item:hover .layer-delete { opacity: 1; }

/* ====== Center Canvas Area ====== */
.canvas-area {
    position: absolute;
    inset: 0;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 10px 0 0 0;
}
/* 印创风格：画布+滚动条视口 */
.ds-viewport {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    min-height: 400px;
    position: relative;
    z-index: 1;
    overflow: hidden;
}
.ds-viewport-inner {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.canvas-container {
    flex: 1;
    min-width: 0;
    min-height: 0;
    background: #fff;
    border-radius: 12px 0 0 0; padding: 80px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
}
/* 印创风格滚动条 */
.ds-scrollbar {
    background: #e5e7eb;
    position: relative;
    flex-shrink: 0;
}
.ds-scrollbar-v {
    width: 14px;
    border-radius: 0 12px 0 0;
    overflow: hidden;
}
.ds-scrollbar-h {
    height: 14px;
    width: 100%;
    border-radius: 0;
    overflow: hidden;
}
.ds-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
    position: absolute;
    cursor: pointer;
    transition: background 0.1s;
    min-width: 20px;
    min-height: 20px;
}
.ds-scrollbar-thumb:hover {
    background: #6b7280;
}
.ds-scrollbar-thumb:active {
    background: #4b5563;
}
.ds-scrollbar-v .ds-scrollbar-thumb {
    left: 2px; right: 2px;
}
.ds-scrollbar-h .ds-scrollbar-thumb {
    top: 2px; bottom: 2px;
}
.ds-scrollbar-corner {
    width: 14px; height: 14px;
    background: #e5e7eb;
    border-radius: 0 0 12px 0;
    flex-shrink: 0;
}
/* ====== 标尺样式（印创风格：独立层absolute定位，不受flex/滚动影响） ====== */
.ruler-layer {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none; /* 整体不拦截事件，但子元素（标尺）单独开启 pointer-events: auto */
}
.canvas-wrapper {
    position: relative;
    display: inline-block;
    /* 宽度和高度由 JS 动态设置 (_dsApplyZoom)，确保和缩放后的canvas匹配 */
}
.ruler-h {
    position: absolute; top: 2px; left: 22px; right: 14px; height: 22px;
    background: #f5f5f5;
    border-bottom: 1px solid #b0b0b0;
    overflow: hidden;
    z-index: 1;
    pointer-events: auto; /* v4.68修复：标尺需要接收鼠标事件以支持拖拽辅助线 */
    cursor: row-resize;
}
.ruler-v {
    position: absolute; top: 25px; left: 0; width: 22px;
    bottom: 14px;
    background: #f5f5f5;
    border-right: 1px solid #b0b0b0;
    overflow: hidden;
    z-index: 1;
    pointer-events: auto; /* v4.68修复：标尺需要接收鼠标事件以支持拖拽辅助线 */
    cursor: col-resize;
}
.ruler-corner {
    position: absolute; top: 2px; left: 0; width: 22px; height: 22px;
    background: #e5e5e5;
    border-right: 1px solid #b0b0b0;
    border-bottom: 1px solid #b0b0b0;
    z-index: 2;
}

/* ====== v4.68: 可拖拽辅助线系统 ====== */
.guide-overlay {
    position: absolute; top: 33px; left: 22px;
    right: 14px; bottom: 14px;
    pointer-events: none; z-index: 3;
}
.guide-line {
    position: absolute;
    pointer-events: auto;
    transition: opacity 0.15s;
}
.guide-line-h {
    left: 0; right: 0; height: 0;
    border-top: 1px dashed #2563eb;
    cursor: row-resize;
}
.guide-line-v {
    top: 0; bottom: 0; width: 0;
    border-left: 1px dashed #2563eb;
    cursor: col-resize;
}
.guide-line.locked {
    border-color: #ef4444;
}
.guide-line.highlight {
    border-color: #93c5fd;
    border-width: 2px;
}
.guide-line .guide-label {
    position: absolute;
    font-size: 9px; color: #2563eb; background: rgba(255,255,255,0.9);
    padding: 1px 4px; border-radius: 3px;
    white-space: nowrap; pointer-events: none;
    font-family: Tahoma, sans-serif;
}
.guide-line-h .guide-label { left: 4px; top: 2px; }
.guide-line-v .guide-label { top: 4px; left: 2px; }
.guide-drag-preview {
    position: fixed; pointer-events: none; z-index: 9999;
    border-left: 1px dashed #93c5fd;
    height: 100vh; top: 0;
}
.guide-drag-preview.h { border-left: none; border-top: 1px dashed #93c5fd; width: 100vw; height: 0; left: 0; }
/* 标尺上的拖拽触发区域提示 */
.ruler-h.guide-dragging, .ruler-v.guide-dragging {
    cursor: ns-resize;
}
.ruler-h.guide-dragging-v, .ruler-v.guide-dragging-h {
    cursor: col-resize;
}
.ruler-h svg, .ruler-v svg {
    display: block;
}
/* ====== v4.69: 本地字体匹配器样式 ====== */
.font-matcher-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
}
.font-matcher-dialog {
    background: #fff; border-radius: 14px;
    width: 580px; max-height: 85vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.font-matcher-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid #e5e7eb;
    font-size: 15px; font-weight: 600; color: #1f2937;
}
.font-matcher-close {
    width: 28px; height: 28px; border: none; background: #f3f4f6;
    border-radius: 6px; cursor: pointer; font-size: 14px; color: #6b7280;
}
.font-matcher-close:hover { background: #e5e7eb; color: #374151; }
.font-matcher-body { padding: 16px 20px; }
.fm-step { display: flex; gap: 10px; margin-bottom: 14px; }
.fm-step-num {
    width: 28px; height: 28px; border-radius: 50%;
    background: #3b82f6; color: #fff; font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fm-step-content { flex: 1; }
.fm-step-content label {
    display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px;
}
.fm-dropzone {
    border: 2px dashed #d1d5db; border-radius: 10px;
    padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s;
}
.fm-dropzone:hover, .fm-dropzone.drag-over {
    border-color: #3b82f6; background: #eff6ff;
}
.fm-dropzone-inner {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 12px; color: #6b7280;
}
.fm-preview-row { display: flex; gap: 10px; }
.fm-preview-box { flex: 1; }
.fm-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.fm-results {
    margin-top: 14px; padding-top: 14px; border-top: 1px solid #e5e7eb;
    max-height: 300px; overflow-y: auto;
}
.fm-result-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px; cursor: pointer;
    transition: background 0.15s; margin-bottom: 4px;
}
.fm-result-item:hover { background: #eff6ff; }
.fm-result-rank {
    width: 24px; height: 24px; border-radius: 50%;
    background: #3b82f6; color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fm-result-rank.r2 { background: #93c5fd; }
.fm-result-rank.r3 { background: #93c5fd; }
.fm-result-name { font-size: 13px; font-weight: 600; color: #1f2937; flex: 1; }
.fm-result-score {
    font-size: 11px; font-weight: 600; color: #3b82f6; min-width: 50px; text-align: right;
}
.fm-result-sample {
    font-size: 16px; padding: 2px 8px; background: #f3f4f6; border-radius: 4px;
    color: #374151; min-width: 60px; text-align: center;
}
.fm-progress {
    display: flex; align-items: center; gap: 8px; padding: 8px 0;
    font-size: 12px; color: #6b7280;
}
.fm-progress-bar {
    flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden;
}
.fm-progress-fill {
    height: 100%; background: linear-gradient(90deg, #3b82f6, #93c5fd);
    border-radius: 3px; transition: width 0.3s;
}

#designCanvas {
    display: block; border-radius: 2px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    cursor: crosshair;
    transform-origin: 0 0;
    transition: none;
}

/* ====== 印创风格状态栏 ====== */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: linear-gradient(135deg, #1e293b, #2563eb);
    color: #dbeafe;
    font-size: 12px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    gap: 12px;
    z-index: 500;
    border-top: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 -1px 8px rgba(37,99,235,0.25);
}
.status-bar span { display: flex; align-items: center; gap: 4px; }
.status-bar .status-label { color: #93c5fd; }
.status-bar .zoom-badge {
    background: rgba(255,255,255,0.15);
    color: #dbeafe;
    padding: 1px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
    transition: background 0.15s;
    border: 1px solid rgba(255,255,255,0.2);
}
.status-bar .zoom-badge:hover { background: rgba(255,255,255,0.25); color: #fff; }
.status-bar .zoom-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: #dbeafe;
    padding: 1px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.status-bar .zoom-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
#statusColor {
    position: absolute !important;
    right: 280px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}  /* v5.57: 实时颜色靠右显示（跨越调色板，在缩放按钮左侧） */

/* ====== 印创风格底部颜色调色板 ====== */
.ds-palette {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
    height: 100%;
}
.ds-palette .palette-swatch {
    width: 22px;
    height: 22px;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
    flex-shrink: 0;
    box-sizing: border-box;
}
.ds-palette .palette-swatch:hover {
    transform: scale(1.25);
    border-color: #fff;
    z-index: 2;
}
.ds-palette .palette-swatch.no-fill {
    background: #2d2a5e;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 13px;
    font-weight: bold;
    line-height: 1;
}
.ds-palette .palette-swatch.no-fill:hover {
    color: #ef4444;
}
.ds-palette .palette-divider {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.1);
    margin: 0 3px;
}
/* 填充/边框指示器 */
.ds-palette .fill-indicator {
    width: 28px;
    height: 22px;
    border-radius: 2px;
    border: 2px solid rgba(255,255,255,0.3);
    cursor: pointer;
    margin-right: 4px;
    position: relative;
    flex-shrink: 0;
}
.ds-palette .fill-indicator .fill-inner {
    position: absolute;
    top: 2px; left: 2px; right: 2px; bottom: 2px;
    border-radius: 1px;
}
.ds-palette .stroke-indicator {
    width: 28px;
    height: 22px;
    border-radius: 2px;
    border: 2px dashed rgba(255,255,255,0.25);
    cursor: pointer;
    margin-right: 6px;
    position: relative;
    flex-shrink: 0;
}
.ds-palette .stroke-indicator .stroke-inner {
    position: absolute;
    top: 1px; left: 1px; right: 1px; bottom: 1px;
    border-radius: 1px;
    border: 2px solid rgba(255,255,255,0.5);
}

/* ====== Right Panel (Templates) - 固定靠右 ====== */
.template-panel {
    width: 200px; flex-shrink: 0;
    display: flex; flex-direction: column; gap: 14px;
    position: fixed;
    right: 12px;
    top: 136px;       /* 两排工具栏下方（+10mm） */
    bottom: 10px;
    overflow-y: auto;
    z-index: 50;
    transition: transform 0.3s ease, opacity 0.3s ease;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}
.template-panel.collapsed {
    transform: translateX(220px);
    opacity: 0;
    pointer-events: none;
}
.template-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.template-thumb {
    aspect-ratio: 3/4;
    border: 2px solid var(--border); border-radius: 8px;
    cursor: pointer; overflow: hidden; transition: all 0.2s;
    position: relative; display: flex; flex-direction: column;
}
.template-thumb:hover { border-color: var(--primary); transform: scale(1.03); }
.template-thumb.active { border-color: var(--primary-dark); box-shadow: 0 0 0 2px var(--primary-light); }
.template-thumb .thumb-canvas { flex: 1; width: 100%; }
.template-thumb .thumb-name {
    font-size: 10px; text-align: center; padding: 4px;
    background: white; color: var(--text-secondary);
}

.elem-palette {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.palette-item {
    aspect-ratio: 1; border: 2px dashed var(--border); border-radius: 8px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: grab; transition: all 0.2s; font-size: 12px; color: var(--text-secondary);
    gap: 4px; background: white;
}
.palette-item:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.palette-item i { font-size: 18px; }

/* ====== 右键上下文菜单 (印创风格) ====== */
.ctx-menu {
    position: fixed; z-index: 10000;
    background: #fff; border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    padding: 5px 0; min-width: 180px;
    display: none; font-family: inherit;
}
.ctx-menu.show { display: block; animation: ctxFadeIn 0.12s ease-out; }
@keyframes ctxFadeIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }
.ctx-menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px; cursor: pointer; font-size: 13px;
    color: var(--text); transition: background 0.1s;
    border: none; background: none; width: 100%; text-align: left;
    font-family: inherit;
}
.ctx-menu-item:hover { background: #eff6ff; color: var(--primary-dark); }
.ctx-menu-item .ctx-icon { width: 20px; text-align: center; font-size: 13px; flex-shrink: 0; }
.ctx-menu-item .ctx-shortcut { margin-left: auto; font-size: 12px; color: #777777; }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 12px; }
.ctx-menu-header {
    padding: 8px 16px 4px; font-size: 12px; color: #666666;
    font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
}

/* ====== Toast — v5.50.87 品牌风格 ====== */
.toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #fff; color: #4c1d95;
    padding: 12px 28px; border-radius: 12px; font-size: 14px;
    opacity: 0; transition: all 0.3s; z-index: 9999; pointer-events: none;
    box-shadow: 0 8px 30px rgba(76,29,149,0.15), 0 0 0 1px rgba(139,92,246,0.15);
    font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #f5f3ff; color: #4c1d95; border: 1px solid #c4b5fd; }
.toast.error { background: #fce7f3; color: #9d174d; border: 1px solid #fbcfe8; }
.toast.warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.toast.info { background: #f5f3ff; color: #4c1d95; border: 1px solid #c4b5fd; }

/* ====== Modal ====== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: none; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: white; border-radius: 16px;
    padding: 28px; max-width: 520px; width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-box h2 { font-size: 1.2rem; margin-bottom: 16px; color: var(--text); }
.modal-box p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ====== Empty State ====== */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 400px; color: var(--text-secondary); gap: 12px;
}
.empty-state i { font-size: 48px; color: var(--primary-light); }
.empty-state h3 { font-size: 16px; color: var(--text); }
.empty-state p { font-size: 13px; text-align: center; max-width: 280px; }

/* ====== Responsive ====== */
@media (max-width: 1100px) {
    .template-panel { display: none; }
    .prop-panel { width: 260px; left: 8px; }
    .canvas-area { margin-right: 0; }
}
@media (max-width: 900px) {
    .main-layout { flex-direction: column; }
    .prop-panel, .template-panel { 
        position: static; 
        width: 100%;
        overflow-y: visible;
    }
    .canvas-area { order: -1; margin-left: 0; margin-right: 0; }
}

/* ====== Scrollbar ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* 吸管面板动画 */
@keyframes _dsFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ====== 分享弹窗 ====== */
.share-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 10000;
    display: none; align-items: center; justify-content: center;
}
.share-overlay.show { display: flex; }

/* v5.40: 符号弹窗——底部抽屉式 */
.sym-popup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 11000; display: none; align-items: flex-end; justify-content: center; padding-bottom: 4px; }
.sym-popup-overlay.show { display: flex; animation: symFadeIn 0.15s ease-out; }
@keyframes symFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes symSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sym-popup-box {
    background: white; border-radius: 16px 16px 0 0; padding: 16px 24px; width: 92vw; max-width: 920px; max-height: 46vh; overflow-y: auto;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.15); position: relative; animation: symSlideUp 0.2s ease-out;
}
.sym-popup-box h3 { margin: 0 0 10px; font-size: 16px; color: #1f2937; display: flex; align-items: center; gap: 6px; }
.sym-popup-close { position: absolute; top: 10px; right: 16px; background: none; border: none; font-size: 20px; cursor: pointer; color: #9ca3af; padding: 4px 8px; border-radius: 6px; }
.sym-popup-close:hover { background: #f3f4f6; color: #374151; }
.sym-popup-tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.sym-popup-tabs span { padding: 4px 10px; border-radius: 14px; cursor: pointer; font-size: 12px; background: #f3f4f6; color: #374151; user-select: none; transition: all 0.12s; }
.sym-popup-tabs span:hover { background: #e5e7eb; }
.sym-popup-panels { min-height: 50px; }
.sym-popup-panel { display: none; flex-wrap: wrap; gap: 4px; }
.sym-popup-panel button { padding: 5px 9px; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; cursor: pointer; font-size: 16px; line-height: 1.2; transition: all 0.1s; }
.sym-popup-panel button:hover { background: #dbeafe; border-color: #2563eb; transform: scale(1.1); }

/* v5.12.29 净含量字高智能提示弹窗 */
.nc-popup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 11500; display: none; align-items: center; justify-content: center; }
.nc-popup-overlay.show { display: flex; animation: symFadeIn 0.15s ease-out; }
.nc-popup-box {
    background: white; border-radius: 14px; padding: 24px 28px; width: 400px; max-width: 92vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2); position: relative;
}
.nc-popup-box h3 { margin: 0 0 6px; font-size: 17px; color: #1f2937; display: flex; align-items: center; gap: 6px; }
.nc-popup-box .nc-subtitle { font-size: 12px; color: #6b7280; margin-bottom: 16px; line-height: 1.5; }
.nc-popup-input-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.nc-popup-input-row input { flex: 1; padding: 8px 12px; border: 2px solid #d1d5db; border-radius: 8px; font-size: 16px; outline: none; transition: border-color 0.15s; }
.nc-popup-input-row input:focus { border-color: #2563eb; }
.nc-popup-input-row select { padding: 8px 10px; border: 2px solid #d1d5db; border-radius: 8px; font-size: 14px; cursor: pointer; outline: none; background: #fafafa; }
.nc-popup-result { background: #eff6ff; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.nc-popup-result .nc-tier { font-size: 13px; color: #1d4ed8; font-weight: 600; margin-bottom: 4px; }
.nc-popup-result .nc-rule { font-size: 12px; color: #1e3a5f; line-height: 1.6; }
.nc-popup-result .nc-recommend { font-size: 16px; color: #2563eb; font-weight: 700; margin-top: 6px; }
.nc-popup-btns { display: flex; gap: 10px; justify-content: flex-end; }
.nc-popup-btns button { padding: 8px 20px; border-radius: 8px; font-size: 14px; cursor: pointer; font-weight: 600; border: none; transition: all 0.12s; }
.nc-btn-apply { background: #2563eb; color: #fff; }
.nc-btn-apply:hover { background: #1d4ed8; }
.nc-btn-skip { background: #f3f4f6; color: #6b7280; }
.nc-btn-skip:hover { background: #e5e7eb; color: #374151; }
.nc-popup-close { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 18px; cursor: pointer; color: #9ca3af; padding: 4px 8px; border-radius: 4px; }
.nc-popup-close:hover { background: #f3f4f6; color: #374151; }

/* v5.12.30 国标合规提示弹窗（配料表/致敏原/日期格式） */
.gb-tip-body { font-size: 13px; color: #374151; line-height: 1.7; margin-bottom: 16px; }
.gb-tip-body .gb-tip-section { border-radius: 8px; padding: 12px 16px; margin-bottom: 10px; border-left: 3px solid #f59e0b; }
.gb-tip-body .gb-tip-section.info { background: #eff6ff; border-left-color: #3b82f6; }
.gb-tip-body .gb-tip-section.warn { background: #fffbeb; border-left-color: #f59e0b; }
.gb-tip-body .gb-tip-section.danger { background: #fef2f2; border-left-color: #ef4444; }
.gb-tip-body .gb-tip-section h4 { margin: 0 0 4px; font-size: 14px; color: #1f2937; }
.gb-tip-section.info h4 { color: #1e40af; }
.gb-tip-section.warn h4 { color: #92400e; }
.gb-tip-section.danger h4 { color: #991b1b; }
.gb-tip-body .gb-tip-section p { margin: 2px 0 0; font-size: 12px; color: #6b7280; line-height: 1.7; }
.gb-allergen-tag { display: inline-block; background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; border-radius: 4px; padding: 2px 8px; margin: 2px 4px; font-size: 12px; font-weight: 600; }

.share-dialog {
    background: white; border-radius: 16px; padding: 28px;
    width: 440px; max-width: 90vw; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.share-dialog h3 { margin: 0 0 8px; font-size: 20px; color: #1f2937; }
.share-dialog .share-subtitle { font-size: 13px; color: #6b7280; margin-bottom: 20px; }
.share-dialog .share-url-box {
    display: flex; gap: 8px; margin-bottom: 16px;
}
.share-dialog .share-url-box input {
    flex: 1; padding: 10px 14px; border: 2px solid #e5e7eb;
    border-radius: 8px; font-size: 13px; outline: none; color: #374151;
    font-family: monospace;
}
.share-dialog .share-url-box input:focus { border-color: #3b82f6; }
.share-dialog .share-url-box button {
    padding: 10px 16px; background: #3b82f6; color: white;
    border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
    white-space: nowrap;
}
.share-dialog .share-url-box button:hover { background: #2563eb; }
.share-dialog .share-qr {
    display: inline-block; padding: 12px; background: #f9fafb;
    border-radius: 12px; margin-bottom: 12px;
}
.share-dialog .share-qr canvas { display: block; }
.share-dialog .share-stats {
    font-size: 12px; color: #444444; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: center; gap: 16px;
}
.share-dialog .share-stats .stat-item {
    display: flex; align-items: center; gap: 4px;
}
.share-dialog .share-stats .dot {
    width: 8px; height: 8px; border-radius: 50%; background: #10b981;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.share-dialog .btn-row {
    display: flex; gap: 8px; justify-content: center;
}
.share-dialog .btn-row button {
    padding: 8px 20px; border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.share-dialog .btn-row .btn-stop {
    background: #ef4444; color: white;
}
.share-dialog .btn-row .btn-stop:hover { background: #dc2626; }
.share-dialog .btn-row .btn-close-dlg {
    background: #f3f4f6; color: #374151;
}
.share-dialog .btn-row .btn-close-dlg:hover { background: #e5e7eb; }

.share-dialog .share-preview {
    display: none; margin: 0 auto 12px; width: 100%; max-width: 380px;
    background: #f3f4f6; border-radius: 8px; padding: 8px; border: 1px solid #e5e7eb;
}
.share-dialog .share-preview.show { display: block; }
.share-dialog .share-preview img {
    width: 100%; height: auto; display: block; border-radius: 4px;
    background: #ffffff; border: 1px solid #d1d5db;
}
.share-dialog .share-preview-label {
    font-size: 11px; color: #6b7280; margin-bottom: 6px; text-align: left;
}

/* 观众预览模式 — 纯只读直播，隐藏编辑UI */
body.viewer-mode .toolbar { display: none; }
body.viewer-mode .left-panel { display: none; }
body.viewer-mode .template-panel { display: none; }
body.viewer-mode .right-toggle { display: none; }
body.viewer-mode .left-toggle { display: none; }
body.viewer-mode .canvas-area { width: 100%; }
body.viewer-mode .ds-viewport { max-height: 100vh; height: 100vh; overflow: hidden; }
body.viewer-mode .ds-viewport-inner { flex: 1; overflow: hidden; }
body.viewer-mode .canvas-container {
    width: 100vw; height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: var(--viewer-bg, #ffffff);  /* v5.22.2: 跟随主播背景色，默认白色 */
    position: relative;
    border-radius: 0;
    padding: 0;  /* v5.50.77: 去掉80px padding，让画面铺满全屏 */
    overflow: hidden;
}
body.viewer-mode .canvas-wrapper {
    position: relative;
    width: 100vw; height: 100vh;  /* v5.50.77: 铺满视口 */
    overflow: hidden;
}
body.viewer-mode .ds-scrollbar,
body.viewer-mode .ds-scrollbar-corner { display: none; }
/* 观众直播画面 - 全屏填充，铺满视口，与主播端画质一致 */
#viewerCanvasImg {
    display: none;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;  /* v5.22.2: 等比缩放，不裁剪 */
    border-radius: 0;      /* v5.22.2: 去圆角 */
    box-shadow: none;      /* v5.22.2: 去阴影 */
    z-index: 10;
    position: relative;
}
body.viewer-mode #viewerCanvasImg {
    display: block;
    position: absolute;      /* v5.50.77: 绝对定位脱离canvas-wrapper约束 */
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: auto; height: auto;
    max-width: 100vw;
    max-height: 100vh;
    z-index: 999;            /* v5.50.77: 最高层级，覆盖所有元素 */
}
body.viewer-mode canvas { visibility: hidden; }
body.viewer-mode svg { visibility: hidden; }  /* v5.50.77: 隐藏所有SVG图层 */
body.viewer-mode .viewer-badge {
    position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.7); color: white; padding: 6px 16px;
    border-radius: 20px; font-size: 12px; z-index: 1000;
    display: flex; align-items: center; gap: 6px;
}
body.viewer-mode .viewer-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; }
body.viewer-mode .viewer-badge .dot.offline { background: #ef4444; }

/* ====== 暗色主题全局覆盖 ====== */
[data-theme="dark"] body {
    background: #0f172a;
    color: #e2e8f0;
}

/* 工具栏区 */
[data-theme="dark"] .tool-btn {
    background: #334155;
    border-color: #475569;
    color: #cbd5e1;
}
[data-theme="dark"] .tool-btn:hover {
    background: #475569;
    border-color: #64748b;
    color: #e2e8f0;
}
[data-theme="dark"] .tool-btn:active {
    background: #1e293b;
}
[data-theme="dark"] .tool-btn.active {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: #fff;
}

[data-theme="dark"] .tool-compact {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}
[data-theme="dark"] .tool-select {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}
[data-theme="dark"] .tool-icon-btn {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
}
[data-theme="dark"] .tool-icon-btn:hover {
    background: #475569;
    border-color: #64748b;
}
[data-theme="dark"] .tool-label {
    color: #94a3b8;
}

/* 操作按钮 */
[data-theme="dark"] .action-btn.outline {
    background: #334155;
    color: #e2e8f0;
    border-color: #475569;
}
[data-theme="dark"] .action-btn.outline:hover {
    background: #475569;
    border-color: var(--primary);
    color: #93c5fd;
}

/* 属性面板 */
[data-theme="dark"] .prop-row label {
    color: var(--prop-label);
}
[data-theme="dark"] .prop-row input,
[data-theme="dark"] .prop-row select,
[data-theme="dark"] .prop-row textarea {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}
[data-theme="dark"] .prop-row input:focus,
[data-theme="dark"] .prop-row select:focus,
[data-theme="dark"] .prop-row textarea:focus {
    border-color: var(--primary);
}

/* 图层面板 */
[data-theme="dark"] .layer-item:hover {
    background: #334155;
}
[data-theme="dark"] .layer-item.selected {
    background: var(--layer-selected-bg);
    border-color: var(--primary);
}

/* 颜色输入行 */
[data-theme="dark"] .color-input-row input[type="text"] {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

/* 字体选项 */
[data-theme="dark"] .font-option:hover {
    background: #334155;
}
[data-theme="dark"] .font-option.active {
    background: var(--primary-light);
    color: var(--primary-dark);
}
/* v4.54: 字体选择器预览——选中字体即时反映在select元素上 */
#propFont { font-size: 13px; }
#propFont option { padding: 3px 6px; font-size: 14px; }
/* 字体分组标签样式 */
#propFont optgroup { font-weight: 600; color: #444444; font-size: 12px; font-family: 'Microsoft YaHei', sans-serif; }

/* Canvas区域 */
[data-theme="dark"] .canvas-container {
    background: #0b1120;
}
[data-theme="dark"] #canvas {
    background: #fff;  /* 画布本身保持白色，因为标签纸是白的 */
}

/* 右键菜单 */
[data-theme="dark"] .ctx-menu {
    background: var(--menu-panel-bg);
    border-color: var(--menu-panel-border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}
[data-theme="dark"] .ctx-menu-item {
    color: #e2e8f0;
}
[data-theme="dark"] .ctx-menu-item:hover {
    background: #334155;
    color: #93c5fd;
}
[data-theme="dark"] .ctx-sep {
    background: #334155;
}

/* 模态对话框 */
[data-theme="dark"] .modal-overlay {
    background: rgba(0,0,0,0.7);
}
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dialog-box {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
}

/* Toast — 暗色主题 */
[data-theme="dark"] .toast {
    background: #1e1b4b;
    color: #e0d7fc;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 0 1px rgba(139,92,246,0.2);
}
[data-theme="dark"] .toast.success { background: #1e1b4b; color: #a78bfa; border-color: rgba(139,92,246,0.3); }
[data-theme="dark"] .toast.error { background: #4c1d2e; color: #fda4af; border-color: rgba(244,114,182,0.3); }
[data-theme="dark"] .toast.warning { background: #3b2f0a; color: #fde68a; border-color: rgba(251,191,36,0.3); }
[data-theme="dark"] .toast.info { background: #1e1b4b; color: #a78bfa; border-color: rgba(139,92,246,0.3); }

/* 标签页切换 */
[data-theme="dark"] .tab-btn {
    color: #94a3b8;
}
[data-theme="dark"] .tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* 属性卡片 */
[data-theme="dark"] .prop-card {
    background: var(--card);
}
[data-theme="dark"] .prop-card h3 {
    color: #e2e8f0;
}

/* 模板缩略图 */
[data-theme="dark"] .template-thumb {
    border-color: #334155;
    background: #0f172a;
}
[data-theme="dark"] .template-thumb:hover {
    border-color: var(--primary);
}
[data-theme="dark"] .template-thumb.active {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 2px var(--primary-light);
}
[data-theme="dark"] .template-thumb .thumb-name {
    background: #1e293b;
    color: #94a3b8;
}

/* 色板 */
[data-theme="dark"] .palette-item {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}
[data-theme="dark"] .palette-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* 空状态 */
[data-theme="dark"] .empty-state {
    color: #64748b;
}
[data-theme="dark"] .empty-state h3 {
    color: #e2e8f0;
}

/* 全屏预览遮罩 */
[data-theme="dark"] .fullscreen-preview {
    background: rgba(0,0,0,0.85);
}

/* 底部状态栏 */
[data-theme="dark"] .bottom-bar {
    background: #1e293b;
    border-top-color: #334155;
    color: #94a3b8;
}
[data-theme="dark"] .bottom-bar .zoom-display {
    color: #e2e8f0;
}

/* 特殊元素：编号/数值显示 */
[data-theme="dark"] .prop-row .val-display {
    color: var(--primary);
}

/* 项目名称输入 */
[data-theme="dark"] #projectNameInput {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

/* 设置区select */
[data-theme="dark"] #settingsCard select,
[data-theme="dark"] #settingsCard input {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

/* 快捷键显示 */
[data-theme="dark"] .menu-item[data-shortcut]::after {
    color: #64748b;
}

/* v5.56 专业风格页签栏（fixed定位，与底部状态栏同级，确保100%可见） */
.page-tab-bar {
    position: fixed;
    left: 0; right: 0; bottom: 32px;
    display: flex;
    align-items: flex-end;
    background: #e8e8e8;
    border-top: 1px solid #bbb;
    border-bottom: 1px solid #bbb;
    padding: 0 6px 0 8px;
    gap: 2px;
    height: 30px;
    z-index: 999;
}
.page-tab-bar .page-tab {
    padding: 4px 16px 4px 14px;
    background: #d4d4d4;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    font-family: "Microsoft YaHei", sans-serif;
    /* 文件夹标签：左上斜切 */
    clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 8px);
    border-top-left-radius: 3px;
    transition: all 0.12s;
    line-height: 18px;
}
.page-tab-bar .page-tab:hover {
    background: #c5c5c5;
    color: #222;
}
.page-tab-bar .page-tab.active {
    background: #fff;
    color: #111;
    font-weight: 700;
    /* 活跃页签向上突出 */
    margin-bottom: -1px;
    clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
    padding-bottom: 5px;
}
.page-tab-bar .page-tab-add {
    font-size: 15px;
    padding: 2px 10px;
    color: #059669;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
    line-height: 24px;
}
.page-tab-bar .page-tab-add:hover {
    color: #047857;
}

/* v5.57: 页面工具按钮组（左侧，与页签同行） */
.page-tools-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 8px;
    margin-right: 6px;
    border-right: 1px solid #bbb;
}
.page-tool-btn {
    height: 24px;
    padding: 0 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    line-height: 24px;
    color: #666;
    border-radius: 3px;
}
.page-tool-btn:hover { background: #c5c5c5; color: #222; }
.page-tool-btn.danger-action:hover { background: #fee2e2; color: #dc2626; }
.page-tools-group span {
    font-size: 11px;
    color: #555;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
    line-height: 24px;
}

/* 分页器 */
[data-theme="dark"] .page-tab-bar {
    background: #1a1f26;
    border-color: #334155;
}
[data-theme="dark"] .page-tab-bar .page-tab {
    background: #283142;
    color: #94a3b8;
}
[data-theme="dark"] .page-tab-bar .page-tab:hover {
    background: #354052;
    color: #e2e8f0;
}
[data-theme="dark"] .page-tab-bar .page-tab.active {
    background: #111827;
    color: #f1f5f9;
    border: none;
}
[data-theme="dark"] .page-tab-bar .page-tab-add {
    color: #34d399;
}
[data-theme="dark"] .page-nav {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .page-nav .page-btn {
    background: #334155;
    border-color: #475569;
    color: #e2e8f0;
}
[data-theme="dark"] .page-nav .page-btn:hover {
    background: #475569;
}
[data-theme="dark"] .page-nav .page-btn.active {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: #fff;
}

/* 菜单触发按钮 */
[data-theme="dark"] .mega-menu-title { color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .menu-trigger:hover {
    background: var(--menubar-hover-bg);
    color: var(--menubar-hover-text);
}

/* 所有白色/浅色背景的容器 */
[data-theme="dark"] .toolbar {
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* SVG overlay中页面名称文字 */
[data-theme="dark"] #pageOverlaySvg text {
    /* 不强制覆盖，因为Canvas内文字需要根据画布颜色调整 */
}

/* 打印预览 */
[data-theme="dark"] .print-preview-overlay {
    background: rgba(0,0,0,0.85);
}

/* 滑块 */
[data-theme="dark"] input[type="range"] {
    background: transparent;
}

/* 页面尺寸标注 */
[data-theme="dark"] .page-size-label {
    color: #94a3b8;
}

/* ====== 交互式新手引导 ====== */
/* 四块遮罩拼出镂空效果（不用box-shadow 9999px，低配机也流畅） */
.ds-guide-mask {
    position: fixed;
    z-index: 99998;
    pointer-events: auto;
    background: rgba(0,0,0,0.55);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.ds-guide-highlight {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    border-radius: 10px;
    border: 4px solid rgba(37,99,235,0.85);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.2), 0 4px 24px rgba(37,99,235,0.25);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.ds-guide-card {
    position: fixed;
    z-index: 100000;
    background: #fff;
    color: #1e1b4b;
    border-radius: 16px;
    padding: 24px 28px;
    max-width: 400px;
    min-width: 280px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(37,99,235,0.2);
    font-family: 'Noto Sans SC', sans-serif;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    animation: dsGuideSlideIn 0.4s ease-out;
}
@keyframes dsGuideSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ds-guide-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #2563eb;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ds-guide-card p {
    margin: 0 0 6px;
    font-size: 14px;
    line-height: 1.7;
    color: #374151;
}
.ds-guide-card .guide-tip {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
    padding: 8px 12px;
    background: #eff6ff;
    border-radius: 8px;
    line-height: 1.6;
}
.ds-guide-card .guide-tip::before {
    content: '💡 提示：';
    font-weight: 600;
}
.ds-guide-card .guide-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    gap: 10px;
}
.ds-guide-card .guide-steps {
    font-size: 12px;
    color: #9ca3af;
}
.ds-guide-card .guide-steps b {
    color: #2563eb;
}
.ds-guide-card button {
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Noto Sans SC', sans-serif;
    transition: all 0.15s;
}
.ds-guide-card .btn-prev {
    background: #f3f4f6;
    color: #6b7280;
}
.ds-guide-card .btn-prev:hover {
    background: #e5e7eb;
}
.ds-guide-card .btn-next {
    background: #2563eb;
    color: #fff;
}
.ds-guide-card .btn-next:hover {
    background: #1d4ed8;
}
.ds-guide-card .btn-skip {
    background: transparent;
    color: #9ca3af;
    font-size: 12px;
    padding: 4px 10px;
}
.ds-guide-card .btn-skip:hover {
    color: #6b7280;
}
/* 暗色主题下的引导卡片保持亮色（引导卡片自身是独立浮层） */

/* ====== 第一阶段：核心交互打磨 ====== */

/* 悬浮高亮：画布元素 hover 效果 */
.ds-hover-overlay {
    position: fixed; pointer-events: none; z-index: 9998;
    border: 2px dashed #2563eb; border-radius: 4px;
    background: rgba(29,78,216,0.08);
    transition: all 0.1s ease;
    display: none;
}
.ds-hover-overlay.active { display: block; }
.ds-hover-label {
    position: fixed; pointer-events: none; z-index: 9999;
    background: #1e1b4b; color: #fff; font-size: 11px;
    padding: 3px 8px; border-radius: 4px;
    white-space: nowrap; font-family: 'Noto Sans SC',sans-serif;
    display: none;
}
.ds-hover-label.active { display: block; }

/* 拖拽坐标覆盖层 */
.ds-drag-coords {
    position: fixed; pointer-events: none; z-index: 9999;
    background: rgba(30,27,75,0.88); color: #fff;
    font-size: 12px; padding: 6px 12px; border-radius: 6px;
    font-family: 'Consolas','Courier New',monospace;
    white-space: nowrap; display: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(29,78,216,0.4);
}
.ds-drag-coords.active { display: block; }
.ds-drag-coords .coord-val { color: #93c5fd; font-weight: 700; }
.ds-drag-coords .coord-snap { color: #f59e0b; font-size: 10px; margin-left: 4px; }

/* 键盘快捷键提示浮层 */
.ds-shortcut-toast {
    position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
    z-index: 10001; background: #1e1b4b; color: #fff;
    font-size: 13px; padding: 8px 18px; border-radius: 20px;
    pointer-events: none; opacity: 0; transition: opacity 0.3s;
    font-family: 'Noto Sans SC',sans-serif;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.ds-shortcut-toast.show { opacity: 1; }
.ds-shortcut-toast .key { 
    display: inline-block; background: rgba(255,255,255,0.15);
    padding: 1px 6px; border-radius: 3px; margin: 0 2px; font-size: 11px;
}

/* ====== 第二阶段：专业印刷功能 ====== */

/* 出血/裁剪标记 */
.ds-bleed-indicator {
    position: absolute; pointer-events: none; z-index: 5;
}
.ds-crop-mark {
    position: absolute; pointer-events: none; z-index: 6;
}
.ds-bleed-label {
    position: absolute; pointer-events: none; z-index: 7;
    font-size: 10px; color: #ef4444; font-weight: 600;
    font-family: 'Noto Sans SC',sans-serif;
}

/* CMYK颜色面板增强 */
.cmyk-preview-bar {
    display: flex; gap: 4px; margin-top: 4px; align-items: center;
}
.cmyk-chip {
    width: 16px; height: 16px; border-radius: 3px; border: 1px solid #d1d5db;
    cursor: pointer; position: relative;
}
.cmyk-chip:hover { transform: scale(1.2); z-index: 2; }
.cmyk-chip .cmyk-tooltip {
    display: none; position: absolute; bottom: 120%; left: 50%;
    transform: translateX(-50%); background: #1e1b4b; color: #fff;
    font-size: 10px; padding: 2px 6px; border-radius: 3px; white-space: nowrap;
}
.cmyk-chip:hover .cmyk-tooltip { display: block; }

/* 拼版预览弹窗 */
.imposition-grid {
    display: grid; gap: 2px; background: #e5e7eb; padding: 2px;
    border-radius: 8px;
}
.imposition-cell {
    background: #fff; aspect-ratio: 1; display: flex;
    align-items: center; justify-content: center;
    font-size: 10px; color: #9ca3af; border-radius: 2px;
}
.imposition-cell.active { 
    background: #dbeafe; color: #2563eb; font-weight: 700;
    border: 2px solid #2563eb;
}

/* ====== 第三阶段：生态与协作 ====== */

/* 模板市场 */
.template-market-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr));
    gap: 10px; max-height: 400px; overflow-y: auto; padding: 4px;
}
.template-market-card {
    border: 2px solid var(--border); border-radius: 10px;
    padding: 8px; cursor: pointer; transition: all 0.2s;
    text-align: center; background: var(--card);
}
.template-market-card:hover {
    border-color: var(--primary); box-shadow: 0 4px 12px rgba(29,78,216,0.15);
    transform: translateY(-2px);
}
.template-market-card .tm-preview {
    width: 100%; height: 80px; background: #eff6ff;
    border-radius: 6px; display: flex; align-items: center;
    justify-content: center; font-size: 28px; margin-bottom: 6px;
}
.template-market-card .tm-name {
    font-size: 12px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.template-market-card .tm-tags {
    font-size: 10px; color: var(--text-muted); margin-top: 2px;
}
.template-market-card .tm-rating {
    font-size: 10px; color: #f59e0b; margin-top: 2px;
}

/* 模板预览弹窗 - 宽屏双栏布局 */
.template-preview-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 11500;
    display: flex; align-items: center; justify-content: center;
    animation: modalFadeIn 0.2s ease;
}
.template-preview-dialog {
    background: var(--card); border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 880px; max-width: 95vw; max-height: 85vh;
    display: flex; flex-direction: column;
    animation: modalSlideUp 0.25s ease;
}
.template-preview-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.template-preview-header h3 {
    margin: 0; font-size: 16px; color: var(--text);
    display: flex; align-items: center; gap: 8px;
}
.template-preview-body {
    display: flex; gap: 20px; padding: 20px;
    overflow-y: auto; flex: 1; min-height: 0;
}
.template-preview-canvas-area {
    flex: 1; min-width: 300px;
    display: flex; align-items: center; justify-content: center;
    background: #f0f0f0; border-radius: 10px;
    padding: 20px; position: relative;
}
[data-theme="dark"] .template-preview-canvas-area {
    background: #0f172a;
}
.template-preview-canvas-area canvas {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 0; display: block; max-width: 100%; max-height: 100%;
    background: #ffffff;
}
.template-preview-info {
    width: 280px; min-width: 260px; flex-shrink: 0;
    display: flex; flex-direction: column;
}
.template-preview-info .tp-name {
    font-size: 20px; font-weight: 700; color: var(--text);
    margin-bottom: 4px; line-height: 1.3;
}
.template-preview-info .tp-meta {
    font-size: 12px; color: var(--text-muted); margin-bottom: 12px;
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.template-preview-info .tp-meta .badge {
    display: inline-block; padding: 2px 8px; border-radius: 100px;
    font-size: 11px; font-weight: 500;
}
.template-preview-info .tp-detail-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border-light);
    font-size: 13px; color: var(--text);
}
.template-preview-info .tp-detail-row .label {
    color: var(--text-muted); font-size: 12px;
}
.template-preview-info .tp-desc {
    font-size: 12px; color: var(--text-muted);
    margin-top: 12px; line-height: 1.6;
    padding: 10px; background: var(--card-hover, #f9fafb);
    border-radius: 8px;
}
.template-preview-info .tp-price {
    font-size: 28px; font-weight: 700; color: #f59e0b;
    margin: 10px 0;
}
.template-preview-info .tp-price.free {
    color: #10b981;
}
.template-preview-footer {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 14px 20px; border-top: 1px solid var(--border);
}
.template-preview-footer button {
    padding: 10px 24px; border-radius: 10px; font-size: 14px;
    font-weight: 600; cursor: pointer; border: none;
    transition: all 0.15s;
}
.tp-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff; box-shadow: 0 4px 14px rgba(29,78,216,0.3);
}
.tp-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(29,78,216,0.4);
}
.tp-btn-secondary {
    background: var(--card-hover, #f3f4f6); color: var(--text);
    border: 1px solid var(--border) !important;
}
.tp-btn-secondary:hover { background: var(--border-light, #e5e7eb); }
.tp-btn-favorite {
    background: none; border: none !important; font-size: 22px;
    padding: 8px 12px !important; cursor: pointer; color: #d1d5db;
}
.tp-btn-favorite.active { color: #f59e0b; }
/* 移动端适配 */
@media (max-width: 768px) {
    .template-preview-dialog { width: 95vw; }
    .template-preview-body { flex-direction: column; }
    .template-preview-canvas-area { min-height: 200px; }
    .template-preview-info { width: 100%; }
}

/* 版本历史列表 */
.version-history-list {
    max-height: 300px; overflow-y: auto;
}
.version-history-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-bottom: 1px solid var(--border-light);
    cursor: pointer; transition: background 0.15s;
}
.version-history-item:hover { background: var(--card-hover); }
.version-history-item .vh-time {
    font-size: 12px; color: var(--text-muted); min-width: 50px;
}
.version-history-item .vh-name {
    flex: 1; font-size: 13px; color: var(--text); font-weight: 500;
}
.version-history-item .vh-badge {
    font-size: 10px; padding: 2px 8px; border-radius: 10px;
    background: #dbeafe; color: #1d4ed8;
}
.version-history-item.current .vh-badge {
    background: #d1fae5; color: #059669;
}

/* CSV批量生成预览 */
.csv-batch-preview {
    max-height: 250px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: 8px;
}
.csv-batch-preview table {
    width: 100%; border-collapse: collapse; font-size: 12px;
}
.csv-batch-preview th {
    background: #eff6ff; color: var(--primary-dark);
    padding: 8px 10px; text-align: left; font-weight: 600;
    position: sticky; top: 0; z-index: 1;
}
.csv-batch-preview td {
    padding: 6px 10px; border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
.csv-batch-preview tr:hover td { background: #f9fafb; }

/* 模态框增强 */
.modal-overlay.show {
    position: fixed; inset: 0; z-index: 11000;
    background: rgba(0,0,0,0.5); display: flex;
    align-items: center; justify-content: center;
    animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-dialog {
    background: var(--card); border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    max-width: 600px; width: 90%; max-height: 80vh;
    overflow-y: auto; animation: modalSlideUp 0.25s ease;
}
@keyframes modalSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; color: var(--text); }
.modal-close {
    background: none; border: none; font-size: 20px; cursor: pointer;
    color: var(--text-muted); padding: 8px 12px; border-radius: 6px;
    line-height: 1; z-index: 5; position: relative;
    min-width: 36px; min-height: 36px;
}
.modal-close:hover { background: var(--border-light); color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 12px 20px; border-top: 1px solid var(--border);
}

/* 暗色主题适配 */
[data-theme="dark"] .ds-drag-coords {
    background: rgba(15,23,42,0.92); border-color: rgba(167,139,250,0.5);
}
[data-theme="dark"] .ds-hover-overlay {
    border-color: #93c5fd; background: rgba(167,139,250,0.12);
}
[data-theme="dark"] .ds-shortcut-toast {
    background: #0f172a; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
[data-theme="dark"] .template-market-card {
    background: #1e293b; border-color: #334155;
}
[data-theme="dark"] .template-market-card:hover {
    border-color: #93c5fd;
}
[data-theme="dark"] .imposition-cell {
    background: #1e293b; color: #64748b;
}
[data-theme="dark"] .imposition-cell.active {
    background: #312e81; color: #93c5fd; border-color: #93c5fd;
}
[data-theme="dark"] .csv-batch-preview th {
    background: #1e1b4b; color: #93c5fd;
}
[data-theme="dark"] .csv-batch-preview tr:hover td { background: #1e293b; }
[data-theme="dark"] .modal-dialog { background: #1e293b; }
[data-theme="dark"] .version-history-item:hover { background: #1e293b; }

/* ====== 报价计算器面板（三栏布局） ====== */
.quote-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.55); z-index: 10000;
    display: none; align-items: center; justify-content: center;
}
.quote-overlay.show { display: flex; }
.quote-panel {
    background: #fff; border-radius: 16px;
    width: 920px; max-width: 95vw; max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    overflow: hidden;
}
.quote-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: #fff;
    font-size: 15px; font-weight: 700;
    flex-shrink: 0;
}
.quote-header .close-btn {
    background: none; border: none; color: #93c5fd; font-size: 20px;
    cursor: pointer; padding: 2px 8px; border-radius: 4px; transition: all 0.15s;
}
.quote-header .close-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.quote-body {
    display: flex; flex: 1; min-height: 0; overflow: hidden;
}
/* 左栏：材料选择 */
.quote-left {
    width: 220px; flex-shrink: 0; border-right: 1px solid #e5e7eb;
    padding: 16px; overflow-y: auto;
    background: #fafafa;
}
.quote-left h4 { font-size: 13px; color: #374151; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid #3b82f6; }
.quote-material-list { list-style: none; margin: 0; padding: 0; }
.quote-material-list li {
    padding: 8px 10px; font-size: 12px; cursor: pointer;
    border-radius: 6px; margin-bottom: 3px;
    transition: all 0.15s; color: #374151;
    border: 1px solid transparent;
}
.quote-material-list li:hover { background: #dbeafe; border-color: #93c5fd; }
.quote-material-list li.selected { background: #3b82f6; color: #fff; border-color: #2563eb; font-weight: 600; }
.quote-size-row { margin-top: 14px; }
.quote-size-row label { font-size: 12px; color: #444444; display: block; margin-bottom: 4px; font-weight: 600; }
.quote-size-row .size-inputs { display: flex; align-items: center; gap: 6px; }
.quote-size-row input {
    width: 60px; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px; text-align: center; outline: none;
}
.quote-size-row input:focus { border-color: #3b82f6; }
.quote-size-row .size-x { font-size: 14px; color: #9ca3af; font-weight: bold; }

/* 中栏：设计预览 */
.quote-center {
    flex: 1; min-width: 0; padding: 16px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    background: #eff6ff; overflow-y: auto;
}
.quote-center h4 { font-size: 13px; color: #374151; margin: 0; }
.quote-preview-box {
    width: 100%; max-width: 280px; aspect-ratio: 1;
    background: #fff; border-radius: 10px;
    border: 2px dashed #d1d5db;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.quote-preview-box canvas { max-width: 100%; max-height: 100%; object-fit: contain; }
.quote-preview-box .no-preview {
    color: #777777; font-size: 12px; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.quote-notice {
    font-size: 12px; color: #777777; text-align: center;
    background: #fff; padding: 8px 14px; border-radius: 8px;
    border: 1px solid #e5e7eb; max-width: 280px;
}

/* 右栏：工艺参数 */
.quote-right {
    width: 200px; flex-shrink: 0; border-left: 1px solid #e5e7eb;
    padding: 16px; overflow-y: auto; background: #fafafa;
}
.quote-right h4 { font-size: 13px; color: #222222; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid #3b82f6; }
.quote-param-group { margin-bottom: 12px; }
.quote-param-group label { font-size: 12px; color: #444444; display: block; margin-bottom: 4px; font-weight: 600; }
.quote-param-group select {
    width: 100%; padding: 6px 8px; border: 1px solid #b0b0b0; border-radius: 6px;
    font-size: 12px; outline: none; cursor: pointer; background: #fff;
}
.quote-param-group select:focus { border-color: #3b82f6; }
.quote-param-group .param-val {
    font-size: 12px; color: #1a1a1a; padding: 6px 0;
}

/* 拼版行列输入组（默认隐藏，选拼多个时显示） */
#quoteImposeGroup { display: none; margin-bottom: 10px; padding: 10px; background: #f0eaff; border-radius: 8px; border: 1px dashed #93c5fd; }
#quoteImposeGroup.show { display: block; }
.quote-impose-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.quote-impose-row label { font-size: 12px; color: #444444; width: 36px; flex-shrink: 0; }
.quote-impose-row input {
    width: 50px; padding: 5px 6px; border: 1px solid #d1d5db; border-radius: 4px;
    font-size: 13px; text-align: center; outline: none;
}
.quote-impose-row input:focus { border-color: #3b82f6; }
.quote-impose-info {
    font-size: 10px; color: #2563eb; margin-top: 4px;
}
.quote-impose-info span { font-weight: 700; }

/* 底部：数量报价区 */
.quote-footer {
    border-top: 1px solid #e5e7eb; padding: 14px 20px;
    background: #fafafa; flex-shrink: 0;
}
.quote-qty-row {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 12px;
}
.quote-qty-row label { font-size: 12px; color: #6b7280; font-weight: 600; }
.quote-qty-btn {
    padding: 6px 14px; border: 1px solid #d1d5db; border-radius: 6px;
    background: #fff; font-size: 12px; cursor: pointer; transition: all 0.15s;
    font-weight: 500;
}
.quote-qty-btn:hover { border-color: #3b82f6; color: #3b82f6; }
.quote-qty-btn.selected { background: #3b82f6; color: #fff; border-color: #2563eb; }
.quote-qty-custom {
    width: 80px; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 12px; text-align: center; outline: none;
}
.quote-qty-custom:focus { border-color: #3b82f6; }
.quote-price-bar {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border-radius: 10px; color: #fff;
}
.quote-price-bar .price-item {
    display: flex; flex-direction: column; gap: 2px;
}
.quote-price-bar .price-label { font-size: 11px; color: #93c5fd; }
.quote-price-bar .price-value { font-size: 22px; font-weight: 700; color: #fff; }
.quote-price-bar .price-unit { font-size: 12px; color: #93c5fd; margin-left: 2px; }
.quote-price-bar .price-sep {
    width: 1px; height: 36px; background: #4c4580;
}
.quote-info-row {
    display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px;
    font-size: 11px; color: #9ca3af;
}
.quote-info-row span { display: flex; align-items: center; gap: 4px; }
.quote-actions {
    display: flex; gap: 8px; margin-top: 10px;
}
.quote-actions button {
    padding: 7px 16px; border: none; border-radius: 6px;
    font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.quote-btn-copy { background: #f3f4f6; color: #374151; }
.quote-btn-copy:hover { background: #e5e7eb; }
.quote-btn-export { background: #3b82f6; color: #fff; }
.quote-btn-export:hover { background: #2563eb; }

/* 下单咨询按钮 */
.quote-btn-order {
    padding: 8px 18px; border: 2px solid #fbbf24; border-radius: 8px;
    background: rgba(251,191,36,0.15); color: #fbbf24;
    font-size: 13px; font-weight: 700; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
    flex-shrink: 0;
}
.quote-btn-order:hover { background: #fbbf24; color: #1e1b4b; }

/* ====== 地域选择面板（不干胶标签询价前置） ====== */
.quote-region-panel {
    background: #fff; border-radius: 16px;
    width: 680px; max-width: 95vw; max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    overflow: hidden;
}
.quote-region-body {
    padding: 24px 28px; flex: 1; min-height: 0; overflow-y: auto;
    background: #f8fafc;
}
.quote-region-intro {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 18px; background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #bfdbfe; border-radius: 12px; margin-bottom: 20px;
}
.quote-region-intro-icon { font-size: 36px; }
.quote-region-intro-title { font-size: 15px; font-weight: 700; color: #1e3a8a; margin-bottom: 4px; }
.quote-region-intro-sub { font-size: 12px; color: #4b5563; line-height: 1.5; }
.quote-region-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px;
}
.quote-region-group { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px; }
.quote-region-group-title {
    font-size: 12px; font-weight: 700; color: #64748b; margin-bottom: 10px;
    padding-bottom: 6px; border-bottom: 1px solid #f1f5f9;
    display: flex; align-items: center; gap: 5px;
}
.quote-region-group-title::before {
    content: ''; display: inline-block; width: 5px; height: 12px; background: #3b82f6; border-radius: 3px;
}
.quote-region-cities { display: flex; flex-wrap: wrap; gap: 8px; }
.quote-region-city {
    padding: 7px 14px; border: 1px solid #d1d5db; border-radius: 20px;
    background: #fff; font-size: 13px; color: #374151; cursor: pointer;
    transition: all 0.15s; font-weight: 500;
}
.quote-region-city:hover { border-color: #3b82f6; color: #3b82f6; background: #eff6ff; }
.quote-region-city.selected { background: #3b82f6; color: #fff; border-color: #2563eb; font-weight: 600; }
.quote-region-selected {
    display: flex; align-items: center; gap: 8px;
    margin-top: 18px; padding: 12px 16px; background: #fff;
    border: 1px dashed #93c5fd; border-radius: 10px; font-size: 13px; color: #374151;
}
.quote-region-selected b { color: #2563eb; font-size: 14px; }
.quote-region-footer {
    display: flex; justify-content: flex-end; align-items: center; gap: 12px;
    padding: 14px 24px; border-top: 1px solid #e2e8f0; background: #fff; flex-shrink: 0;
}
.quote-region-tip {
    margin-right: auto; font-size: 12px; color: #f97316; font-weight: 500;
    display: flex; align-items: center; gap: 5px;
}
.quote-region-tip::before { content: '💡'; }
.quote-region-btn-cancel {
    padding: 8px 22px; border: 1px solid #d1d5db; border-radius: 8px;
    background: #fff; font-size: 13px; color: #4b5563; cursor: pointer; transition: all 0.15s;
}
.quote-region-btn-cancel:hover { background: #f3f4f6; }
.quote-region-btn-confirm {
    padding: 8px 26px; border: none; border-radius: 8px;
    background: #3b82f6; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all 0.15s;
}
.quote-region-btn-confirm:hover:not(:disabled) { background: #2563eb; }
.quote-region-btn-confirm:disabled { background: #cbd5e1; cursor: not-allowed; }

/* 报价面板头部已选地域 */
.quote-header-region {
    display: flex; align-items: center; gap: 6px;
    margin-left: auto; font-size: 12px; color: #bfdbfe; font-weight: 500;
    background: rgba(255,255,255,0.12); padding: 4px 10px; border-radius: 20px;
}
.quote-header-region b { color: #fff; font-weight: 600; }
.quote-header-region-change {
    background: rgba(255,255,255,0.2); border: none; border-radius: 12px;
    color: #fff; font-size: 11px; padding: 2px 8px; cursor: pointer; margin-left: 4px;
    transition: all 0.15s;
}
.quote-header-region-change:hover { background: rgba(255,255,255,0.35); }

/* 下单咨询按钮 */
.order-consult-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.55); z-index: 10001;
    justify-content: center; align-items: center;
}
.order-consult-overlay.show { display: flex; }
.order-consult-dialog {
    background: #fff; border-radius: 14px; width: 380px; max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden;
}
.order-consult-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff; font-size: 16px; font-weight: 700;
}
.order-consult-header .close-btn {
    background: none; border: none; color: #fff; font-size: 20px;
    cursor: pointer; padding: 0; line-height: 1;
}
.order-consult-body { padding: 20px; }
.order-consult-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; margin-bottom: 10px;
    background: #fffbeb; border-radius: 10px; border: 1px solid #fde68a;
}
.order-consult-icon { font-size: 28px; }
.order-consult-label { font-size: 12px; color: #92400e; margin-bottom: 2px; }
.order-consult-value { font-size: 18px; font-weight: 700; color: #d97706; letter-spacing: 0.5px; }
.order-consult-tip {
    font-size: 12px; color: #6b7280; line-height: 1.6;
    padding: 10px 12px; background: #f9fafb; border-radius: 8px; margin-top: 8px;
}

/* ====== 变换泊坞窗 (印创风格浮动面板) ====== */
.transform-docker {
    position: fixed; z-index: 10500;
    width: 260px; min-width: 220px;
    background: #fff; border: 1px solid #d1d5db;
    border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    font-family: 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    display: none; user-select: none;
    overflow: hidden;
}
.transform-docker.show { display: block; animation: dockerFadeIn 0.15s ease-out; }
@keyframes dockerFadeIn { from { opacity:0; transform:scale(0.93); } to { opacity:1; transform:scale(1); } }

.transform-docker-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff; cursor: move; font-size: 13px; font-weight: 600;
    border-radius: 9px 9px 0 0;
}
.transform-docker-header button {
    background: rgba(255,255,255,0.2); border: none; color: #fff;
    width: 22px; height: 22px; border-radius: 4px; cursor: pointer;
    font-size: 13px; line-height: 22px; padding: 0; text-align: center;
    transition: background 0.15s;
}
.transform-docker-header button:hover { background: rgba(255,255,255,0.35); }

.transform-docker-body {
    padding: 10px 12px; max-height: 420px; overflow-y: auto;
}

/* 变换分类标签 */
.transform-tabs {
    display: flex; gap: 0; border-bottom: 2px solid #e5e7eb; margin-bottom: 10px;
}
.transform-tab {
    flex: 1; text-align: center; padding: 6px 4px; font-size: 11px; cursor: pointer;
    border: none; background: none; color: #6b7280; font-weight: 500;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all 0.15s; font-family: inherit;
}
.transform-tab.active {
    color: #2563eb; border-bottom-color: #2563eb; font-weight: 700;
}
.transform-tab:hover { color: #1e3a5f; }

/* 变换输入行 */
.transform-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.transform-row label {
    font-size: 12px; color: #6b7280; white-space: nowrap; min-width: 36px;
}
.transform-row input[type="number"] {
    width: 0; flex: 1; padding: 5px 6px; font-size: 12px;
    border: 1px solid #d1d5db; border-radius: 5px; outline: none;
    text-align: center; font-family: 'Consolas', 'Microsoft YaHei', monospace;
    transition: border-color 0.15s;
}
.transform-row input[type="number"]:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }
.transform-row .unit-suffix { font-size: 11px; color: #9ca3af; min-width: 20px; text-align: left; }

/* 按比例复选框 */
.transform-check {
    display: flex; align-items: center; gap: 6px; margin-bottom: 8px; cursor: pointer;
    font-size: 11px; color: #6b7280;
}
.transform-check input[type="checkbox"] {
    width: 14px; height: 14px; accent-color: #3b82f6; cursor: pointer;
}

/* 9宫格锚点 */
.anchor-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
    gap: 2px; width: 72px; height: 72px; margin: 8px auto;
}
.anchor-cell {
    width: 22px; height: 22px; border: 1px solid #d1d5db; border-radius: 3px;
    cursor: pointer; background: #f9fafb; transition: all 0.12s;
    position: relative;
}
.anchor-cell:hover { border-color: #3b82f6; background: #dbeafe; }
.anchor-cell.active {
    border-color: #2563eb; background: #2563eb;
    box-shadow: inset 0 0 0 2px #fff;
}
/* 中心点特殊样式 */
.anchor-cell.center { border: 2px solid #3b82f6; }
.anchor-cell.center.active { background: #2563eb; border-color: #1d4ed8; }

.anchor-label {
    text-align: center; font-size: 10px; color: #9ca3af; margin-top: 2px;
}

/* 相对位置复选框 */
.transform-section-label {
    font-size: 11px; color: #374151; font-weight: 600; margin: 8px 0 4px;
    padding-bottom: 4px; border-bottom: 1px solid #f3f4f6;
}

/* 应用按钮 */
.transform-apply-btn {
    display: block; width: 100%; padding: 8px; margin-top: 10px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff; border: none; border-radius: 6px; font-size: 13px;
    font-weight: 600; cursor: pointer; font-family: inherit;
    transition: all 0.15s;
}
.transform-apply-btn:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(37,99,235,0.3); }
.transform-apply-btn:active { transform: translateY(0); }

/* 副本数量行 */
.transform-row-copies {
    display: flex; align-items: center; gap: 8px;
}
.transform-row-copies input {
    width: 60px; padding: 5px 6px; font-size: 12px;
    border: 1px solid #d1d5db; border-radius: 5px; text-align: center;
    font-family: 'Consolas', 'Microsoft YaHei', monospace;
    outline: none;
}
.transform-row-copies input:focus { border-color: #3b82f6; }

/* ====== 用户登录注册弹窗 ====== */
.auth-overlay { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.6); z-index:10000; display:none; align-items:center; justify-content:center; }
.auth-overlay.show { display:flex; }
.auth-dialog { position:relative; background:#1e1e2e; border:1px solid #333; border-radius:12px; padding:30px; width:400px; max-width:90vw; color:#e0e0e0; box-shadow:0 20px 60px rgba(0,0,0,0.5); }
.auth-dialog .auth-title { margin:0 0 16px; font-size:20px; color:#fff; text-align:center; }
.auth-dialog .auth-close { position:absolute; top:12px; right:16px; background:none; border:none; color:#666; cursor:pointer; font-size:22px; line-height:1; }
.auth-dialog .auth-close:hover { color:#fff; }
/* 标签切换 */
.auth-tabs { display:flex; gap:0; margin-bottom:16px; border-radius:8px; overflow:hidden; border:1px solid #444; }
.auth-tab { flex:1; text-align:center; padding:8px 0; font-size:14px; cursor:pointer; color:#888; background:#2a2a3a; transition:all 0.2s; }
.auth-tab.active { background:#2563eb; color:#fff; font-weight:600; }
.auth-tab:hover:not(.active) { color:#ccc; background:#333; }
/* 消息提示 */
.auth-msg { padding:8px 12px; border-radius:6px; font-size:13px; margin-bottom:12px; }
.auth-msg-error { background:#3a1a1a; border:1px solid #f44; color:#f88; }
.auth-msg-success { background:#1a3a1a; border:1px solid #4a4; color:#8f8; }
/* 表单 */
.auth-form { }
.auth-label { display:block; margin-bottom:4px; font-size:12px; color:#aaa; }
.auth-input { width:100%; padding:10px 14px; background:#2a2a3a; border:1px solid #444; border-radius:8px; color:#fff; font-size:14px; box-sizing:border-box; margin-bottom:12px; transition:border-color 0.2s; }
.auth-input:focus { outline:none; border-color:#3b82f6; }
.auth-submit { width:100%; padding:12px; background:linear-gradient(135deg,#2563eb,#a855f7); border:none; border-radius:8px; color:#fff; font-size:15px; font-weight:600; cursor:pointer; margin-top:4px; transition:opacity 0.2s; }
.auth-submit:hover { opacity:0.9; }
.auth-submit:disabled { opacity:0.5; cursor:not-allowed; }
.auth-footer { text-align:center; margin-top:16px; font-size:11px; color:#666; }
/* 登录按钮在 menubar-right */
.menubar-right .btn-login { background:linear-gradient(135deg,#2563eb,#a855f7); border:none; border-radius:6px; color:#fff; font-size:12px; padding:5px 14px; cursor:pointer; font-weight:600; margin-left:10px; white-space:nowrap; }
.menubar-right .btn-login:hover { opacity:0.85; }
.menubar-right .user-badge { display:inline-flex; align-items:center; gap:6px; color:#93c5fd; font-size:12px; font-weight:600; margin-left:10px; cursor:pointer; white-space:nowrap; }
.menubar-right .user-badge:hover { color:#93c5fd; }
.menubar-right .user-dropdown { position:absolute; top:100%; right:0; background:#1e1e2e; border:1px solid #333; border-radius:8px; min-width:160px; padding:4px; z-index:9999; box-shadow:0 8px 24px rgba(0,0,0,0.4); display:none; }
.menubar-right .user-dropdown.show { display:block; }
.menubar-right .user-dropdown-item { padding:8px 14px; font-size:13px; color:#ccc; cursor:pointer; border-radius:4px; white-space:nowrap; }
.menubar-right .user-dropdown-item:hover { background:#2a2a3a; color:#fff; }
.menubar-right { position:relative; }

/* ====== 新建项目弹窗 ====== */
.new-preset-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.new-preset-item {
    text-align:center; padding:10px 4px; border:1px solid #444; border-radius:8px;
    cursor:pointer; color:#aaa; font-size:12px; font-weight:600;
    transition:all 0.15s; background:#2a2a3a;
}
.new-preset-item:hover { border-color:#6366f1; color:#c4b5fd; background:#312e4a; }
.new-preset-item.active { border-color:#818cf8; color:#fff; background:rgba(99,102,241,0.25); box-shadow:0 0 0 1px #818cf8; }
.new-preset-item span { display:block; font-size:10px; font-weight:400; color:#777; margin-top:2px; }
.new-preset-item.active span { color:#a5b4fc; }

/* ====== 智能描摹面板 ====== */
.trace-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.55); z-index: 10000;
    display: none; align-items: center; justify-content: center;
}
.trace-dialog {
    background: white; border-radius: 16px;
    width: 820px; max-width: 94vw; max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    overflow: hidden;
}
.trace-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid #e5e7eb;
    font-size: 18px; font-weight: 700; color: #1e1b4b;
}
.trace-header .close-btn {
    width: 32px; height: 32px; border: none; background: #f3f4f6;
    border-radius: 8px; cursor: pointer; font-size: 16px; color: #6b7280;
    display: flex; align-items: center; justify-content: center;
}
.trace-header .close-btn:hover { background: #e5e7eb; color: #1f2937; }
.trace-body {
    display: flex; gap: 20px; padding: 20px 24px; flex: 1; overflow: hidden;
    min-height: 360px;
}
.trace-left {
    width: 260px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px;
}
.trace-left h4, .trace-right h4 {
    font-size: 14px; color: #374151; margin: 0 0 8px; font-weight: 600;
}
.trace-dropzone {
    width: 100%; height: 200px; border: 2px dashed #c5c5c5;
    border-radius: 12px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
    cursor: pointer; transition: all 0.2s; color: #6b7280;
    background: #f9fafb;
}
.trace-dropzone:hover { border-color: #3b82f6; background: #eff6ff; color: #2563eb; }
.trace-original { width: 100%; }
.trace-original canvas { max-width: 100%; border-radius: 8px; border: 1px solid #e5e7eb; }
.trace-right { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.trace-preview-box {
    flex: 1; min-height: 200px; background: #f9fafb;
    border: 1px solid #e5e7eb; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    overflow: auto; padding: 10px;
    background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
                      linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
                      linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
.trace-preview-box canvas { max-width: 100%; max-height: 100%; }
.trace-params {
    display: flex; flex-direction: column; gap: 8px;
}
.trace-param-row {
    display: flex; align-items: center; gap: 10px;
}
.trace-param-row label {
    font-size: 13px; color: #374151; font-weight: 500;
    min-width: 120px; white-space: nowrap;
}
.trace-param-row label span { color: #3b82f6; font-weight: 700; }
.trace-param-row input[type="range"] {
    flex: 1; cursor: pointer; accent-color: #3b82f6;
}
.trace-progress {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0;
}
.trace-progress-bar {
    flex: 1; height: 4px; background: #e5e7eb; border-radius: 2px;
    overflow: hidden;
}
.trace-progress-bar-inner {
    height: 100%; background: #3b82f6; border-radius: 2px;
    width: 0%; transition: width 0.3s;
}
.trace-progress-text { font-size: 12px; color: #6b7280; }
.trace-stats {
    display: flex; gap: 16px; font-size: 12px; color: #6b7280;
}
.trace-stats b { color: #374151; }
.trace-layer-colors {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.trace-color-swatch {
    width: 28px; height: 28px; border-radius: 6px;
    border: 2px solid #e5e7eb; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: white; font-weight: 700;
    text-shadow: 0 0 3px rgba(0,0,0,0.5);
    transition: transform 0.15s;
}
.trace-color-swatch:hover { transform: scale(1.2); border-color: #3b82f6; }
.trace-footer {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 16px 24px; border-top: 1px solid #e5e7eb;
}

/* ====== 平板横屏适配 (≤1024px) ====== */
@media (max-width: 1024px) {
    /* 菜单栏 */
    .top-menubar { font-size: 11px; padding: 0 6px; gap: 4px; }
    .menu-panel.mega-menu {
        grid-template-columns: repeat(2, minmax(170px, 1fr));
        min-width: 360px;
        max-width: 96vw;
        left: auto;
        right: 0;
    }
    .menubar-right { gap: 6px; }
    .menubar-right .action-btn { font-size: 10px; padding: 3px 8px; }
    
    /* 工具栏：允许横向滚动 */
    .toolbar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .toolbar-row { flex-wrap: nowrap; padding: 4px 8px; overflow-x: auto; }
    .tool-group { flex-shrink: 0; }
    .tool-btn { width: 28px; height: 28px; }
    .tool-sep { width: 1px; height: 24px; margin: 0 3px; }
    .tool-group-label { font-size: 10px; }
    .action-btn { font-size: 10px; padding: 4px 8px; }
    .tool-compact, .tool-select { height: 24px; font-size: 10px; }
    
    /* 属性面板：默认折叠，通过按钮弹出 */
    .prop-panel { 
        width: 220px; left: 8px; top: 120px; z-index: 300;
        transform: translateX(-240px); opacity: 0; pointer-events: none;
        transition: transform 0.25s ease, opacity 0.25s ease;
        max-height: calc(100vh - 140px);
    }
    .prop-panel.tablet-open {
        transform: translateX(0); opacity: 1; pointer-events: auto;
    }
    .left-toggle { left: 10px; top: 50%; width: 32px; height: 56px; font-size: 18px; border-radius: 0 8px 8px 0; }
    .left-toggle.collapsed { left: 10px; border-radius: 8px; }
    .right-toggle { display: none; } /* 右侧面板平板不显示 */
    
    /* 画布区 */
    .canvas-container { padding: 40px; }
    .ds-scrollbar-v { width: 16px; }
    .ds-scrollbar-h { height: 16px; }
    
    /* 主布局 */
    .main-layout { height: calc(100vh - 110px); }
}

/* ====== 平板竖屏 (≤768px) ====== */
@media (max-width: 768px) {
    .top-menubar { height: 36px; font-size: 10px; padding: 0 4px; }
    .menu-panel.mega-menu {
        grid-template-columns: 1fr;
        min-width: 260px;
        max-width: 96vw;
        max-height: calc(100vh - 50px);
        left: auto;
        right: 0;
    }
    .menubar-right .action-btn { font-size: 9px; padding: 2px 6px; }
    
    .toolbar-row { padding: 2px 4px; }
    .tool-btn { width: 24px; height: 24px; }
    .tool-select { height: 22px; font-size: 9px; }
    .action-btn { font-size: 9px; padding: 3px 6px; }
    
    .prop-panel { width: 200px; top: 110px; max-height: calc(100vh - 130px); }
    .left-toggle { width: 28px; height: 48px; font-size: 16px; }
    
    .canvas-container { padding: 24px; }
    .main-layout { height: calc(100vh - 132px); }
}

/* ====== 平板触屏适配提示样式 ====== */
.tablet-tip {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(37,99,235,0.92); color: #fff; padding: 8px 20px;
    border-radius: 20px; font-size: 13px; z-index: 999; pointer-events: none;
    animation: tabletTipFade 2.5s ease forwards;
}
@keyframes tabletTipFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* ====== 语言切换按钮 ====== */
.lang-switch { position: relative; margin-left: 8px; }
.lang-btn {
    background: rgba(255,255,255,0.12); border: 1px solid var(--menubar-sep);
    color: var(--menubar-text); font-size: 12px; padding: 3px 8px;
    border-radius: 4px; cursor: pointer; font-family: inherit;
    transition: all 0.15s; white-space: nowrap;
}
.lang-btn:hover { background: var(--menubar-hover-bg); color: var(--menubar-hover-text); }
.lang-dropdown {
    display: none; position: absolute; top: 100%; right: 0;
    background: var(--menu-panel-bg); color: var(--menu-panel-text);
    border-radius: 8px; box-shadow: var(--shadow-lg);
    min-width: 140px; padding: 4px 0; z-index: 1000;
    border: 1px solid var(--menu-panel-border);
}
.lang-switch:hover .lang-dropdown { display: block; }
.lang-option {
    padding: 6px 14px; cursor: pointer; font-size: 13px;
    transition: background 0.1s; white-space: nowrap;
}
.lang-option:hover { background: var(--menu-item-hover-bg); color: var(--menu-item-hover-text); }
.lang-option.active { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
/* P2-11: 提取重复内联样式为CSS类 */
.ch-swatch{width:24px;height:24px;border:1px solid #b0b0b0;border-radius:3px;cursor:pointer;padding:0;flex-shrink:0;}
.ch-swatch-fill{}
.ch-swatch.ch-swatch-stroke{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent !important;border:4px solid currentColor;padding:0;box-sizing:border-box;}
.ch-swatch-stroke::-webkit-color-swatch-wrapper{padding:0;}
.ch-swatch-stroke::-webkit-color-swatch{border:none;background:transparent !important;}
.ch-swatch-stroke::-moz-color-swatch{border:none;background:transparent;}
.ch-clear{width:24px;height:24px;border:1px solid #d0d0d0;border-radius:3px;cursor:pointer;padding:0;background:#f8f8f8;color:#bbb;font-size:11px;line-height:22px;text-align:center;flex-shrink:0;margin-left:1px;transition:all 0.15s;position:relative;overflow:hidden;}
.ch-clear:hover{background:#fee2e2;color:#dc2626;border-color:#fca5a5;}
.ch-clear.active{background:#fee2e2;color:#dc2626;border-color:#fca5a5;}
.ch-clear-slash{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);font-size:18px;font-weight:700;line-height:1;pointer-events:none;color:inherit;}
.ch-clear-fill{font-weight:700;font-size:13px;line-height:24px;}
.ch-clear-stroke{font-size:14px;line-height:24px;font-weight:400;}
.bool-btn-lg{width:36px;height:36px;}
.bool-btn-lg svg{width:20px;height:20px;}
.btn-tiny{font-size:11px;padding:4px 10px;}
/* ====== AI设计助手弹窗 v5.14.0 ====== */
.ai-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.45);z-index:9000;display:flex;align-items:center;justify-content:center;backdrop-filter:blur(4px);}
.ai-dialog{background:#fff;border-radius:14px;width:620px;max-width:calc(100vw - 40px);max-height:90vh;overflow-y:auto;box-shadow:0 24px 64px rgba(0,0,0,0.25);padding:0;position:relative;}
.ai-header{display:flex;align-items:center;justify-content:space-between;padding:16px 24px 0;border-bottom:none;}
.ai-header h3{margin:0;font-size:16px;color:#1e1b4b;display:flex;align-items:center;gap:8px;}
.ai-close{background:none;border:none;font-size:20px;color:#9ca3af;cursor:pointer;padding:4px 8px;border-radius:6px;transition:all 0.15s;}
.ai-close:hover{background:#f3f4f6;color:#374151;}
/* Tab导航 */
.ai-tabs{display:flex;gap:1px;padding:8px 20px 0;border-bottom:2px solid #f3f4f6;overflow-x:auto;scrollbar-width:thin;-ms-overflow-style:auto;flex-wrap:nowrap;}
.ai-tabs::-webkit-scrollbar{height:4px;background:transparent;}
.ai-tabs::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:2px;}
.ai-tab{padding:8px 12px;border:none;background:none;font-size:13px;font-weight:500;color:#9ca3af;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .15s;font-family:inherit;white-space:nowrap;flex-shrink:0;}
.ai-tab:hover{color:#2563eb;}
.ai-tab.active{color:#2563eb;border-bottom-color:#2563eb;font-weight:700;}
/* 领域选择器 */
.ai-domain-bar{display:flex;gap:6px;padding:12px 24px 8px;border-bottom:1px solid #f3f4f6;flex-wrap:wrap;}
.ai-domain-btn{padding:8px 14px;border:2px solid #e5e7eb;border-radius:10px;background:#fff;font-size:13px;font-weight:500;color:#6b7280;cursor:pointer;transition:all .2s;font-family:inherit;display:flex;align-items:center;gap:5px;white-space:nowrap;}
.ai-domain-btn:hover{border-color:#93c5fd;color:#2563eb;background:#eff6ff;}
.ai-domain-btn.active{border-color:#2563eb;color:#2563eb;background:#eff6ff;font-weight:700;box-shadow:0 1px 3px rgba(29,78,216,0.15);}
.ai-domain-tag{font-size:10px;background:#f3f4f6;color:#6b7280;padding:1px 6px;border-radius:4px;}
/* Tab内容区 */
.ai-tab-panel{display:none;padding:18px 24px;}
.ai-tab-panel.active{display:block;}
.ai-body{padding:0;}
.ai-field{margin-bottom:14px;}
.ai-field label{display:block;font-size:13px;font-weight:500;color:#374151;margin-bottom:5px;}
.ai-field input,.ai-field select{width:100%;padding:9px 12px;border:1px solid #d1d5db;border-radius:8px;font-size:13px;outline:none;background:#fff;color:#1e1b4b;box-sizing:border-box;transition:border-color .15s;}
.ai-field input:focus,.ai-field select:focus{border-color:#3b82f6;box-shadow:0 0 0 3px rgba(37,99,235,0.1);}
.ai-generate-btn{width:100%;padding:11px;background:linear-gradient(135deg,#3b82f6,#2563eb);color:#fff;border:none;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;margin-top:6px;transition:all .2s;}
.ai-generate-btn:hover{background:linear-gradient(135deg,#2563eb,#1d4ed8);transform:translateY(-1px);}
.ai-generate-btn:disabled{opacity:.5;cursor:not-allowed;transform:none;}
.ai-results{margin-top:18px;display:none;}
.ai-results.show{display:block;}
.ai-result-item{background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;padding:14px 14px 40px;margin-bottom:10px;position:relative;transition:border-color .15s;}
.ai-result-item:hover{border-color:#3b82f6;}
.ai-result-idx{font-size:11px;color:#3b82f6;font-weight:600;margin-bottom:4px;}
.ai-result-title{font-size:15px;font-weight:700;color:#1e1b4b;margin-bottom:4px;line-height:1.4;}
.ai-result-desc{font-size:13px;color:#6b7280;margin-bottom:6px;line-height:1.5;}
.ai-result-insert{position:absolute;right:10px;bottom:10px;padding:5px 14px;background:#3b82f6;color:#fff;border:none;border-radius:6px;font-size:11px;font-weight:600;cursor:pointer;transition:all .15s;}
.ai-result-insert:hover{background:#2563eb;transform:scale(1.03);}
.ai-loading{display:none;text-align:center;padding:24px;color:#3b82f6;}
.ai-loading.show{display:block;}
.ai-spinner{display:inline-block;width:32px;height:32px;border:3px solid #e5e7eb;border-top-color:#3b82f6;border-radius:50%;animation:ai-spin 0.8s linear infinite;margin-bottom:10px;}
@keyframes ai-spin{to{transform:rotate(360deg);}}
.ai-error{display:none;padding:10px 14px;background:#fef2f2;color:#dc2626;border:1px solid #fecaca;border-radius:8px;font-size:12px;margin-bottom:12px;}
.ai-error.show{display:block;}
.ai-footer{font-size:11px;color:#9ca3af;text-align:center;padding:10px 24px;border-top:1px solid #f3f4f6;}
.ai-tip{margin-top:8px;font-size:11px;color:#6b7280;text-align:center;}
/* 配色卡片 */
.ai-palette-list{display:flex;flex-direction:column;gap:14px;}
.ai-palette-card{background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;padding:0;overflow:hidden;transition:border-color .15s;}
.ai-palette-card:hover{border-color:#3b82f6;}
.ai-palette-header{display:flex;align-items:center;justify-content:space-between;padding:12px 14px 8px;}
.ai-palette-name{font-size:14px;font-weight:700;color:#1e1b4b;}
.ai-palette-scheme{display:flex;gap:0;padding:0 14px 12px;}
.ai-palette-color{flex:1;text-align:center;}
.ai-palette-swatch{width:100%;height:36px;border-radius:6px;border:1px solid rgba(0,0,0,0.08);margin-bottom:4px;cursor:pointer;transition:transform .12s;}
.ai-palette-swatch:hover{transform:scale(1.08);}
.ai-palette-hex{font-size:10px;color:#374151;font-family:monospace;font-weight:500;}
.ai-palette-label{font-size:9px;color:#6b7280;margin-top:1px;font-weight:500;}
.ai-palette-reason{font-size:11px;color:#6b7280;padding:0 14px 12px;line-height:1.5;border-top:1px solid #f3f4f6;padding-top:8px;margin:0 14px;}
.ai-palette-apply{padding:5px 12px;background:#10b981;color:#fff;border:none;border-radius:5px;font-size:11px;font-weight:600;cursor:pointer;transition:all .12s;}
.ai-palette-apply:hover{background:#059669;transform:scale(1.03);}
/* 诊断报告 */
.ai-diag-overview{background:linear-gradient(135deg,#dbeafe,#fae8ff);border-radius:10px;padding:14px 16px;margin-bottom:14px;display:flex;align-items:center;gap:12px;}
.ai-diag-score{width:56px;height:56px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:800;color:#fff;flex-shrink:0;}
.ai-diag-score.good{background:linear-gradient(135deg,#10b981,#34d399);}
.ai-diag-score.ok{background:linear-gradient(135deg,#f59e0b,#fbbf24);}
.ai-diag-score.bad{background:linear-gradient(135deg,#ef4444,#f87171);}
.ai-diag-text{font-size:13px;color:#1e3a5f;line-height:1.5;}
.ai-diag-section{margin-bottom:12px;}
.ai-diag-section-title{font-size:13px;font-weight:700;color:#1e1b4b;margin-bottom:6px;display:flex;align-items:center;gap:6px;}
.ai-diag-item{background:#f9fafb;border-left:3px solid #e5e7eb;border-radius:4px;padding:8px 12px;margin-bottom:5px;font-size:12px;color:#374151;line-height:1.5;}
.ai-diag-item.warn{border-left-color:#f59e0b;background:#fffbeb;}
.ai-diag-item.good{border-left-color:#10b981;background:#f0fdf4;}
.ai-diag-item.bad{border-left-color:#ef4444;background:#fef2f2;}
/* 字体搭配卡片 */
.ai-font-pair{background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;padding:14px;margin-bottom:10px;transition:border-color .15s;}
.ai-font-pair:hover{border-color:#3b82f6;}
.ai-font-pair-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;}
.ai-font-pair-scene{font-size:13px;font-weight:700;color:#1e1b4b;}
.ai-font-pair-apply{padding:4px 10px;background:#3b82f6;color:#fff;border:none;border-radius:5px;font-size:10px;font-weight:600;cursor:pointer;transition:all .12s;}
.ai-font-pair-apply:hover{background:#2563eb;transform:scale(1.03);}
.ai-font-demo{margin-bottom:8px;padding:8px 12px;background:#fff;border-radius:6px;border:1px solid #e5e7eb;}
.ai-font-demo-title{font-size:20px;font-weight:700;margin-bottom:2px;}
.ai-font-demo-body{font-size:13px;color:#6b7280;}
.ai-font-info{font-size:11px;color:#6b7280;line-height:1.5;}
/* 快捷按钮行 */
.ai-quick-row{display:flex;gap:6px;margin-bottom:14px;flex-wrap:wrap;}
.ai-quick-btn{flex:1;min-width:70px;padding:7px 6px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;font-size:11px;cursor:pointer;text-align:center;transition:all .12s;font-family:inherit;color:#374151;}
.ai-quick-btn:hover{border-color:#3b82f6;color:#2563eb;background:#eff6ff;}
.ai-quick-btn:active{background:#dbeafe;}
/* 多尺寸复选框标签 */
.ai-check-label{display:inline-flex;align-items:center;gap:4px;padding:5px 10px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;font-size:12px;cursor:pointer;transition:all .15s;font-family:inherit;color:#374151;user-select:none;}
.ai-check-label:hover{border-color:#3b82f6;color:#2563eb;}
.ai-check-label input[type=checkbox]{accent-color:#2563eb;margin:0;}
/* 合规检查结果 */
.ai-comp-item{padding:10px 12px;margin-bottom:8px;border-radius:8px;font-size:12px;}
.ai-comp-item.pass{background:#ecfdf5;border:1px solid #6ee7b7;color:#065f46;}
.ai-comp-item.warn{background:#fef3c7;border:1px solid #fcd34d;color:#92400e;}
.ai-comp-item.fail{background:#fef2f2;border:1px solid #fca5a5;color:#991b1b;}
.ai-comp-badge{display:inline-block;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;}
.ai-comp-badge.pass{background:#6ee7b7;color:#065f46;}
.ai-comp-badge.warn{background:#fcd34d;color:#92400e;}
.ai-comp-badge.fail{background:#fca5a5;color:#991b1b;}
/* 暗色模式 */
body.dark .ai-dialog{background:#1e1b4b;}
body.dark .ai-header h3{color:#f3f4f6;}
body.dark .ai-close:hover{background:#312e81;color:#e5e7eb;}
body.dark .ai-tabs{border-bottom-color:#1e3a5f;}
body.dark .ai-tab{color:#6b7280;}
body.dark .ai-tab.active{color:#93c5fd;border-bottom-color:#93c5fd;}
body.dark .ai-domain-btn{background:#1e3a5f;border-color:#3c3880;color:#a5a2c8;}
body.dark .ai-domain-btn:hover{border-color:#93c5fd;color:#93c5fd;}
body.dark .ai-domain-btn.active{border-color:#93c5fd;color:#93c5fd;background:#1e3a5f;}
body.dark .ai-field label{color:#d1d5db;}
body.dark .ai-field input,body.dark .ai-field select{background:#312e81;border-color:#4c4580;color:#f3f4f6;}
body.dark .ai-field input:focus,body.dark .ai-field select:focus{border-color:#3b82f6;}
body.dark .ai-result-item{background:#1e3a5f;border-color:#4c4580;}
body.dark .ai-result-title{color:#f3f4f6;}
body.dark .ai-result-desc,.ai-result-tag{color:#9ca3af;}
body.dark .ai-footer{border-top-color:#1e3a5f;}
body.dark .ai-palette-card{background:#1e3a5f;border-color:#4c4580;}
body.dark .ai-palette-name{color:#f3f4f6;}
body.dark .ai-palette-reason{color:#9ca3af;border-top-color:#1e3a5f;}
body.dark .ai-diag-overview{background:linear-gradient(135deg,#1e3a5f,#312e81);}
body.dark .ai-diag-text{color:#93c5fd;}
body.dark .ai-diag-section-title{color:#f3f4f6;}
body.dark .ai-diag-item{background:#1e3a5f;color:#d1d5db;border-left-color:#4c4580;}
body.dark .ai-diag-item.warn{background:#3b2f1a;border-left-color:#f59e0b;}
body.dark .ai-diag-item.good{background:#1a3b2f;border-left-color:#10b981;}
body.dark .ai-diag-item.bad{background:#3b1a1a;border-left-color:#ef4444;}
body.dark .ai-font-pair{background:#1e3a5f;border-color:#4c4580;}
body.dark .ai-font-pair-scene{color:#f3f4f6;}
body.dark .ai-font-demo{background:#312e81;border-color:#4c4580;}
body.dark .ai-font-info{color:#9ca3af;}
body.dark .ai-quick-btn{background:#312e81;border-color:#4c4580;color:#d1d5db;}
body.dark .ai-quick-btn:hover{border-color:#93c5fd;color:#93c5fd;background:#1e3a5f;}
/* 整版布局生成 */
.ai-layout-card{background:#f0fdf4;border:2px solid #86efac;border-radius:12px;padding:0;margin-bottom:14px;overflow:hidden;transition:all .15s;}
.ai-layout-card:hover{border-color:#22c55e;box-shadow:0 4px 12px rgba(34,197,94,0.15);}
.ai-layout-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:linear-gradient(135deg,#ecfdf5,#d1fae5);}
.ai-layout-name{font-size:14px;font-weight:700;color:#065f46;}
.ai-layout-count{font-size:11px;color:#059669;}
.ai-layout-apply{padding:6px 16px;background:linear-gradient(135deg,#059669,#10b981);color:#fff;border:none;border-radius:6px;font-size:12px;font-weight:700;cursor:pointer;transition:all .12s;white-space:nowrap;}
.ai-layout-apply:hover{background:linear-gradient(135deg,#047857,#059669);transform:scale(1.03);}
.ai-layout-preview{width:100%;height:160px;background:#fff;border-top:1px solid #d1fae5;position:relative;overflow:hidden;}
.ai-layout-preview canvas{position:absolute;top:0;left:0;}
.ai-layout-elements{padding:10px 16px;display:flex;flex-wrap:wrap;gap:4px;border-top:1px solid #d1fae5;}
.ai-layout-el-tag{display:inline-block;padding:2px 8px;background:#fff;border:1px solid #a7f3d0;border-radius:20px;font-size:10px;color:#047857;white-space:nowrap;}
/* 空白区域分析 */
.ai-blank-result{background:#eff6ff;border:2px solid #93c5fd;border-radius:12px;padding:16px;margin-bottom:12px;}
.ai-blank-title{font-size:14px;font-weight:700;color:#1e40af;margin-bottom:8px;display:flex;align-items:center;gap:6px;}
.ai-blank-info{font-size:12px;color:#3b82f6;line-height:1.6;margin-bottom:10px;}
.ai-blank-recommend{font-size:11px;color:#6b7280;line-height:1.5;padding:8px;background:#fff;border-radius:6px;border:1px dashed #93c5fd;margin-bottom:10px;}
.ai-blank-actions{display:flex;gap:8px;}
.ai-blank-btn{padding:8px 16px;border:none;border-radius:6px;font-size:12px;font-weight:600;cursor:pointer;transition:all .12s;flex:1;}
.ai-blank-btn.primary{background:linear-gradient(135deg,#2563eb,#1d4ed8);color:#fff;}
.ai-blank-btn.primary:hover{transform:scale(1.02);}
.ai-blank-btn.secondary{background:#fff;color:#2563eb;border:2px solid #93c5fd;}
.ai-blank-btn.secondary:hover{background:#eff6ff;}
/* AI面板内textarea */
.ai-field textarea:focus{border-color:#3b82f6;box-shadow:0 0 0 3px rgba(37,99,235,0.1);}
.ai-field textarea{font-family:'Microsoft YaHei',sans-serif;}
/* 暗色模式补充 */
body.dark .ai-layout-card{background:#1a2e1a;border-color:#14532d;}
body.dark .ai-layout-header{background:linear-gradient(135deg,#1a2e1a,#14532d);}
body.dark .ai-layout-name{color:#86efac;}
body.dark .ai-layout-preview{background:#000;border-top-color:#14532d;}
body.dark .ai-layout-elements{border-top-color:#14532d;}
body.dark .ai-layout-el-tag{background:#1a2e1a;border-color:#14532d;color:#86efac;}
body.dark .ai-blank-result{background:#1e2946;border-color:#1e3a5f;}
body.dark .ai-blank-title{color:#93c5fd;}
body.dark .ai-blank-info{color:#60a5fa;}
body.dark .ai-blank-recommend{background:#111827;border-color:#1e3a5f;}
body.dark .ai-blank-btn.secondary{background:#1e2946;color:#93c5fd;border-color:#1e3a5f;}
body.dark .ai-blank-btn.secondary:hover{background:#1e3a5f;}

/* ====== v5.36.3: 批处理面板 ====== */
.batch-side-panel {
    position: fixed; top: 52px; right: 12px; width: 300px; max-height: calc(100vh - 80px);
    background: #1e293b; border: 1px solid #334155; border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4); z-index: 5000;
    overflow-y: auto; padding: 0; color: #e2e8f0; font-size: 13px;
}
.batch-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid #334155;
    position: sticky; top: 0; background: #1e293b; z-index: 1;
}
.batch-title { font-weight: 700; font-size: 14px; color: #22d3ee; }
.batch-close {
    background: none; border: none; color: #94a3b8; font-size: 20px;
    cursor: pointer; padding: 0 4px; line-height: 1;
}
.batch-close:hover { color: #f87171; }

.batch-recording-bar, .batch-playing-bar {
    padding: 10px 16px; font-size: 12px; display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.batch-recording-bar { background: rgba(239,68,68,0.15); border-bottom: 1px solid rgba(239,68,68,0.3); }
.batch-playing-bar { background: rgba(245,158,11,0.15); border-bottom: 1px solid rgba(245,158,11,0.3); }
.batch-rec-dot {
    width: 8px; height: 8px; background: #ef4444; border-radius: 50%;
    animation: batchBlink 1s infinite;
}
.batch-play-icon { color: #f59e0b; font-size: 14px; }
@keyframes batchBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.batch-controls {
    display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #334155;
}
.batch-btn {
    flex: 1; padding: 8px 12px; border: none; border-radius: 8px;
    font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.batch-btn-record { background: #ef4444; color: #fff; }
.batch-btn-record:hover { background: #dc2626; }
.batch-btn-folder { background: #334155; color: #e2e8f0; }
.batch-btn-folder:hover { background: #475569; }
.batch-btn-stop { background: #1e293b; color: #f87171; border: 1px solid #f87171; padding: 4px 10px; font-size: 11px; border-radius: 6px; cursor: pointer; }
.batch-btn-stop:hover { background: #f87171; color: #fff; }

.batch-progress { height: 4px; background: #334155; }
.batch-progress-fill { height: 100%; background: linear-gradient(90deg, #22d3ee, #a78bfa); transition: width 0.3s; }

.batch-actions-list { padding: 8px 0; }
.batch-empty { text-align: center; padding: 24px 16px; color: #64748b; font-size: 12px; line-height: 1.8; }
.batch-action-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; cursor: pointer; transition: background 0.15s;
    border-bottom: 1px solid rgba(51,65,85,0.4);
}
.batch-action-item:hover { background: rgba(34,211,238,0.06); }
.batch-action-info { flex: 1; min-width: 0; }
.batch-action-name { font-weight: 600; font-size: 13px; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-action-meta { font-size: 10px; color: #64748b; margin-top: 2px; }
.batch-action-btns { display: flex; gap: 4px; flex-shrink: 0; }
.batch-btn-sm {
    width: 28px; height: 28px; border: none; border-radius: 6px;
    font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.batch-btn-play { background: #22d3ee; color: #0f172a; }
.batch-btn-play:hover { background: #06b6d4; }
.batch-btn-del { background: transparent; color: #94a3b8; }
.batch-btn-del:hover { background: rgba(239,68,68,0.15); color: #f87171; }

.batch-status-badge {
    position: fixed; top: 56px; right: 50%; transform: translateX(50%);
    padding: 4px 14px; border-radius: 20px; font-size: 11px; font-weight: 700;
    z-index: 6000; box-shadow: 0 2px 8px rgba(0,0,0,0.3); animation: batchBadgeIn 0.3s ease-out;
}
@keyframes batchBadgeIn { from { opacity: 0; transform: translateX(50%) translateY(-8px); } to { opacity: 1; transform: translateX(50%) translateY(0); } }

.batch-dialog-overlay { animation: batchFadeIn 0.2s ease-out; }
@keyframes batchFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ====== v5.49.29 设计师须知弹窗 ====== */
.designer-notice-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: center; }
.designer-notice-table th { padding: 10px 8px; font-weight: 600; background: #1e1b4b; color: #fff; }
.designer-notice-table td { padding: 9px 8px; border-bottom: 1px solid #e5e7eb; }
.designer-notice-table tr:nth-child(even) { background: #f9fafb; }
.designer-notice-highlight { font-weight: 700; color: #059669; }
.designer-notice-tip { text-align: center; padding: 10px; background: #f0fdf4; border-radius: 8px; font-size: 11px; color: #065f46; }
.designer-notice-welcome { background: linear-gradient(135deg, #eef2ff, #e0e7ff); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; border-left: 4px solid #6366f1; }
.designer-notice-section-title { font-size: 14px; font-weight: 700; color: #1e1b4b; margin: 0 0 10px; }






