/* ==========================================================================
   PDF 删除 / 页面管理 - 工具专用样式
   布局与卡片、按钮、表单、进度条、说明块等均复用 /css/common.css 公共样式
   本文件仅保留本工具特有、common.css 未提供的样式
   ========================================================================== */

/* ---------- 水印小预览可拖动光标 ---------- */
.watermark-preview-wrap canvas.wm-canvas-draggable {
    cursor: grab;
    touch-action: none;
}
.watermark-preview-wrap canvas.wm-canvas-draggable:active {
    cursor: grabbing;
}

/* ---------- 带开关的设置项 ---------- */
.setting-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.setting-toggle .setting-label {
    margin-bottom: 0;
    cursor: pointer;
}

.setting-toggle .toggle-switch {
    flex-shrink: 0;
}

/* ---------- 预览标签行 + 小按钮 ---------- */
.preview-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.preview-label-row .setting-label {
    margin-bottom: 0;
}

.mini-btn {
    flex-shrink: 0;
    padding: 3px 10px;
    font-size: 12px;
    color: #6d28d9;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.mini-btn:hover {
    color: #fff;
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.mini-btn.active {
    color: #fff;
    background: #8b5cf6;
    border-color: #8b5cf6;
}

body.dark .mini-btn {
    color: #c4b5fd;
    background: #2a2438;
    border-color: #4c3f7a;
}

body.dark .mini-btn:hover,
body.dark .mini-btn.active {
    color: #fff;
    background: #8b5cf6;
    border-color: #8b5cf6;
}

/* ---------- 水印大预览面板 ---------- */
.watermark-large-panel {
    margin-bottom: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fafafa;
}

.watermark-large-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f5f3ff;
    border-bottom: 1px solid #ede9fe;
}

.watermark-large-title {
    font-size: 13px;
    font-weight: 600;
    color: #6d28d9;
}

.watermark-large-tip {
    flex: 1;
    font-size: 12px;
    color: #9ca3af;
}

.watermark-large-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 200px;
    background: #fff;
    position: relative;
}

.watermark-large-body.dragging {
    cursor: grabbing;
}

.watermark-large-stage {
    position: relative;
    display: block;
    line-height: 0;
}

.watermark-large-img {
    display: block;
    max-width: 100%;
    max-height: 560px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    user-select: none;
    -webkit-user-drag: none;
}

/* 水印拖动手柄 */
.wm-drag-handle {
    position: absolute;
    box-sizing: border-box;
    border: 1.5px dashed #8b5cf6;
    background: rgba(139, 92, 246, 0.12);
    border-radius: 6px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    z-index: 3;
}

.wm-drag-handle:hover {
    background: rgba(139, 92, 246, 0.22);
    border-color: #7c3aed;
}

.watermark-large-body.dragging .wm-drag-handle {
    cursor: grabbing;
    background: rgba(139, 92, 246, 0.3);
}

.wm-drag-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.watermark-large-empty {
    font-size: 13px;
    color: #9ca3af;
}

body.dark .watermark-large-panel {
    border-color: #374151;
    background: #1f2937;
}

body.dark .watermark-large-header {
    background: #2a2438;
    border-bottom-color: #4c3f7a;
}

body.dark .watermark-large-title {
    color: #c4b5fd;
}

body.dark .watermark-large-body {
    background: #111827;
}

/* ---------- 已导入文件列表（可拖动排序） ---------- */
.setting-label .setting-label-tip {
    margin-left: 6px;
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
}

.import-file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.import-file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    font-size: 12px;
    color: #374151;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.15s;
    user-select: none;
}

.import-file-item:hover {
    border-color: #c4b5fd;
    background: #faf5ff;
}

.import-file-item.dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.import-file-item.drag-over {
    border-color: #8b5cf6;
    border-style: dashed;
    background: #f5f3ff;
    transform: translateY(1px);
}

.import-file-handle {
    flex-shrink: 0;
    color: #c4b5fd;
    font-size: 12px;
    letter-spacing: -2px;
    line-height: 1;
}

.import-file-icon {
    flex-shrink: 0;
    font-size: 13px;
}

.import-file-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-file-count {
    flex-shrink: 0;
    padding: 1px 6px;
    font-size: 11px;
    color: #8b5cf6;
    background: #f3e8ff;
    border-radius: 4px;
}

.import-file-tag {
    flex-shrink: 0;
    padding: 1px 6px;
    font-size: 11px;
    color: #047857;
    background: #d1fae5;
    border-radius: 4px;
}

body.dark .import-file-item {
    color: #d1d5db;
    background: #1f2937;
    border-color: #374151;
}

body.dark .import-file-item:hover {
    background: #2a2438;
    border-color: #8b5cf6;
}

body.dark .import-file-item.drag-over {
    background: #2a2438;
}

body.dark .import-file-count {
    color: #c4b5fd;
    background: #3b2f5c;
}

body.dark .import-file-tag {
    color: #6ee7b7;
    background: #1e3a2f;
}

/* ---------- 顶部功能导航 ---------- */
.op-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    margin-bottom: 15px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
}

.op-nav-title {
    flex: 0 0 auto;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    padding-right: 14px;
    border-right: 2px solid #f3f4f6;
}

.op-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.op-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.op-tab:hover {
    border-color: #c4b5fd;
    color: #6d28d9;
}

.op-tab.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #6366f1;
    color: #fff;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.28);
}

body.dark .op-nav {
    background: #212529;
    border-color: #495057;
}

body.dark .op-nav-title {
    color: #e0e0e0;
    border-right-color: #495057;
}

body.dark .op-tab {
    background: #212529;
    border-color: #495057;
    color: #b8c4c4;
}

body.dark .op-tab.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #6366f1;
    color: #fff;
}

/* ---------- 当前功能说明条 ---------- */
.func-desc-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #6d28d9;
    background: #f5f3ff;
    border: 2px solid #ede9fe;
    border-radius: 12px;
}

.func-desc-bar .func-desc-icon {
    flex-shrink: 0;
    font-size: 14px;
}

.func-desc-bar .func-desc-text {
    min-width: 0;
    flex: 1;
}

/* 说明条右侧操作按钮组 */
.func-desc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.func-desc-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px !important;
    margin: 0 !important;
    width: auto !important;
    font-size: 13px !important;
    border-radius: 8px;
    white-space: nowrap;
}

/* 「重新上传」：白底 + 紫色描边，与同排的实心按钮形成清晰层级 */
.func-desc-actions .btn-outline-purple {
    background: #fff;
    border: 2px solid #8b5cf6;
    color: #7c3aed;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(139, 92, 246, 0.18);
}

.func-desc-actions .btn-outline-purple:hover:not(:disabled) {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
    transform: translateY(-2px);
}

.func-desc-actions .btn-outline-purple:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.25);
}

.func-desc-actions .btn-outline-purple:disabled {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #9ca3af;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

/* 撤销按钮：灰底描边，弱于预览/下载 */
.func-desc-actions .btn-outline:not(.btn-outline-purple) {
    background: #fff;
    border-color: #d1d5db;
    color: #6b7280;
}

.func-desc-actions .btn-outline:not(.btn-outline-purple):hover:not(:disabled) {
    background: #6b7280;
    border-color: #6b7280;
    color: #fff;
}

.func-desc-actions .btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 描边按钮 hover 时文字变白，保证可读 */
.settings-card .btn-outline:hover:not(:disabled) {
    color: #fff;
    border-color: #8b5cf6;
}

body.dark .func-desc-actions .btn-outline-purple {
    background: #2a2438;
    border-color: #8b5cf6;
    color: #c4b5fd;
    box-shadow: none;
}

body.dark .func-desc-actions .btn-outline-purple:hover:not(:disabled) {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
}

body.dark .func-desc-actions .btn-outline:not(.btn-outline-purple) {
    background: #212529;
    border-color: #495057;
    color: #9ca3af;
}

body.dark .func-desc-actions .btn-outline:not(.btn-outline-purple):hover:not(:disabled) {
    background: #6b7280;
    border-color: #6b7280;
    color: #fff;
}

body.dark .func-desc-bar {
    color: #c4b5fd;
    background: #2a2438;
    border-color: #4c3f7a;
}

/* ---------- 通用小组件（common.css 未提供） ---------- */
.mode-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mode-selector .mode-btn {
    flex: 1 1 auto;
    min-width: 72px;
    padding: 8px 10px;
    font-size: 12px;
    text-align: center;
}

.setting-tip {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #6b7280;
}

.btn-group-vertical .btn {
    width: 100%;
}

/* 设置项内的主操作按钮（如「开始XX」）占满整行宽度 */
.setting-item > .btn {
    display: block;
    width: 100%;
}

.alert-error {
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 12px;
    color: #dc2626;
}

/* 滑块 / 取色器 */
.range-with-value {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-slider {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #8b5cf6;
    border-radius: 50%;
    cursor: pointer;
}

.range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #8b5cf6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.range-value {
    min-width: 52px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-input {
    width: 44px;
    height: 34px;
    padding: 2px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.color-input:hover {
    border-color: #c4b5fd;
}

.color-value {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
}

/* ---------- 右侧卡片头部中间信息 ---------- */

/* ---------- 卡片头部批量操作按钮 ---------- */
.header-batch-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    background: #dc2626;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

/* ---------- 卡片头部重置顺序按钮 ---------- */
.header-reset-btn {
    padding: 5px 12px;
    border: 1px solid #8b5cf6;
    border-radius: 6px;
    background: #fff;
    color: #8b5cf6;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.header-reset-btn:hover:not(:disabled) {
    background: #8b5cf6;
    color: #fff;
}

.header-reset-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

body.dark .header-reset-btn {
    background: transparent;
    border-color: #8b5cf6;
    color: #c4b5fd;
}

body.dark .header-reset-btn:hover:not(:disabled) {
    background: #8b5cf6;
    color: #fff;
}

.header-batch-btn:hover:not(:disabled) {
    background: #b91c1c;
}

.header-batch-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

body.dark .header-batch-btn {
    background: #dc2626;
    color: #fff;
}

/* ---------- 文件名条 ---------- */
.file-name-bar {
    display: flex;
    align-items: center;
    margin: 0 16px 12px;
    padding: 8px 12px;
    font-size: 13px;
    color: #4b5563;
    background: #f9fafb;
    border: 1px dashed #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.file-name-bar .file-name-label {
    flex-shrink: 0;
    font-weight: 600;
    color: #8b5cf6;
}

.file-name-bar .file-name-text {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark .file-name-bar {
    color: #d1d5db;
    background: #1f2937;
    border-color: #374151;
}

body.dark .file-name-bar .file-name-label {
    color: #c4b5fd;
}

/* ---------- 右侧卡片头部中间信息 ---------- */
.card-header-center {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    margin-right: auto;
}

.header-count {
    font-size: 12px;
    font-weight: 600;
    color: #8b5cf6;
}

.drag-hint {
    font-size: 12px;
    font-weight: 500;
    color: #8b5cf6;
}

/* ---------- 右侧预览区 ---------- */
.preview-area {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 15px;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 60px 40px;
    border: 3px dashed #d1d5db;
    border-radius: 16px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-placeholder:hover,
.upload-placeholder.drag-over {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.upload-icon {
    font-size: 48px;
    line-height: 1;
}

.upload-text {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.upload-hint {
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
}

.progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    padding: 30px 0;
}

.progress-text {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #6d28d9;
}

/* ---------- 页面缩略图网格 ---------- */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    padding: 15px;
}

.page-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-card:hover {
    border-color: #c4b5fd;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.12);
}

.page-card.selected {
    border-color: #8b5cf6;
    background: #f3e8ff;
}

.page-card.added-page {
    background: #fefce8;
    border-color: #fde68a;
}

.page-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.page-card:hover {
    border-color: #c4b5fd;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.12);
}

.page-card.selected {
    border-color: #8b5cf6;
    background: #f3e8ff;
}

.page-card.added-page {
    background: #fefce8;
    border-color: #fde68a;
}

/* 拖拽中的卡片：半透明 + 缩小，提示正在移动 */
.page-card.dragging {
    opacity: 0.45;
    transform: scale(0.95);
    box-shadow: 0 8px 22px rgba(139, 92, 246, 0.28);
}

/* 落点指示：在被拖入的卡片顶部显示醒目的插入线 */
.page-card.drag-over {
    border-style: solid;
    border-color: #e5e7eb;
    background: #f8f9fa;
    transform: none;
    position: relative;
}

.page-card.drag-over::before {
    content: '';
    position: absolute;
    left: -4px;
    right: -4px;
    top: -5px;
    height: 5px;
    border-radius: 3px;
    background: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
    animation: drop-line-pulse 1s ease-in-out infinite;
}

@keyframes drop-line-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 框选：拖拽期间禁止文本选中 */
.page-grid.box-selecting {
    user-select: none;
    cursor: crosshair;
}

/* 框选矩形覆盖层 */
.box-select-rect {
    position: fixed;
    z-index: 1500;
    border: 2px solid #8b5cf6;
    background: rgba(139, 92, 246, 0.14);
    border-radius: 3px;
    pointer-events: none;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.page-flags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.card-index {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    color: #8b5cf6;
    background: #f5f3ff;
    border-radius: 8px;
    white-space: nowrap;
}

.card-index.added-badge {
    color: #d97706;
    background: #fef3c7;
}

.downloaded-badge {
    padding: 1px 5px;
    font-size: 9px;
    color: #059669;
    background: #d1fae5;
    border-radius: 4px;
    white-space: nowrap;
}

.card-badge {
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 500;
    border-radius: 6px;
}

.card-badge.orig {
    color: #8b5cf6;
    background: #ede9fe;
}

.card-badge.added {
    color: #d97706;
    background: #fef3c7;
}

.drag-handle {
    font-size: 12px;
    color: #9ca3af;
    cursor: grab;
}

.card-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 11px;
    color: #fff;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    transition: all 0.2s;
}

.card-check.checked {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.card-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* 兜底比例，实际由 :style 动态覆盖为该页真实宽高比（发票等为横版） */
    aspect-ratio: 210 / 297;
    min-height: 90px;
    max-height: 260px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card-preview .thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    /* 完整显示整页内容：发票等非 A4 比例页面用 cover 会被裁掉，改为 contain */
    object-fit: contain;
    object-position: center;
}

/* 渲染用离屏 canvas 不显示（仅用于生成 toDataURL 缩略图） */
.card-preview canvas {
    display: none;
}

.card-preview .loading-spinner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: pdf-spin 0.6s linear infinite;
}

@keyframes pdf-spin {
    to { transform: rotate(360deg); }
}

/* 单页旋转时的卡片内加载遮罩 */
.card-rotating-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.82);
    color: #6c5ce7;
    font-size: 13px;
    font-weight: 500;
}

.card-rotating-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: pdf-spin 0.6s linear infinite;
}

.blank-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 32px;
    color: #d1d5db;
    background: #fff;
}

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #fff;
}

.image-placeholder img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.card-action-btn {
    flex: 1;
    min-width: 0;
    padding: 5px 4px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: all 0.18s;
}

.card-action-btn.preview {
    flex: 0 0 auto;
    padding: 5px 12px;
    color: #6d28d9;
    border-color: #ddd6fe;
    background: #f5f3ff;
}

/* 只有一个按钮（预览）时占满整行 */
.card-actions .card-action-btn:only-child {
    flex: 1 1 100%;
    padding: 5px 12px;
}

.card-action-btn.preview:hover {
    background: #ede9fe;
    border-color: #8b5cf6;
}

.card-action-btn.danger {
    color: #dc2626;
    border-color: #fecaca;
    background: #fff;
}

.card-action-btn.danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* 签名状态徽标（加在页面卡片右上角，与「原/加」角标同排） */
.sig-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    color: #7c3aed;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    white-space: nowrap;
}
.sig-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8b5cf6;
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.6);
    animation: sigStatusPulse 1.5s infinite;
}
@keyframes sigStatusPulse {
    0%   { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.55); }
    70%  { box-shadow: 0 0 0 6px rgba(139, 92, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}
body.dark .sig-status-badge {
    color: #c4b5fd;
    background: #2a2438;
    border-color: #4c3d6e;
}

/* 签名开关按钮：与其他模式按钮一致的扁平风格（白底灰边，靠颜色区分状态） */
.card-action-btn.sig-switch {
    flex: 1;
    font-weight: 600;
}
.card-action-btn.sig-switch.sig-off {
    color: #6b7280;
    border-color: #e5e7eb;
    background: #fff;
}
.card-action-btn.sig-switch.sig-off:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}
.card-action-btn.sig-switch.sig-on {
    color: #7c3aed;
    border-color: #ddd6fe;
    background: #f5f3ff;
}
.card-action-btn.sig-switch.sig-on:hover {
    background: #ede9fe;
    border-color: #8b5cf6;
}
.card-action-btn.sig-switch:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* 预览按钮：相对开关更小、靠右自适应宽度 */
.card-action-btn.sig-adjust {
    flex: 0 0 auto;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 600;
    color: #2563eb;
    border-color: #bfdbfe;
    background: #eff6ff;
}
.card-action-btn.sig-adjust:hover {
    background: #dbeafe;
    border-color: #3b82f6;
}
.card-action-btn.sig-adjust:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

body.dark .card-action-btn.sig-switch.sig-off {
    color: #b8c4c4;
    border-color: #495057;
    background: #2b2f36;
}
body.dark .card-action-btn.sig-switch.sig-on {
    color: #c4b5fd;
    border-color: #4c3d6e;
    background: #2a2438;
}
body.dark .card-action-btn.sig-adjust {
    color: #93c5fd;
    border-color: #1e3a5f;
    background: #152a44;
}


body.dark .card-action-btn {
    background: #2b2f36;
    border-color: #495057;
    color: #b8c4c4;
}

body.dark .card-action-btn.preview {
    color: #c4b5fd;
    border-color: #4c3d6e;
    background: #2a2438;
}

body.dark .card-action-btn.danger:hover {
    background: #3a2528;
    border-color: #ef4444;
    color: #f87171;
}

/* ---------- 水印图片上传 / 预览 ---------- */
.watermark-image-upload {
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s;
}

.watermark-image-upload:hover {
    border-color: #c4b5fd;
}

.watermark-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px;
}

.upload-icon-small {
    font-size: 24px;
}

.upload-text-small {
    font-size: 12px;
    color: #6b7280;
}

.watermark-image-preview {
    padding: 5px;
}

.watermark-image-preview img {
    display: block;
    width: 100%;
    height: 80px;
    object-fit: contain;
}

.watermark-preview-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

/* 覆盖 JS 内联尺寸，等比缩放到合适大小（保持宽高比） */
.watermark-preview-wrap canvas {
    display: block;
    width: auto !important;
    height: 220px !important;
    max-width: 100%;
    object-fit: contain;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

/* ---------- PDF 预览弹窗（避免与 common.css 的 .modal-overlay 冲突） ---------- */
.pdf-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.6);
}

.pdf-modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1180px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.pdf-modal-content.page-preview-modal {
    max-height: 94vh;
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 15px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
}

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

.pdf-modal-actions .btn {
    width: auto;
    margin-bottom: 0;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

/* 上一页 / 下一页：使用 common.css 的 .btn-outline / .btn-outline-purple 风格 */
.pdf-modal-actions .btn-outline {
    background: transparent;
    border: 2px solid #8b5cf6;
    color: #8b5cf6;
}

.pdf-modal-actions .btn-outline:hover:not(:disabled) {
    background: #8b5cf6;
    color: #fff;
}

.pdf-modal-actions .btn-outline-purple {
    color: #8b5cf6;
    border-color: #8b5cf6;
}

.pdf-modal-actions .btn-outline-purple:hover:not(:disabled) {
    background: #8b5cf6;
    color: #fff;
}

/* 下载 PDF / 下载图片：使用 common.css 的 .btn-green / .btn-outline-green 风格 */
.pdf-modal-actions .btn-green {
    background: #22c55e;
    border: 2px solid #22c55e;
    color: #fff;
}

.pdf-modal-actions .btn-green:hover:not(:disabled) {
    background: #16a34a;
    border-color: #16a34a;
}

.pdf-modal-actions .btn-outline-green {
    background: transparent;
    border: 2px solid #22c55e;
    color: #22c55e;
}

.pdf-modal-actions .btn-outline-green:hover:not(:disabled) {
    background: #22c55e;
    color: #fff;
}

.pdf-modal-actions .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pdf-modal-actions a.btn {
    text-decoration: none;
    line-height: normal;
}

.pdf-modal-body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
    overflow-y: auto;
    background: #525659;
    max-height: calc(90vh - 52px);
}

/* “预览 PDF”弹窗：与单页预览弹窗观感保持一致 */
.pdf-modal-body.page-preview-body .preview-page-canvas {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.pdf-modal-loading {
    padding: 40px;
    font-size: 14px;
    color: #fff;
    text-align: center;
}

/* 单页预览弹窗 */
.page-preview-modal {
    max-width: 1180px;
    width: min(1180px, 94vw);
}

.page-preview-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 240px;
    max-height: calc(94vh - 52px);
    background: #3c4043;
}

/* “预览 PDF”弹窗（多页）与单页预览观感对齐 */
.pdf-modal-body.page-preview-body {
    align-items: center;
    justify-content: flex-start;
    background: #3c4043;
    min-height: 240px;
    max-height: calc(94vh - 52px);
}

.page-preview-img {
    display: block;
    max-width: 100%;
    max-height: calc(94vh - 100px);
    object-fit: contain;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
/* 高清渲染中：低清图轻微淡化 + 加载提示 */
.page-preview-img.is-loading {
    opacity: 0.75;
}
.page-preview-body {
    position: relative;
}
.page-preview-loading {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    font-size: 12px;
    color: #fff;
    background: rgba(139, 92, 246, 0.92);
    border-radius: 999px;
    z-index: 2;
    pointer-events: none;
}

/* 签名放大预览弹窗 */
.sig-preview-modal {
    max-width: 900px;
}

.sig-preview-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    padding: 16px;
    background: #3c4043;
}

.sig-preview-stage {
    position: relative;
    display: inline-block;
    line-height: 0;
    max-width: 100%;
}

.sig-preview-stage .page-preview-img {
    max-height: calc(85vh - 120px);
}

/* ---------- 深色模式适配（工具特有元素） ---------- */
body.dark .watermark-preview-wrap,
body.dark .page-card {
    background: #212529;
    border-color: #495057;
    color: #e0e0e0;
}

body.dark .card-rotating-overlay {
    background: rgba(33, 37, 41, 0.82);
    color: #a78bfa;
}

body.dark .card-rotating-spinner {
    border-color: #495057;
    border-top-color: #a78bfa;
}

body.dark .page-card.drag-over::before {
    background: #a78bfa;
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.3);
}

body.dark .box-select-rect {
    border-color: #a78bfa;
    background: rgba(167, 139, 250, 0.16);
}

body.dark .upload-placeholder {
    background: #212529;
    border-color: #495057;
}

body.dark .setting-tip,
body.dark .progress-text {
    color: #9ca3af;
}

body.dark .card-index,
body.dark .header-count,
body.dark .drag-hint {
    color: #c4b5fd;
}

body.dark .pdf-modal-content,
body.dark .pdf-modal-header {
    background: #212529;
    color: #e0e0e0;
    border-color: #495057;
}

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }

    .pdf-modal-overlay {
        padding: 12px;
    }
}

/* ---------- 顶部处理进度条（全局固定细条） ---------- */
.top-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    height: 4px;
    background: rgba(139, 92, 246, 0.12);
    overflow: hidden;
}
.top-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #6366f1);
    transition: width 0.25s ease;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
}
.top-progress-text {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #6d28d9;
    background: rgba(255, 255, 255, 0.92);
    padding: 1px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* ---------- 轻提示 Toast ---------- */
/* ============ Toast 提示（样式对齐 common.css） ============ */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    width: max-content;
    max-width: 90vw;
}
.toast {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    min-width: 320px;
    max-width: 520px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: auto;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    overflow: hidden;
}
.toast.show {
    opacity: 1;
    transform: translateX(0) translateY(0);
}
.toast.hide {
    opacity: 0;
    transform: translateX(0) translateY(-20px);
}
.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
}
.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    line-height: 1.4;
}
.toast-close {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
}
.toast-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.3); }
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 10px 10px;
    transition: width 0.1s linear;
}
.toast-success { background: linear-gradient(135deg, #22c55e, #16a34a); }
.toast-error { background: linear-gradient(135deg, #ef4444, #dc2626); }
.toast-warning { background: linear-gradient(135deg, #eab308, #ca8a04); }
.toast-info { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.toast-primary { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

/* ---------- 缩略图骨架屏 ---------- */
.thumb-skeleton {
    position: absolute;
    inset: 0;
    background: #f1f3f5;
    overflow: hidden;
}
.skeleton-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, #f1f3f5 30%, #e2e8f0 50%, #f1f3f5 70%);
    background-size: 200% 100%;
    animation: skeleton-shine 1.1s ease-in-out infinite;
}
@keyframes skeleton-shine {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ---------- 文件名可编辑输入框 ---------- */
.file-name-input {
    width: 200px;
    padding: 3px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    color: #374151;
    background: #fff;
    outline: none;
}
.file-name-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.18);
}
.file-name-ext { font-size: 12px; color: #9ca3af; }

/* ---------- 说明条选中计数 ---------- */
.func-desc-count {
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #7c3aed;
    background: #ede9fe;
    border-radius: 999px;
    white-space: nowrap;
}

/* ---------- 说明条/按钮响应式换行 ---------- */
@media (max-width: 900px) {
    .func-desc-bar { flex-wrap: wrap; }
    .func-desc-actions { flex-wrap: wrap; justify-content: flex-start; }
    .func-desc-actions .btn { flex: 1 1 auto; }
    .file-name-input { width: 150px; }
}

body.dark .top-progress { background: rgba(139, 92, 246, 0.25); }
body.dark .top-progress-text { color: #c4b5fd; background: rgba(33, 37, 41, 0.92); }
body.dark .thumb-skeleton { background: #2b2f36; }
body.dark .skeleton-shimmer {
    background: linear-gradient(100deg, #2b2f36 30%, #3a3f47 50%, #2b2f36 70%);
    background-size: 200% 100%;
}
body.dark .file-name-input { background: #212529; border-color: #495057; color: #e0e0e0; }
body.dark .func-desc-count { color: #c4b5fd; background: #2a2438; }

/* ==================== 签名功能 ==================== */
.signature-pad-wrap {
    position: relative;
    width: 100%;
    height: 160px;
    border: 1.5px dashed #c4b5fd;
    border-radius: 10px;
    background: #faf9ff;
    overflow: hidden;
}
.signature-pad {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}
.signature-pad-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    color: #b8b0d6;
    pointer-events: none;
    user-select: none;
}
.signature-pad-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}
/* 手写签名标签行（含放大按钮） */
.setting-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.sig-zoom-btn {
    padding: 3px 10px;
    font-size: 12px;
    color: #7c3aed;
    background: #f5f3ff;
    border: 1px solid #c4b5fd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sig-zoom-btn:hover {
    background: #ede9fe;
    border-color: #a78bfa;
    transform: translateY(-1px);
}
/* 放大签名板弹窗 */
.sig-zoom-modal {
    max-width: 860px;
}
.sig-zoom-body {
    padding: 16px;
}
.signature-pad-wrap-lg {
    height: 340px;
    background: #fff;
}
.signature-pad-lg {
    touch-action: none;
}
.sig-zoom-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}
.sig-zoom-tip {
    font-size: 12px;
    color: #9ca3af;
}
body.dark .sig-zoom-btn { background: #2a2438; border-color: #4c3d6b; color: #c4b5fd; }
body.dark .signature-pad-wrap-lg { background: #212529; border-color: #495057; }
.signature-color-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.signature-tool-label {
    font-size: 12px;
    color: #6b7280;
}
.signature-color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #d1d5db;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.signature-color-dot:hover { transform: scale(1.12); }
.signature-color-dot.active {
    box-shadow: 0 0 0 2px #8b5cf6;
    transform: scale(1.12);
}
.mini-btn {
    padding: 3px 10px;
    font-size: 12px;
    color: #6b7280;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mini-btn:hover {
    color: #7c3aed;
    border-color: #8b5cf6;
    background: #f5f3ff;
}
.mini-btn-wide {
    width: 100%;
    text-align: center;
}

/* 卡片内可拖动签名覆盖层 */
.sig-overlay {
    position: absolute;
    z-index: 30;
    cursor: grab;
    border: 1.5px dashed rgba(124, 58, 237, 0.9);
    background: rgba(139, 92, 246, 0.08);
    opacity: 0.92;
    user-select: none;
    touch-action: none;
    line-height: 0;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
}
.sig-overlay:active { cursor: grabbing; }
.sig-overlay img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}
.sig-overlay-hint {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1px 7px;
    font-size: 10px;
    line-height: 1.5;
    white-space: nowrap;
    color: #fff;
    background: rgba(124, 58, 237, 0.92);
    border-radius: 5px;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}
.sig-overlay:hover .sig-overlay-hint,
.sig-overlay:active .sig-overlay-hint { opacity: 1; }
/* 尺寸提示气泡 */
.sig-overlay-size {
    position: absolute;
    top: -18px;
    right: 0;
    padding: 1px 7px;
    font-size: 10px;
    line-height: 1.5;
    white-space: nowrap;
    color: #fff;
    background: rgba(37, 99, 235, 0.92);
    border-radius: 5px;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}
.sig-overlay:hover .sig-overlay-size,
.sig-overlay:active .sig-overlay-size { opacity: 1; }
/* 右下角缩放手柄 */
.sig-resize-handle {
    position: absolute;
    right: -7px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: #7c3aed;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: nwse-resize;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
}
.sig-resize-handle::after {
    content: '';
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 5px;
    height: 5px;
    border-right: 1.5px solid #fff;
    border-bottom: 1.5px solid #fff;
}
/* 左上角旋转手柄 */
.sig-rotate-handle {
    position: absolute;
    left: -7px;
    top: -7px;
    width: 16px;
    height: 16px;
    background: #2563eb;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
}
.sig-rotate-handle:active { cursor: grabbing; }
.sig-rotate-handle::after {
    content: '↻';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    line-height: 1;
    color: #fff;
}
/* 旋转手柄与签名框之间的连接线提示 */
.sig-rotate-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 22px;
    transform: translate(-50%, -50%);
    border: 1.5px dashed rgba(37, 99, 235, 0.7);
    border-radius: 50%;
    animation: sigRotatePulse 1.8s ease-in-out infinite;
}
@keyframes sigRotatePulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.85; }
}
body.dark .sig-rotate-handle { border-color: #212529; }
body.dark .sig-overlay {
    border-color: rgba(196, 181, 253, 0.9);
    background: rgba(139, 92, 246, 0.15);
}
.signature-upload-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 12px;
    border: 1.5px dashed #c4b5fd;
    border-radius: 10px;
    background: #faf9ff;
    cursor: pointer;
    transition: all 0.15s ease;
}
.signature-upload-zone:hover {
    border-color: #8b5cf6;
    background: #f3f0ff;
}
.signature-upload-hint {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
}
.signature-upload-preview {
    max-width: 100%;
    max-height: 110px;
    object-fit: contain;
}
.signature-result-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
    padding: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background-image:
        linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(-45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f3f4f6 75%),
        linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.signature-result-preview img {
    max-width: 80%;
    max-height: 60px;
    object-fit: contain;
}
.setting-tip {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}
/* 我的签名（保存/选择） */
.saved-sig-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.saved-sig-item {
    width: 120px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.saved-sig-item:hover {
    border-color: #8b5cf6;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.12);
}
.saved-sig-thumb {
    width: 100%;
    height: 56px;
    object-fit: contain;
    cursor: pointer;
    border-radius: 6px;
    background-image:
        linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(-45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f3f4f6 75%),
        linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.saved-sig-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.saved-sig-name {
    font-size: 12px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.saved-sig-actions {
    display: flex;
    gap: 4px;
}
.saved-sig-actions .mini-btn-xs {
    flex: 1;
    padding: 2px 4px;
    font-size: 11px;
}
.saved-sig-empty {
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
    padding: 10px;
    border: 1px dashed #e5e7eb;
    border-radius: 8px;
    text-align: center;
}
body.dark .saved-sig-item { background: #212529; border-color: #495057; }
body.dark .saved-sig-name { color: #d1d5db; }
body.dark .saved-sig-empty { border-color: #495057; color: #6b7280; }

body.dark .signature-pad-wrap,
body.dark .signature-upload-zone {
    background: #212529;
    border-color: #495057;
}
body.dark .signature-pad-hint { color: #6b7280; }
body.dark .mini-btn { background: #2b2f36; border-color: #495057; color: #9ca3af; }
body.dark .mini-btn:hover { background: #2a2438; color: #c4b5fd; border-color: #8b5cf6; }
body.dark .signature-result-preview { background-color: #212529; border-color: #495057; }
