/* ToolTapGo PDF Editor - isolated scene-workspace styles */
.ttg-pe {
  --pe-bg: #eef2f4;
  --pe-panel: #ffffff;
  --pe-panel-soft: #f7f9fa;
  --pe-ink: #17332f;
  --pe-muted: #60736f;
  --pe-line: #d8e1e1;
  --pe-line-strong: #b9c9c7;
  --pe-brand: #ed6848;
  --pe-brand-soft: #fff0eb;
  --pe-teal: #11675f;
  --pe-teal-soft: #e5f5f2;
  --pe-danger: #bf3d35;
  --pe-shadow: 0 14px 42px rgba(17, 47, 43, .14);
  --pe-toolbar-h: 68px;
  color: var(--pe-ink);
  font-family: Manrope, Arial, sans-serif;
}

body.ttg-pdf-editor-active {
  overflow: hidden;
}

body.ttg-pdf-editor-active .ttg-pe-intro,
body.ttg-pdf-editor-active .ttg-pe-content-copy,
body.ttg-pdf-editor-active .ttg-pe-site-footer,
body.ttg-pdf-editor-active .ttg-pe-private-note,
body.ttg-pdf-editor-active .ttg-pe-host-actions,
body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel > .guide {
  display: none !important;
}

body.ttg-pdf-editor-active .ttg-pe-page-main,
body.ttg-pdf-editor-active .ttg-pe-host,
body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel,
body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel .tool-form,
body.ttg-pdf-editor-active #toolFields {
  width: 100%;
  height: calc(100vh - 76px);
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel > .tool-form > .tool-status {
  position: fixed;
  z-index: 10060;
  right: 18px;
  bottom: 14px;
  max-width: min(460px, calc(100vw - 36px));
  min-height: 0;
  margin: 0;
  pointer-events: none;
}

.ttg-pe * { box-sizing: border-box; }
.ttg-pe button, .ttg-pe input, .ttg-pe select, .ttg-pe textarea { font: inherit; }
.ttg-pe button { color: inherit; }
.ttg-pe [hidden], .ttg-pe .pe-hidden { display: none !important; }
.ttg-pe #peImageInput + .file-dropzone, .ttg-pe #peSignatureInput + .file-dropzone { display: none !important; }
.ttg-pe input.pe-sr-only { position: absolute; width: 1px !important; min-width: 1px !important; max-width: 1px !important; height: 1px !important; min-height: 1px !important; padding: 0 !important; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0 !important; }

.pe-start {
  display: grid;
  gap: 18px;
}

.pe-start-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 22px;
  border: 1px solid var(--pe-line);
  border-radius: 20px;
  background: linear-gradient(135deg, #fff 0%, #f5fbfa 100%);
}

.pe-file-picker { display: grid; gap: 7px; min-width: 0; }
.pe-file-picker > b { font-size: 1rem; }
.pe-file-picker > span { color: var(--pe-muted); font-size: .82rem; line-height: 1.5; }
.pe-file-picker label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 18px;
  border: 1.5px dashed #9ec8c3;
  border-radius: 16px;
  background: rgba(230, 247, 244, .7);
  cursor: pointer;
}
.pe-file-picker label:hover { border-color: var(--pe-teal); background: var(--pe-teal-soft); }
.pe-file-picker label i { color: var(--pe-teal); font-size: 1.35rem; }
.pe-file-picker input { position: absolute; opacity: 0; pointer-events: none; }
.pe-file-picker .pe-file-name { display: grid; gap: 2px; min-width: 0; }
.pe-file-picker .pe-file-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-file-picker .pe-file-name small { color: var(--pe-muted); }

.pe-primary, .pe-secondary, .pe-icon-btn, .pe-tool, .pe-context-control, .pe-panel-tab, .pe-mini-btn {
  appearance: none;
  border: 1px solid var(--pe-line);
  border-radius: 10px;
  background: var(--pe-panel);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.pe-primary:hover, .pe-secondary:hover, .pe-icon-btn:hover, .pe-tool:hover, .pe-context-control:hover, .pe-panel-tab:hover, .pe-mini-btn:hover { border-color: #a9bfbc; }
.pe-primary:active, .pe-secondary:active, .pe-icon-btn:active, .pe-tool:active, .pe-context-control:active, .pe-mini-btn:active { transform: translateY(1px); }
.pe-primary:disabled, .pe-secondary:disabled, .pe-icon-btn:disabled, .pe-tool:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.pe-primary { min-height: 46px; padding: 0 18px; border-color: var(--pe-brand); background: var(--pe-brand); color: white; font-weight: 800; box-shadow: 0 8px 20px rgba(237, 104, 72, .2); }
.pe-primary:hover { border-color: #d95537; background: #d95537; }
.pe-secondary { min-height: 38px; padding: 0 12px; font-size: .76rem; font-weight: 800; }
.pe-icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; flex: 0 0 auto; }
.pe-mini-btn { min-height: 32px; padding: 0 10px; font-size: .69rem; font-weight: 800; }
.pe-mini-btn.pe-danger { color: var(--pe-danger); }

.pe-app {
  width: 100%;
  min-width: 0;
}

.pe-workspace {
  width: 100vw;
  height: calc(100vh - 76px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 54px var(--pe-toolbar-h) 48px minmax(0, 1fr) 34px;
  background: var(--pe-bg);
}

.pe-topbar {
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--pe-line);
  background: var(--pe-panel);
}
.pe-document { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pe-document-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: #fff0ed; color: var(--pe-brand); }
.pe-document-copy { display: grid; min-width: 0; }
.pe-document-copy b { max-width: min(420px, 38vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.pe-document-copy small { color: var(--pe-muted); font-size: .65rem; }
.pe-top-actions { display: flex; align-items: center; gap: 7px; }
.pe-top-actions .pe-primary { min-height: 38px; }

.pe-main-toolbar {
  z-index: 45;
  display: flex;
  align-items: stretch;
  gap: 7px;
  min-width: 0;
  padding: 6px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--pe-line);
  background: var(--pe-panel);
}
.pe-tool-group { display: flex; gap: 3px; padding-right: 7px; border-right: 1px solid var(--pe-line); flex: 0 0 auto; }
.pe-tool-group:last-child { padding-right: 0; border-right: 0; }
.pe-tool {
  width: 60px;
  height: 55px;
  display: grid;
  grid-template-rows: 23px 16px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 3px 4px;
  border-color: transparent;
  background: transparent;
}
.pe-tool i { font-size: .95rem; line-height: 23px; }
.pe-tool span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .58rem; font-weight: 750; }
.pe-tool.active { border-color: #f1b09e; background: var(--pe-brand-soft); color: #bd4428; box-shadow: inset 0 -2px 0 var(--pe-brand); }
.pe-tool[data-tool="sign"].active { border-color: #9ac9c3; background: var(--pe-teal-soft); color: var(--pe-teal); box-shadow: inset 0 -2px 0 var(--pe-teal); }

.pe-contextbar {
  z-index: 44;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 6px 10px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--pe-line);
  background: #fbfcfc;
}
.pe-context-label { display: inline-flex; align-items: center; gap: 7px; min-width: max-content; padding-right: 8px; color: var(--pe-muted); font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.pe-context-control { height: 34px; display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 0 9px; color: var(--pe-ink); font-size: .68rem; font-weight: 750; }
.pe-context-control.active { border-color: #9fc7c2; background: var(--pe-teal-soft); color: var(--pe-teal); }
.pe-contextbar input[type="number"] { width: 62px; height: 34px; padding: 0 7px; border: 1px solid var(--pe-line); border-radius: 9px; background: white; color: var(--pe-ink); font-size: .7rem; }
.pe-contextbar input[type="color"] { width: 34px; height: 34px; padding: 3px; border: 1px solid var(--pe-line); border-radius: 9px; background: white; cursor: pointer; }
.pe-contextbar .pe-context-control input[type="color"] { width: 23px; height: 23px; padding: 1px; border-radius: 6px; }
.pe-contextbar .pe-context-control input[type="number"] { width: 50px; height: 24px; padding: 0 5px; }
.pe-contextbar input[type="range"] { width: 84px; }
.pe-contextbar select { height: 34px; max-width: 126px; padding: 0 26px 0 8px; border: 1px solid var(--pe-line); border-radius: 9px; background: white; color: var(--pe-ink); font-size: .68rem; font-weight: 700; }
.pe-context-separator { width: 1px; height: 24px; flex: 0 0 auto; background: var(--pe-line); }
.pe-context-hint { min-width: max-content; margin-left: auto; color: var(--pe-muted); font-size: .67rem; }

.pe-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr) 288px;
  overflow: hidden;
}

.pe-sidebar-left, .pe-sidebar-right {
  z-index: 35;
  min-width: 0;
  min-height: 0;
  display: grid;
  background: var(--pe-panel);
}
.pe-sidebar-left { grid-template-rows: 44px minmax(0, 1fr) auto; border-right: 1px solid var(--pe-line); }
.pe-sidebar-right { grid-template-rows: 44px minmax(0, 1fr); border-left: 1px solid var(--pe-line); }
.pe-sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; border-bottom: 1px solid var(--pe-line); }
.pe-sidebar-head b { font-size: .74rem; }
.pe-sidebar-head small { color: var(--pe-muted); font-size: .64rem; }

.pe-thumbs { min-height: 0; overflow-y: auto; padding: 9px; scrollbar-width: thin; }
.pe-thumb-row { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; align-items: start; margin-bottom: 9px; padding: 6px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.pe-thumb-row:hover { background: var(--pe-panel-soft); }
.pe-thumb-row.active { border-color: #f2a991; background: var(--pe-brand-soft); }
.pe-thumb-row.drag-over { border-color: var(--pe-teal); box-shadow: inset 0 0 0 1px var(--pe-teal); }
.pe-thumb-index { display: grid; place-items: center; min-height: 25px; color: var(--pe-muted); font-size: .62rem; font-weight: 800; }
.pe-thumb-sheet { position: relative; aspect-ratio: .77; overflow: hidden; border: 1px solid #cbd6d5; border-radius: 4px; background: #fff; box-shadow: 0 2px 8px rgba(24,49,45,.08); }
.pe-thumb-sheet canvas { width: 100%; height: 100%; display: block; object-fit: contain; }
.pe-thumb-sheet .pe-thumb-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #94a5a3; font-size: .68rem; background: linear-gradient(135deg,#fff,#f2f5f5); }
.pe-thumb-row.deleted { opacity: .48; }
.pe-thumb-row.deleted .pe-thumb-sheet::after { content: "Deleted"; position: absolute; inset: auto 4px 4px; padding: 2px; border-radius: 4px; background: #a62f29; color: #fff; text-align: center; font-size: .55rem; font-weight: 800; }
.pe-thumb-meta { grid-column: 2; display: flex; justify-content: space-between; gap: 4px; color: var(--pe-muted); font-size: .56rem; }

.pe-page-actions { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 5px; padding: 8px; border-top: 1px solid var(--pe-line); background: var(--pe-panel-soft); }
.pe-page-actions button { height: 32px; display: grid; place-items: center; border: 1px solid var(--pe-line); border-radius: 8px; background: white; cursor: pointer; }
.pe-page-actions button:hover { border-color: #a9bfbc; color: var(--pe-teal); }

.pe-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 28px;
  background-color: #dfe5e7;
  background-image: radial-gradient(rgba(80,104,102,.16) .7px, transparent .7px);
  background-size: 14px 14px;
  scrollbar-gutter: stable both-edges;
}
.pe-page-wrap { position: relative; margin: auto; flex: 0 0 auto; background: white; box-shadow: 0 8px 32px rgba(21,45,42,.22); transform-origin: top center; }
.pe-page-canvas { display: block; width: 100%; height: 100%; background: white; }
.pe-text-layer, .pe-scene-layer, .pe-interaction-layer, .pe-crop-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.pe-text-layer { z-index: 4; overflow: hidden; pointer-events: none; }
.pe-text-layer.edit-mode { pointer-events: auto; }
.pe-text-span { position: absolute; display: block; overflow: hidden; color: transparent; white-space: pre; line-height: 1; cursor: text; transform-origin: 0 0; border-radius: 2px; }
.pe-text-layer.edit-mode .pe-text-span:hover { outline: 1px solid rgba(17,103,95,.48); background: rgba(51,176,160,.12); }
.pe-text-span.edited { opacity: .08; pointer-events: none; }
.pe-scene-layer { z-index: 8; overflow: visible; pointer-events: none; }
.pe-object { position: absolute; transform-origin: 50% 50%; pointer-events: auto; cursor: move; user-select: none; }
.pe-object.locked { cursor: not-allowed; }
.pe-object.selected::after { content: ""; position: absolute; inset: -3px; border: 1.5px solid #148d82; border-radius: 2px; pointer-events: none; }
.pe-object-content { width: 100%; height: 100%; position: relative; overflow: hidden; opacity: var(--pe-object-opacity, 1); }
.pe-object.type-text .pe-object-content, .pe-object.type-existingText .pe-object-content, .pe-object.type-fieldText .pe-object-content { display: block; padding: 2px 3px; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; outline: none; user-select: text; }
.pe-object.type-note .pe-object-content { padding: 8px; border: 1px solid #d8b62a; border-radius: 3px; background: #fff39d; color: #433a13; font-size: 11px; }
.pe-object.type-stamp .pe-object-content { display: grid; place-items: center; border: 2px solid currentColor; border-radius: 4px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.pe-object.type-image img, .pe-object.type-signature img { width: 100%; height: 100%; display: block; object-fit: contain; pointer-events: none; }
.pe-object.type-fieldText .pe-object-content { border: 1px solid #637a77; background: rgba(255,255,255,.74); }
.pe-object.type-fieldCheck .pe-object-content, .pe-object.type-fieldRadio .pe-object-content { display: grid; place-items: center; border: 1.5px solid #506a66; background: rgba(255,255,255,.8); font-weight: 900; }
.pe-vector-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pe-document-preview { position: absolute; z-index: 10000; max-width: 92%; overflow: hidden; pointer-events: none; white-space: nowrap; font-weight: 900; text-transform: uppercase; transform-origin: center; }
.pe-page-number-preview { font-weight: 700; text-transform: none; }

.pe-selection-box { position: absolute; z-index: 20; pointer-events: none; border: 1.5px solid #148d82; box-shadow: 0 0 0 1px rgba(255,255,255,.8); }
.pe-handle { position: absolute; width: 9px; height: 9px; border: 1px solid #0c615a; border-radius: 50%; background: white; pointer-events: auto; }
.pe-handle[data-handle="nw"] { left: -5px; top: -5px; cursor: nwse-resize; }
.pe-handle[data-handle="n"] { left: calc(50% - 4px); top: -5px; cursor: ns-resize; }
.pe-handle[data-handle="ne"] { right: -5px; top: -5px; cursor: nesw-resize; }
.pe-handle[data-handle="e"] { right: -5px; top: calc(50% - 4px); cursor: ew-resize; }
.pe-handle[data-handle="se"] { right: -5px; bottom: -5px; cursor: nwse-resize; }
.pe-handle[data-handle="s"] { left: calc(50% - 4px); bottom: -5px; cursor: ns-resize; }
.pe-handle[data-handle="sw"] { left: -5px; bottom: -5px; cursor: nesw-resize; }
.pe-handle[data-handle="w"] { left: -5px; top: calc(50% - 4px); cursor: ew-resize; }
.pe-handle[data-handle="rotate"] { left: calc(50% - 5px); top: -28px; width: 11px; height: 11px; cursor: grab; background: var(--pe-brand); border-color: white; box-shadow: 0 0 0 1px #b64d34; }
.pe-handle[data-handle="rotate"]::after { content: ""; position: absolute; left: 4px; top: 10px; width: 1px; height: 15px; background: #148d82; }

.pe-draft { position: absolute; z-index: 18; border: 1.5px dashed var(--pe-teal); background: rgba(17,103,95,.08); pointer-events: none; }
.pe-marquee { position: absolute; z-index: 24; border: 1px solid #168a80; background: rgba(34,151,139,.1); pointer-events: none; }
.pe-crop-mask { z-index: 16; pointer-events: none; }
.pe-crop-box { position: absolute; border: 2px solid #f26b49; box-shadow: 0 0 0 9999px rgba(20,39,37,.45); pointer-events: auto; cursor: move; }
.pe-crop-box .pe-handle { pointer-events: auto; }

.pe-empty-stage { display: grid; place-items: center; min-height: 300px; color: var(--pe-muted); text-align: center; }
.pe-page-loading { position: absolute; z-index: 40; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.78); color: var(--pe-teal); font-size: .75rem; font-weight: 800; }

.pe-right-tabs { display: flex; gap: 3px; padding: 6px; border-bottom: 1px solid var(--pe-line); overflow-x: auto; }
.pe-panel-tab { min-width: 62px; height: 31px; padding: 0 7px; border-color: transparent; background: transparent; font-size: .61rem; font-weight: 800; }
.pe-panel-tab.active { border-color: #afd0cc; background: var(--pe-teal-soft); color: var(--pe-teal); }
.pe-inspector { min-height: 0; overflow-y: auto; padding: 12px; scrollbar-width: thin; }
.pe-inspector-section { display: grid; gap: 11px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--pe-line); }
.pe-inspector-section:last-child { border-bottom: 0; }
.pe-inspector-section h3 { margin: 0; font-size: .88rem; }
.pe-inspector-section p { margin: 0; color: var(--pe-muted); font-size: .7rem; line-height: 1.5; }
.pe-field { display: grid; gap: 5px; color: var(--pe-muted); font-size: .64rem; font-weight: 750; }
.pe-field input, .pe-field select, .pe-field textarea { width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid var(--pe-line); border-radius: 9px; background: white; color: var(--pe-ink); font-size: .72rem; }
.pe-field textarea { min-height: 78px; resize: vertical; }
.pe-field-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.pe-check-row { display: flex; align-items: center; gap: 8px; color: var(--pe-ink); font-size: .7rem; font-weight: 700; }
.pe-check-row input { width: 16px; height: 16px; }
.pe-inspector-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.pe-inspector-actions .pe-primary, .pe-inspector-actions .pe-secondary { width: 100%; }
.pe-panel-notice { display: flex; gap: 8px; padding: 10px; border: 1px solid #efb29f; border-radius: 10px; background: #fff1ec; color: #78372a; font-size: .67rem; line-height: 1.45; }
.pe-panel-notice.info { border-color: #acd1cc; background: var(--pe-teal-soft); color: #175c55; }
.pe-panel-notice i { margin-top: 2px; }

.pe-sign-tabs { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.pe-sign-tabs button { min-height: 34px; border: 1px solid var(--pe-line); border-radius: 8px; background: white; cursor: pointer; font-size: .65rem; font-weight: 800; }
.pe-sign-tabs button.active { border-color: #9bc8c3; background: var(--pe-teal-soft); color: var(--pe-teal); }
.pe-sign-canvas { width: 100%; height: 120px; border: 1px solid var(--pe-line); border-radius: 10px; background: white; touch-action: none; cursor: crosshair; }
.pe-sign-preview { min-height: 72px; display: grid; place-items: center; padding: 8px; border: 1px dashed var(--pe-line-strong); border-radius: 10px; background: white; font-size: 2rem; font-family: cursive; overflow: hidden; }

.pe-statusbar { z-index: 42; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 10px; border-top: 1px solid var(--pe-line); background: var(--pe-panel); color: var(--pe-muted); font-size: .64rem; }
.pe-status-centre { display: flex; align-items: center; gap: 5px; }
.pe-status-centre input { width: 50px; height: 24px; padding: 0 4px; border: 1px solid var(--pe-line); border-radius: 6px; text-align: center; font-size: .65rem; }
.pe-status-right { justify-self: end; display: flex; align-items: center; gap: 7px; }
.pe-statusbar button { width: 26px; height: 24px; display: grid; place-items: center; border: 1px solid var(--pe-line); border-radius: 6px; background: white; cursor: pointer; }

.pe-popover {
  position: fixed;
  z-index: 10050;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 24px));
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--pe-line);
  border-radius: 14px;
  background: var(--pe-panel);
  box-shadow: var(--pe-shadow);
}
.pe-popover-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; }
.pe-popover-head b { font-size: .8rem; }
.pe-popover-tabs { display: flex; gap: 5px; margin-bottom: 9px; }
.pe-popover-tabs button { height: 32px; padding: 0 10px; border: 1px solid var(--pe-line); border-radius: 8px; background: white; cursor: pointer; font-size: .64rem; font-weight: 800; }
.pe-popover-tabs button.active { border-color: #9fcac5; background: var(--pe-teal-soft); color: var(--pe-teal); }
.pe-tile-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.pe-tile { min-height: 72px; display: grid; place-items: center; gap: 4px; padding: 7px; border: 1px solid var(--pe-line); border-radius: 10px; background: white; cursor: pointer; text-align: center; }
.pe-tile:hover { border-color: #96bcb7; background: var(--pe-panel-soft); }
.pe-tile svg { width: 30px; height: 30px; }
.pe-tile i { font-size: 1.15rem; }
.pe-tile span { font-size: .6rem; font-weight: 800; }
.pe-font-grid { display: grid; gap: 4px; }
.pe-font-option { min-height: 38px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.pe-font-option:hover, .pe-font-option.active { border-color: #acd0cc; background: var(--pe-teal-soft); }

.pe-context-menu { position: fixed; z-index: 10055; width: 190px; padding: 6px; border: 1px solid var(--pe-line); border-radius: 11px; background: white; box-shadow: var(--pe-shadow); }
.pe-context-menu button { width: 100%; min-height: 33px; display: flex; align-items: center; gap: 9px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; text-align: left; font-size: .68rem; }
.pe-context-menu button:hover { background: var(--pe-panel-soft); }
.pe-context-menu button.danger { color: var(--pe-danger); }
.pe-context-menu hr { height: 1px; margin: 5px 0; border: 0; background: var(--pe-line); }

.pe-toast-stack { position: fixed; z-index: 10070; right: 14px; bottom: 42px; display: grid; gap: 7px; pointer-events: none; }
.pe-toast { max-width: 390px; padding: 10px 13px; border: 1px solid #a9ccc7; border-radius: 10px; background: #effbf8; color: #175c55; box-shadow: 0 8px 24px rgba(17,47,43,.13); font-size: .7rem; font-weight: 750; animation: pe-toast-in .18s ease; }
.pe-toast.error { border-color: #efb29f; background: #fff0eb; color: #813928; }
@keyframes pe-toast-in { from { opacity: 0; transform: translateY(6px); } }

.pe-progress-modal { position: fixed; z-index: 10080; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(18,39,37,.58); }
.pe-progress-card { width: min(430px,100%); display: grid; gap: 13px; padding: 22px; border-radius: 16px; background: white; box-shadow: var(--pe-shadow); }
.pe-progress-card h3 { margin: 0; font-size: 1rem; }
.pe-progress-card p { margin: 0; color: var(--pe-muted); font-size: .75rem; line-height: 1.5; }
.pe-progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e9eeee; }
.pe-progress-track span { display: block; width: var(--pe-progress,0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--pe-teal),#3fb7a9); transition: width .22s ease; }

[data-theme="dark"] .ttg-pe {
  --pe-bg: #12201f;
  --pe-panel: #192a28;
  --pe-panel-soft: #203330;
  --pe-ink: #eff8f6;
  --pe-muted: #9db4b0;
  --pe-line: #334946;
  --pe-line-strong: #4b625e;
  --pe-brand-soft: #402820;
  --pe-teal-soft: #173a36;
}
[data-theme="dark"] .pe-stage { background-color: #0d1817; }
[data-theme="dark"] .pe-contextbar, [data-theme="dark"] .pe-contextbar input, [data-theme="dark"] .pe-contextbar select, [data-theme="dark"] .pe-field input, [data-theme="dark"] .pe-field select, [data-theme="dark"] .pe-field textarea, [data-theme="dark"] .pe-page-actions button, [data-theme="dark"] .pe-sign-tabs button, [data-theme="dark"] .pe-popover-tabs button, [data-theme="dark"] .pe-tile, [data-theme="dark"] .pe-popover, [data-theme="dark"] .pe-context-menu { background: var(--pe-panel); color: var(--pe-ink); }

@media (max-width: 1100px) {
  .pe-shell { grid-template-columns: 154px minmax(0,1fr); }
  .pe-sidebar-right { position: absolute; inset: 0 0 0 auto; width: min(310px, 92vw); box-shadow: -10px 0 28px rgba(17,47,43,.18); }
  .pe-sidebar-right.pe-panel-closed { display: none; }
  .pe-context-hint { display: none; }
}

@media (max-width: 760px) {
  .pe-workspace { --pe-toolbar-h: 62px; grid-template-rows: 50px var(--pe-toolbar-h) 44px minmax(0,1fr) 32px; }
  .pe-document-copy b { max-width: 34vw; }
  .pe-top-actions .pe-secondary span, .pe-top-actions .pe-primary span { display: none; }
  .pe-top-actions .pe-secondary, .pe-top-actions .pe-primary { width: 37px; min-width: 37px; padding: 0; display: grid; place-items: center; }
  .pe-tool { width: 54px; height: 49px; }
  .pe-tool span { font-size: .54rem; }
  .pe-shell { grid-template-columns: minmax(0,1fr); }
  .pe-sidebar-left { position: absolute; z-index: 38; inset: 0 auto 0 0; width: min(176px, 82vw); box-shadow: 10px 0 28px rgba(17,47,43,.18); }
  .pe-sidebar-left.pe-panel-closed { display: none; }
  .pe-stage { padding: 18px; }
  .pe-statusbar { grid-template-columns: auto 1fr auto; }
  .pe-statusbar > span:first-child { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pe-start-card { grid-template-columns: 1fr; }
  .pe-start-card .pe-primary { width: 100%; }
}

@media (max-width: 480px) {
  .pe-topbar { padding-inline: 7px; }
  .pe-document-copy small { display: none; }
  .pe-contextbar { padding-inline: 6px; }
  .pe-stage { padding: 10px; }
  .pe-tile-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pe-status-right span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ttg-pe *, .ttg-pe *::before, .ttg-pe *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   ToolTapGo v27 — PDF Editor visual-system alignment
   Matches the main ToolTapGo website rather than a separate app.
   ============================================================ */
.ttg-pe {
  --pe-bg: var(--page, #f7f4ed);
  --pe-panel: var(--surface, #fffdf8);
  --pe-panel-soft: var(--surface-2, #f0ebe1);
  --pe-ink: var(--ink, #102b2a);
  --pe-muted: var(--muted, #6e7e7b);
  --pe-line: var(--line, #ddd6c9);
  --pe-line-strong: color-mix(in srgb, var(--line, #ddd6c9) 68%, var(--ink, #102b2a));
  --pe-brand: var(--brand, #ef6a47);
  --pe-brand-soft: var(--brand-soft, #fff0e8);
  --pe-teal: var(--teal, #0f766e);
  --pe-teal-soft: var(--teal-soft, #dff3ef);
  --pe-danger: var(--danger, #c2414b);
  --pe-shadow: var(--shadow, 0 22px 55px rgba(34,43,38,.10));
  --pe-toolbar-h: 64px;
  color: var(--pe-ink);
  font-family: Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.ttg-pe h1,
.ttg-pe h2,
.ttg-pe h3,
.ttg-pe .pe-document-copy b,
.ttg-pe .pe-sidebar-head b,
.ttg-pe .pe-popover-head b {
  font-family: "Plus Jakarta Sans", Manrope, sans-serif;
  letter-spacing: -.02em;
}

.pe-workspace {
  grid-template-rows: 60px var(--pe-toolbar-h) 50px minmax(0, 1fr) 38px;
  background: var(--pe-bg);
}

.pe-topbar {
  gap: 16px;
  padding: 8px 14px;
  border-bottom-color: var(--pe-line);
  background: color-mix(in srgb, var(--pe-panel) 94%, transparent);
  box-shadow: 0 4px 16px rgba(34,43,38,.045);
}
.pe-document-icon {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--pe-brand-soft);
  color: var(--pe-brand);
  font-size: 1.05rem;
}
.pe-document-copy b { font-size: .88rem; font-weight: 800; }
.pe-document-copy small { margin-top: 2px; font-size: .7rem; }
.pe-top-actions { gap: 8px; }
.pe-top-actions .pe-primary,
.pe-top-actions .pe-secondary { min-height: 42px; border-radius: 13px; font-size: .76rem; }
.pe-top-actions .pe-icon-btn { width: 40px; height: 40px; border-radius: 13px; }

.pe-primary,
.pe-secondary,
.pe-icon-btn,
.pe-tool,
.pe-context-control,
.pe-panel-tab,
.pe-mini-btn {
  border-radius: 12px;
  border-color: var(--pe-line);
  background: var(--pe-panel);
  box-shadow: none;
}
.pe-primary { min-height: 44px; border-color: var(--pe-brand); background: var(--pe-brand); font-size: .78rem; }
.pe-primary:hover { border-color: var(--brand-strong, #db4f2e); background: var(--brand-strong, #db4f2e); }
.pe-secondary { min-height: 40px; font-size: .75rem; }
.pe-icon-btn { width: 38px; height: 38px; }

.pe-main-toolbar {
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom-color: var(--pe-line);
  background: var(--pe-panel);
  scrollbar-color: color-mix(in srgb, var(--pe-teal) 35%, transparent) transparent;
}
.pe-tool-group {
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--pe-line);
  border-radius: 15px;
  background: var(--pe-panel-soft);
}
.pe-tool-group:last-child { border: 1px solid var(--pe-line); padding: 3px; }
.pe-tool {
  width: 64px;
  height: 50px;
  grid-template-rows: 22px 17px;
  gap: 1px;
  padding: 4px 5px;
  border-radius: 11px;
  color: var(--pe-muted);
}
.pe-tool:hover { border-color: color-mix(in srgb, var(--pe-teal) 30%, var(--pe-line)); background: var(--pe-panel); color: var(--pe-ink); }
.pe-tool i { font-size: 1rem; line-height: 22px; }
.pe-tool span { font-size: .65rem; font-weight: 800; line-height: 1.15; }
.pe-tool.active {
  border-color: color-mix(in srgb, var(--pe-brand) 38%, var(--pe-line));
  background: var(--pe-brand-soft);
  color: var(--pe-brand);
  box-shadow: inset 0 -2px 0 var(--pe-brand), 0 4px 10px rgba(239,106,71,.08);
}
.pe-tool[data-pe-tool="sign"].active,
.pe-tool[data-tool="sign"].active { border-color: color-mix(in srgb, var(--pe-teal) 38%, var(--pe-line)); background: var(--pe-teal-soft); color: var(--pe-teal); box-shadow: inset 0 -2px 0 var(--pe-teal); }

.pe-contextbar {
  min-height: 50px;
  gap: 8px;
  padding: 7px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom-color: var(--pe-line);
  background: color-mix(in srgb, var(--pe-panel-soft) 56%, var(--pe-panel));
  scrollbar-width: thin;
}
.pe-context-label {
  gap: 8px;
  min-height: 34px;
  padding: 0 11px 0 0;
  color: var(--pe-ink);
  font-size: .7rem;
  font-weight: 850;
  letter-spacing: .025em;
}
.pe-context-label i { color: var(--pe-brand); }
.pe-context-control {
  height: 36px;
  gap: 7px;
  padding: 0 10px;
  border-radius: 11px;
  color: var(--pe-ink);
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.pe-context-control:hover { background: var(--pe-panel); }
.pe-context-control.active { border-color: color-mix(in srgb, var(--pe-brand) 40%, var(--pe-line)); background: var(--pe-brand-soft); color: var(--pe-brand); }
.pe-contextbar input[type="number"] { width: 64px; height: 36px; border-radius: 11px; border-color: var(--pe-line); background: var(--pe-panel); font-size: .74rem; }
.pe-contextbar select[data-native-select] {
  width: auto;
  min-width: 104px;
  max-width: 150px;
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--pe-line);
  border-radius: 11px;
  background: var(--pe-panel);
  color: var(--pe-ink);
  font-size: .72rem;
  font-weight: 750;
}
.pe-contextbar input[type="range"] { width: 100px; accent-color: var(--pe-brand); }
.pe-colour-control { padding-right: 7px; }
.pe-colour-control > span { font-size: .69rem; }
.pe-contextbar .pe-colour-control input[type="color"],
.pe-contextbar input[type="color"] {
  width: 27px;
  height: 27px;
  padding: 2px;
  overflow: hidden;
  border: 2px solid var(--pe-panel);
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 0 0 1px var(--pe-line);
}
.pe-contextbar input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.pe-contextbar input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.pe-contextbar input[type="color"]::-moz-color-swatch { border: 0; border-radius: 5px; }
.pe-context-separator { height: 27px; background: var(--pe-line); }
.pe-context-hint { color: var(--pe-muted); font-size: .69rem; }

.pe-shell { grid-template-columns: 184px minmax(0, 1fr) 304px; }
.pe-sidebar-left,
.pe-sidebar-right { background: var(--pe-panel); }
.pe-sidebar-left { border-right-color: var(--pe-line); }
.pe-sidebar-right { border-left-color: var(--pe-line); }
.pe-sidebar-head { min-height: 48px; padding: 8px 10px; }
.pe-sidebar-head b { font-size: .8rem; }
.pe-sidebar-head small { font-size: .68rem; }
.pe-thumbs { padding: 10px; }
.pe-thumb-row { grid-template-columns: 24px minmax(0,1fr); gap: 7px; margin-bottom: 10px; padding: 7px; border-radius: 13px; }
.pe-thumb-row.active { border-color: color-mix(in srgb, var(--pe-brand) 44%, var(--pe-line)); background: var(--pe-brand-soft); }
.pe-thumb-index { font-size: .68rem; }
.pe-thumb-sheet { border-color: var(--pe-line); border-radius: 7px; box-shadow: var(--shadow-sm, 0 10px 28px rgba(34,43,38,.07)); }
.pe-thumb-meta { font-size: .62rem; }
.pe-page-actions { gap: 7px; padding: 9px; background: var(--pe-panel-soft); }
.pe-page-actions button { height: 36px; border-radius: 10px; color: var(--pe-ink); }

.pe-stage {
  padding: 30px;
  background-color: #e9e4da;
  background-image: radial-gradient(color-mix(in srgb, var(--pe-ink) 10%, transparent) .7px, transparent .7px);
  background-size: 16px 16px;
}
.pe-page-wrap { box-shadow: 0 18px 45px rgba(30,43,39,.18); }
.pe-page-loading { color: var(--pe-teal); font-size: .78rem; }

.pe-selection-box { border: 2px solid var(--pe-brand); box-shadow: 0 0 0 1px rgba(255,255,255,.92); }
.pe-handle { width: 10px; height: 10px; border: 2px solid var(--pe-brand); background: var(--pe-panel); }
.pe-handle[data-handle="rotate"] { top: -31px; width: 12px; height: 12px; border-color: #fff; background: var(--pe-brand); box-shadow: 0 0 0 2px var(--pe-brand); }
.pe-handle[data-handle="rotate"]::after { left: 4px; top: 10px; height: 18px; background: var(--pe-brand); }
.pe-object.selected::after { border-color: var(--pe-brand); }
.pe-handdraw-draft {
  position: absolute;
  inset: 0;
  z-index: 24;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.ttg-pe[data-active-tool="draw"] .pe-stage { cursor: crosshair; }
.ttg-pe[data-active-tool="inkEraser"] .pe-stage,
.ttg-pe[data-active-tool="inkEraser"] .pe-object { cursor: cell; }

.pe-right-tabs { gap: 5px; padding: 7px; background: var(--pe-panel-soft); }
.pe-panel-tab { min-width: 64px; height: 34px; border-radius: 10px; font-size: .68rem; }
.pe-panel-tab.active { border-color: color-mix(in srgb, var(--pe-teal) 34%, var(--pe-line)); background: var(--pe-teal-soft); color: var(--pe-teal); }
.pe-inspector { padding: 15px; }
.pe-inspector-section { gap: 12px; margin-bottom: 18px; padding-bottom: 18px; }
.pe-inspector-section h3 { font-size: .98rem; }
.pe-inspector-section p { font-size: .75rem; line-height: 1.55; }
.pe-field { gap: 6px; color: var(--pe-ink); font-size: .72rem; font-weight: 800; }
.pe-field input,
.pe-field select[data-native-select],
.pe-field textarea { min-height: 42px; padding: 9px 11px; border-radius: 11px; border-color: var(--pe-line); background: var(--pe-panel); font-size: .76rem; }
.pe-field textarea { min-height: 88px; }
.pe-check-row { font-size: .75rem; }
.pe-sign-tabs { gap: 7px; }
.pe-sign-tabs button { min-height: 38px; border-radius: 10px; font-size: .72rem; }
.pe-sign-preview { border-radius: 12px; background: var(--pe-panel); }
.pe-panel-notice { border-radius: 12px; font-size: .72rem; }

.pe-statusbar { min-height: 38px; padding: 0 12px; background: var(--pe-panel); font-size: .69rem; }
.pe-status-centre input { width: 54px; height: 27px; border-radius: 8px; font-size: .69rem; }
.pe-statusbar button { width: 29px; height: 27px; border-radius: 8px; background: var(--pe-panel); }

.pe-popover { padding: 12px; border-radius: 18px; background: var(--pe-panel); box-shadow: var(--pe-shadow); }
.pe-popover-head { margin-bottom: 11px; }
.pe-popover-head b { font-size: .88rem; }
.pe-popover-tabs { gap: 6px; margin-bottom: 11px; }
.pe-popover-tabs button { height: 36px; border-radius: 10px; font-size: .7rem; }
.pe-tile-grid { gap: 9px; }
.pe-tile { min-height: 78px; border-radius: 13px; background: var(--pe-panel); }
.pe-tile span { font-size: .67rem; }
.pe-font-grid { gap: 6px; }
.pe-font-option { min-height: 42px; border-radius: 10px; font-size: .82rem; }
.pe-context-menu { width: 208px; padding: 7px; border-radius: 14px; background: var(--pe-panel); }
.pe-context-menu button { min-height: 37px; border-radius: 9px; font-size: .73rem; }
.pe-toast { border-radius: 13px; font-size: .74rem; }

/* Keep the normal website upload step aligned with ToolTapGo cards. */
.pe-start { gap: 20px; }
.pe-start-card { padding: 24px; border-color: var(--pe-line); border-radius: 20px; background: var(--pe-panel); box-shadow: var(--shadow-sm, 0 10px 28px rgba(34,43,38,.07)); }
.pe-file-picker > b { font-family: "Plus Jakarta Sans", Manrope, sans-serif; font-size: 1.02rem; }
.pe-file-picker > span { font-size: .82rem; }
.pe-file-picker label { padding: 19px; border-color: color-mix(in srgb, var(--pe-teal) 42%, var(--pe-line)); border-radius: 16px; background: color-mix(in srgb, var(--pe-teal-soft) 60%, var(--pe-panel)); }
.pe-file-picker .pe-file-name b { font-size: .82rem; }
.pe-file-picker .pe-file-name small { font-size: .72rem; }

[data-theme="dark"] .ttg-pe {
  --pe-bg: var(--page);
  --pe-panel: var(--surface);
  --pe-panel-soft: var(--surface-2);
  --pe-ink: var(--ink);
  --pe-muted: var(--muted);
  --pe-line: var(--line);
  --pe-brand: var(--brand);
  --pe-brand-soft: var(--brand-soft);
  --pe-teal: var(--teal);
  --pe-teal-soft: var(--teal-soft);
}
[data-theme="dark"] .pe-stage { background-color: #111c1a; }

@media (max-width: 1100px) {
  .pe-shell { grid-template-columns: 164px minmax(0,1fr); }
}

@media (max-width: 760px) {
  .pe-workspace { --pe-toolbar-h: 60px; grid-template-rows: 52px var(--pe-toolbar-h) 46px minmax(0,1fr) 34px; }
  .pe-topbar { padding: 6px 8px; }
  .pe-document-icon { width: 36px; height: 36px; }
  .pe-top-actions { gap: 5px; }
  .pe-main-toolbar { padding: 5px 7px; }
  .pe-tool-group { padding: 2px; }
  .pe-tool { width: 58px; height: 48px; }
  .pe-tool span { font-size: .61rem; }
  .pe-contextbar { padding: 5px 7px; }
  .pe-context-control { height: 34px; font-size: .68rem; }
  .pe-stage { padding: 18px; }
}

@media (max-width: 480px) {
  .pe-workspace { grid-template-rows: 50px 58px 44px minmax(0,1fr) 32px; }
  .pe-document-copy b { max-width: 29vw; font-size: .76rem; }
  .pe-tool { width: 55px; }
  .pe-context-label { font-size: .66rem; }
  .pe-context-hint { display: none; }
  .pe-stage { padding: 10px; }
}

/* Editor controls must override the general ToolTapGo form rules. */
#toolFields .pe-contextbar label.pe-context-control {
  display: inline-flex;
  width: auto;
  min-width: max-content;
  height: 36px;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
}
#toolFields .pe-contextbar input[type="color"] {
  width: 27px !important;
  min-width: 27px !important;
  max-width: 27px !important;
  height: 27px !important;
  min-height: 27px !important;
  margin: 0 !important;
  padding: 2px !important;
}
#toolFields .pe-contextbar input[type="number"] {
  width: 58px !important;
  min-width: 58px !important;
  max-width: 58px !important;
  height: 27px !important;
  min-height: 27px !important;
  margin: 0 !important;
  padding: 0 6px !important;
}
#toolFields .pe-contextbar input[type="range"] {
  width: 100px !important;
  min-width: 100px !important;
  max-width: 100px !important;
  min-height: 18px !important;
  margin: 0 !important;
}
#toolFields .pe-contextbar select[data-native-select] {
  width: auto !important;
  min-width: 104px !important;
  max-width: 150px !important;
  height: 36px !important;
  min-height: 36px !important;
  margin: 0 !important;
}
#toolFields .pe-statusbar input[type="number"] {
  width: 54px !important;
  min-width: 54px !important;
  max-width: 54px !important;
  height: 27px !important;
  min-height: 27px !important;
  margin: 0 !important;
  padding: 0 5px !important;
}
#toolFields .pe-inspector label.pe-field {
  display: grid;
  width: 100%;
  flex-direction: initial;
  align-items: stretch;
}
#toolFields .pe-inspector .pe-check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
}
#toolFields .pe-tool { min-width: 68px; width: 68px; }
#toolFields .pe-tool span { overflow: visible; text-overflow: clip; }

/* Prevent browser pan/selection gestures from cancelling PDF drawing operations. */
.ttg-pe[data-active-tool]:not([data-active-tool="select"]):not([data-active-tool="editText"]) .pe-stage,
.ttg-pe[data-active-tool]:not([data-active-tool="select"]):not([data-active-tool="editText"]) .pe-page-wrap,
.ttg-pe[data-active-tool]:not([data-active-tool="select"]):not([data-active-tool="editText"]) .pe-crop-layer,
.ttg-pe[data-active-tool]:not([data-active-tool="select"]):not([data-active-tool="editText"]) .pe-interaction-layer {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Final mobile workspace rules: side panels are drawers, never grid columns. */
@media (max-width: 760px) {
  .pe-shell { grid-template-columns: minmax(0,1fr) !important; }
  .pe-sidebar-left,
  .pe-sidebar-right { position: absolute; top: 0; bottom: 0; height: 100%; }
  .pe-sidebar-left { left: 0; width: min(184px, 84vw); }
  .pe-sidebar-right { right: 0; width: min(320px, 92vw); }
  .pe-sidebar-left.pe-panel-closed,
  .pe-sidebar-right.pe-panel-closed { display: none !important; }
  .pe-stage { min-width: 0; width: 100%; }
}


/* v28 polish: fix text submenu sizing/alignment and right inspector tabs */
.pe-contextbar {
  align-items: center;
  flex-wrap: nowrap;
}
.pe-contextbar > * {
  flex: 0 0 auto;
}
.pe-contextbar > .pe-context-hint {
  flex: 1 1 auto;
  min-width: 180px;
  text-align: right;
}
.pe-contextbar > button[data-context-action="font"] {
  min-width: 132px;
  justify-content: space-between;
  padding-inline: 12px;
}
.pe-contextbar > select[data-native-select="true"] {
  width: 132px !important;
  min-width: 132px !important;
  max-width: 132px !important;
  flex: 0 0 132px !important;
}
.pe-contextbar > input[type="number"] {
  width: 58px;
  min-width: 58px;
}
.pe-contextbar > .pe-context-control input[type="number"] {
  width: 46px !important;
  min-width: 46px !important;
  max-width: 46px !important;
}
.pe-contextbar > .pe-context-control {
  justify-content: center;
}
.pe-contextbar > .pe-colour-control {
  gap: 8px;
}
.pe-contextbar > .pe-context-control[data-context-action="link"] {
  padding-inline: 12px;
}
.pe-sidebar-right {
  grid-template-rows: auto minmax(0, 1fr);
  width: 320px;
  min-width: 320px;
  overflow: hidden;
}
.pe-right-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  overflow: visible;
  border-bottom: 1px solid var(--pe-line);
}
.pe-panel-tab {
  min-width: 0;
  width: 100%;
  padding: 0 8px;
  justify-content: center;
  white-space: nowrap;
}
.pe-inspector {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
}
.pe-inspector-section:last-child {
  margin-bottom: 0;
}
#toolFields .pe-contextbar > select[data-native-select] {
  width: 132px !important;
  min-width: 132px !important;
  max-width: 132px !important;
  flex: 0 0 132px !important;
}
#toolFields .pe-sidebar-right {
  width: 320px;
  min-width: 320px;
}
@media (max-width: 1280px) {
  .pe-shell {
    grid-template-columns: 184px minmax(0, 1fr) 296px;
  }
  .pe-sidebar-right,
  #toolFields .pe-sidebar-right {
    width: 296px;
    min-width: 296px;
  }
}
@media (max-width: 980px) {
  .pe-contextbar > .pe-context-hint {
    display: none;
  }
}


/* v29 cleanup: remove text preset dropdown and right inspector tab menu */
.pe-right-tabs { display: none !important; }
.pe-sidebar-right { grid-template-rows: minmax(0, 1fr) !important; }
.pe-inspector { padding-top: 14px; }


/* v30 PDF Studio: website header, upload screen, action buttons and hand-draw polish */
body.ttg-pdf-editor-active > .site-header {
  display: block !important;
  position: sticky;
  top: 0;
  z-index: 10080;
}
body.ttg-pdf-editor-active .ttg-pe-page-main,
body.ttg-pdf-editor-active .ttg-pe-host,
body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel,
body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel .tool-form,
body.ttg-pdf-editor-active #toolFields {
  height: calc(100vh - 76px);
}
body.ttg-pdf-editor-active .pe-workspace {
  height: calc(100vh - 76px);
}

.pe-start-card {
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--pe-line);
  border-radius: 22px;
  background: var(--pe-panel);
  box-shadow: var(--shadow-sm, 0 10px 28px rgba(34,43,38,.07));
}
.pe-start-heading {
  display: flex;
  align-items: center;
  gap: 13px;
}
.pe-start-heading > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.pe-start-heading b {
  font-family: "Plus Jakarta Sans", Manrope, sans-serif;
  font-size: 1.08rem;
  line-height: 1.25;
}
.pe-start-heading span {
  color: var(--pe-muted);
  font-size: .8rem;
  line-height: 1.5;
}
.pe-start-icon,
.pe-upload-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--pe-teal);
  background: var(--pe-teal-soft);
}
.pe-start-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 1.1rem;
}
.pe-pdf-dropzone {
  width: 100%;
  min-height: 116px;
  display: grid;
  grid-template-columns: 48px minmax(0,1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 20px;
  border: 1.5px dashed color-mix(in srgb, var(--pe-teal) 48%, var(--pe-line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--pe-teal-soft) 58%, var(--pe-panel));
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.pe-pdf-dropzone:hover,
.pe-pdf-dropzone.is-dragging {
  border-color: var(--pe-teal);
  background: var(--pe-teal-soft);
  box-shadow: 0 10px 26px rgba(17,103,95,.1);
}
.pe-pdf-dropzone.is-dragging { transform: translateY(-1px); }
.pe-pdf-dropzone.has-file {
  border-style: solid;
  border-color: var(--pe-teal);
}
.pe-pdf-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.pe-upload-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 1.05rem;
  background: var(--pe-panel);
  box-shadow: var(--shadow-sm, 0 8px 20px rgba(34,43,38,.08));
}
.pe-pdf-dropzone .pe-file-name {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.pe-pdf-dropzone .pe-file-name b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .88rem;
}
.pe-pdf-dropzone .pe-file-name small {
  color: var(--pe-muted);
  font-size: .74rem;
}
.pe-browse-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid var(--pe-brand);
  border-radius: 13px;
  background: var(--pe-brand);
  color: #fff;
  font-size: .78rem;
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(237,104,72,.2);
}
.pe-start-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.pe-start-actions .pe-secondary,
.pe-start-actions .pe-primary {
  min-height: 44px;
  border-radius: 13px;
  font-size: .78rem;
}
.pe-start-private {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--pe-muted);
  font-size: .72rem;
}
.pe-start-private i { color: var(--pe-teal); }

.pe-topbar {
  min-height: 58px;
  padding: 8px 14px;
  background: var(--pe-panel);
}
.pe-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.pe-top-actions::-webkit-scrollbar { display: none; }
.pe-top-actions .pe-secondary,
.pe-top-actions .pe-primary,
.pe-top-actions .pe-icon-btn {
  min-height: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  box-shadow: var(--shadow-sm, 0 7px 18px rgba(34,43,38,.07));
}
.pe-top-actions .pe-secondary {
  padding-inline: 14px;
  background: var(--pe-panel);
  color: var(--pe-ink);
}
.pe-top-actions .pe-secondary:hover {
  border-color: color-mix(in srgb, var(--pe-brand) 35%, var(--pe-line));
  background: var(--pe-brand-soft);
  color: var(--pe-brand);
}
.pe-top-actions .pe-leave-studio {
  border-color: color-mix(in srgb, var(--pe-teal) 28%, var(--pe-line));
  color: var(--pe-teal);
}
.pe-top-actions .pe-primary {
  padding-inline: 17px;
  box-shadow: 0 9px 22px rgba(237,104,72,.2);
}

.pe-handdraw-draft path {
  filter: drop-shadow(0 1px 1px rgba(16,47,45,.12));
}
.ttg-pe[data-active-tool="draw"] .pe-stage,
.ttg-pe[data-active-tool="draw"] .pe-page-wrap,
.ttg-pe[data-active-tool="draw"] .pe-interaction-layer {
  cursor: crosshair;
}
.ttg-pe[data-active-tool="draw"] .pe-object {
  pointer-events: none;
}

@media (max-width: 800px) {
  body.ttg-pdf-editor-active .ttg-pe-page-main,
  body.ttg-pdf-editor-active .ttg-pe-host,
  body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel,
  body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel .tool-form,
  body.ttg-pdf-editor-active #toolFields,
  body.ttg-pdf-editor-active .pe-workspace {
    height: calc(100vh - 76px);
  }
  .pe-document-copy { display: none; }
}
@media (max-width: 560px) {
  body.ttg-pdf-editor-active .ttg-pe-page-main,
  body.ttg-pdf-editor-active .ttg-pe-host,
  body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel,
  body.ttg-pdf-editor-active .ttg-pe-bootstrap-panel .tool-form,
  body.ttg-pdf-editor-active #toolFields,
  body.ttg-pdf-editor-active .pe-workspace {
    height: calc(100vh - 68px);
  }
  .pe-pdf-dropzone {
    grid-template-columns: 42px minmax(0,1fr);
    padding: 16px;
  }
  .pe-browse-button {
    grid-column: 1 / -1;
    width: 100%;
  }
  .pe-start-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .pe-start-actions button { width: 100%; }
  .pe-top-actions .pe-secondary span,
  .pe-top-actions .pe-primary span { display: inline; }
}

/* ToolTapGo v31: focused PDF editor tool behaviour and menus */
.pe-page-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.pe-contextbar { min-height: 50px; align-items: center; }
.pe-contextbar .pe-context-label { min-width: max-content; }
.pe-contextbar .pe-font-button { min-width: 132px; justify-content: space-between; }
.pe-contextbar .pe-font-size { width: 58px !important; min-width: 58px !important; max-width: 58px !important; }
.pe-contextbar .pe-icon-control { width: 36px; min-width: 36px; padding: 0; }
.pe-contextbar .pe-number-control { gap: 6px; }
.pe-contextbar .pe-number-control input[type="number"] { width: 48px !important; min-width: 48px !important; max-width: 48px !important; }
.pe-contextbar label:has(input[type="range"]) output { min-width: 34px; color: var(--pe-teal); font-size: .67rem; font-weight: 850; }
.pe-contextbar .pe-danger-control { color: var(--pe-danger); }
.pe-contextbar .pe-context-hint-left { margin-left: 0; margin-right: auto; }

.pe-handdraw-draft {
  position: absolute;
  inset: auto;
  z-index: 24;
  overflow: visible;
  pointer-events: none;
}
.pe-vector-draft {
  position: absolute;
  inset: 0;
  z-index: 24;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.pe-handdraw-draft path,
.pe-vector-draft line { filter: drop-shadow(0 1px 1px rgba(16,47,45,.12)); }

.pe-more-popover { width: min(390px, calc(100vw - 16px)); max-height: min(620px, calc(100vh - 100px)); overflow: hidden; }
.pe-more-popover [data-more-pane] { max-height: 500px; overflow-y: auto; padding-right: 3px; }
.pe-stamp-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
.pe-stamp-tile { min-height: 80px; padding: 11px; border: 1px solid var(--pe-line); border-radius: 11px; background: var(--pe-panel); cursor: pointer; display: grid; place-items: center; }
.pe-stamp-tile:hover { border-color: color-mix(in srgb, var(--pe-brand) 42%, var(--pe-line)); background: var(--pe-panel-soft); }
.pe-stamp-preview { --stamp-colour:#168148; --stamp-bg:#eafff0; min-width: 68px; max-width: 100%; padding: 7px 11px; border: 2px solid var(--stamp-colour); border-radius: 8px; background: var(--stamp-bg); color: var(--stamp-colour); font-size: .72rem; font-weight: 900; line-height: 1.05; text-align: center; text-transform: uppercase; }
.pe-stamp-tile.tone-red .pe-stamp-preview { --stamp-colour:#c64c2e; --stamp-bg:#fff1ec; }
.pe-stamp-tile.tone-blue .pe-stamp-preview { --stamp-colour:#08669b; --stamp-bg:#edf8ff; }
.pe-stamp-tile.tone-amber .pe-stamp-preview { --stamp-colour:#c68000; --stamp-bg:#fff8df; }
.pe-stamp-tile.shape-tag .pe-stamp-preview { min-width: 122px; clip-path: polygon(22% 0,100% 0,100% 100%,22% 100%,0 50%); padding-left: 24px; }
.pe-stamp-tile.shape-pill .pe-stamp-preview { border-radius: 10px; }
.pe-stamp-tile.shape-icon .pe-stamp-preview { min-width: 58px; padding: 2px; border: 0; background: transparent; font-size: 2.35rem; }
.pe-stamp-tile.shape-small .pe-stamp-preview { max-width: 125px; font-size: .57rem; line-height: 1.15; }
.pe-object.type-stamp .pe-object-content { border: 0; background: transparent; }
.pe-stamp-object { --stamp-colour: currentColor; display: grid !important; place-items: center; width: 100%; height: 100%; padding: 7px 10px; border: 2px solid var(--stamp-colour) !important; border-radius: 8px !important; background: rgba(255,255,255,.92); color: var(--stamp-colour); font-weight: 900; line-height: 1.05; text-align: center; }
.pe-stamp-object.shape-tag { clip-path: polygon(22% 0,100% 0,100% 100%,22% 100%,0 50%); padding-left: 18%; }
.pe-stamp-object.shape-icon { border: 0 !important; background: transparent; font-size: 2.6em !important; }
.pe-stamp-object.shape-small { font-size: .72em !important; }

.pe-sign-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.pe-sign-field-grid .pe-secondary { width: 100%; justify-content: flex-start; }

.pe-modal-backdrop { position: fixed; inset: 0; z-index: 10090; display: grid; place-items: center; padding: 20px; background: rgba(16,47,45,.38); backdrop-filter: blur(3px); }
.pe-link-modal { width: min(520px, 100%); display: grid; gap: 17px; padding: 22px; border: 1px solid var(--pe-line); border-radius: 18px; background: var(--pe-panel); box-shadow: var(--pe-shadow); }
.pe-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pe-modal-head > div { display: grid; gap: 5px; }
.pe-modal-head b { font-size: 1.05rem; }
.pe-modal-head span { color: var(--pe-muted); font-size: .76rem; line-height: 1.5; }
.pe-modal-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 9px; align-items: center; }
.pe-exit-modal { width: min(470px, 100%); gap: 14px; }
.pe-exit-modal-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--pe-brand-soft);
  color: var(--pe-brand);
  font-size: 1.05rem;
}
.pe-exit-modal .pe-modal-head { align-items: flex-start; }
.pe-exit-modal .pe-modal-head b { font-size: 1.08rem; }
.pe-exit-modal-actions { grid-template-columns: 1fr 1fr; margin-top: 3px; }
.pe-exit-modal-actions .pe-secondary,
.pe-exit-modal-actions .pe-primary { width: 100%; min-height: 44px; justify-content: center; font-weight: 850; }
.pe-link-error { margin: -8px 0 0; color: var(--pe-danger); font-size: .72rem; }
.pe-danger-text { color: var(--pe-danger); }

.pe-object.type-text .pe-object-content,
.pe-object.type-existingText .pe-object-content,
.pe-object.type-fieldText .pe-object-content { display: block; }

@media (max-width: 760px) {
  .pe-stamp-grid { grid-template-columns: 1fr 1fr; }
  .pe-modal-actions { grid-template-columns: 1fr 1fr; }
  .pe-modal-actions > span { display: none; }
}

/* v32: context bar collapse for Image and consistent professional stamps */
.pe-workspace.pe-no-context {
  grid-template-rows: 54px var(--pe-toolbar-h) minmax(0, 1fr) 34px;
}
.pe-workspace.pe-no-context .pe-contextbar {
  display: none !important;
}
.pe-stamp-preview,
.pe-stamp-object {
  box-sizing: border-box;
  border: 2px solid var(--stamp-colour, currentColor) !important;
  border-radius: 9px !important;
  background: var(--stamp-bg, rgba(255,255,255,.94)) !important;
  color: var(--stamp-colour, currentColor);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}
.pe-stamp-tile.shape-tag .pe-stamp-preview,
.pe-stamp-object.shape-tag {
  clip-path: none !important;
  padding-left: 11px !important;
  border-radius: 5px 11px 11px 5px !important;
  position: relative;
}
.pe-stamp-tile.shape-icon .pe-stamp-preview,
.pe-stamp-object.shape-icon {
  min-width: 64px;
  min-height: 48px;
  padding: 6px 12px !important;
  border: 2px solid var(--stamp-colour, currentColor) !important;
  border-radius: 12px !important;
  background: var(--stamp-bg, rgba(255,255,255,.94)) !important;
  font-size: 1.9rem !important;
}
.pe-stamp-tile.shape-small .pe-stamp-preview,
.pe-stamp-object.shape-small {
  min-width: 108px;
  min-height: 42px;
  padding: 7px 9px !important;
  border-radius: 7px !important;
}
.pe-object.type-stamp .pe-object-content {
  width: 100%;
  height: 100%;
}
.pe-handdraw-draft {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 40 !important;
  overflow: visible !important;
  pointer-events: none !important;
}
.ttg-pe[data-active-tool="draw"] .pe-page-canvas,
.ttg-pe[data-active-tool="draw"] .pe-text-layer,
.ttg-pe[data-active-tool="draw"] .pe-scene-layer,
.ttg-pe[data-active-tool="draw"] .pe-interaction-layer {
  cursor: crosshair !important;
}
@media (max-width: 760px) {
  .pe-workspace.pe-no-context {
    grid-template-rows: 52px var(--pe-toolbar-h) minmax(0, 1fr) 34px;
  }
}

/* v33: text editing, upload cleanup, image picker stability and ToolTapGo visual polish */
.ttg-pe-host-actions,
.ttg-pe-private-note {
  display: none !important;
}

/* The PDF Studio provides its own upload UI. Never show the shared generated uploader. */
.ttg-pe #pePdfFile + .file-dropzone,
.ttg-pe #peImageInput + .file-dropzone,
.ttg-pe #peSignatureInput + .file-dropzone {
  display: none !important;
}

.pe-start-card {
  padding: 24px;
  gap: 20px;
}
.pe-start-heading b {
  font-size: 1rem;
}
.pe-start-heading span,
.pe-pdf-dropzone .pe-file-name small,
.pe-start-private {
  font-size: .76rem;
}
.pe-pdf-dropzone {
  min-height: 108px;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--pe-teal-soft) 48%, var(--pe-panel));
}
.pe-pdf-dropzone .pe-file-name b {
  font-size: .86rem;
}
.pe-start-actions .pe-secondary,
.pe-start-actions .pe-primary,
.pe-browse-button {
  min-height: 44px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 800;
}

/* Top document action bar follows the same sizing as normal ToolTapGo controls. */
.pe-topbar {
  min-height: 60px;
  gap: 14px;
  padding: 8px 14px;
}
.pe-top-actions {
  gap: 8px;
}
.pe-top-actions .pe-secondary,
.pe-top-actions .pe-primary,
.pe-top-actions .pe-icon-btn {
  min-height: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1;
}
.pe-top-actions .pe-secondary,
.pe-top-actions .pe-primary {
  padding-inline: 14px;
}
.pe-top-actions button i {
  font-size: .8rem;
}
.pe-document-copy b {
  font-size: .82rem;
}
.pe-document-copy small {
  font-size: .68rem;
}

/* Right properties panel typography and control alignment. */
.pe-sidebar-right,
#toolFields .pe-sidebar-right {
  width: 328px;
  min-width: 328px;
}
.pe-inspector {
  padding: 18px;
  overflow-x: hidden;
}
.pe-inspector-section {
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 18px;
}
.pe-inspector-section h3 {
  margin: 0;
  font-family: "Plus Jakarta Sans", Manrope, sans-serif;
  font-size: .96rem;
  line-height: 1.3;
}
.pe-inspector-section p {
  margin: 0;
  font-size: .76rem;
  line-height: 1.55;
}
.pe-field {
  gap: 7px;
  font-size: .75rem;
  line-height: 1.3;
}
.pe-field input,
.pe-field select[data-native-select],
.pe-field textarea {
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 11px;
  font-size: .78rem;
  line-height: 1.4;
}
.pe-field textarea {
  min-height: 90px;
}
.pe-field-row {
  gap: 10px;
}
.pe-check-row {
  gap: 8px;
  font-size: .75rem;
}
.pe-inspector-actions {
  gap: 9px;
}
.pe-inspector-actions .pe-secondary,
.pe-inspector .pe-primary,
.pe-inspector .pe-secondary {
  min-height: 42px;
  padding-inline: 11px;
  border-radius: 11px;
  font-size: .75rem;
  font-weight: 800;
  justify-content: center;
}

/* Text objects: click to edit, drag to move. Avoid move cursor while editing. */
.pe-object.type-text,
.pe-object.type-existingText,
.pe-object.type-fieldText,
.pe-object.type-note {
  cursor: text;
}
.pe-object.type-text.is-editing,
.pe-object.type-existingText.is-editing,
.pe-object.type-fieldText.is-editing,
.pe-object.type-note.is-editing {
  cursor: text;
}
.pe-object.is-editing .pe-object-content {
  overflow: visible;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  outline: 1px dashed color-mix(in srgb, var(--pe-brand) 70%, transparent);
  outline-offset: 2px;
}
.pe-object.is-editing::after {
  display: none;
}
.pe-object.is-editing [contenteditable="true"] {
  min-width: 100%;
  min-height: 100%;
  caret-color: var(--pe-brand);
}

/* Erase uses a visible eraser cursor rather than the generic plus/crosshair. */
.ttg-pe[data-active-tool="erase"] .pe-stage,
.ttg-pe[data-active-tool="erase"] .pe-page-wrap,
.ttg-pe[data-active-tool="erase"] .pe-interaction-layer {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg transform='rotate(-35 14 14)'%3E%3Crect x='5' y='8' width='18' height='12' rx='3' fill='%23ffffff' stroke='%23ef6a47' stroke-width='2'/%3E%3Cpath d='M14 8v12' stroke='%23ef6a47' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E") 8 20, auto !important;
}

@media (max-width: 1280px) {
  .pe-shell {
    grid-template-columns: 184px minmax(0, 1fr) 304px;
  }
  .pe-sidebar-right,
  #toolFields .pe-sidebar-right {
    width: 304px;
    min-width: 304px;
  }
}
@media (max-width: 760px) {
  .pe-sidebar-right,
  #toolFields .pe-sidebar-right {
    width: min(328px, 92vw);
    min-width: 0;
  }
  .pe-top-actions .pe-secondary,
  .pe-top-actions .pe-primary,
  .pe-top-actions .pe-icon-btn {
    min-height: 40px;
    height: 40px;
  }
}


/* v34: hidden contextual toolbar must not collapse the PDF canvas row. */
.pe-workspace.pe-no-context {
  grid-template-rows: 60px var(--pe-toolbar-h) minmax(0, 1fr) 38px !important;
}
@media (max-width: 760px) {
  .pe-workspace.pe-no-context {
    grid-template-rows: 52px var(--pe-toolbar-h) minmax(0, 1fr) 34px !important;
  }
}
@media (max-width: 480px) {
  .pe-workspace.pe-no-context {
    grid-template-rows: 50px 58px minmax(0, 1fr) 32px !important;
  }
}


/* ToolTapGo v35: stable toolbar sizing and one-shot text placement */
.pe-main-toolbar { align-items: center; }
.pe-tool,
#toolFields .pe-tool,
.pe-tool.active,
#toolFields .pe-tool.active {
  box-sizing: border-box;
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  height: 52px;
  min-height: 52px;
  margin: 0;
  border-width: 1px;
}
.pe-tool-group { align-items: center; }
.pe-move-text-control { color: var(--pe-teal); }
.pe-move-text-control i { color: var(--pe-teal); }

/* v36 Edit PDF detection layer: text and image objects */
.pe-image-boundary {
  position: absolute;
  display: block;
  border: 1px dashed rgba(17, 103, 95, .48);
  border-radius: 3px;
  background: rgba(17, 103, 95, .035);
  cursor: move;
  pointer-events: auto;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.pe-text-layer.edit-mode .pe-text-span {
  outline: 1px dashed rgba(17, 103, 95, .34);
  outline-offset: -1px;
}
.pe-text-layer.edit-mode .pe-text-span:hover,
.pe-text-layer.edit-mode .pe-image-boundary:hover {
  outline-color: rgba(17, 103, 95, .9);
  border-color: rgba(17, 103, 95, .9);
  background: rgba(51, 176, 160, .12);
  box-shadow: 0 0 0 2px rgba(51, 176, 160, .08);
}
.pe-image-boundary.edited,
.pe-text-span.edited {
  opacity: 0;
  pointer-events: none;
}
.pe-existing-source-mask {
  position: absolute;
  z-index: 0;
  display: block;
  background: #fff;
  pointer-events: none;
  transform-origin: 50% 50%;
}
.pe-object.type-existingImage .pe-object-content,
.pe-object.type-existingText .pe-object-content {
  background-clip: padding-box;
}
.pe-object.type-existingImage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  pointer-events: none;
}
.ttg-pe[data-active-tool="editText"] .pe-text-layer { cursor: default; }


/* ToolTapGo v38: stable toolbar, exact text sizes, upload and inspector polish */
.pe-main-toolbar {
  align-items: center !important;
  min-height: var(--pe-toolbar-h);
}
.pe-tool-group {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 58px;
}
.pe-tool,
#toolFields .pe-tool,
.pe-tool.active,
#toolFields .pe-tool.active {
  flex: 0 0 68px !important;
  width: 68px !important;
  min-width: 68px !important;
  max-width: 68px !important;
  height: 52px !important;
  min-height: 52px !important;
  padding: 4px 5px !important;
  border-width: 1px !important;
  border-radius: 11px !important;
}
.pe-tool i { width: 20px; text-align: center; }
.pe-tool.active { padding: 4px 5px !important; }
.pe-top-actions .pe-primary,
#peExport {
  color: #fff !important;
}
.pe-top-actions .pe-primary i,
.pe-top-actions .pe-primary span,
#peExport i,
#peExport span { color: #fff !important; }
.pe-contextbar .pe-font-size,
#toolFields .pe-contextbar input.pe-font-size[type="number"] {
  width: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 9px !important;
  border: 1px solid var(--pe-line) !important;
  border-radius: 11px !important;
  background: var(--pe-panel) !important;
  color: var(--pe-ink) !important;
  font-size: .76rem !important;
  line-height: 38px !important;
}
.pe-contextbar .pe-font-button,
.pe-contextbar .pe-icon-control,
.pe-contextbar .pe-context-control {
  min-height: 38px;
  height: 38px;
}
#toolFields .pe-contextbar label.pe-context-control {
  min-height: 38px;
  height: 38px;
}
.pe-start-card {
  gap: 14px;
  padding: 22px;
  border-radius: 20px;
}
.pe-start-copy {
  display: grid;
  gap: 5px;
}
.pe-start-copy b {
  color: var(--pe-ink);
  font-family: "Plus Jakarta Sans", Manrope, sans-serif;
  font-size: .9rem;
  line-height: 1.25;
}
.pe-start-copy span {
  color: var(--pe-muted);
  font-size: .74rem;
  line-height: 1.5;
}
.pe-pdf-dropzone {
  min-height: 112px;
  padding: 18px;
  border-radius: 17px;
  background: color-mix(in srgb, var(--pe-teal-soft) 40%, var(--pe-panel));
}
#toolFields label.pe-pdf-dropzone {
  width: 100%;
  min-height: 112px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  margin: 0;
  padding: 18px;
}
#toolFields label.pe-pdf-dropzone > input[type="file"] {
  position: absolute;
  width: 1px !important;
  min-width: 1px !important;
  max-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0;
  pointer-events: none;
}
#toolFields label.pe-pdf-dropzone .pe-browse-button {
  width: auto;
  min-width: max-content;
}
.pe-pdf-dropzone .pe-file-name b { font-size: .84rem; }
.pe-pdf-dropzone .pe-file-name small { font-size: .72rem; }
.pe-start-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
}
.pe-start-actions .pe-primary {
  width: 100%;
  justify-content: center;
}
.pe-start-private { font-size: .7rem; }
.pe-sidebar-right,
#toolFields .pe-sidebar-right {
  width: 342px;
  min-width: 342px;
}
.pe-shell {
  grid-template-columns: 184px minmax(0, 1fr) 342px !important;
}
.pe-inspector {
  padding: 20px 22px 24px;
}
.pe-inspector-section {
  width: 100%;
  min-width: 0;
  gap: 13px;
  margin-bottom: 20px;
  padding-bottom: 20px;
}
.pe-sign-tabs { gap: 8px; }
.pe-sign-tabs button {
  min-height: 40px;
  padding: 0 12px;
  font-size: .74rem;
}
.pe-sign-field-grid {
  gap: 9px;
}
.pe-sign-field-grid .pe-secondary {
  min-height: 43px;
  padding-inline: 12px;
  justify-content: center;
}
.pe-sign-preview {
  min-height: 96px;
  margin-top: 2px;
}
.pe-inspector .pe-primary,
.pe-inspector .pe-secondary {
  min-height: 43px;
}
.pe-text-layer .pe-text-span {
  transform-origin: left top;
  line-height: 1;
}
@media (max-width: 1280px) {
  .pe-sidebar-right,
  #toolFields .pe-sidebar-right {
    width: 316px;
    min-width: 316px;
  }
  .pe-shell {
    grid-template-columns: 184px minmax(0, 1fr) 316px !important;
  }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .pe-shell {
    grid-template-columns: 154px minmax(0, 1fr) !important;
  }
  .pe-sidebar-right,
  #toolFields .pe-sidebar-right {
    position: absolute;
    inset: 0 0 0 auto;
    width: min(316px, 92vw);
    min-width: 0;
  }
}
@media (max-width: 760px) {
  .pe-shell {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .pe-sidebar-right,
  #toolFields .pe-sidebar-right {
    width: min(342px, 92vw);
    min-width: 0;
  }
  .pe-start-actions { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  #toolFields label.pe-pdf-dropzone {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 16px;
  }
  #toolFields label.pe-pdf-dropzone .pe-browse-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Font Awesome Free fallback for the requested light star class. */
.ttg-pe .fa-light.fa-star::before {
  font-family: "Font Awesome 7 Free";
  font-weight: 400;
  content: "\f005";
}

/* v38.2: collapsible panel rails, separate zoom controls, and actual Font Awesome objects. */
.pe-shell {
  transition: grid-template-columns .26s cubic-bezier(.22, .8, .28, 1);
}
.pe-sidebar-left,
.pe-sidebar-right {
  position: relative;
  overflow: hidden;
  transition: width .26s cubic-bezier(.22, .8, .28, 1), min-width .26s cubic-bezier(.22, .8, .28, 1), box-shadow .2s ease;
}
.pe-sidebar-left.pe-panel-closed,
.pe-sidebar-right.pe-panel-closed {
  width: 54px !important;
  min-width: 54px !important;
  display: grid !important;
}
.pe-sidebar-left.pe-panel-closed {
  grid-template-rows: 48px minmax(0, 1fr);
}
.pe-sidebar-left.pe-panel-closed .pe-sidebar-head {
  justify-content: center;
  padding-inline: 7px;
}
.pe-sidebar-left .pe-sidebar-head > span {
  min-width: 0;
  opacity: 1;
  white-space: nowrap;
  transition: opacity .16s ease, max-width .24s ease;
}
.pe-sidebar-left.pe-panel-closed .pe-sidebar-head > span {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
}
.pe-sidebar-head .pe-icon-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}
.pe-sidebar-head .pe-icon-btn i { transition: transform .24s ease; }
.pe-sidebar-left.pe-panel-closed .pe-sidebar-head .pe-icon-btn i { transform: rotate(180deg); }
.pe-sidebar-left.pe-panel-closed .pe-thumbs {
  padding: 7px;
  overflow-x: hidden;
}
.pe-sidebar-left.pe-panel-closed .pe-thumb-row {
  width: 40px;
  min-height: 38px;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  gap: 0;
  margin: 0 0 6px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
}
.pe-sidebar-left.pe-panel-closed .pe-thumb-index {
  width: 100%;
  min-height: 36px;
  display: grid;
  place-items: center;
  color: var(--pe-muted);
  font-size: .72rem;
  font-weight: 800;
}
.pe-sidebar-left.pe-panel-closed .pe-thumb-row:hover {
  border-color: color-mix(in srgb, var(--pe-teal) 32%, var(--pe-line));
  background: var(--pe-teal-soft);
}
.pe-sidebar-left.pe-panel-closed .pe-thumb-row.active {
  border-color: color-mix(in srgb, var(--pe-brand) 52%, var(--pe-line));
  background: var(--pe-brand-soft);
}
.pe-sidebar-left.pe-panel-closed .pe-thumb-row.active .pe-thumb-index { color: var(--pe-brand); }
.pe-sidebar-left.pe-panel-closed .pe-thumb-row:focus-visible {
  outline: 2px solid var(--pe-teal);
  outline-offset: 1px;
}
.pe-sidebar-left.pe-panel-closed .pe-thumb-sheet,
.pe-sidebar-left.pe-panel-closed .pe-thumb-meta,
.pe-sidebar-left.pe-panel-closed .pe-page-actions { display: none !important; }
.pe-panel-rail-button {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 3;
  width: 40px;
  min-width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--pe-line);
  border-radius: 11px;
  background: var(--pe-panel);
  color: var(--pe-teal);
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px);
  transition: opacity .16s ease, transform .24s ease, border-color .16s ease, background .16s ease;
}
.pe-sidebar-right.pe-panel-closed .pe-panel-rail-button {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}
.pe-panel-rail-button:hover {
  border-color: color-mix(in srgb, var(--pe-teal) 45%, var(--pe-line));
  background: var(--pe-teal-soft);
}
.pe-panel-rail-button:focus-visible {
  outline: 2px solid var(--pe-teal);
  outline-offset: 2px;
}
.pe-sidebar-right .pe-right-tabs,
.pe-sidebar-right .pe-inspector {
  transition: opacity .16s ease;
}
.pe-sidebar-right.pe-panel-closed .pe-right-tabs,
.pe-sidebar-right.pe-panel-closed .pe-inspector {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.pe-page-actions {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
}
.pe-page-actions button {
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  line-height: 1;
}
.pe-page-actions button i {
  width: 1em;
  height: 1em;
  display: block;
  line-height: 1;
  text-align: center;
}
.pe-top-zoom {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.pe-top-actions .pe-top-zoom .pe-icon-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  border: 1px solid var(--pe-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm, 0 7px 18px rgba(34,43,38,.07));
}
.pe-top-actions .pe-top-zoom .pe-icon-btn:hover {
  border-color: color-mix(in srgb, var(--pe-teal) 42%, var(--pe-line));
  background: var(--pe-teal-soft);
  color: var(--pe-teal);
}
.pe-zoom-readout {
  min-width: 58px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 9px;
  border: 1px solid var(--pe-line);
  border-radius: 12px;
  background: #fff;
  color: var(--pe-ink);
  font-size: .75rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.pe-status-right .pe-zoom-readout {
  min-width: 50px;
  height: 28px;
  padding-inline: 7px;
  border-radius: 8px;
}
.pe-top-actions .pe-leave-studio {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  margin-left: 2px;
  border-color: color-mix(in srgb, var(--pe-teal) 28%, var(--pe-line));
  color: var(--pe-teal);
}
.pe-fa-vector {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  pointer-events: none;
}
.pe-fa-vector i {
  width: 1em;
  height: 1em;
  display: block;
  font-size: var(--pe-fa-size);
  line-height: 1;
  text-align: center;
  transform-origin: center;
}
.pe-fa-vector-symbol i { transform: none; }
.pe-object.type-arrow .pe-object-content,
.pe-object.type-cross .pe-object-content,
.pe-object.type-check .pe-object-content,
.pe-object.type-star .pe-object-content { overflow: visible; }
.pe-object.type-arrow,
.pe-object.type-arrow .pe-object-content,
.pe-object.type-arrow .pe-arrow-svg { overflow: visible !important; }
.pe-object.type-existingText .pe-object-content {
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid transparent;
  background: transparent !important;
  line-height: 1;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  overflow: visible;
}
.pe-object.type-existingText.is-editing .pe-object-content {
  border-color: #3b82f6;
}
.pe-object.type-existingText.is-source-preview .pe-object-content {
  background: #ffffff !important;
  box-shadow: 0 0 0 2px #ffffff;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
}
@media (max-width: 760px) {
  .pe-top-zoom { height: 40px; gap: 5px; }
  .pe-top-actions .pe-top-zoom .pe-icon-btn { width: 38px; min-width: 38px; height: 40px; min-height: 40px; }
  .pe-top-zoom .pe-zoom-readout { min-width: 50px; height: 40px; }
  .pe-sidebar-left.pe-panel-closed { left: 0; width: 54px !important; }
  .pe-sidebar-right.pe-panel-closed { right: 0; width: 54px !important; }
}

/* Edit PDF session and original-text formatting controls. */
.pe-edit-session-actions {
  display: inline-flex;
  align-items: stretch;
  gap: 7px;
  flex: 0 0 auto;
  margin-left: 2px;
  padding-left: 9px;
  border-left: 1px solid var(--pe-line);
}
.pe-edit-session-actions[hidden] { display: none !important; }
.pe-edit-session-actions .pe-secondary {
  min-height: 55px;
  padding-inline: 15px;
  border-radius: 13px;
  background: var(--pe-panel);
  box-shadow: var(--shadow-sm, 0 7px 18px rgba(34,43,38,.06));
  font-weight: 900;
}
.pe-edit-session-actions .pe-secondary span { font-weight: 900; }
.pe-edit-session-actions .pe-apply-edits {
  border-color: color-mix(in srgb, var(--pe-teal) 38%, var(--pe-line));
  color: var(--pe-teal);
}
.pe-edit-session-actions .pe-apply-edits:hover {
  background: var(--pe-teal-soft);
}
.pe-edit-session-actions .pe-discard-edits,
.pe-inspector .pe-discard-edits {
  border-color: color-mix(in srgb, var(--pe-danger) 28%, var(--pe-line));
  color: var(--pe-danger);
}
.pe-edit-session-actions .pe-discard-edits:hover,
.pe-inspector .pe-discard-edits:hover {
  background: color-mix(in srgb, var(--pe-danger) 8%, var(--pe-panel));
}
.pe-format-toggle-grid,
.pe-align-toggle-grid {
  display: grid;
  gap: 7px;
}
.pe-format-toggle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pe-align-toggle-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pe-format-toggle-grid .pe-secondary,
.pe-align-toggle-grid .pe-secondary {
  width: 100%;
  min-width: 0;
  justify-content: center;
  padding-inline: 7px;
}
.pe-format-toggle-grid .pe-secondary.active,
.pe-align-toggle-grid .pe-secondary.active {
  border-color: #9fc7c2;
  background: var(--pe-teal-soft);
  color: var(--pe-teal);
}
.pe-workspace.pe-edit-session-dirty .pe-tool:disabled {
  opacity: .3;
  filter: grayscale(1);
  border-color: transparent;
  background: #eef0ef;
  color: #8b9693;
  box-shadow: none;
  cursor: not-allowed;
}
.pe-workspace.pe-crop-session-dirty .pe-page-actions button.active {
  border-color: var(--pe-brand);
  background: var(--pe-brand-soft);
  color: var(--pe-brand);
  box-shadow: inset 0 -2px 0 var(--pe-brand);
}
.pe-crop-session-actions { margin-top: 10px; }
.pe-crop-session-actions .pe-primary,
.pe-crop-session-actions .pe-secondary { font-weight: 900; }

/* Brand-orange actions always keep accessible white labels and icons. */
.ttg-pe .pe-primary,
.ttg-pe .pe-browse-button,
.ttg-pe .pe-primary *,
.ttg-pe .pe-browse-button * {
  color: #fff !important;
}
.pe-object.type-existingText.is-geometry-edited .pe-object-content {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .pe-edit-session-actions .pe-secondary { min-height: 50px; padding-inline: 11px; }
  .pe-edit-session-actions .pe-secondary span { display: none; }
}

/* ToolTapGo v42: PDF editor dark-mode control polish and simplified lower toolbar */
[data-theme="dark"] .ttg-pe .pe-top-actions .pe-top-zoom .pe-icon-btn,
[data-theme="dark"] .ttg-pe .pe-zoom-readout,
[data-theme="dark"] .ttg-pe .pe-statusbar button,
[data-theme="dark"] .ttg-pe .pe-status-right .pe-zoom-readout{
  background:var(--pe-panel-soft);
  color:var(--pe-ink);
  border-color:var(--pe-line);
}
[data-theme="dark"] .ttg-pe .pe-top-actions .pe-top-zoom .pe-icon-btn:hover,
[data-theme="dark"] .ttg-pe .pe-statusbar button:hover{
  background:var(--pe-teal-soft);
  color:var(--pe-teal);
  border-color:color-mix(in srgb,var(--pe-teal) 42%,var(--pe-line));
}
[data-theme="dark"] .ttg-pe .pe-statusbar{
  background:color-mix(in srgb,var(--pe-panel) 92%,#081210 8%);
}
.pe-status-right{
  gap:8px;
}
.pe-status-right .pe-zoom-readout.pe-zoom-readout-passive{
  min-width:56px;
  background:var(--pe-panel);
}

/* ToolTapGo v46: PDF editor page spacing and dark-mode readability */
body.ttg-pdf-editor-page:not(.ttg-pdf-editor-active) .ttg-pe-page-main{
  padding-bottom:34px;
}
body.ttg-pdf-editor-page:not(.ttg-pdf-editor-active) .ttg-pe-host{
  margin-bottom:30px;
}
body.ttg-pdf-editor-page:not(.ttg-pdf-editor-active) .ttg-pe-bootstrap-panel{
  margin-bottom:0;
}
[data-theme="dark"] .ttg-pe .pe-panel-notice.info,
[data-theme="dark"] .ttg-pe .pe-panel-notice.info *{
  color:#c7eee7 !important;
}
[data-theme="dark"] .ttg-pe .pe-panel-notice.info{
  background:#153b37 !important;
  border-color:#5fa99f !important;
  box-shadow:none;
}
[data-theme="dark"] .ttg-pe .pe-panel-notice.info i{
  color:#7fd8cb !important;
}

/* Final mobile access and workspace spacing */
.ttg-pe-site-footer{margin-top:48px}
.ttg-pe-workspace{min-height:0}
@media(max-width:640px){body.ttg-pdf-editor-page{overflow-x:hidden}.ttg-pe-site-footer{margin-top:18px}}
