.viewer-tools{display:flex;align-items:center;gap:5px;flex:none;padding:0 0 5px;color:#164457;font-size:12px}.viewer-tools button{padding:5px 10px;min-height:28px}.viewer-tools #save-pdf{margin-left:auto}.viewer-tools span{min-width:42px;text-align:center}
.index-viewer .page-surface{display:block;position:relative;overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y;background:#e4ebef}.page-space{position:relative;min-width:100%;min-height:100%}.page-canvas{position:absolute;left:50%;top:50%;transform-origin:center;background:white;box-shadow:0 1px 6px #102c3626}.index-viewer .page-canvas>#page{display:block;width:100%;height:100%;max-width:none;max-height:none;object-fit:fill;transform:none!important}.annotation-layer{position:absolute;inset:0;pointer-events:none}.stamp-overlay{position:absolute;pointer-events:none;box-sizing:border-box}.index-viewer .stamp-overlay img{width:100%;height:100%;object-fit:fill;pointer-events:none;display:block}.transform-stamps .stamp-overlay{pointer-events:auto;cursor:move;outline:1px dashed #00848f}.stamp-resize{display:none;position:absolute;right:-5px;bottom:-5px;width:10px;height:10px;background:#00848f;border:1px solid white;cursor:nwse-resize}.transform-stamps .stamp-resize{display:block;pointer-events:auto}.stamp-overlay.selected{outline:1px solid #00848f}.page-canvas.placing-stamp,.page-canvas.placing-stamp #page{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M12 19V13c-5-6-2-12 4-12s9 6 4 12v6M7 19h18v7H7zM5 29h22' fill='white' stroke='%2300848f' stroke-width='2'/%3E%3C/svg%3E") 16 16,crosshair}

.page-surface.legacy{display:grid;place-items:center;overflow:hidden}.page-surface.legacy .page-space{width:100%;height:100%}.page-surface.legacy .page-canvas{position:relative;left:0;top:0;width:100%;height:100%;transform:none;background:transparent;box-shadow:none}.index-viewer .page-surface.legacy .page-canvas>#page{object-fit:contain}.page-surface.legacy .annotation-layer{display:none}

.stamp-ghost{position:absolute;pointer-events:none;opacity:.55;outline:1px dashed #00848f;z-index:3}.stamp-ghost[hidden]{display:none}.index-viewer .stamp-ghost img{display:block;width:100%;height:100%;object-fit:fill}.stamp-ghost::after{content:"+";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:#00848f;font-size:20px;font-weight:bold;line-height:1}

/* Touch controls remain local to the stamp editor; the page can still pan outside stamps. */
.stamp-edit-actions{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:6px 0}.stamp-edit-actions[hidden],.stamp-edit-actions button[hidden]{display:none!important}
.stamp-edit-actions button{min-height:44px;min-width:44px;padding:8px 14px;touch-action:manipulation}.stamp-edit-actions.active{border-top:2px solid #00848f}.stamp-edit-actions.active button{border-color:#00848f}.stamp-edit-actions.active button:nth-last-child(2){background:#00848f;color:white}
.transform-stamps .stamp-overlay{touch-action:none;user-select:none;-webkit-user-select:none;outline:1px dashed #00848f}.transform-stamps .stamp-overlay.selected{outline:2px solid #00848f;z-index:5}
.transform-stamps .stamp-resize{display:none}.transform-stamps .selected .stamp-resize{display:block;position:absolute;width:32px;height:32px;background:transparent;border:0;touch-action:none;z-index:7}
.stamp-resize::after{content:'';position:absolute;inset:8px;border:2px solid white;border-radius:4px;background:#00848f;box-shadow:0 0 0 1px #00848f}
.stamp-resize.nw{left:-16px;top:-16px;right:auto;bottom:auto;cursor:nwse-resize}.stamp-resize.ne{right:-16px;top:-16px;bottom:auto;cursor:nesw-resize}.stamp-resize.sw{left:-16px;bottom:-16px;right:auto;cursor:nesw-resize}.stamp-resize.se{right:-16px;bottom:-16px;cursor:nwse-resize}
.stamp-overlay .stamp-delete{position:absolute;right:0;top:-48px;width:44px;height:44px;min-height:44px;padding:0;border:2px solid white;border-radius:50%;background:#b42332;color:white;font:bold 28px/36px sans-serif;box-shadow:0 2px 6px #102c3650;pointer-events:auto;touch-action:manipulation;z-index:8;cursor:pointer}
@media(max-width:700px){.stamp-edit-actions{gap:4px}.stamp-edit-actions button{padding:8px 10px}#stamp-tools{flex-shrink:0}}

@media(pointer:coarse){.index-viewer .stamp-button{min-height:44px;min-width:44px;height:44px}.index-viewer #stamp-template{min-height:44px}}

@media(max-width:700px){.viewer-tools{flex-wrap:wrap;gap:4px}.viewer-tools #save-pdf{margin-left:0}}

.upload-selection{position:sticky;top:10px;z-index:15;padding:12px;margin:0 0 12px;border:1px solid #00848f;border-radius:10px;background:#e8f5f5;box-shadow:0 3px 10px #102c3620}.upload-selection[hidden]{display:none}.upload-selection #upload-status{margin:0 0 8px;max-height:96px;overflow:auto;overflow-wrap:anywhere}.upload-selection button{min-height:44px;margin:3px 3px 0 0}
