:root {
    --op-p: var(--primary, var(--success,#10b981));
    --op-ph: var(--primary-hover, var(--success,#0ea371));
    --op-pl: var(--primary-light, color-mix(in srgb, var(--success) 14%, transparent));
    --op-bg: var(--bg-card, var(--bg, var(--bg-input,var(--bg-input,#fff))));
    --op-tx: var(--text, var(--text,#1f2937));
    --op-txs: var(--text-soft, var(--text-muted, var(--text-secondary,#6b7280)));
    --op-bd: var(--border, var(--border,#e5e7eb));
    --op-r: var(--radius, 14px);
    --op-rs: var(--radius-sm, 9px);
    --op-rl: var(--radius-lg, 18px);
    --op-sh: 0 1px 2px color-mix(in srgb, var(--text) 4%, transparent), 0 10px 26px color-mix(in srgb, var(--text) 6%, transparent);
}

.office-to-pdf-app {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    color: var(--op-tx);
    font-size: 14px;
    line-height: 1.6;
    box-sizing: border-box;
}
.office-to-pdf-app *,
.office-to-pdf-app *::before,
.office-to-pdf-app *::after { box-sizing: border-box; }

/* card + head */
.office-to-pdf-card {
    padding: 18px;
    border: 1px solid var(--op-bd);
    border-radius: var(--op-rl);
    background: var(--op-bg);
    box-shadow: var(--op-sh);
}
.office-to-pdf-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.office-to-pdf-headico {
    flex: none;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    font-size: 21px;
    border-radius: var(--radius);
    background: var(--op-pl);
    border: 1px solid var(--op-bd);
}
.office-to-pdf-headtxt { display: flex; flex-direction: column; min-width: 0; }
.office-to-pdf-headt { font-size: 15px; font-weight: 700; color: var(--op-tx); }
.office-to-pdf-heads { font-size: 12px; color: var(--op-txs); line-height: 1.5; }

/* dropzone — paper motif */
.office-to-pdf-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    border: 2px dashed var(--op-bd);
    border-radius: var(--op-r);
    background:
        linear-gradient(180deg, var(--op-pl) 0%, transparent 60%),
        var(--bg-input, var(--op-bg));
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.office-to-pdf-drop:hover { border-color: var(--op-p); }
.office-to-pdf-dropico { font-size: 30px; line-height: 1; opacity: 0.9; }
.office-to-pdf-drop-txt { font-size: 13px; color: var(--op-txs); line-height: 1.55; }
.office-to-pdf-file {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.office-to-pdf-drop.office-to-pdf-over,
.office-to-pdf-over {
    border-color: var(--op-p);
    background: var(--op-pl);
    transform: scale(1.01);
    box-shadow: 0 0 0 4px var(--op-pl);
}

/* hint */
.office-to-pdf-hint { margin-top: 12px; }
.office-to-pdf-hint-b {
    padding: 9px 12px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--op-txs);
    background: var(--op-pl);
    border-left: 3px solid var(--op-p);
    border-radius: 0 var(--op-rs) var(--op-rs) 0;
}

/* buttons */
.office-to-pdf-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.office-to-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--op-tx);
    background: var(--op-bg);
    border: 1px solid var(--op-bd);
    border-radius: var(--op-rs);
    cursor: pointer;
    transition: transform 0.14s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.office-to-pdf-btn:hover { color: var(--op-p); border-color: var(--op-p); box-shadow: 0 4px 12px var(--op-pl); }
.office-to-pdf-btn:active { transform: translateY(1px); }
.office-to-pdf-btn:disabled { opacity: 0.48; cursor: not-allowed; box-shadow: none; color: var(--op-txs); }
.office-to-pdf-btn-primary {
    color: var(--bg-input,#fff);
    background: var(--op-p);
    border-color: var(--op-p);
    box-shadow: 0 4px 14px var(--op-pl);
}
.office-to-pdf-btn-primary:hover { color: var(--bg-input,#fff); background: var(--op-ph); border-color: var(--op-ph); }
.office-to-pdf-btn-quiet { color: var(--op-txs); }
.office-to-pdf-btn-quiet:hover { color: var(--danger,#dc2626); border-color: color-mix(in srgb, var(--danger) 38%, var(--bg,#fff)); box-shadow: none; }

/* status */
.office-to-pdf-status { font-size: 13px; color: var(--op-txs); }
.office-to-pdf-status:not(:empty) {
    padding: 10px 14px;
    border-radius: var(--op-rs);
    background: var(--op-pl);
    border: 1px solid color-mix(in srgb, var(--op-p) 32%, var(--op-bd));
    color: var(--op-tx);
}
.office-to-pdf-status.err,
.office-to-pdf-status.error { background: color-mix(in srgb, var(--danger) 8%, var(--bg,#fff)); border-color: color-mix(in srgb, var(--danger) 24%, var(--bg,#fff)); color: var(--danger,#b91c1c); }

/* output */
.office-to-pdf-out {
    padding: 18px;
    border: 1px solid var(--op-bd);
    border-radius: var(--op-rl);
    background: var(--op-bg);
    box-shadow: var(--op-sh);
    position: relative;
}
.office-to-pdf-label {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--op-txs);
}

/* sheet tabs */
.office-to-pdf-sheets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.office-to-pdf-shtab {
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--op-txs);
    background: var(--bg-input, var(--op-bg));
    border: 1px solid var(--op-bd);
    border-radius: var(--op-rs) var(--op-rs) 0 0;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.office-to-pdf-shtab:hover { color: var(--op-p); border-color: var(--op-p); }
.office-to-pdf-shtab.active {
    color: var(--bg-input,#fff);
    background: var(--op-p);
    border-color: var(--op-p);
}

/* paper preview */
.office-to-pdf-preview { overflow: auto; }
.office-to-pdf-sheetpane {
    padding: 24px 26px;
    background: var(--bg-input,#fff);
    border: 1px solid var(--op-bd);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 6px color-mix(in srgb, var(--text) 8%, transparent), 0 12px 28px color-mix(in srgb, var(--text) 8%, transparent);
    min-height: 200px;
    line-height: 1.75;
}
.office-to-pdf-sheetpane p { margin: 0 0 10px; }
.office-to-pdf-sheetpane h1,
.office-to-pdf-sheetpane h2,
.office-to-pdf-sheetpane h3 { margin: 14px 0 8px; font-weight: 700; }
.office-to-pdf-sheetpane h1 { font-size: 20px; }
.office-to-pdf-sheetpane h2 { font-size: 17px; }
.office-to-pdf-sheetpane h3 { font-size: 15px; }
.office-to-pdf-sheetpane ul,
.office-to-pdf-sheetpane ol { margin: 0 0 10px; padding-left: 22px; }

/* table (xlsx) */
.office-to-pdf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.office-to-pdf-table th,
.office-to-pdf-table td {
    padding: 7px 10px;
    border: 1px solid var(--op-bd);
    text-align: left;
    vertical-align: top;
}
.office-to-pdf-table th {
    font-weight: 700;
    background: var(--op-pl);
    color: var(--op-tx);
}
.office-to-pdf-table tbody tr:nth-child(even) td { background: var(--bg-input, var(--bg-btn,#fafafa)); }

/* plain text preview */
.office-to-pdf-txtpre {
    margin: 0;
    padding: 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-input,#fff);
    border: 1px solid var(--op-bd);
    border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
    .office-to-pdf-actions .office-to-pdf-btn { flex: 1 1 auto; justify-content: center; }
    .office-to-pdf-sheetpane { padding: 16px; }
}

/* 页面设置 / 页眉页脚 / 水印 */
.office-to-pdf-setup { margin-top: 14px; }
.office-to-pdf-subhead { font-size: 13px; font-weight: 600; color: var(--op-tx); margin: 4px 0 10px; }
.office-to-pdf-fields { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.office-to-pdf-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 180px; min-width: 0; }
.office-to-pdf-field-sm { flex: 0 1 110px; }
.office-to-pdf-fieldlabel { font-size: 12px; color: var(--op-txs); }
.office-to-pdf-select, .office-to-pdf-input {
    padding: 6px 8px; border: 1px solid var(--op-bd); border-radius: var(--op-rs);
    background: var(--op-bg); color: var(--op-tx); font-size: 13px; min-width: 0;
}
.office-to-pdf-color { width: 100%; height: 32px; padding: 2px; border: 1px solid var(--op-bd); border-radius: var(--op-rs); background: var(--op-bg); }
.office-to-pdf-range { width: 100%; }
.office-to-pdf-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--op-tx); flex: 1 1 180px; }
.office-to-pdf-hdrbar, .office-to-pdf-ftrbar {
    font-size: 12px; color: var(--op-txs); padding: 6px 0;
    border-bottom: 1px solid var(--op-bd); margin-bottom: 8px;
}
.office-to-pdf-ftrbar { border-bottom: none; border-top: 1px solid var(--op-bd); margin: 8px 0 0; display: flex; justify-content: space-between; }
.office-to-pdf-wmlayer {
    position: absolute; inset: 0; pointer-events: none; overflow: hidden;
    display: flex; flex-wrap: wrap; align-content: flex-start;
}
.office-to-pdf-wmcell {
    flex: 0 0 33.33%; height: 190px; display: flex; align-items: center; justify-content: center;
    font-weight: 700; white-space: nowrap; user-select: none;
}
@media (max-width: 640px) {
    .office-to-pdf-field, .office-to-pdf-field-sm { flex: 1 1 100%; }
}

/* 打印 / 导出 PDF：只保留正文与页眉页脚水印，隐藏全部界面元素 */
@media print {
    .office-to-pdf-head,
    .office-to-pdf-drop,
    .office-to-pdf-hint,
    .office-to-pdf-actions,
    .office-to-pdf-status,
    .office-to-pdf-setup,
    .office-to-pdf-label {
        display: none !important;
    }
    .office-to-pdf-out {
        border: none;
        box-shadow: none;
        padding: 0;
        background: transparent;
    }
}
