/* PDF tools (/pdf/…): every file is read and written inside the browser – nothing is uploaded. */
.pdf-tool { max-width: 1040px; margin: 0 auto; padding: 24px 16px 8px; }
.pdf-tool h1 { font-family: var(--font-head, inherit); font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.15; margin: 6px 0 8px; }
.pdf-lead { font-size: 1.08rem; color: var(--muted); margin: 0 0 14px; max-width: 760px; }

/* privacy strip: live upload counter */
.pdf-privacy { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 0 0 18px; font-size: .9rem; }
.pdf-privacy span { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--brand-soft); }
.pdf-privacy .dot { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .25); }
.pdf-privacy b { font-variant-numeric: tabular-nums; }
.pdf-privacy .bad { border-color: #ff6b6b; background: rgba(255, 107, 107, .15); }

/* work area */
.pdf-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius, 16px); padding: 18px; box-shadow: var(--shadow); }
.pdf-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; min-height: 190px; padding: 26px 16px;
  border: 2px dashed var(--brand-line); border-radius: 16px; cursor: pointer; transition: background .2s, border-color .2s; }
.pdf-drop.over, .pdf-drop:hover { border-color: var(--accent, var(--brand)); background: var(--brand-soft); }
.pdf-drop p { margin: 0; }
.pdf-drop .big-icon { font-size: 2.2rem; line-height: 1; }
.pdf-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pdf-work[hidden], .pdf-drop[hidden] { display: none; }

.pdf-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 0; }
.pdf-bar .grow { flex: 1; }
.pdf-opts { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; margin: 12px 0; }
.pdf-opts label { display: inline-flex; gap: 8px; align-items: center; }
.pdf-opts select, .pdf-opts input[type=text], .pdf-opts input[type=number], .pdf-field input[type=text], .pdf-field select {
  min-height: 38px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(10, 8, 30, .55); color: var(--text); font: inherit; }
.pdf-opts input[type=number] { width: 110px; }
.pdf-status { margin: 10px 0 0; min-height: 1.4em; color: var(--muted); }
.pdf-status.err { color: #ff8a8a; }
.pdf-status.ok { color: #6ff0a8; }
.pdf-progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 8px; }
.pdf-progress i { display: block; height: 100%; width: 0; background: var(--accent, var(--brand)); transition: width .2s; }
.pdf-progress[hidden] { display: none; }

/* file list (merge, jpg to pdf) */
.pdf-files { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pdf-files li { position: relative; background: rgba(10, 8, 30, .35); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.pdf-files li.drag { opacity: .4; }
.pdf-files .thumb { aspect-ratio: 3 / 4; background: #fff; border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pdf-files .thumb img, .pdf-files .thumb canvas { max-width: 100%; max-height: 100%; }
.pdf-files .name { font-size: .82rem; word-break: break-all; line-height: 1.25; max-height: 2.5em; overflow: hidden; }
.pdf-files .meta { font-size: .76rem; color: var(--muted); }
.pdf-files .acts { display: flex; gap: 4px; }
.pdf-files .acts button, .pg-acts button { flex: 1; min-height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--text); cursor: pointer; font-size: .9rem; }
.pdf-files .acts button:hover, .pg-acts button:hover { border-color: var(--accent, var(--brand)); }

/* page grid (split, organize, pdf to jpg) */
.pdf-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 6px; }
.pg { position: relative; border: 2px solid transparent; border-radius: 10px; padding: 6px; background: rgba(10, 8, 30, .35); cursor: pointer; user-select: none; }
.pg.sel { border-color: var(--accent, var(--brand)); background: var(--brand-soft); }
.pg.drag { opacity: .4; }
.pg .pv { aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; }
.pg .pv canvas { max-width: 100%; max-height: 100%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); transition: transform .25s; }
.pg .no { text-align: center; font-size: .8rem; margin-top: 4px; color: var(--muted); }
.pg .tick { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #fff; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.pg.sel .tick { background: var(--accent, var(--brand)); color: var(--accent-ink, #fff); }
.pg.del .pv { opacity: .25; }
.pg-acts { display: flex; gap: 4px; margin-top: 6px; }

/* sign / stamp viewer */
.pdf-split { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .pdf-split { grid-template-columns: 1fr; } }
.pdf-side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 860px) { .pdf-side { position: static; } }
.pdf-side h3 { margin: 4px 0 0; font-size: 1rem; }
.pdf-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pdf-tabs button { flex: 1; white-space: nowrap; padding: 0 8px; min-height: 34px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: .88rem; }
.pdf-tabs button.on { background: var(--accent, var(--brand)); color: var(--accent-ink, #fff); border-color: transparent; font-weight: 700; }
.pdf-field { display: flex; flex-direction: column; gap: 5px; font-size: .9rem; }
.pdf-field input[type=color] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }
.pdf-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sig-pad { width: 100%; height: 150px; background: #fff; border-radius: 10px; touch-action: none; cursor: crosshair; display: block; }
.sig-preview { min-height: 90px; background: repeating-conic-gradient(#e9e9ef 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 8px; }
.sig-preview img { max-width: 100%; max-height: 140px; }
.sig-list { display: flex; gap: 8px; flex-wrap: wrap; }
.sig-list button { width: 84px; height: 54px; border-radius: 8px; border: 2px solid var(--line); background: #fff; cursor: pointer; padding: 3px; }
.sig-list button.on { border-color: var(--accent, var(--brand)); }
.sig-list img { max-width: 100%; max-height: 100%; }
.pdf-hint { font-size: .85rem; color: var(--muted); margin: 0; }

.pdf-viewer { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.vpage { position: relative; background: #fff; box-shadow: 0 6px 22px rgba(0, 0, 0, .4); max-width: 100%; }
.vpage canvas { display: block; width: 100%; height: auto; }
.vpage .layer { position: absolute; inset: 0; }
.vpage.placing { cursor: copy; }
.vpage .pno { position: absolute; top: -22px; left: 0; font-size: .8rem; color: var(--muted); }
.item { position: absolute; outline: 1.5px dashed rgba(109, 93, 246, .9); cursor: move; touch-action: none; }
.item img { width: 100%; height: 100%; display: block; pointer-events: none; }
.item .rs { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: #6d5df6; border: 2px solid #fff; cursor: nwse-resize; touch-action: none; }
.item .x { position: absolute; right: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; background: #e5484d; color: #fff; border: 2px solid #fff; font-size: 13px; line-height: 16px; text-align: center; cursor: pointer; padding: 0; }
.item.text { outline-color: rgba(229, 72, 77, .8); }

/* edit PDF */
.edit-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.edit-tools button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: .78rem; }
.edit-tools button b { font-size: 1.15rem; line-height: 1; }
.edit-tools button.on { background: var(--accent, var(--brand)); color: var(--accent-ink, #fff); border-color: transparent; font-weight: 700; }
.vpage.edit[data-mode=text] .layer { cursor: text; }
.vpage.edit[data-mode=whiteout] .layer, .vpage.edit[data-mode=highlight] .layer, .vpage.edit[data-mode=rect] .layer, .vpage.edit[data-mode=draw] .layer { cursor: crosshair; touch-action: none; }
.vpage.edit[data-mode=image] .layer { cursor: copy; }
.eitem { position: absolute; }
.tspan { position: absolute; display: none; border-radius: 2px; cursor: text; }
.vpage.edit[data-mode=edittext] .tspan { display: block; }
.vpage.edit[data-mode=edittext] .tspan:hover { background: rgba(109, 93, 246, .14); outline: 1px solid rgba(109, 93, 246, .7); }
.tspan[hidden] { display: none !important; }
.ecover { position: absolute; pointer-events: none; }
.eitem.sel { outline: 1.5px dashed #6d5df6; outline-offset: 2px; }
.vpage.edit[data-mode=select] .eitem, .eitem.e-text { cursor: move; }
.eitem img, .eitem svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.eitem.e-whiteout { box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.etext { min-width: 14px; padding: 0; margin: 0; white-space: pre; outline: 1px dashed rgba(109, 93, 246, .55); cursor: text; }
.etext:focus { outline: 1.5px solid #6d5df6; }
.eitem .rs, .eitem .x { display: none; }
.eitem.sel .rs, .eitem.sel .x { display: block; }
.eitem .rs { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: #6d5df6; border: 2px solid #fff; cursor: nwse-resize; touch-action: none; }
.eitem .x { position: absolute; right: -12px; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: #e5484d; color: #fff; border: 2px solid #fff; font-size: 13px; line-height: 16px; text-align: center; cursor: pointer; padding: 0; }

/* hub cards */
.pdf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 18px 0; }
.pdf-cards a { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: transform .2s, border-color .2s; }
.pdf-cards a:hover { transform: translateY(-3px); border-color: var(--accent, var(--brand)); }
.pdf-cards b { font-size: 1.05rem; }
.pdf-cards span { font-size: .88rem; color: var(--muted); }
.pdf-cards i { font-style: normal; font-size: 1.6rem; }
.pdf-related { margin-top: 26px; }
