/* Sign PDF: signature pad, font picker, page canvases and draggable placements. */
.sg-pad-wrap { position: relative; border-radius: var(--r); background: #fff; border: 1px solid var(--line-strong); }
#sg-pad { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; border-radius: var(--r); }
.sg-pad-line { position: absolute; left: 6%; right: 6%; bottom: 28%; border-bottom: 1.5px dashed #b8bfcc; pointer-events: none; }
.sg-pad-hint { position: absolute; left: 0; right: 0; top: 38%; text-align: center; color: #7a8399; font-size: 0.95rem; pointer-events: none; }
.sg-fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.sg-font { min-height: 74px; padding: 8px 14px; border-radius: var(--r); border: 1px solid var(--line-strong); background: #fff; font-size: 2rem; line-height: 1.15; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.sg-font[aria-checked='true'] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.sg-font:focus-visible { outline: none; box-shadow: var(--ring); }
.sg-upload-preview { display: grid; place-items: center; min-height: 80px; padding: 10px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); }
.sg-current { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.sg-current img { max-height: 70px; max-width: min(320px, 100%); padding: 6px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.sg-pages { display: grid; gap: 18px; justify-items: center; padding: 6px 0; }
.sg-page { position: relative; width: 100%; max-width: 820px; background: #fff; border-radius: 4px; box-shadow: var(--shadow); cursor: copy; }
.sg-page canvas { display: block; width: 100%; height: 100%; border-radius: 4px; }
.sg-page.is-failed::after { content: 'This page could not be displayed'; position: absolute; inset: 0; display: grid; place-items: center; color: #7a8399; }
.sg-page-num { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(17, 26, 46, 0.6); color: #fff; font-size: 0.75rem; pointer-events: none; }
.sg-mark { position: absolute; outline: 1.5px dashed var(--accent); outline-offset: 2px; cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
.sg-mark img { display: block; width: 100%; height: 100%; pointer-events: none; }
.sg-mark:focus-visible, .sg-mark.is-active { outline-style: solid; outline-width: 2px; }
.sg-mark:focus { outline-style: solid; }
.sg-del { position: absolute; top: -14px; right: -14px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--err); color: #fff; cursor: pointer; }
.sg-del svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.sg-resize { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: nwse-resize; }
@media (pointer: coarse) {
  .sg-resize { width: 28px; height: 28px; right: -14px; bottom: -14px; }
  .sg-del { width: 34px; height: 34px; top: -17px; right: -17px; }
}
/* Grid children default to min-width:auto; let the pad and pages shrink to the panel. */
#sg-work > *, #sg-maker > *, #sg-draw-box > *, #sg-type-box > *, #sg-upload-box > * { min-width: 0; }
.sg-pad-wrap { overflow: hidden; }
#sg-pad { max-width: 100%; }
.tool-ui .btn { white-space: normal; }
