/* PDF Editor Pro - all rules are scoped to .pep-wrap / .pep-app so the theme can't break the tool */
.pep-wrap { --pep-accent: #2563eb; margin: 20px 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Devanagari", "Nirmala UI", Mangal, Arial, sans-serif; color: #1f2937; }
.pep-wrap *, .pep-wrap *::before, .pep-wrap *::after { box-sizing: border-box; }
.pep-hide { display: none !important; }

.pep-app { position: relative; display: flex; flex-direction: column; height: min(88vh, 940px); min-height: 560px; background: #eef0f4; border: 1px solid #d5d9e0; border-radius: 12px; overflow: hidden; font-size: 14px; line-height: 1.4; }
.pep-app.pep-full { position: fixed; inset: 0; z-index: 999999; height: 100%; border-radius: 0; border: 0; }
html.pep-nofs, html.pep-nofs body { overflow: hidden !important; }
.pep-app.pep-dz::after { content: ""; position: absolute; inset: 6px; border: 3px dashed var(--pep-accent); border-radius: 10px; background: rgba(37, 99, 235, .06); pointer-events: none; z-index: 50; }

/* buttons */
.pep-app button { font: inherit; cursor: pointer; }
.pep-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid #cdd2da; background: #fff; color: #1f2937; border-radius: 8px; font-size: 13px; font-weight: 500; line-height: 1.2; white-space: nowrap; transition: background .12s, border-color .12s; }
.pep-btn:hover { background: #f4f6fa; border-color: #b9c0cc; }
.pep-btn:focus-visible, .pep-tb:focus-visible, .pep-ib:focus-visible, .pep-tg:focus-visible { outline: 2px solid var(--pep-accent); outline-offset: 2px; }
.pep-btn.pri { background: var(--pep-accent); border-color: var(--pep-accent); color: #fff; }
.pep-btn.pri:hover { filter: brightness(.93); }
.pep-btn.dng { color: #b42318; border-color: #f0c4c0; }
.pep-btn.dng:hover { background: #fdf0ef; }
.pep-btn.sm { padding: 5px 9px; font-size: 12px; }
.pep-btn.ico { padding: 7px 8px; }
.pep-btn:disabled { opacity: .4; cursor: default; }
.pep-i { width: 18px; height: 18px; flex: none; }
.pep-ib { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; border-radius: 6px; color: #4b5563; }
.pep-ib:hover { background: #e5e8ee; color: #111; }
.pep-ib .pep-i { width: 15px; height: 15px; }
.pep-hi { font-size: .86em; font-weight: 400; opacity: .75; }

/* empty state */
.pep-drop { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; background: repeating-linear-gradient(135deg, #f5f6f9 0 14px, #eef0f4 14px 28px); }
.pep-dropbox { width: min(560px, 100%); background: #fff; border: 2px dashed #b9c4d8; border-radius: 16px; padding: 34px 28px; text-align: center; }
.pep-dropbox h2 { margin: 6px 0 6px; font-size: 24px; font-weight: 700; color: #111827; }
.pep-dropbox p { margin: 0 0 18px; color: #4b5563; }
.pep-dropicon .pep-i { width: 44px; height: 44px; color: var(--pep-accent); }
.pep-dropbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pep-dropbtns .pep-btn { padding: 11px 18px; font-size: 15px; }
.pep-dropbox p.pep-priv { margin: 18px 0 0; font-size: 12.5px; color: #667085; }

/* top bar + tools */
.pep-editor { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pep-top { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 10px; background: #fff; border-bottom: 1px solid #dde1e8; }
.pep-grp { display: flex; align-items: center; gap: 5px; }
.pep-grp.pep-right { margin-left: auto; }
.pep-zl { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; font-size: 13px; }
.pep-pgin { width: 54px; padding: 6px; border: 1px solid #cdd2da; border-radius: 8px; text-align: center; font: inherit; }
.pep-pt { color: #667085; font-size: 13px; }
.pep-tools { display: flex; gap: 2px; padding: 6px 8px; background: #fff; border-bottom: 1px solid #dde1e8; overflow-x: auto; scrollbar-width: thin; }
.pep-tb { flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 62px; padding: 6px 7px; border: 1px solid transparent; background: transparent; border-radius: 9px; color: #374151; font-size: 11.5px; line-height: 1.15; text-align: center; }
.pep-tb:hover { background: #f1f3f7; }
.pep-tb.on { background: color-mix(in srgb, var(--pep-accent) 12%, #fff); border-color: color-mix(in srgb, var(--pep-accent) 45%, #fff); color: var(--pep-accent); }
.pep-tb .pep-hi { display: block; font-size: 10.5px; }
.pep-hintbar { padding: 5px 12px; font-size: 12.5px; color: #475467; background: #f8f9fb; border-bottom: 1px solid #e3e6ec; min-height: 28px; }

/* three-column workspace */
.pep-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 156px minmax(0, 1fr) 250px; }
.pep-side { display: flex; flex-direction: column; min-height: 0; background: #fafbfc; border-right: 1px solid #dde1e8; }
.pep-sbar { padding: 8px 6px 6px; border-bottom: 1px solid #e3e6ec; }
.pep-sh { font-weight: 600; font-size: 12.5px; margin: 0 4px 6px; }
.pep-sbtns { display: flex; flex-wrap: wrap; gap: 1px; align-items: center; }
.pep-sbtns input[type=checkbox] { margin: 0 6px 0 4px; }
.pep-thumbs { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pep-th { position: relative; width: 120px; padding: 6px 6px 4px; border: 2px solid transparent; border-radius: 8px; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); cursor: pointer; text-align: center; flex: none; }
.pep-th.cur { border-color: var(--pep-accent); }
.pep-th.drag { opacity: .45; }
.pep-th.over { box-shadow: 0 -3px 0 var(--pep-accent); }
.pep-thchk { position: absolute; top: 8px; left: 8px; z-index: 2; margin: 0; }
.pep-thimg { margin: 0 auto; background: #f1f2f5; overflow: hidden; }
.pep-thimg img { width: 100%; height: 100%; display: block; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.pep-thn { font-size: 12px; color: #475467; margin: 3px 0 1px; }
.pep-tha { display: flex; justify-content: center; gap: 0; }
.pep-tha .pep-ib { width: 20px; height: 20px; }
.pep-tha .pep-ib .pep-i { width: 13px; height: 13px; }

.pep-view { position: relative; overflow: auto; background: #e3e6ec; padding: 14px 0 40px; }
.pep-pages { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: min-content; padding: 0 18px; }
.pep-page { margin: 0 auto 10px; }
.pep-pgbox { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(16, 24, 40, .22); }
.pep-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pep-svg { position: absolute; left: 0; top: 0; display: block; overflow: hidden; user-select: none; -webkit-user-select: none; }
.pep-view[data-tool="select"] .pep-svg { cursor: default; }
.pep-view:not([data-tool="select"]) .pep-svg { cursor: crosshair; touch-action: none; }
.pep-view[data-tool="text"] .pep-svg, .pep-view[data-tool="edit"] .pep-svg { cursor: text; }
.pep-svg g[data-oid] { cursor: move; }
.pep-view:not([data-tool="select"]) .pep-svg g[data-oid] { cursor: inherit; }
.pep-pglabel { text-align: center; font-size: 12px; color: #667085; margin-top: 5px; }

/* properties */
.pep-props { min-height: 0; overflow-y: auto; padding: 10px 12px 16px; background: #fff; border-left: 1px solid #dde1e8; }
.pep-ph { font-weight: 700; font-size: 13px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #eceff3; }
.pep-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 9px; font-size: 13px; }
.pep-row > span:first-child { flex: none; color: #374151; }
.pep-row input[type=number], .pep-row input[type=url], .pep-row select { width: 120px; max-width: 100%; padding: 5px 7px; border: 1px solid #cdd2da; border-radius: 7px; font: inherit; font-size: 13px; background: #fff; }
.pep-row input[type=url] { width: 140px; }
.pep-row input[type=color] { width: 44px; height: 28px; padding: 1px; border: 1px solid #cdd2da; border-radius: 7px; background: #fff; cursor: pointer; }
.pep-row input[type=range] { width: 120px; accent-color: var(--pep-accent); }
.pep-inl { display: inline-flex; align-items: center; gap: 8px; }
.pep-seg { display: inline-flex; gap: 3px; }
.pep-tg { min-width: 30px; height: 28px; padding: 0 7px; border: 1px solid #cdd2da; background: #fff; border-radius: 7px; font-weight: 700; color: #374151; }
.pep-tg.on { background: var(--pep-accent); border-color: var(--pep-accent); color: #fff; }
.pep-ta { width: 100%; margin: 0 0 10px; padding: 8px; border: 1px solid #cdd2da; border-radius: 8px; font: inherit; font-size: 14px; resize: vertical; min-height: 70px; }
.pep-hint, .pep-tip { color: #667085; font-size: 12.5px; margin: 6px 0; }
.pep-tip { margin-top: 14px; padding-top: 10px; border-top: 1px dashed #dde1e8; }
.pep-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eceff3; }

/* busy / toast / popover / dialog */
.pep-busy { position: absolute; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(255, 255, 255, .78); backdrop-filter: blur(2px); }
.pep-busytxt { font-weight: 600; }
.pep-spin { width: 36px; height: 36px; border: 4px solid #d5d9e0; border-top-color: var(--pep-accent); border-radius: 50%; animation: pepspin .8s linear infinite; }
@keyframes pepspin { to { transform: rotate(360deg); } }
.pep-toast { position: absolute; left: 50%; bottom: 18px; transform: translate(-50%, 20px); max-width: 90%; padding: 10px 16px; background: #1f2937; color: #fff; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 120; }
.pep-toast.show { opacity: 1; transform: translate(-50%, 0); }
.pep-toast.bad { background: #b42318; }
.pep-pop { position: absolute; z-index: 80; min-width: 250px; padding: 6px; background: #fff; border: 1px solid #d5d9e0; border-radius: 10px; box-shadow: 0 10px 30px rgba(16, 24, 40, .18); }
.pep-pi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 7px; text-align: left; color: #1f2937; font-size: 13.5px; }
.pep-pi:hover { background: #f1f3f7; }
.pep-modal { position: absolute; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(16, 24, 40, .5); }
.pep-dlg { width: min(460px, 100%); max-height: 100%; display: flex; flex-direction: column; background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); overflow: hidden; }
.pep-dlg.wide { width: min(660px, 100%); }
.pep-dh { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #eceff3; font-size: 16px; }
.pep-db { padding: 16px; overflow: auto; }
.pep-df { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid #eceff3; background: #fafbfc; }
.pep-frow { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; font-size: 13px; font-weight: 600; color: #344054; }
.pep-frow input[type=text], .pep-frow input[type=number], .pep-frow input[type=url], .pep-frow select, .pep-frow input[type=file] { width: 100%; padding: 8px 10px; border: 1px solid #cdd2da; border-radius: 8px; font: inherit; font-weight: 400; font-size: 14px; background: #fff; }
.pep-frow input[type=color] { width: 60px; height: 34px; padding: 2px; border: 1px solid #cdd2da; border-radius: 8px; }
.pep-frow input[type=range] { width: 100%; accent-color: var(--pep-accent); }
.pep-frow.chk { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
.pep-frow.chk input { margin-top: 4px; }
.pep-frow.chk small, .pep-note { color: #667085; font-weight: 400; font-size: 12.5px; }
.pep-note { margin: 0 0 12px; }
.pep-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.pep-formlist { max-height: 46vh; overflow: auto; padding-right: 4px; }
.pep-sigpad { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; background: repeating-linear-gradient(0deg, #fff 0 38px, #f1f3f7 38px 39px); border: 1px solid #cdd2da; border-radius: 10px; touch-action: none; cursor: crosshair; }
.pep-sigbar { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.pep-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid #e3e6ec; }
.pep-tab { padding: 8px 14px; border: 0; background: transparent; border-bottom: 2px solid transparent; color: #475467; font-weight: 600; }
.pep-tab.on { color: var(--pep-accent); border-bottom-color: var(--pep-accent); }
.pep-savedsig { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; margin-bottom: 14px; background: #f8f9fb; border: 1px solid #e3e6ec; border-radius: 10px; }
.pep-savedsig img { max-height: 54px; max-width: 200px; background: #fff; border-radius: 6px; padding: 4px; }
.pep-done p { margin: 0 0 8px; }
.pep-donead { margin-top: 12px; text-align: center; min-height: 0; }

/* AdSense areas */
.pep-ad { margin: 12px auto; text-align: center; overflow: hidden; max-width: 100%; }
.pep-ad .pep-adlabel { display: block; font-size: 10px; color: #98a2b3; margin-bottom: 2px; letter-spacing: .04em; }
.pep-ad-src { margin: 8px 4px; text-align: center; overflow: hidden; }
.pep-side .pep-ad-src { flex: none; width: 100%; padding: 4px; border-top: 1px solid #e3e6ec; background: #fff; max-height: 270px; }

.pep-login-note { padding: 22px; border: 1px dashed #b9c4d8; border-radius: 12px; background: #f8f9fb; text-align: center; }
.pep-nojs { padding: 16px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; }

/* small screens: strip of pages on top, properties below */
@media (max-width: 900px) {
  .pep-app { height: auto; min-height: 0; max-height: none; }
  .pep-app.pep-full { height: 100%; }
  .pep-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(360px, 70vh) auto; }
  .pep-side { flex-direction: row; align-items: stretch; border-right: 0; border-bottom: 1px solid #dde1e8; max-height: 168px; }
  .pep-sbar { flex: none; width: 118px; border-bottom: 0; border-right: 1px solid #e3e6ec; }
  .pep-thumbs { flex-direction: row; overflow-x: auto; overflow-y: hidden; align-items: flex-start; padding: 8px; }
  .pep-side .pep-ad-src { display: none; }
  .pep-props { border-left: 0; border-top: 1px solid #dde1e8; max-height: 230px; }
  .pep-bl { display: none; }
  .pep-grp.pep-right { margin-left: 0; }
  .pep-grid3 { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .pep-spin { animation-duration: 2s; } .pep-toast { transition: none; } }
