/* Edit PDF tool */
.ep-body { font-family: 'Inter', sans-serif; background: #eef1f5; }
.ep-desc { text-align: center; max-width: 820px; margin: 0 auto 20px; color: #555; font-size: 14px; }

/* start card */
.ep-start { max-width: 640px; margin: 10px auto 24px; text-align: center; }
.ep-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 46px 16px; border: 2px dashed #aab6c8; border-radius: 16px; background: #fff; color: #5b6678; cursor: pointer; transition: border-color .15s, background .15s; margin: 0; font-weight: 400; }
.ep-drop:hover, .ep-drop.over { border-color: #2563eb; background: #f3f7ff; }
.ep-drop i { font-size: 46px; color: #d23b3b; }
.ep-drop b { font-size: 18px; color: #1e3a8a; }
.ep-note { margin-top: 12px; font-size: 12.5px; color: #6b7686; }
.ep-msg { margin: 10px auto; max-width: 760px; padding: 10px 14px; border-radius: 10px; background: #fdecec; color: #a12a2a; border: 1px solid #f3c2c2; font-size: 14px; text-align: left; }
.ep-msg.ok { background: #e9f7ee; color: #1d6b3a; border-color: #bfe5cc; }

/* toolbar */
.ep-bar { position: sticky; top: 68px; z-index: 30; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 10px; background: #fff; border: 1px solid #dde3ec; border-radius: 12px; box-shadow: 0 6px 16px rgba(20, 30, 60, .08); }
.ep-group { display: flex; align-items: center; gap: 4px; }
.ep-group + .ep-group { padding-left: 14px; border-left: 1px solid #e3e8ef; }
.ep-end { margin-left: auto; }
.ep-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #26324a; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; font-family: inherit; }
.ep-btn:hover { background: #eef3fb; }
.ep-btn.active { background: #dbe8ff; border-color: #9db9ee; color: #0f3d91; }
.ep-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.ep-btn:focus-visible, .ep-f input:focus-visible, .ep-f select:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.ep-btn i { font-size: 15px; }
.ep-sq { width: 34px; padding: 0; justify-content: center; }
.ep-sq.active { background: #dbe8ff; }
.ep-primary { background: #1d4ed8; color: #fff; border-color: #1d4ed8; padding: 0 14px; }
.ep-primary:hover { background: #1e40af; }
.ep-primary:disabled { background: #1d4ed8; opacity: .6; }
.ep-f { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; font-size: 12.5px; color: #4a566e; }
.ep-f input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid #ccd3df; border-radius: 6px; background: #fff; cursor: pointer; }
.ep-f input[type=number], .ep-f select { height: 30px; border: 1px solid #ccd3df; border-radius: 6px; padding: 0 6px; font-size: 13px; background: #fff; width: 64px; font-family: inherit; }
.ep-f select { width: 96px; }
.ep-zoom { min-width: 46px; text-align: center; font-size: 13px; font-weight: 600; color: #26324a; }
.ep-bottom { display: flex; justify-content: center; padding: 0 0 22px; }
.ep-bottom .ep-btn { height: 42px; padding: 0 22px; font-size: 14px; }
.ep-hint { margin: 10px 2px 8px; font-size: 13px; color: #55617a; text-align: center; min-height: 18px; }

/* pages */
.ep-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 8px 0 26px; overflow-x: auto; }
.ep-page { max-width: none; }
.ep-phead { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 5px; font-size: 12.5px; color: #5d6980; font-weight: 600; }
.ep-pbtns { display: flex; gap: 2px; }
.ep-pbtns button { width: 28px; height: 26px; border: 1px solid #d6dce7; background: #fff; border-radius: 6px; color: #3b4863; cursor: pointer; font-size: 13px; padding: 0; }
.ep-pbtns button:hover { background: #eef3fb; }
.ep-pbtns button:disabled { opacity: .35; cursor: default; }
.ep-pbox { position: relative; background: #fff; box-shadow: 0 4px 18px rgba(20, 30, 60, .18); isolation: isolate; overflow: hidden; }
.ep-canvas { position: absolute; left: 0; top: 0; display: block; }
.ep-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; -webkit-user-select: none; }

.ep-pages.tool-text .ep-layer { cursor: text; }
.ep-pages.tool-draw .ep-layer, .ep-pages.tool-hl .ep-layer, .ep-pages.tool-white .ep-layer, .ep-pages.tool-rect .ep-layer { cursor: crosshair; touch-action: none; }
.ep-pages.tool-edittext .ep-layer { cursor: default; }

/* objects */
.ep-obj { position: absolute; touch-action: none; }
.ep-pages:not(.tool-select) .ep-obj { pointer-events: none; }
.ep-pages.tool-text .ep-text, .ep-pages.tool-edittext .ep-text { pointer-events: auto; }
.ep-text { touch-action: auto; }
.ep-text textarea { display: block; margin: 0; padding: 0; border: 0; outline: 0; background: transparent; resize: none; overflow: hidden; white-space: pre; line-height: 1.2; min-width: 12px; cursor: text; font-family: inherit; box-sizing: content-box; }
.ep-text textarea::placeholder { color: #9aa4b6; }
.ep-white { background: #fff; }
.ep-hl { opacity: .45; } /* the saved PDF uses a real multiply blend, so text stays dark under it */
.ep-rect { box-sizing: border-box; border-style: solid; }
.ep-image img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.ep-draw { left: 0; top: 0; pointer-events: none !important; overflow: visible; }
.ep-draw .hit { pointer-events: stroke; cursor: move; }
.ep-pages:not(.tool-select) .ep-draw .hit { pointer-events: none; }
.ep-obj.sel { outline: 1.5px dashed #2563eb; outline-offset: 1px; }
.ep-draw.sel { outline: 0; }
.ep-selbox { fill: none; stroke: #2563eb; stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.ep-obj:not(.sel) > .ep-h, .ep-obj:not(.sel) .ep-h { display: none; }
.ep-h { position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #2563eb; color: #fff; font-size: 11px; line-height: 20px; text-align: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); z-index: 5; touch-action: none; }
.ep-mv { left: -10px; top: -26px; cursor: move; }
.ep-x { right: -10px; top: -26px; cursor: pointer; background: #dc2626; }
.ep-rz { right: -10px; bottom: -10px; cursor: nwse-resize; border-radius: 4px; }
.ep-hots { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.ep-hot { position: absolute; border-radius: 2px; cursor: pointer; background: rgba(37, 99, 235, .08); outline: 1px solid rgba(37, 99, 235, .35); }
.ep-hot:hover { background: rgba(37, 99, 235, .22); outline-color: #2563eb; }
.ep-prev { position: absolute; pointer-events: none; }

/* modal */
.ep-modal { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ep-modal-card { background: #fff; border-radius: 14px; padding: 16px; width: 100%; max-width: 600px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.ep-modal-card h4 { margin: 0 0 10px; font-weight: 700; }
#epSignPad { width: 100%; height: auto; aspect-ratio: 560 / 220; border: 1px dashed #9aa7bd; border-radius: 10px; background: #fcfdff; touch-action: none; cursor: crosshair; display: block; }
.ep-modal-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ep-spacer { flex: 1; }

/* info */
.ep-info { max-width: 900px; margin: 10px auto 22px; background: #fff; border-radius: 14px; padding: 18px 22px; box-shadow: 0 4px 14px rgba(20, 30, 60, .07); }
.ep-info h3 { font-size: 18px; font-weight: 700; margin: 4px 0 10px; }
.ep-info h4 { font-size: 15px; font-weight: 700; margin: 14px 0 4px; }
.ep-info p, .ep-info li { font-size: 14px; line-height: 1.6; color: #3f4a60; }
.ep-info h3:not(:first-child) { margin-top: 22px; }
.ep-small { font-size: 13px !important; color: #5d6980 !important; }

@media (max-width: 768px) {
  .ep-bar { position: static; }
  .ep-group { flex-wrap: wrap; }
  .ep-btn { padding: 0 8px; }
  .ep-group + .ep-group { padding-left: 0; border-left: 0; }
  .ep-btn span { display: none; }
  .ep-btn.ep-primary span { display: inline; }
  .ep-info { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { .ep-drop { transition: none; } }
