/* PDF 工具箱 · 页面专用样式（通用样式见 theme.css） */
[data-icon] > svg { display: block; }
.btn [data-icon] svg { width: 18px; height: 18px; }
.title-aside { margin-left: auto; font-weight: 400; }

/* ---------- 功能网格 ---------- */
.tools-card { padding-bottom: clamp(14px, 2.2vw, 22px); }
.tool-group + .tool-group { margin-top: 18px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px; }
.tool {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--card); border: 1px solid var(--border); color: var(--text); transition: border-color .18s, background .18s, transform .12s, box-shadow .18s;
}
.tool:hover { border-color: var(--border-strong); background: var(--card-2); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.tool:active { transform: scale(.985); }
.tool .ic { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); border: 1px solid var(--border); color: var(--accent-1); transition: all .2s; }
.tool .ic svg { width: 21px; height: 21px; }
.tool:hover .ic { background: var(--accent); color: #fff; border-color: transparent; box-shadow: var(--shadow-glow); }
.tool .tx { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tool .tt { font-size: 14.5px; font-weight: 650; line-height: 1.3; }
.tool .ts { font-size: 12px; color: var(--text-3); line-height: 1.35; }
.tool.disabled { opacity: .45; cursor: not-allowed; }
.tool.disabled:hover { transform: none; box-shadow: none; }
.tool .badge-soon { position: absolute; top: 8px; right: 8px; font-size: 10.5px; color: var(--warn); }
.tool.current { background: var(--accent-soft); border-color: transparent; box-shadow: inset 0 0 0 1.5px rgba(220,192,143,.85); }
.carry-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(220,192,143,.45); background: var(--accent-soft); font-size: 13.5px; }
.carry-banner img { width: 38px; height: 50px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #fff; flex: none; }
.carry-banner .grow { flex: 1; min-width: 0; }
.carry-banner b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 当前功能 / 上传 ---------- */
.cur-tool { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cur-tool .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: var(--shadow-glow); flex: none; }
.cur-tool .ic svg { width: 20px; height: 20px; }
.cur-tool .tx { flex: 1; min-width: 0; }
.cur-tool .tt { font-weight: 700; font-size: 16px; line-height: 1.3; }
.cur-tool .ts { font-size: 12.5px; color: var(--text-3); }
.cur-tool .icon-btn { flex: none; }
.dropzone { min-height: 240px; }
.dropzone.compact { min-height: 0; flex-direction: row; justify-content: flex-start; text-align: left; gap: 14px; padding: 14px 16px; }
.dropzone.compact .dz-icon { width: 42px; height: 42px; border-radius: 12px; margin: 0; flex: none; }
.dropzone.compact .dz-icon svg { width: 20px; height: 20px; }
.dropzone.compact h3 { font-size: 14.5px; margin: 0 0 2px; }
.dropzone.compact p { font-size: 12px; }

/* 文件列表 */
.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.file-list:empty { display: none; }
.frow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); position: relative; overflow: hidden; touch-action: pan-y; }
.frow.dragging { z-index: 5; box-shadow: 0 14px 40px rgba(0,0,0,.35), inset 0 0 0 1.5px rgba(220,192,143,.8); background: var(--card-solid); }
.frow .grip { color: var(--text-3); cursor: grab; touch-action: none; padding: 4px 0; flex: none; }
.frow .grip svg { width: 18px; height: 18px; }
.frow .idx { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 650; background: var(--card-2); border: 1px solid var(--border); flex: none; }
.frow .fthumb { width: 40px; height: 52px; border-radius: 6px; object-fit: cover; flex: none; background: #fff; border: 1px solid var(--border); }
.frow .fthumb.icon { background: none; border: 0; object-fit: contain; }
.frow .meta { flex: 1; min-width: 0; }
.frow .meta .n { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .meta .s { font-size: 12px; color: var(--text-3); }
.frow .meta .s.err { color: var(--err); }
.frow .acts { display: flex; gap: 4px; flex: none; }
.frow .acts .icon-btn { height: 32px; min-width: 32px; padding: 0 6px; border-radius: 10px; }
.frow .acts .icon-btn svg { width: 16px; height: 16px; }
.frow .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); transition: width .2s; }
.frow.warn { border-color: rgba(251,191,36,.45); }

/* ---------- 页面缩略图网格 ---------- */
.page-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 10px; }
.page-tools .grow { flex: 1; }
.page-tools .icon-btn { height: 34px; font-size: 13px; padding: 0 10px; }
.page-tools .icon-btn svg { width: 16px; height: 16px; }
.page-tools .cnt { font-size: 12.5px; color: var(--text-2); }
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; user-select: none; -webkit-user-select: none; }
.pg { position: relative; border-radius: 12px; padding: 8px 8px 6px; background: var(--card); border: 1px solid var(--border); cursor: pointer; transition: border-color .15s, background .15s, opacity .15s, box-shadow .15s; -webkit-touch-callout: none; }
.pg:hover { border-color: var(--border-strong); }
.pg .thumb { position: relative; aspect-ratio: 1 / 1.3; display: grid; place-items: center; overflow: hidden; border-radius: 6px; }
.pg .thumb img { max-width: 100%; max-height: 100%; display: block; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); transition: transform .25s; border-radius: 2px; pointer-events: none; -webkit-user-drag: none; }
.pg .foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 6px; min-height: 26px; }
.pg .no { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pg .pa { display: flex; gap: 2px; }
.pg .pa button { width: 26px; height: 26px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; padding: 0; }
.pg .pa button:hover { background: var(--card-2); border-color: var(--border); color: var(--text); }
.pg .pa svg { width: 15px; height: 15px; }
.pg.selected { background: var(--accent-soft); border-color: transparent; box-shadow: inset 0 0 0 1.5px rgba(220,192,143,.85); }
.pg .check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(25,20,11,.5); border: 1.5px solid rgba(255,255,255,.7); color: #fff; z-index: 2; }
.pg .check svg { width: 13px; height: 13px; opacity: 0; }
.pg.selected .check { background: var(--accent); border-color: transparent; box-shadow: var(--shadow-glow); }
.pg.selected .check svg { opacity: 1; }
.pg.deleted .thumb { opacity: .28; }
.pg.deleted::after { content: "将删除"; position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); font-size: 12px; font-weight: 650; padding: 3px 10px; border-radius: 999px; background: rgba(248,113,113,.92); color: #fff; }
.pg .pa button.on { color: var(--err); }
.pg.dragging { z-index: 5; opacity: .92; box-shadow: 0 16px 40px rgba(0,0,0,.4), inset 0 0 0 1.5px rgba(220,192,143,.85); transform: scale(1.04); background: var(--card-solid); }
.pg.drop-hint { box-shadow: inset 3px 0 0 var(--accent-1); }
.page-hint { margin-top: 10px; }

/* 单页预览（水印 / 页码） */
.preview-pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.preview-pages.one { grid-template-columns: minmax(0, 360px); justify-content: center; }
.pv { position: relative; border-radius: 10px; padding: 12px; background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0/18px 18px; border: 1px solid var(--border); display: grid; place-items: center; }
.pv .pv-in { position: relative; line-height: 0; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.pv img { max-width: 100%; max-height: 520px; display: block; background: #fff; }
.pv canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pv .cap { position: absolute; top: 8px; left: 8px; font-size: 11.5px; line-height: 1; padding: 5px 9px; border-radius: 999px; background: rgba(25,20,11,.62); color: #fff; z-index: 2; }

/* 单文件信息卡 */
.file-hero { display: flex; gap: 16px; align-items: center; margin-top: 14px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); }
.file-hero img { width: 92px; height: 120px; object-fit: contain; background: #fff; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.3); flex: none; }
.file-hero .lock-ph { width: 92px; height: 120px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); border: 1px solid var(--border); color: var(--accent-1); flex: none; }
.file-hero .lock-ph svg { width: 34px; height: 34px; }
.file-hero .meta { min-width: 0; flex: 1; }
.file-hero .n { font-weight: 650; word-break: break-all; }
.file-hero .s { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.file-hero .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- 签名 ---------- */
.sign-nav { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0 10px; }
.sign-nav .pno { font-size: 13.5px; color: var(--text-2); min-width: 92px; text-align: center; font-variant-numeric: tabular-nums; }
.sign-nav select.input { width: auto; height: 36px; }
.sign-stage { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0/18px 18px; display: grid; place-items: center; }
.sign-page { position: relative; line-height: 0; box-shadow: 0 8px 30px rgba(0,0,0,.35); touch-action: pan-y; max-width: 100%; }
.sign-page > img { display: block; max-width: 100%; max-height: 72vh; background: #fff; user-select: none; -webkit-user-drag: none; }
.sig-box { position: absolute; border: 1.5px dashed rgba(220,192,143,.95); border-radius: 4px; cursor: move; touch-action: none; background: rgba(220,192,143,.06); }
.sig-box img { width: 100%; height: 100%; display: block; pointer-events: none; }
.sig-box .rs { position: absolute; right: -10px; bottom: -10px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: var(--shadow-glow); cursor: nwse-resize; touch-action: none; }
.sig-box .del { position: absolute; right: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; background: #ef4444; color: #fff; border: 2px solid #fff; display: grid; place-items: center; cursor: pointer; padding: 0; line-height: 0; }
.sig-box .del svg { width: 11px; height: 11px; }
.sig-pad-wrap { position: relative; border-radius: 12px; border: 1px dashed var(--border-strong); background: #fff; overflow: hidden; touch-action: none; }
.sig-pad-wrap canvas { display: block; width: 100%; height: 150px; touch-action: none; cursor: crosshair; }
.sig-pad-wrap .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa3b8; font-size: 13px; pointer-events: none; }
.sig-preview { display: grid; place-items: center; height: 110px; border-radius: 12px; border: 1px solid var(--border); background: #fff; overflow: hidden; }
.sig-preview img { max-width: 90%; max-height: 90px; }
.pen-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.pen-row .grow { flex: 1; }

/* ---------- 设置控件 ---------- */
.set-field { margin-bottom: 14px; }
.set-field:last-child { margin-bottom: 0; }
.set-label { font-size: 13px; color: var(--text-2); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.set-label b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.set-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.5; }
.opt-grid.list { grid-template-columns: minmax(0, 1fr); }
.opt.row { flex-direction: row; justify-content: flex-start; text-align: left; gap: 10px; padding: 11px 12px; min-height: 0; }
.opt.row .o-tx { display: flex; flex-direction: column; gap: 1px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-strong); cursor: pointer; padding: 0; transition: transform .1s; }
.swatch-btn.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #dcc08f; transform: scale(1.06); }
.posgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; max-width: 220px; padding: 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); aspect-ratio: 1 / .9; }
.posgrid button { border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; display: grid; place-items: center; }
.posgrid button span { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); opacity: .55; }
.posgrid button:hover { background: var(--card-2); }
.posgrid button.on { background: var(--accent-soft); border-color: rgba(220,192,143,.7); }
.posgrid button.on span { background: var(--accent); opacity: 1; box-shadow: 0 0 8px rgba(220,192,143,.9); }
.posgrid button.mid { visibility: hidden; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; height: 32px; width: 36px; border: 0; background: none; color: var(--text-3); cursor: pointer; display: grid; place-items: center; }
.pw-wrap button svg { width: 18px; height: 18px; }
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input.num { width: 110px; }
.inline-row { display: flex; gap: 10px; align-items: center; }

/* ---------- 结果 ---------- */
.result-card { max-width: 920px; margin: 0 auto; }
.res-head { display: flex; align-items: center; gap: 14px; }
.res-ok { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: var(--shadow-glow); flex: none; }
.res-ok svg { width: 24px; height: 24px; }
.res-tt h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.res-tt .muted { font-size: 13.5px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.stat { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); }
.stat b { display: block; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat span { font-size: 12px; color: var(--text-3); }
.stat.hi b { background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.res-files { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.rfile { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); }
.rfile.main { background: var(--accent-soft); border-color: rgba(220,192,143,.45); }
.rfile img { width: 38px; height: 48px; object-fit: cover; border-radius: 5px; background: #fff; flex: none; border: 1px solid var(--border); }
.rfile img.icon { background: none; border: 0; object-fit: contain; }
.rfile .meta { flex: 1; min-width: 0; }
.rfile .n { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rfile .s { font-size: 12px; color: var(--text-3); }
.rfile .acts { display: flex; gap: 6px; flex: none; }
.rfile .btn { height: 38px; padding: 0 14px; font-size: 13.5px; }
.res-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.res-pages a { display: block; border-radius: 10px; padding: 8px; background: var(--card); border: 1px solid var(--border); text-align: center; color: var(--text-3); font-size: 11.5px; }
.res-pages a:hover { border-color: var(--border-strong); }
.res-pages .thumb { aspect-ratio: 1 / 1.3; display: grid; place-items: center; margin-bottom: 4px; }
.res-pages img { max-width: 100%; max-height: 100%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); border-radius: 2px; }
.ocr-text { margin: 0; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 13px/1.7 var(--font); padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text-2); }
.res-actions { margin-top: 18px; }

/* ---------- 弹层 ---------- */
.busy-fixed { position: fixed; z-index: 120; }
.busy-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 26px 30px; min-width: min(320px, 86vw); background: var(--card-solid); }
.busy-card .progress { width: 100%; }
.busy-card .txt { font-weight: 600; text-align: center; }
.busy-card .faint { text-align: center; }
.modal-back { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--bg) 60%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal { width: min(380px, 100%); background: var(--card-solid); }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.modal-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: var(--shadow-glow); margin-bottom: 14px; }
.modal-ic svg { width: 21px; height: 21px; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .run-desk { display: none; }
  .mobile-bar .mb-info { font-size: 12.5px; color: var(--text-2); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-bar .btn-primary { padding: 0 20px; }
}
@media (max-width: 600px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tool { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .tool .ic { width: 36px; height: 36px; border-radius: 10px; }
  .tool .ic svg { width: 18px; height: 18px; }
  .tool .tt { font-size: 14px; }
  .tool .ts { font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .title-aside { display: none; }
  .dropzone { min-height: 190px; }
  .page-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pg { padding: 6px 6px 4px; border-radius: 10px; }
  .pg .pa button { width: 24px; height: 24px; }
  .pg .check { top: 9px; right: 9px; width: 20px; height: 20px; }
  .preview-pages { grid-template-columns: minmax(0, 1fr); }
  .preview-pages .pv:nth-child(2) { display: none; }
  .file-hero img, .file-hero .lock-ph { width: 70px; height: 92px; }
  .rfile { flex-wrap: wrap; }
  .rfile .acts { width: 100%; }
  .rfile .acts .btn { flex: 1; }
  .res-pages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res-actions { flex-direction: column; }
  .cur-tool .icon-btn .lbl-txt { display: none; }
}
.btn.soft-disabled { opacity: .55; box-shadow: none; }

.run-desk { margin-top: 18px; }
#resPreviewWrap, #resTextWrap { margin-top: 16px; }
.set-hint + .btn, .note + .btn { margin-top: 14px; }
