/* ScriptZaar — PDF tools (prefix pt-) */
/* colours on :root, so pop-ups added to <body> (signature, password) get them too */
:root { --pt-blue: #2563eb; --pt-red: #dc2626; --pt-ink: #1f1d1a; --pt-paper: #ece8e1; }
.pt { padding: 22px 0 10px; }
.pt [hidden] { display: none !important; }
.pt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pt input[type=text], .pt input[type=number], .pt input[type=password], .pt select, .pt textarea { width: 100%; font: inherit; font-size: 15px; border: 1px solid #ddd6cb; border-radius: 10px; padding: 8px 10px; background: var(--card); color: var(--text); min-height: 42px; box-sizing: border-box; }
.pt textarea { min-height: 80px; resize: vertical; }
.pt input:focus, .pt select:focus, .pt textarea:focus { outline: 3px solid rgba(245, 158, 11, .35); border-color: var(--gold); }
.pt input[type=checkbox], .pt input[type=radio] { width: 18px; height: 18px; accent-color: #d97706; margin: 0; flex: none; }
.pt input[type=range] { width: 100%; accent-color: #d97706; }
.pt input[type=color] { width: 42px; height: 38px; padding: 2px; border: 1px solid #ddd6cb; border-radius: 9px; background: #fff; cursor: pointer; }
.pt-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pt-grow { flex: 1; }
.pt-link { font: inherit; font-size: 13.5px; border: 0; background: none; color: var(--gold-text); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
.pt-msg { min-height: 22px; font-size: 14px; font-weight: 700; color: #15803d; margin: 8px 0 4px; }
.pt-msg.pt-err { color: #b42318; }
.pt-msg.pt-warn { color: #b45309; }
.pt-note { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }

/* ---------- start ---------- */
.pt-start { max-width: 860px; margin: 0 auto; }
.pt-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; border: 2px dashed #e0b765; border-radius: 18px; background: #fffdf7; padding: 46px 18px; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; min-height: 260px; }
.pt-drop:hover, .pt-drop.pt-over, .pt-drop:focus-within { border-color: var(--gold); background: var(--gold-soft); }
.pt-drop.pt-over { transform: scale(1.01); }
.pt-drop b { font-size: 22px; }
.pt-drop > span { color: var(--muted); font-size: 15px; max-width: 520px; }
.pt-drop .btn { margin-top: 6px; font-size: 16px; padding: 13px 26px; }
.pt-ico { width: 52px; height: 52px; color: var(--gold-text); }
.pt-trust { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin-top: 14px; font-size: 14px; font-weight: 700; color: var(--muted); }
.pt-trust span::before { content: "✓ "; color: #15803d; }
.pt-try { text-align: center; margin: 12px 0 0; color: var(--muted); font-size: 14.5px; }
.pt-also { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.pt-also a { font-size: 13px; font-weight: 700; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--card); }
.pt-also a:hover { border-color: var(--gold); background: var(--gold-soft); }

/* ---------- work ---------- */
.pt-work { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.pt-main { border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden; min-width: 0; }
.pt-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--card); position: sticky; top: 0; z-index: 3; }
.pt-files { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.pt-file { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 12.5px; font-weight: 800; max-width: 260px; background: var(--fc-bg, #eef2ff); color: var(--fc-ink, #1e3a8a); }
.pt-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-file button { border: 0; background: rgba(0, 0, 0, .08); color: inherit; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 13px; line-height: 1; flex: none; }
.pt-ib { border: 1px solid var(--line); background: var(--card); border-radius: 9px; min-width: 36px; height: 36px; padding: 0 9px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.pt-ib:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-soft); }
.pt-ib:disabled { opacity: .45; cursor: default; }
.pt-ib.pt-on { background: var(--pt-ink); color: #fff; border-color: var(--pt-ink); }
.pt input.pt-size { width: 110px; flex: none; }
.pt-count { font-size: 13px; color: var(--muted); font-weight: 700; }

/* board */
.pt-board { --card-w: 150px; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr)); gap: 22px 18px; padding: 20px; background: #f4f1ec; min-height: 320px; user-select: none; -webkit-user-select: none; }
.pt-card { position: relative; text-align: center; border-radius: 10px; outline: none; touch-action: manipulation; }
.pt-card:focus-visible .pt-thumb { outline: 3px solid var(--gold); outline-offset: 3px; }
.pt-thumb { position: relative; aspect-ratio: 1 / 1.25; display: flex; align-items: center; justify-content: center; cursor: grab; }
.pt-thumb .pt-pg { background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); border-top: 4px solid var(--fc, #3b82f6); max-width: 100%; max-height: 100%; transition: transform .2s; display: block; }
.pt-thumb .pt-pg.pt-loading { width: 80%; aspect-ratio: 1 / 1.414; background: linear-gradient(90deg, #fff, #f2efe9, #fff); background-size: 200% 100%; animation: pt-shim 1.2s infinite linear; }
@keyframes pt-shim { to { background-position: -200% 0; } }
/* iPhone: a long press must not open the picture menu or drag the image out (that broke the hold-and-drag) */
.pt-thumb, .pt-thumb img { -webkit-touch-callout: none; -webkit-user-drag: none; }
.pt-lbl { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.pt-lbl small { flex: 1; min-width: 0; margin-top: 0 !important; }
.pt-mv { flex: none; width: 30px; height: 28px; border: 1px solid #d8d2c8; background: #fff; color: #1f1d1a; border-radius: 8px; font-size: 19px; font-weight: 800; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0 0 2px; }
.pt-mv:hover:not(:disabled) { border-color: var(--gold); background: #fff8e8; }
.pt-mv:disabled { opacity: .25; cursor: default; }
@media (hover: none) { .pt-mv { width: 38px; height: 34px; font-size: 22px; } }
.pt-card small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-card.pt-sel .pt-pg { outline: 3px solid var(--pt-blue); outline-offset: 3px; }
.pt-card.pt-del .pt-pg { opacity: .35; filter: grayscale(1); }
.pt-card.pt-del .pt-thumb::after { content: "✕"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 900; color: var(--pt-red); pointer-events: none; }
.pt-card.pt-ghost { opacity: .3; }
.pt-card.pt-drop-before::before, .pt-card.pt-drop-after::after { content: ""; position: absolute; top: 4px; bottom: 22px; width: 4px; border-radius: 2px; background: var(--gold); z-index: 2; }
.pt-card.pt-drop-before::before { left: -11px; }
.pt-card.pt-drop-after::after { right: -11px; }
.pt-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 3px; opacity: 0; transition: opacity .15s; z-index: 2; }
.pt-card:hover .pt-tools, .pt-card:focus-within .pt-tools, .pt-card.pt-sel .pt-tools { opacity: 1; }
.pt-tools button { border: 0; background: rgba(31, 29, 26, .86); color: #fff; width: 26px; height: 26px; border-radius: 7px; font-size: 13px; cursor: pointer; line-height: 1; display: flex; align-items: center; justify-content: center; }
.pt-tools button:hover { background: #000; }
.pt-check { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #fff; background: rgba(31, 29, 26, .25); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); z-index: 2; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 900; cursor: pointer; padding: 0; }
.pt-card.pt-sel .pt-check { background: var(--pt-blue); }
.pt-split { position: absolute; right: -16px; top: 0; bottom: 20px; width: 14px; border: 0; background: none; cursor: pointer; z-index: 3; padding: 0; }
.pt-split::before { content: ""; position: absolute; left: 6px; top: 10%; bottom: 10%; border-left: 2px dashed rgba(31, 29, 26, .18); }
/* always shown (phones have no hover): a clear round ✂ button between two pages */
.pt-split i { position: absolute; top: 40%; left: -6px; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 1.5px solid var(--gold); color: var(--gold-text); font-style: normal; font-size: 13px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); transition: transform .15s; }
.pt-split:hover i, .pt-split:focus-visible i { transform: scale(1.12); }
.pt-split.pt-on::before { border-color: var(--pt-red); }
.pt-split.pt-on i { opacity: 1; background: var(--pt-red); color: #fff; border-color: var(--pt-red); }
.pt-group { position: absolute; left: 0; right: 0; bottom: -14px; height: 4px; border-radius: 2px; background: var(--gc, transparent); }
.pt-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1 / 1.25; border: 2px dashed #cfc6b8; border-radius: 10px; color: #9b8f7d; font-weight: 800; font-size: 13px; cursor: pointer; background: transparent; font-family: inherit; }
.pt-add b { font-size: 30px; line-height: 1; }
.pt-add:hover { border-color: var(--gold); color: var(--gold-text); background: var(--gold-soft); }

/* single-page preview (numbers, watermark, crop, compress) */
.pt-view { background: #f4f1ec; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 420px; }
.pt-stage { position: relative; display: inline-block; box-shadow: 0 2px 14px rgba(0, 0, 0, .2); background: #fff; max-width: 100%; }
.pt-stage canvas { display: block; max-width: 100%; height: auto; }
.pt-ov { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pt-ov .pt-num { position: absolute; font-family: Helvetica, Arial, sans-serif; white-space: nowrap; line-height: 1; }
.pt-ov .pt-wm { position: absolute; white-space: nowrap; line-height: 1; transform-origin: 50% 50%; font-family: Helvetica, Arial, sans-serif; }
.pt-ov .pt-wm img { display: block; width: 100%; height: auto; }
.pt-crop { position: absolute; border: 2px solid var(--pt-blue); box-shadow: 0 0 0 9999px rgba(31, 29, 26, .45); pointer-events: auto; cursor: move; touch-action: none; }
.pt-crop i { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--pt-blue); border-radius: 3px; }
.pt-crop i[data-h=nw] { left: -8px; top: -8px; cursor: nwse-resize; } .pt-crop i[data-h=ne] { right: -8px; top: -8px; cursor: nesw-resize; }
.pt-crop i[data-h=sw] { left: -8px; bottom: -8px; cursor: nesw-resize; } .pt-crop i[data-h=se] { right: -8px; bottom: -8px; cursor: nwse-resize; }
.pt-crop i[data-h=n] { left: calc(50% - 7px); top: -8px; cursor: ns-resize; } .pt-crop i[data-h=s] { left: calc(50% - 7px); bottom: -8px; cursor: ns-resize; }
.pt-crop i[data-h=w] { top: calc(50% - 7px); left: -8px; cursor: ew-resize; } .pt-crop i[data-h=e] { top: calc(50% - 7px); right: -8px; cursor: ew-resize; }
.pt-pager { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--muted); }

/* side panel */
.pt-side { border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 16px; position: sticky; top: 12px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 24px); overflow: auto; }
.pt-side h2 { font-size: 17px; margin: 0; }
.pt-side h3 { font-size: 13px; margin: 0 0 7px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pt-field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 700; }
.pt-field small { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.pt-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pt-check-row { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.pt-check-row small { display: block; color: var(--muted); font-size: 12.5px; }
.pt-seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pt-seg button { flex: 1 1 auto; border: 0; border-right: 1px solid var(--line); background: var(--card); padding: 8px 10px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text); min-height: 38px; }
.pt-seg button:last-child { border-right: 0; }
.pt-seg button.pt-on { background: var(--pt-ink); color: #fff; }
.pt-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pt-opt { border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 8px; text-align: center; background: var(--card); cursor: pointer; font: inherit; color: var(--text); }
.pt-opt b { display: block; font-size: 15px; }
.pt-opt span { font-size: 11.5px; color: var(--muted); }
.pt-opt.pt-on { border-color: var(--gold); background: var(--gold-soft); }
.pt-grid9 { display: grid; grid-template-columns: repeat(3, 34px); gap: 5px; }
.pt-grid9 button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); cursor: pointer; position: relative; padding: 0; }
.pt-grid9 button::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 2px; background: #c9c0b2; left: 13px; top: 13px; }
.pt-grid9 button.pt-on { border-color: var(--gold); background: var(--gold-soft); }
.pt-grid9 button.pt-on::after { background: var(--gold-text); }
.pt-grid9 button:disabled { visibility: hidden; }
.pt-go { width: 100%; justify-content: center; font-size: 16px; padding: 14px 18px; }
.pt-strength { height: 6px; border-radius: 3px; background: #e8e2d8; overflow: hidden; }
.pt-strength i { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.pt-filelist { display: flex; flex-direction: column; gap: 6px; }
.pt-fl { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px; font-size: 13px; }
.pt-fl i { width: 10px; height: 26px; border-radius: 3px; background: var(--fc); flex: none; }
.pt-fl span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.pt-fl small { color: var(--muted); white-space: nowrap; }
.pt-fl button { border: 1px solid var(--line); background: var(--card); border-radius: 7px; width: 28px; height: 28px; cursor: pointer; font-size: 12px; }

/* busy + result */
.pt-busy { position: fixed; inset: 0; background: rgba(31, 29, 26, .55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pt-busybox { background: var(--card); border-radius: 16px; padding: 22px; width: min(420px, 100%); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.pt-busybox b { display: block; font-size: 16px; margin-bottom: 10px; }
.pt-bar2 { height: 10px; border-radius: 5px; background: #ece6dc; overflow: hidden; }
.pt-bar2 i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f59e0b, #fbbf24); transition: width .2s; }
.pt-busybox small { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }
.pt-done { border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 22px; max-width: 860px; margin: 0 auto; }
.pt-done-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pt-done-ic { width: 54px; height: 54px; border-radius: 50%; background: #dcfce7; color: #15803d; font-size: 28px; font-weight: 900; display: flex; align-items: center; justify-content: center; flex: none; }
.pt-done h2 { margin: 0; font-size: 21px; }
.pt-done p { margin: 3px 0 0; color: var(--muted); }
.pt-big { font-size: 30px; font-weight: 900; color: #15803d; }
.pt-done-acts { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.pt-done-acts .btn.gold { font-size: 16px; padding: 13px 24px; }
.pt-outs { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 280px; overflow: auto; }
.pt-out { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.pt-out span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.pt-out small { color: var(--muted); }
.pt-next { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.pt-next h3 { font-size: 14px; margin: 0 0 8px; }
.pt-next-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-next-list button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text); }
.pt-next-list button:hover { border-color: var(--gold); background: var(--gold-soft); }
.pt-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.pt-cmp figure { margin: 0; }
.pt-cmp figcaption { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.pt-cmp canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; display: block; background: #fff; }
.pt textarea.pt-textout { width: 100%; min-height: 340px; font: 13.5px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; }

/* modal */
.pt-modal { position: fixed; inset: 0; background: rgba(31, 29, 26, .55); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pt-mbox { background: var(--card); border-radius: 16px; padding: 20px; width: min(420px, 100%); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.pt-mbox h2 { margin: 0 0 6px; font-size: 18px; }
.pt-mbox p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

/* hub tool grid */
.pt-hub { margin-top: 26px; }
.pt-hub h2 { font-size: 20px; margin: 0 0 12px; }
.pt-hub-sec { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 8px; }
.pt-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.doc a.pt-tool, a.pt-tool { color: var(--text); font-weight: 400; text-decoration: none; }
.pt-tool { display: block; border: 1px solid var(--line); border-radius: 14px; padding: 14px 13px; background: var(--card); transition: border-color .15s, transform .15s, box-shadow .15s; }
.pt-tool:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow); }
.pt-tool i { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-style: normal; font-weight: 900; color: #fff; margin-bottom: 9px; }
.pt-tool b { display: block; font-size: 14px; margin-bottom: 3px; }
.pt-tool span { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }
.pt-tool.pt-here { border-color: var(--gold); background: var(--gold-soft); }

/* ---------- editor (pe-) ---------- */
.pe { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--card); position: relative; }
.pe-top { display: flex; align-items: center; gap: 6px; background: #1f1d1a; padding: 0 10px; min-height: 50px; flex-wrap: wrap; }
.pe-tabs { display: flex; gap: 2px; }
.pe-tabs button { border: 0; background: none; color: #cfc8bd; font: inherit; font-weight: 700; font-size: 14px; padding: 14px 14px 11px; border-bottom: 3px solid transparent; cursor: pointer; }
.pe-tabs button.pe-on { color: #fff; border-color: var(--gold); }
.pe-name { color: #fff; font-size: 13.5px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 8px; opacity: .85; }
.pe-ib { border: 1px solid #3a3631; background: #2a2724; color: #fff; border-radius: 8px; min-width: 34px; height: 34px; font: inherit; font-weight: 700; cursor: pointer; }
.pe-ib:disabled { opacity: .35; cursor: default; }
.pe-findbox .pe-ib { background: var(--card); color: var(--text); border-color: var(--line); }
.pe-zoom { color: #fff; font-size: 13px; font-weight: 700; min-width: 46px; text-align: center; }
.pe-save { margin-left: 6px; }
.pe-rib { display: flex; align-items: center; gap: 3px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; position: relative; z-index: 4; }
.pe-tool { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid transparent; background: none; border-radius: 9px; padding: 5px 8px; font: inherit; font-size: 11.5px; font-weight: 700; color: var(--text); cursor: pointer; min-width: 58px; }
.pe-tool i { font-style: normal; font-size: 17px; line-height: 1.1; height: 20px; }
.pe-tool:hover { background: var(--soft); }
.pe-tool.pe-on { background: #fff7e6; border-color: var(--gold); }
.pe-sep { width: 1px; height: 34px; background: var(--line); margin: 0 5px; }
.pe-body { display: grid; grid-template-columns: 104px minmax(0, 1fr) 270px; height: min(78vh, 900px); min-height: 520px; background: #e9e6e0; }
.pe-thumbs { overflow: auto; background: #f4f1ec; border-right: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.pe-thumbs button { border: 0; background: none; padding: 0; cursor: pointer; text-align: center; }
.pe-thumbs canvas { display: block; width: 100%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.pe-thumbs small { font-size: 11px; color: var(--muted); font-weight: 700; }
.pe-view { overflow: auto; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 18px; outline: none; }
.pe-page { position: relative; background: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, .2); flex: none; touch-action: pan-x pan-y pinch-zoom; }
.pe-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pe-lines, .pe-layer { position: absolute; inset: 0; }
/* the layer of added things only takes clicks on those things: empty spots reach the text lines below (Edit text, hover) */
.pe-layer { pointer-events: none; }
.pe-layer > * { pointer-events: auto; }
.pe-pno { position: absolute; right: -2px; bottom: -20px; font-size: 11px; color: var(--muted); font-weight: 700; }
.pe-view[data-tool="text"] .pe-page, .pe-view[data-tool="note"] .pe-page, .pe-view[data-tool="stamp"] .pe-page { cursor: copy; }
.pe-view[data-tool="rect"] .pe-page, .pe-view[data-tool="ellipse"] .pe-page, .pe-view[data-tool="line"] .pe-page, .pe-view[data-tool="arrow"] .pe-page, .pe-view[data-tool="white"] .pe-page, .pe-view[data-tool="redact"] .pe-page, .pe-view[data-tool="link"] .pe-page, .pe-view[data-tool="highlight"] .pe-page, .pe-view[data-tool="underline"] .pe-page, .pe-view[data-tool="strike"] .pe-page { cursor: crosshair; }
.pe-view[data-tool="draw"] .pe-page { cursor: crosshair; touch-action: none; }
.pe-view:not([data-tool="select"]):not([data-tool="edit"]) .pe-page { touch-action: none; }
.pe-line { position: absolute; border: 1px dashed rgba(37, 99, 235, .55); background: rgba(37, 99, 235, .05); border-radius: 3px; cursor: text; }
.pe-line:hover { background: rgba(37, 99, 235, .14); border-style: solid; }
/* touch-action none: a finger on an item moves the item, not the page (the page scrolled and the move was lost) */
.pe-it { position: absolute; box-sizing: border-box; touch-action: none; }
.pe-it.pe-sel { outline: 2px dashed #2563eb; outline-offset: 2px; z-index: 3; }
.pe-h { position: absolute; width: 12px; height: 12px; background: #2563eb; border: 2px solid #fff; border-radius: 3px; right: -8px; bottom: -8px; cursor: nwse-resize; display: none; z-index: 2; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.pe-ln .pe-h { right: auto; bottom: auto; cursor: move; border-radius: 50%; }
.pe-it.pe-sel .pe-h { display: block; }
.pe-x { position: absolute; top: -12px; right: -12px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #dc2626; color: #fff; font-size: 14px; line-height: 1; cursor: pointer; display: none; z-index: 2; padding: 0; }
.pe-it.pe-sel .pe-x { display: block; }
/* fingers: a bigger, unseen grip around small text and the corner handle (what shows stays the same) */
@media (hover: none) {
  .pe-txt::before { content: ""; position: absolute; inset: -10px -8px; }
  .pe-h::before { content: ""; position: absolute; inset: -12px; }
  .pe-x { width: 28px; height: 28px; top: -16px; right: -16px; font-size: 16px; }
}
.pe-nudge { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 38px); gap: 4px; margin-top: 6px; }
.pe-nudge button { border: 1px solid #d8d2c8; background: #fff; border-radius: 9px; font-size: 18px; font-weight: 800; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; color: #1f1d1a; }
.pe-nudge button:active { background: #fff3d6; border-color: var(--gold); }
.pe-nudge [data-nudge="0,-1"] { grid-column: 2; grid-row: 1; }
.pe-nudge [data-nudge="-1,0"] { grid-column: 1; grid-row: 2; }
.pe-nudge [data-nudge="0,1"] { grid-column: 2; grid-row: 2; }
.pe-nudge [data-nudge="1,0"] { grid-column: 3; grid-row: 2; }
/* max-content: the dashed box always holds all the words (near the right edge it was squeezed and the words ran out of it) */
.pe-txt { white-space: pre; line-height: 1.2; cursor: move; min-width: 6px; width: max-content; }
.pe-tx { position: relative; z-index: 1; outline: none; min-width: 4px; min-height: 1em; width: max-content; }
.pe-tx[contenteditable="true"] { cursor: text; background: transparent; outline: 1px dashed rgba(37, 99, 235, .7); outline-offset: 2px; }
.pe-cover { position: absolute; z-index: 0; }
.pe-img img { width: 100%; height: 100%; display: block; pointer-events: none; }
.pe-img, .pe-shape, .pe-white, .pe-redact, .pe-stamp, .pe-link, .pe-note { cursor: move; }
.pe-shape svg, .pe-ln svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pe-redact { background: repeating-linear-gradient(45deg, #111 0 8px, #2b2b2b 8px 16px); outline: 1px solid #dc2626; }
.pe-mark i { position: absolute; }
.pe-highlight i { background: var(--mc); mix-blend-mode: multiply; opacity: .85; }
.pe-underline i { border-bottom: 2px solid var(--mc); }
.pe-strike i::after { content: ""; position: absolute; left: 0; right: 0; top: 55%; border-top: 2px solid var(--mc); }
.pe-note { font-size: 15px; line-height: 20px; text-align: center; background: var(--mc); border-radius: 4px 4px 4px 0; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.pe-link { border: 1.5px dashed #2563eb; background: rgba(37, 99, 235, .08); }
.pe-link span { position: absolute; left: 0; top: -18px; font-size: 11px; color: #1d4ed8; white-space: nowrap; font-weight: 700; background: #fff; padding: 0 4px; border-radius: 4px; }
.pe-stamp { display: flex; align-items: center; justify-content: center; border-style: solid; border-radius: 6px; font-family: Helvetica, Arial, sans-serif; font-weight: 800; letter-spacing: .03em; opacity: .9; white-space: nowrap; }
.pe-drag { position: absolute; border: 1.5px dashed #2563eb; background: rgba(37, 99, 235, .08); pointer-events: none; }
.pe-drag-redact { background: rgba(0, 0, 0, .55); }
.pe-drag-highlight { background: rgba(253, 224, 71, .45); border-color: #eab308; }
.pe-drag-line, .pe-drag-arrow, .pe-drag-draw { border: 0; background: none; }
.pe-side { overflow: auto; background: var(--card); border-left: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; }
.pe-side h2 { font-size: 16px; margin: 0; }
.pe-side h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.pe-colors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pe-colors button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #c9c0b2; cursor: pointer; padding: 0; }
.pe-colors button[data-v=""] { background: linear-gradient(135deg, #fff 45%, #dc2626 45% 55%, #fff 55%) !important; }
.pe-colors button.pe-on { box-shadow: 0 0 0 2px var(--gold); }
.pe-colors input[type=color] { width: 32px; height: 28px; }
.pe-styles { display: flex; gap: 4px; }
.pe-styles button { width: 36px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; font-size: 15px; color: var(--text); }
.pe-styles button.pe-on { background: var(--pt-ink); color: #fff; border-color: var(--pt-ink); }
.pe-stamps { display: flex; flex-wrap: wrap; gap: 5px; }
.pe-stamps button { border: 1.5px solid var(--line); background: var(--card); border-radius: 7px; padding: 5px 8px; font: inherit; font-size: 11.5px; font-weight: 800; cursor: pointer; color: var(--text); }
.pe-stamps button.pe-on { border-color: var(--gold); background: var(--gold-soft); }
.pe-list { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.pe-list button { display: flex; gap: 6px; align-items: center; border: 0; background: none; padding: 5px 6px; border-radius: 7px; font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; color: var(--text); }
.pe-list button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-list button small { color: var(--muted); }
.pe-list button:hover, .pe-list button.pe-on { background: var(--soft); }
.pe-find { position: absolute; right: 12px; top: 84px; z-index: 65; width: min(380px, calc(100% - 24px)); }
.pe-find .pe-fres { max-height: 150px; }
.pe-findbox { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .22); padding: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.pe-findbox input[type=text] { width: 100%; font: inherit; font-size: 15px; border: 1px solid #ddd6cb; border-radius: 10px; padding: 8px 10px; }
.pe-fres { max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.pe-fres button { border: 0; background: none; text-align: left; padding: 5px 6px; border-radius: 6px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text); }
.pe-fres button:hover { background: var(--soft); }
.pe-fres mark { background: #fde047; }
.pe-toast { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); background: #1f1d1a; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 600; z-index: 20; box-shadow: 0 10px 26px rgba(0, 0, 0, .3); max-width: min(560px, 92%); text-align: center; }
.pe-toast .pe-share { display: block; margin: 0 auto 8px; padding: 9px 18px; font-size: 15px; background: #22c55e; color: #fff; }
.pe-toast.pe-err { background: #b42318; }
.pe-toast.pe-warn { background: #b45309; }
.pe-toast button { border: 0; background: var(--gold); color: #1f1d1a; border-radius: 999px; padding: 3px 10px; margin: 3px 2px 0; font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.pe-sigbox { width: min(560px, 100%); }
.pe-pad { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1.5px dashed #cfc6b8; border-radius: 12px; background: #fff; margin-top: 10px; touch-action: none; display: block; }
.pe-sigtype { width: 100%; font: inherit; font-size: 16px; border: 1px solid #ddd6cb; border-radius: 10px; padding: 9px; margin-top: 8px; }
.pe-dock { display: none; }
@media (max-width: 1000px) {
  .pe-body { grid-template-columns: minmax(0, 1fr) 250px; }
  .pe-thumbs { display: none; }
}
@media (max-width: 720px) {
  /* one row on a phone: tabs can scroll sideways, undo/redo and zoom stay together on the right */
  .pe-top { padding: 0 4px; flex-wrap: nowrap; gap: 2px; }
  .pe-tabs { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .pe-tabs::-webkit-scrollbar { display: none; }
  .pe-tabs button { padding: 12px 7px 9px; font-size: 12.5px; white-space: nowrap; }
  .pe-top .pe-ib { flex: none; }
  .pe-zoom { min-width: 34px; font-size: 12px; }
  .pe-name { display: none; }
  .pe-save { display: none; }
  .pe-rib { display: none; position: absolute; left: 0; right: 0; top: 50px; box-shadow: 0 10px 20px rgba(0, 0, 0, .15); }
  .pe-rib.pe-open { display: flex; }
  .pe-body { grid-template-columns: 1fr; height: 72vh; }
  .pe-view { padding: 10px; }
  .pe-side { position: fixed; left: 0; right: 0; bottom: 62px; max-height: 46vh; z-index: 30; border: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .2); transform: translateY(110%); transition: transform .2s; }
  .pe-side.pe-open, .pe:has(.pe-it.pe-sel) .pe-side { transform: none; }
  .pe-dock { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--card); border-top: 1px solid var(--line); justify-content: space-around; padding: 4px 2px 8px; }
  .pe-dock .pe-tool { min-width: 0; padding: 4px 5px; font-size: 10.5px; }
  .pe-find { position: fixed; top: auto; bottom: 70px; right: 12px; }
}

/* phone */
.pt-sheetbtn { display: none; }
@media (max-width: 900px) {
  .pt-work { grid-template-columns: 1fr; }
  .pt-side { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .pt { padding-top: 14px; }
  .pt-drop { padding: 34px 14px; min-height: 220px; }
  .pt-drop b { font-size: 19px; }
  .pt-board { --card-w: 104px; gap: 16px 12px; padding: 12px; }
  .pt-tools { opacity: 1; }
  .pt-tools button { width: 24px; height: 24px; }
  .pt-bar { padding: 8px; gap: 6px; }
  .pt-size { display: none; }
  .pt-cmp { grid-template-columns: 1fr; }
  .pt-done { padding: 16px; }
  .pt-work.pt-has-sheet { padding-bottom: 76px; }
  .pt-work.pt-has-sheet .pt-side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40; border-radius: 18px 18px 0 0; max-height: 80vh; box-shadow: 0 -10px 30px rgba(0, 0, 0, .22); transform: translateY(calc(100% - 70px)); transition: transform .25s; padding-top: 10px; }
  .pt-work.pt-has-sheet .pt-side.pt-open { transform: none; }
  .pt-sheetbtn { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 4px 0 6px; font: inherit; cursor: pointer; color: var(--text); }
  .pt-sheetbtn::before { content: ""; position: absolute; left: calc(50% - 20px); top: 6px; width: 40px; height: 4px; border-radius: 2px; background: #ddd; }
  .pt-sheetbtn b { flex: 1; text-align: left; font-size: 15px; }
  .pt-sheetbtn .btn { padding: 10px 16px; font-size: 14px; }
}
