/* Simple one-step tool pages: page numbers, watermark, compress, protect, unlock */
body[data-mode='finish'] main { max-width: 860px; }
#pick { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pick:focus-within { outline: 3px solid var(--select); outline-offset: 3px; }
.pick:has(input:disabled) { opacity: .55; }
.finish-file { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 14px; }
.finish-file strong { overflow-wrap: anywhere; }
.finish-file span { color: var(--ink-2); }
.link-button { margin-left: auto; color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: underline; }
.finish-form { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.frow { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.ff { display: flex; flex-direction: column; gap: 5px; flex: 1 1 150px; min-width: 0; font-weight: 600; font-size: .875rem; }
.ff small { font-weight: 400; color: var(--ink-2); font-size: .78rem; line-height: 1.35; }
.ff input:not([type='color']):not([type='file']), .ff select { padding: 9px 10px; border: 1px solid var(--line-input); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 400; min-width: 0; }
.ff input[type='color'] { width: 100%; height: 38px; padding: 2px; border: 1px solid var(--line-input); border-radius: 9px; background: var(--surface); }
.ff input[type='file'] { font-weight: 400; font-size: .85rem; }
.fcheck { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.fperm { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; display: grid; gap: 8px; }
.fperm legend { font-weight: 600; font-size: .875rem; padding: 0 6px; }
.fnote { margin: 0; color: var(--ink-2); font-size: .85rem; }
.finish-run { border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.finish-run:disabled { opacity: .6; cursor: progress; }
#finish-status { min-height: 1.4em; margin: 12px 2px; }
#finish-status.error { color: var(--danger, #b42318); font-weight: 600; }
#finish-done { text-align: center; padding: 8px 0 18px; }
.finish-size { margin: 0 0 10px; font-weight: 600; }
.finish-preview { max-width: min(100%, 420px); height: auto; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 22px #0002; margin: 6px auto 14px; display: block; background: #fff; }
.finish-downloads { display: flex; justify-content: center; margin: 10px 0; }
#finish-done .btn { margin: 6px 4px 0; border: 1px solid var(--line-2); cursor: pointer; font: inherit; font-weight: 700; }
#finish-done .btn-primary { border-color: transparent; }

/* Shared live-preview layout and responsive PDF canvas sizing. */
body[data-mode='finish'] { overflow-x:clip; }
.finish-workspace { display:grid; gap:16px; align-items:start; }
.finish-workspace.with-live-preview { grid-template-columns:minmax(270px,.8fr) minmax(300px,1.2fr); }
.finish-workspace > * { min-width:0; }
.live-preview-panel { min-width:0; overflow:hidden; padding:16px; border:1px solid var(--line); border-radius:14px; background:var(--surface); }
.live-preview-panel h2 { margin:0 0 10px; font-size:1.05rem; }
.live-preview-stage { position:relative; width:min(100%,760px); min-width:0; margin:10px auto; }
.live-preview-canvas { display:block; width:auto; max-width:100%; height:auto; margin:10px auto; border:1px solid var(--line); border-radius:6px; background:#fff; box-shadow:0 5px 20px #0002; }
.live-preview-stage > .live-preview-canvas { width:100%; margin:0; }
.live-preview-nav { display:flex; justify-content:center; align-items:center; flex-wrap:wrap; gap:8px; }
.live-page-label { min-width:82px; text-align:center; color:var(--ink-2); font-size:.875rem; }
.live-preview-status { min-height:1.2em; margin:8px 0 0; color:var(--ink-2); font-size:.82rem; }
.result-preview-nav { margin:12px 0 4px; }
.crop-live-stage { position:relative; width:min(100%,760px); min-width:0; margin:10px auto; touch-action:none; user-select:none; }
.crop-live-stage .live-preview-canvas { width:100%; margin:0; }
.crop-selection { position:absolute; box-sizing:border-box; border:2px dashed var(--accent); background:#13b88920; cursor:move; touch-action:none; }
.crop-selection.crop-full { background:transparent; }
.crop-handle { position:absolute; width:12px; height:12px; border:2px solid var(--accent); border-radius:50%; background:var(--surface); }
.crop-handle-nw { left:-7px; top:-7px; cursor:nwse-resize; } .crop-handle-n { left:calc(50% - 6px); top:-7px; cursor:ns-resize; }
.crop-handle-ne { right:-7px; top:-7px; cursor:nesw-resize; } .crop-handle-e { right:-7px; top:calc(50% - 6px); cursor:ew-resize; }
.crop-handle-se { right:-7px; bottom:-7px; cursor:nwse-resize; } .crop-handle-s { left:calc(50% - 6px); bottom:-7px; cursor:ns-resize; }
.crop-handle-sw { left:-7px; bottom:-7px; cursor:nesw-resize; } .crop-handle-w { left:-7px; top:calc(50% - 6px); cursor:ew-resize; }
.crop-readout { margin:8px 0 0; text-align:center; color:var(--ink-2); font-size:.82rem; }
.finish-preview-info { margin:10px 0 4px; color:var(--ink-2); font-size:.85rem; }
.finish-preview-strip { display:flex; gap:12px; max-width:100%; overflow-x:auto; overflow-y:hidden; padding:4px 2px 12px; overscroll-behavior-x:contain; scroll-snap-type:x proximity; scrollbar-color:var(--accent-dark) var(--surface-2); scrollbar-width:auto; }
.finish-preview-strip figure { margin:0; flex:0 0 170px; text-align:center; scroll-snap-align:start; }
.finish-preview-strip canvas { display:block; width:170px; height:auto; border:1px solid var(--line); border-radius:6px; background:#fff; box-shadow:0 5px 20px #0002; }
.finish-preview-strip figcaption { margin-top:4px; color:var(--ink-2); font-size:.75rem; }
.finish-preview-strip::-webkit-scrollbar { height:12px; }
.finish-preview-strip::-webkit-scrollbar-track { border-radius:8px; background:var(--surface-2); }
.finish-preview-strip::-webkit-scrollbar-thumb { border:2px solid var(--surface-2); border-radius:8px; background:var(--accent-dark); }
@media (max-width:760px) { .finish-workspace.with-live-preview { grid-template-columns:minmax(0,1fr); } }

/* Draggable text watermark controls in the live page preview. */
.live-preview-stage { touch-action:pan-y; }
.watermark-preview-overlay { position:absolute; inset:0; z-index:2; pointer-events:none; }
.watermark-preview-overlay[hidden] { display:none; }
.watermark-preview-text { position:absolute; max-width:96%; padding:3px 7px; border:1px dashed color-mix(in srgb,var(--accent) 68%,transparent); border-radius:5px; background:color-mix(in srgb,var(--surface) 35%,transparent); font-weight:700; line-height:1.1; white-space:nowrap; text-align:center; cursor:move; user-select:none; touch-action:none; pointer-events:auto; transform-origin:center; }
.watermark-preview-text:focus { outline:2px solid var(--select); outline-offset:3px; }
.watermark-rotate-handle { position:absolute; z-index:3; width:30px; height:30px; display:grid; place-items:center; padding:0; border:1px solid var(--line); border-radius:50%; background:var(--surface); color:var(--accent-ink); box-shadow:0 2px 8px #0003; font-size:19px; line-height:1; cursor:grab; touch-action:none; pointer-events:auto; transform:translate(-50%,-50%) translateY(-28px); }
.watermark-rotate-handle:active { cursor:grabbing; }
@media (max-width:760px) { .watermark-preview-text { padding:5px 8px; } .watermark-rotate-handle { width:36px; height:36px; } }
