/* ===== PDF Watermark Local — UI ===== */
.pwl-app {
    --pwl-primary: #4f46e5;
    --pwl-primary-2: #7c3aed;
    --pwl-primary-soft: #eef2ff;
    --pwl-bg: #ffffff;
    --pwl-bg-alt: #f9fafb;
    --pwl-border: #e5e7eb;
    --pwl-border-strong: #d1d5db;
    --pwl-text: #111827;
    --pwl-muted: #6b7280;
    --pwl-success: #059669;
    --pwl-error: #dc2626;
    --pwl-radius: 14px;

    max-width: 900px;
    margin: 32px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--pwl-text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.pwl-app *, .pwl-app *::before, .pwl-app *::after { box-sizing: border-box; }

.pwl-card {
    background: var(--pwl-bg);
    border: 1px solid var(--pwl-border);
    border-radius: 20px;
    padding: 26px 28px;
    box-shadow:
        0 1px 2px rgba(16, 24, 40, .04),
        0 12px 32px -12px rgba(16, 24, 40, .12);
}

/* ---------- Header ---------- */
.pwl-header {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--pwl-border);
}
.pwl-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 20px; font-weight: 700; letter-spacing: -.01em;
}
.pwl-title-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--pwl-primary), var(--pwl-primary-2));
    font-size: 16px; box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .5);
}
.pwl-sub { margin-top: 6px; font-size: 13px; color: var(--pwl-muted); }

/* ---------- Layout ---------- */
.pwl-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
}
@media (min-width: 780px) {
    .pwl-body {
        grid-template-columns: minmax(0, 1fr) 300px;
        align-items: start;
    }
}

/* ---------- Section / Step ---------- */
.pwl-section { margin-bottom: 20px; }
.pwl-step {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px; font-size: 14px; font-weight: 600;
}
.pwl-step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--pwl-primary-soft); color: var(--pwl-primary);
    font-size: 11px; font-weight: 700;
}

/* ---------- Dropzone ---------- */
.pwl-dropzone {
    display: block; position: relative;
    padding: 24px 20px; text-align: center;
    border: 1.5px dashed var(--pwl-border-strong);
    border-radius: var(--pwl-radius);
    background: var(--pwl-bg-alt); cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.pwl-dropzone:hover { border-color: var(--pwl-primary); background: var(--pwl-primary-soft); }
.pwl-dropzone.is-drag { border-color: var(--pwl-primary); background: var(--pwl-primary-soft); transform: scale(1.01); }
.pwl-dropzone-sm { padding: 18px 14px; }
.pwl-dropzone-icon { color: var(--pwl-primary); opacity: .8; line-height: 0; margin-bottom: 8px; }
.pwl-dropzone-title { font-size: 14px; font-weight: 600; }
.pwl-dropzone-hint { margin-top: 3px; font-size: 12px; color: var(--pwl-muted); }
.pwl-file-chip {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 12px; padding: 5px 12px; max-width: 100%;
    font-size: 12px; font-weight: 500;
    color: var(--pwl-primary); background: #fff;
    border: 1px solid var(--pwl-primary); border-radius: 999px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Tabs ---------- */
.pwl-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    padding: 4px; margin-bottom: 16px;
    background: var(--pwl-bg-alt); border-radius: 12px;
}
.pwl-tab {
    padding: 9px 12px; font-size: 13.5px; font-weight: 600;
    color: var(--pwl-muted); background: transparent; border: none;
    border-radius: 9px; cursor: pointer; font-family: inherit;
    transition: all .16s ease;
}
.pwl-tab:hover { color: var(--pwl-text); }
.pwl-tab.is-active {
    background: #fff; color: var(--pwl-primary);
    box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}

/* ---------- Field ---------- */
.pwl-field { margin-bottom: 14px; }
.pwl-field-inline { display: flex; align-items: center; justify-content: space-between; }
.pwl-field-inline .pwl-label { margin-bottom: 0; }
.pwl-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.pwl-val {
    display: inline-block; min-width: 30px; padding: 1px 7px;
    margin-left: 2px; font-size: 12px; font-weight: 600;
    color: var(--pwl-primary); background: var(--pwl-primary-soft);
    border-radius: 6px; text-align: center; font-variant-numeric: tabular-nums;
}
.pwl-input {
    width: 100%; padding: 10px 13px; font-size: 14px; font-family: inherit;
    color: var(--pwl-text); background: #fff;
    border: 1px solid var(--pwl-border); border-radius: 10px;
    transition: border-color .16s ease, box-shadow .16s ease; outline: none;
}
.pwl-input:focus { border-color: var(--pwl-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); }
.pwl-color {
    width: 48px; height: 36px; padding: 2px;
    border: 1px solid var(--pwl-border); border-radius: 10px;
    background: #fff; cursor: pointer;
}

/* ---------- Range ---------- */
.pwl-app input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px; margin: 6px 0;
    background: linear-gradient(to right, var(--pwl-primary-soft), #e5e7eb);
    border-radius: 999px; outline: none; cursor: pointer;
}
.pwl-app input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 18px; height: 18px; background: #fff;
    border: 2px solid var(--pwl-primary); border-radius: 50%;
    box-shadow: 0 2px 6px rgba(79, 70, 229, .35);
    transition: transform .12s ease;
}
.pwl-app input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
.pwl-app input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px; background: #fff;
    border: 2px solid var(--pwl-primary); border-radius: 50%;
    box-shadow: 0 2px 6px rgba(79, 70, 229, .35); cursor: pointer;
}

/* ---------- Checkbox ---------- */
.pwl-check {
    display: flex; align-items: center; gap: 9px;
    padding: 10px 14px; font-size: 13.5px; font-weight: 500;
    background: var(--pwl-bg-alt); border: 1px solid var(--pwl-border);
    border-radius: 10px; cursor: pointer; user-select: none;
    transition: border-color .16s ease, background .16s ease;
}
.pwl-check:hover { border-color: var(--pwl-primary); background: var(--pwl-primary-soft); }
.pwl-check input[type="checkbox"] {
    width: 17px; height: 17px; margin: 0;
    accent-color: var(--pwl-primary); cursor: pointer;
}

/* ---------- Button ---------- */
.pwl-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; margin-top: 4px; padding: 13px 20px;
    font-size: 15px; font-weight: 600; font-family: inherit; color: #fff;
    background: linear-gradient(135deg, var(--pwl-primary), var(--pwl-primary-2));
    border: none; border-radius: 12px; cursor: pointer;
    box-shadow: 0 6px 18px -6px rgba(79, 70, 229, .6);
    transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease;
}
.pwl-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 24px -8px rgba(79, 70, 229, .7); }
.pwl-btn:active:not(:disabled) { transform: translateY(0); }
.pwl-btn:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }

/* ---------- Status ---------- */
.pwl-status {
    margin-top: 14px; font-size: 13px; font-weight: 500;
    text-align: center; border-radius: 10px; transition: all .18s ease;
}
.pwl-status:not(:empty) { padding: 10px 14px; }
.pwl-status.is-info { color: var(--pwl-primary); background: var(--pwl-primary-soft); }
.pwl-status.is-success { color: var(--pwl-success); background: #ecfdf5; }
.pwl-status.is-error { color: var(--pwl-error); background: #fef2f2; }

/* ---------- Preview ---------- */
.pwl-preview { position: sticky; top: 20px; }
.pwl-preview-label {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; font-size: 12.5px; font-weight: 600;
}
.pwl-preview-title { display: inline-flex; align-items: center; gap: 7px; color: var(--pwl-text); }
.pwl-live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #10b981; box-shadow: 0 0 0 0 rgba(16, 185, 129, .5);
    animation: pwl-pulse 2s infinite;
}
@keyframes pwl-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); }
    70%  { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.pwl-preview-meta {
    font-size: 11.5px; font-weight: 500; color: var(--pwl-muted);
    max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pwl-preview-paper {
    padding: 12px;
    background:
        radial-gradient(circle at 1px 1px, rgba(0,0,0,.05) 1px, transparent 0) 0 0 / 10px 10px,
        var(--pwl-bg-alt);
    border: 1px solid var(--pwl-border);
    border-radius: 14px;
}
.pwl-preview-holder { width: 100%; line-height: 0; display: flex; justify-content: center; }
.pwl-preview-holder canvas {
    display: block; max-width: 100%;
    border-radius: 3px;
    box-shadow: 0 3px 14px rgba(16, 24, 40, .16);
    background: #fff;
}
.pwl-preview-hint {
    margin-top: 9px; font-size: 11.5px; color: var(--pwl-muted);
    text-align: center; line-height: 1.45;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
    .pwl-card { padding: 20px 16px; border-radius: 16px; }
    .pwl-title { font-size: 18px; }
    .pwl-btn { font-size: 14.5px; }
    .pwl-preview { position: static; }
}
/* ===== 进度条 + 取消 + 密度字段（追加） ===== */

.pwl-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.pwl-progress[hidden] { display: none; }

.pwl-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--pwl-bg-alt);
    border: 1px solid var(--pwl-border);
    border-radius: 999px;
    overflow: hidden;
}

.pwl-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--pwl-primary), var(--pwl-primary-2));
    border-radius: 999px;
    transition: width .2s ease;
}

.pwl-progress-text {
    min-width: 64px;
    font-size: 12px;
    font-weight: 600;
    color: var(--pwl-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pwl-cancel {
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    color: var(--pwl-error);
    background: #fff;
    border: 1px solid var(--pwl-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .14s ease, background .14s ease, opacity .14s ease;
}
.pwl-cancel:hover:not(:disabled) { border-color: var(--pwl-error); background: #fef2f2; }
.pwl-cancel:disabled { opacity: .5; cursor: not-allowed; }

.pwl-density { margin-top: 12px; }
.pwl-density[hidden] { display: none; }