#pdf-editor { --pe-ink:#172033; --pe-blue:#2459e0; --pe-border:#dce3ed; --pe-muted:#617089; color:var(--pe-ink); background:#f6f8fc; min-height:100dvh; }
#pdf-editor *, .pe-dialog * { box-sizing:border-box; }
#pdf-editor [hidden], .pe-dialog [hidden] { display:none!important; }
#pdf-editor[data-editing=true] { height:100dvh; display:flex; flex-direction:column; overflow:hidden; }
#pe-workbench { flex:1; min-height:0; display:flex; flex-direction:column; }
.pe-header, .pe-commandbar, .pe-tools, .pe-options { flex-shrink:0; }
.pe-header { display:flex; align-items:center; gap:16px; padding:15px 24px; border-bottom:1px solid var(--pe-border); background:white; }
.pe-back { padding:10px; border:1px solid var(--pe-border); border-radius:12px; }
.pe-title h1 { font-size:22px; font-weight:800; line-height:1.15; margin:3px 0 0; }
.pe-eyebrow { text-transform:uppercase; letter-spacing:.14em; color:#2459e0; font-size:10px; font-weight:800; }
.pe-count { font-size:12px; color:var(--pe-muted); }
.pe-header-actions { display:flex; gap:8px; margin-left:auto; }
.pe-button { display:inline-flex; justify-content:center; align-items:center; gap:8px; border:1px solid #dce3ed; background:#fff; padding:10px 15px; border-radius:10px; font-size:13px; font-weight:650; cursor:pointer; color:#26354c; min-height:42px; }
.pe-button:hover, .pe-icon:hover { background:#eef3fc; }
.pe-primary { background:#2459e0; color:white; border-color:#2459e0; box-shadow:0 4px 10px #2459e01a; }
.pe-primary:hover { background:#1746c1; }
.pe-button:disabled, .pe-icon:disabled { opacity:.4; cursor:not-allowed; }
.pe-button svg, .pe-back svg, .pe-icon svg { width:18px; height:18px; flex-shrink:0; }
.pe-welcome { text-align:center; max-width:760px; margin:48px auto; padding:46px 28px; border:1px dashed #b7c8e7; border-radius:28px; background:radial-gradient(ellipse at top,#eaf1ff,transparent 65%),white; }
.pe-welcome.is-dragging { outline:3px solid #2459e0; background:#edf3ff; }
.pe-upload-illustration { width:80px; height:80px; display:grid; place-items:center; margin:0 auto 20px; background:white; border:1px solid #d2dffc; border-radius:22px; box-shadow:0 14px 28px #2459e014; transform:rotate(-5deg); }
.pe-upload-illustration svg { width:42px; height:42px; color:#2459e0; }
.pe-welcome h2 { font-size:clamp(30px,4vw,46px); line-height:1.1; font-weight:850; letter-spacing:-.04em; margin:12px 0 16px; }
.pe-welcome > p:not(.pe-eyebrow) { color:#617089; max-width:560px; margin:14px auto; line-height:1.7; }
.pe-upload-button { margin-top:14px; padding:14px 26px; font-size:16px; }
.pe-welcome-features { display:flex; flex-wrap:wrap; gap:24px; justify-content:center; margin:30px 0; font-size:13px; }
.pe-welcome-features span { display:flex; gap:6px; align-items:center; }
.pe-welcome-features svg { width:17px; height:17px; }
.pe-privacy, .pe-muted { font-size:12px; color:#617089; line-height:1.6; }
#pe-notice { padding:12px 24px; background:#eaf1ff; font-size:13px; }
#pe-notice[data-error="true"], #pe-export-error { color:#ad2342; background:#fff0f3; padding:12px; border-radius:8px; }
.pe-commandbar { display:flex; align-items:center; gap:8px; padding:8px 20px; background:white; border-bottom:1px solid var(--pe-border); }
.pe-icon { display:inline-flex; justify-content:center; align-items:center; min-width:36px; height:36px; padding:8px; border-radius:8px; background:transparent; border:0; cursor:pointer; }
.pe-zoom { min-width:52px; font-size:12px; font-weight:700; }
.pe-search { display:flex; align-items:center; gap:8px; flex:1; margin:0 16px; }
.pe-search svg { width:17px; color:#8492a8; }
.pe-search input { width:100%; max-width:360px; padding:7px; background:transparent; font-size:13px; border:none; }
.pe-layout { display:grid; position:relative; grid-template-columns:174px minmax(0,1fr); flex:1; min-height:0; }
.pe-pages { overflow:auto; overscroll-behavior:contain; background:#fff; border-right:1px solid var(--pe-border); padding:14px; }
.pe-panel-title { font-size:13px; font-weight:750; display:flex; justify-content:space-between; align-items:center; }
#pe-pages-close, #pe-pages-toggle { display:none; }
.pe-page-help { margin:8px 0 14px; font-size:11px; }
.pe-thumb { border:2px solid transparent; border-radius:9px; padding:6px; margin-bottom:12px; background:#f2f5fa; }
.pe-thumb.active { border-color:#2459e0; background:#eaf1ff; }
.pe-thumb-main { display:block; width:100%; text-align:left; font-size:11px; }
.pe-thumb img { width:100%; height:140px; object-fit:contain; margin-bottom:6px; }
.pe-thumb small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#617089; }
.pe-thumb-actions { display:flex; justify-content:space-between; margin-top:3px; }
.pe-thumb-actions .pe-icon { min-width:32px; height:30px; }
.pe-thumb-actions svg { width:14px; height:14px; }
.pe-center { min-width:0; display:flex; flex-direction:column; overflow:hidden; }
.pe-options { background:linear-gradient(110deg,#f9fbff,#fff); padding:12px 22px; border-bottom:1px solid var(--pe-border); display:flex; align-items:center; gap:16px; overflow-x:auto; overscroll-behavior:contain; }
.pe-options > * { flex-shrink:0; }
.pe-options label { display:flex; flex-direction:column; gap:5px; font-size:11px; font-weight:650; color:#617089; }
.pe-options input:not([type=color]) { width:60px; height:36px; padding:6px 9px; border:1px solid #dce3ed; border-radius:8px; font-size:15px; background:white; }
.pe-options input[type=color] { width:42px; height:36px; padding:3px; background:white; border:1px solid #dce3ed; border-radius:9px; cursor:pointer; }
.pe-options select { width:140px; height:36px; font-size:14px; border:1px solid #dce3ed; border-radius:8px; padding:5px 9px; background:white; }
.pe-options .pe-button { font-size:12px; min-height:38px; white-space:nowrap; }
.pe-property-context { width:132px; padding-right:12px; border-right:1px solid #dce3ed; }
.pe-property-context strong { display:block; font-size:13px; margin-top:5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pe-swatches { display:grid; grid-template-columns:repeat(3,18px); gap:6px; }
.pe-swatches button { width:18px; height:18px; background:var(--swatch); border-radius:50%; border:2px solid white; outline:1px solid #dce3ed; }
.pe-swatches button:hover { transform:scale(1.15); }
.pe-type-style { display:flex; gap:2px; align-self:flex-end; background:white; border:1px solid #dce3ed; border-radius:9px; }
.pe-type-style [aria-pressed=true] { background:#e8efff; color:#2459e0; }
.pe-options :disabled { opacity:.35; cursor:not-allowed; }
.pe-hint { background:#f6f8fc; padding:8px 14px; font-size:11px; color:#617089; min-height:33px; }
.pe-viewport { flex:1; min-height:0; padding:28px; overflow:auto; overscroll-behavior:contain; touch-action:none; cursor:var(--pe-cursor,grab); background:radial-gradient(#cbd5e166 .7px,transparent .7px) 0 0/12px 12px,linear-gradient(145deg,#eef2f8,#e6edf7); }
.pe-page-shell { position:relative; margin:0 auto; background:white; box-shadow:0 5px 25px #23324720; flex-shrink:0; }
#pe-page-image { display:block; width:100%; height:100%; user-select:none; }
#pe-overlay, #pe-fields { position:absolute; inset:0; width:100%; height:100%; }
#pe-overlay { touch-action:none; outline:none; pointer-events:none; z-index:3; overflow:visible; }
#pe-overlay:focus-visible { outline:2px solid #2459e0; }
#pe-fields { pointer-events:none; z-index:4; }
#pe-text-masks { position:absolute; inset:0; pointer-events:none; z-index:1; }
#pe-text-masks > div { position:absolute; background:white; }
#pe-text-layer { position:absolute; inset:0; pointer-events:none; user-select:none; z-index:2; }
#pe-text-layer span { position:absolute; display:block; color:transparent; white-space:pre; font-family:sans-serif; line-height:1; transform-origin:top left; }
#pdf-editor:is([data-tool=highlight],[data-tool=text_highlight],[data-tool=select_text]) #pe-text-layer { pointer-events:auto; user-select:text; -webkit-user-select:text; cursor:text; }
#pe-text-layer ::selection { color:transparent; background:#3b82f64d; }
.pe-viewport.is-dragging, .pe-viewport.is-dragging * { cursor:grabbing!important; }
#pe-inline-box { position:absolute; z-index:6; border:1.5px solid #2459e0; outline:3px solid #2459e014; background:white; box-shadow:0 6px 20px #17203312; }
#pe-inline-text { display:block; resize:none; padding:0; margin:0; width:100%; height:100%; border:0; border-radius:0; outline:0; background:transparent; line-height:1.15; overflow:hidden; white-space:pre-wrap; overflow-wrap:anywhere; cursor:text; }
.pe-inline-actions { position:absolute; bottom:calc(100% + 7px); right:0; display:flex; gap:3px; align-items:center; padding:4px; background:#fff; border:1px solid #dce3ed; border-radius:8px; box-shadow:0 5px 18px #1720331a; white-space:nowrap; }
.pe-inline-actions span { font:600 10px sans-serif; color:#617089; padding:0 6px; }
.pe-inline-actions button { width:28px; height:28px; display:grid; place-items:center; border-radius:5px; color:#2459e0; }
.pe-inline-actions button:hover { background:#eaf1ff; }
.pe-inline-actions svg { width:16px; height:16px; }
.pe-field { position:absolute; pointer-events:auto; background:#2459e012; border:1px solid #2459e080; border-radius:2px; padding:0 2px; min-width:0; color:#152441; }
.pe-field:focus { background:#fff; outline:2px solid #2459e0; }
.pe-field-passive { pointer-events:none; border-color:transparent; background:transparent; opacity:1; -webkit-text-fill-color:#152441; }
.pe-field[type=checkbox], .pe-field[type=radio] { accent-color:#2459e0; padding:0; }
.pe-statusbar { display:flex; justify-content:space-between; gap:10px; background:white; padding:8px 14px; font-size:10px; color:#617089; }
.pe-tools { display:flex; align-items:stretch; gap:3px; background:white; border-bottom:1px solid var(--pe-border); padding:9px 18px; overflow-x:auto; overscroll-behavior:contain; scrollbar-width:thin; }
.pe-tool { flex:1 0 50px; max-width:76px; display:flex; flex-direction:column; gap:6px; align-items:center; justify-content:center; padding:8px 5px; border-radius:10px; text-align:center; font-size:10px; line-height:1.15; font-weight:650; color:#475569; min-height:58px; }
.pe-tool:hover { background:#f1f5fc; }
.pe-tool[aria-pressed=true] { background:#eaf1ff; color:#2459e0; }
.pe-tool svg { width:20px; height:20px; flex-shrink:0; }
.pe-tool-tip { position:fixed; z-index:100; width:270px; overflow:hidden; border:1px solid #d9e2f1; border-radius:16px; background:#fff; box-shadow:0 15px 45px #10214930; pointer-events:none; }
.pe-tool-tip[hidden] { display:none; }
.pe-tool-tip canvas { display:block; width:100%; height:135px; background:#edf2fa; }
.pe-tool-tip > div { padding:14px 16px 16px; }
.pe-tool-tip strong { font-size:14px; color:#172033; }
.pe-tool-tip p { font-size:12px; color:#617089; line-height:1.6; margin-top:6px; }
.pe-dialog.pe-stamp-dialog { width:min(620px,calc(100vw - 24px)); }
.pe-stamp-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:18px 0; }
.pe-stamp-card { position:relative; border:1px solid #dce3ed; border-radius:14px; background:linear-gradient(145deg,#fafcff,#f0f4fa); padding:22px 16px; min-width:0; }
.pe-stamp-card:hover { border-color:#2459e0; background:#eef3ff; }
.pe-stamp-card > button:first-child { width:100%; display:block; }
.pe-stamp-card > button:first-child > svg, .pe-stamp-card img { display:block; width:100%; height:64px; object-fit:contain; }
.pe-stamp-card small { display:block; font-size:11px; color:#617089; margin-top:14px; text-align:center; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pe-stamp-remove { position:absolute; right:5px; top:5px; color:#b53951; background:#fff; }
.pe-library-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:26px; padding-top:22px; border-top:1px solid #e4eaf3; }
.pe-library-heading h3 { font-weight:750; }
#pe-stamp-error { color:#ad2342; background:#fff0f3; padding:12px; border-radius:8px; }
.pe-dialog { border:1px solid #dce3ed; padding:26px; border-radius:22px; width:min(520px,calc(100vw - 24px)); max-height:calc(100dvh - 32px); overflow:auto; background:white; color:#172033; box-shadow:0 30px 100px #10214940; }
.pe-dialog::backdrop { background:#111c3666; backdrop-filter:blur(4px); }
.pe-dialog-heading { display:flex; justify-content:space-between; gap:15px; margin-bottom:20px; align-items:start; }
.pe-dialog h2 { font-weight:800; font-size:23px; margin:5px 0; }
.pe-dialog input:not([type=checkbox]):not([type=radio]), .pe-dialog textarea, .pe-dialog select { border:1px solid #ccd6e6; padding:11px; border-radius:9px; width:100%; font-size:16px; margin-bottom:12px; }
.pe-dialog textarea { resize:vertical; }
.pe-choice { display:flex; gap:12px; padding:13px 0; align-items:start; cursor:pointer; }
.pe-choice input { margin-top:4px; accent-color:#2459e0; width:17px; height:17px; flex-shrink:0; }
.pe-choice strong { display:block; font-size:14px; }
.pe-choice small { display:block; color:#617089; font-size:12px; margin-top:4px; line-height:1.5; }
.pe-choice:has(input:disabled) { opacity:.4; }
.pe-dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:20px; }
.pe-block-label { display:block; font-size:13px; font-weight:650; margin:14px 0 8px; }
#signature-modal > div { max-height:calc(100dvh - 24px); overflow:auto; }
#signature-canvas { touch-action:none; }
@media(max-width:1050px) { .pe-layout { grid-template-columns:146px minmax(0,1fr); } .pe-tool { flex-basis:62px; } .pe-options { gap:12px; } .pe-property-context { width:108px; } }
@media(max-width:700px) {
    .pe-header { padding:10px; gap:8px; } .pe-title h1 { font-size:17px; } .pe-title .pe-eyebrow { font-size:8px; } .pe-back { padding:7px; } .pe-count { display:none; }
    .pe-header-actions { gap:4px; } .pe-header-actions .pe-button { padding:9px; } .pe-header-actions .pe-button span { display:none; }
    .pe-welcome { margin:20px 12px; padding:32px 18px; } .pe-welcome-features { gap:12px; font-size:11px; }
    .pe-commandbar { padding:6px; gap:2px; } .pe-search { margin:0 4px; min-width:0; } .pe-search input { min-width:0; font-size:16px; }
    .pe-layout { grid-template-columns:minmax(0,1fr); }
    .pe-pages { display:none; position:absolute; inset:0 auto 0 0; width:190px; z-index:30; box-shadow:20px 0 40px #17203322; }
    .pe-pages.open { display:block; } #pe-pages-close, #pe-pages-toggle { display:inline-flex; }
    .pe-options { padding:8px 12px; gap:12px; } .pe-options input:not([type=color]), .pe-options select { font-size:16px; }
    .pe-property-context { display:none; } .pe-tools { padding:5px 8px; } .pe-tool { flex-basis:58px; min-height:54px; }
    .pe-viewport { padding:12px; } .pe-hint { font-size:10px; padding:6px 9px; min-height:38px; }
    .pe-statusbar { font-size:9px; padding:6px; } .pe-dialog { padding:20px; }
    #signature-name, #signature-initials { font-size:16px; }
}
@media(prefers-reduced-motion:no-preference) { .pe-welcome { animation:pe-enter .45s ease-out both; } @keyframes pe-enter { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } } }
