/* g1tech.in – PDF editor workspace (tools/edit-pdf). Desktop: tools | thumbnails | pages | properties.
   Phones: top bar, pages, tool strip at the bottom, pages drawer and properties sheet. */
.pe { --pe-line: #d9dee8; --pe-bg: #eef1f6; --pe-panel: #fff; --pe-ink: #1f2937; --pe-muted: #6b7280; --pe-acc: #2563eb; --pe-acc-soft: #e8efff; color: var(--pe-ink); }
.pe [hidden] { display: none !important; }
.pe-start { max-width: 760px; margin: 0 auto; }
.pe-or { text-align: center; margin: 10px 0 0; }
.pe-restore { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid #f3d27a; background: #fff8e1; border-radius: 12px; }
.pe-restore > span { flex: 1 1 240px; }
.pe-note { margin-top: 10px; }

/* the app fills the tool box; taller in full screen */
.pe-app { display: flex; flex-direction: column; height: clamp(520px, calc(100vh - 150px), 1100px); border: 1px solid var(--pe-line); border-radius: 14px; overflow: hidden; background: var(--pe-bg); position: relative; }
.is-fullscreen .pe-app, :fullscreen .pe-app, .tool-app.fs .pe-app { height: calc(100vh - 90px); }
.pe.busy .pe-app::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, .35); cursor: progress; z-index: 50; }

/* top toolbar */
.pe-top { display: flex; align-items: center; gap: 2px; padding: 6px 8px; background: var(--pe-panel); border-bottom: 1px solid var(--pe-line); overflow-x: auto; scrollbar-width: thin; flex: none; }
.pe-b { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 36px; height: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--pe-ink); font: 600 .85rem system-ui, sans-serif; cursor: pointer; white-space: nowrap; flex: none; }
.pe-b:hover:not(:disabled) { background: var(--pe-acc-soft); }
.pe-b:disabled { opacity: .35; cursor: default; }
.pe-b[aria-pressed="true"] { background: var(--pe-acc-soft); color: var(--pe-acc); }
.pe-b.sm { min-width: 30px; height: 30px; padding: 0 6px; font-size: .95rem; }
.pe-ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pe-zoom { min-width: 54px; font-variant-numeric: tabular-nums; }
.pe-sep { width: 1px; height: 22px; background: var(--pe-line); margin: 0 4px; flex: none; }
.pe-grow { flex: 1 1 auto; }
.pe-search { display: flex; align-items: center; gap: 2px; flex: none; }
.pe-search-in { width: 170px; height: 32px; border: 1px solid var(--pe-line); border-radius: 8px; padding: 0 8px; font: inherit; }
.pe-search-n { font-size: .8rem; min-width: 52px; }
.pe-nav { display: flex; align-items: center; gap: 2px; flex: none; font-size: .85rem; }
.pe-pageno { width: 42px; height: 30px; text-align: center; border: 1px solid var(--pe-line); border-radius: 7px; font: inherit; }
.pe-dl { flex: none; display: inline-flex; gap: 6px; align-items: center; margin-left: 4px; }
.pe-dl .pe-ic { stroke: #fff; }

/* body */
.pe-body { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }
.pe-tools { flex: none; width: 78px; overflow-y: auto; background: var(--pe-panel); border-right: 1px solid var(--pe-line); padding: 6px 4px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.pe-tool { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; border: 0; border-radius: 10px; background: transparent; color: var(--pe-ink); font: 600 .66rem/1.15 system-ui, sans-serif; text-align: center; cursor: pointer; }
.pe-tool:hover { background: #f3f5f9; }
.pe-tool.on { background: var(--pe-acc-soft); color: var(--pe-acc); box-shadow: inset 0 0 0 1.5px #b9ccff; }
.pe-tools-sep { height: 1px; background: var(--pe-line); margin: 6px 6px; flex: none; }

.pe-thumbs { flex: none; width: 168px; display: flex; flex-direction: column; background: #f7f8fb; border-right: 1px solid var(--pe-line); transition: margin .2s; }
.pe-thumbs.off { display: none; }
.pe-thumbs-bar { display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--pe-line); font-size: .78rem; }
.pe-thumbs-bar .pe-check { margin-right: auto; }
.pe-check { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; cursor: pointer; }
.pe-thumb-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; }
.pe-thumb { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 10px; border: 2px solid transparent; }
.pe-thumb.cur { border-color: #b9ccff; background: #fff; }
.pe-thumb.sel { background: var(--pe-acc-soft); border-color: var(--pe-acc); }
.pe-thumb.dragging { opacity: .45; }
.pe-thumb.drop-before { box-shadow: 0 -4px 0 var(--pe-acc); }
.pe-thumb-go { border: 0; padding: 0; background: none; cursor: pointer; line-height: 0; }
.pe-thumb-go canvas { box-shadow: 0 1px 4px rgba(0, 0, 0, .25); background: #fff; }
.pe-thumb-bar { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.pe-thumb-acts { display: flex; gap: 1px; }
.pe-thumb-acts button { border: 0; background: none; width: 24px; height: 24px; border-radius: 6px; cursor: pointer; font-size: .85rem; color: var(--pe-muted); }
.pe-thumb-acts button:hover { background: #e5e9f2; color: var(--pe-ink); }
[data-tdrag] { cursor: grab; touch-action: none; }

/* pages */
.pe-canvas { flex: 1 1 auto; overflow: auto; position: relative; outline: none; overscroll-behavior: contain; }
.pe-canvas.panning { cursor: grabbing; }
.pe-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 16px; min-width: min-content; }
.pe-page { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 6px 18px rgba(0, 0, 0, .08); flex: none; overflow: hidden; }
.pe-pc { position: absolute; left: 0; top: 0; display: block; }
.pe-num { position: absolute; right: 6px; bottom: 4px; font: 600 11px system-ui, sans-serif; color: #9aa3b2; pointer-events: none; }
.pe-layer { position: absolute; transform-origin: center center; }
[data-mode="hand"] .pe-canvas { cursor: grab; }
[data-mode="text"] .pe-layer, [data-mode="note"] .pe-layer, [data-mode="stamp"] .pe-layer { cursor: text; }
[data-mode="draw"] .pe-layer, [data-mode="shape"] .pe-layer, [data-mode="highlight"] .pe-layer, [data-mode="underline"] .pe-layer, [data-mode="strike"] .pe-layer,
[data-mode="whiteout"] .pe-layer, [data-mode="link"] .pe-layer, [data-mode="crop"] .pe-layer { cursor: crosshair; }
.pe:not([data-mode="select"]):not([data-mode="hand"]) .pe-layer { touch-action: none; }

/* objects */
.pe-obj { position: absolute; box-sizing: border-box; transform-origin: center center; outline: none; }
.pe-obj.sel { box-shadow: 0 0 0 calc(1.5px * var(--inv, 1)) var(--pe-acc); }
.pe-obj:focus-visible { box-shadow: 0 0 0 calc(2px * var(--inv, 1)) #f59e0b; }
[data-mode="select"] .pe-obj, [data-mode="edit"] .pe-obj { cursor: move; }
.pe-obj svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.t-line svg { left: 0; top: 0; }
.pe-tx { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; min-height: 1em; outline: none; margin: 0; padding: 0; }
.pe-obj.editing { cursor: text; box-shadow: 0 0 0 calc(1.5px * var(--inv, 1)) #f59e0b; }
.pe-obj.editing .pe-tx { cursor: text; }
.pe-imgclip { position: absolute; inset: 0; overflow: hidden; box-sizing: border-box; }
.pe-imgclip img { position: absolute; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.pe-hl { position: absolute; inset: 0; mix-blend-mode: multiply; }
.pe-ml { position: absolute; left: 0; right: 0; }
.pe-linkbox { position: absolute; inset: 0; border: calc(1.2px * var(--inv, 1)) dashed #2563eb; background: rgba(37, 99, 235, .08); }
.pe-stamp { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border: 3px solid; border-radius: 8px; font: 800 1em Helvetica, Arial, sans-serif; letter-spacing: .04em; white-space: nowrap; overflow: hidden; }
.pe-wo { position: absolute; inset: 0; }
.t-whiteout { box-shadow: 0 0 0 calc(1px * var(--inv, 1)) rgba(0, 0, 0, .12); }
.pe-cover { position: absolute; pointer-events: none; }
.pe-mark { position: absolute; white-space: pre; pointer-events: none; transform-origin: center center; }
.pe-cropshade { position: absolute; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .45); outline: calc(1.5px * var(--inv, 1)) dashed #fff; pointer-events: none; z-index: 1; }

/* handles keep their size at any zoom */
.pe-h { position: absolute; width: calc(12px * var(--inv, 1)); height: calc(12px * var(--inv, 1)); margin: calc(-6px * var(--inv, 1)) 0 0 calc(-6px * var(--inv, 1)); background: #fff; border: calc(1.5px * var(--inv, 1)) solid var(--pe-acc); border-radius: 3px; z-index: 5; touch-action: none; }
.pe-h.nw { left: 0; top: 0; cursor: nwse-resize; } .pe-h.n { left: 50%; top: 0; cursor: ns-resize; } .pe-h.ne { left: 100%; top: 0; cursor: nesw-resize; }
.pe-h.e { left: 100%; top: 50%; cursor: ew-resize; } .pe-h.se { left: 100%; top: 100%; cursor: nwse-resize; } .pe-h.s { left: 50%; top: 100%; cursor: ns-resize; }
.pe-h.sw { left: 0; top: 100%; cursor: nesw-resize; } .pe-h.w { left: 0; top: 50%; cursor: ew-resize; }
.pe-h.rot { left: 50%; top: calc(-26px * var(--inv, 1)); border-radius: 50%; cursor: grab; background: var(--pe-acc); }
.pe-h.rot::after { content: ''; position: absolute; left: 50%; top: 100%; width: calc(1.5px * var(--inv, 1)); height: calc(14px * var(--inv, 1)); background: var(--pe-acc); transform: translateX(-50%); }
.pe-h.end { border-radius: 50%; cursor: move; }
@media (pointer: coarse) { .pe-h { width: calc(20px * var(--inv, 1)); height: calc(20px * var(--inv, 1)); margin: calc(-10px * var(--inv, 1)) 0 0 calc(-10px * var(--inv, 1)); } }

/* while creating */
.pe-ghost { position: absolute; pointer-events: none; border: calc(1.5px * var(--inv, 1)) dashed var(--pe-acc); background: rgba(37, 99, 235, .06); }
.pe-ghost.g-highlight { background: rgba(255, 235, 59, .45); border: 0; }
.pe-ghost.g-whiteout { background: #fff; border-color: #94a3b8; }
.pe-ghost.g-crop { border-color: #0f172a; background: transparent; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .3); }
.pe-ghost-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }

/* existing text boxes (Edit text), links, search hits */
.pe-tl { position: absolute; padding: 0; border: calc(1px * var(--inv, 1)) dashed rgba(37, 99, 235, .55); background: rgba(37, 99, 235, .05); border-radius: 2px; cursor: text; }
.pe-tl:hover, .pe-tl:focus-visible { background: rgba(37, 99, 235, .16); border-style: solid; outline: none; }
.pe-oldlink { position: absolute; padding: 0; border: calc(1.5px * var(--inv, 1)) solid #2563eb; background: rgba(37, 99, 235, .12); cursor: pointer; border-radius: 2px; }
.pe-hit { position: absolute; background: rgba(255, 196, 0, .4); pointer-events: none; border-radius: 2px; }
.pe-hit.cur { background: rgba(255, 120, 0, .55); outline: calc(1.5px * var(--inv, 1)) solid #e65100; }

/* properties */
.pe-props { flex: none; width: 290px; background: var(--pe-panel); border-left: 1px solid var(--pe-line); display: flex; flex-direction: column; min-height: 0; }
.pe-props-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--pe-line); }
.pe-props-head strong { font-size: .92rem; }
.pe-props-body { padding: 10px 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; font-size: .86rem; }
.pe-props-body:empty::before { content: 'Choose a tool on the left, or select something on the page to change it.'; color: var(--pe-muted); }
.pe-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pe-f > span { font-size: .74rem; font-weight: 600; color: var(--pe-muted); }
.pe-f .input, .pe-f .select, .pe-f .textarea { width: 100%; min-height: 34px; padding: 4px 8px; font-size: .86rem; }
.pe-f input[type="color"] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--pe-line); border-radius: 7px; background: #fff; }
.pe-f input[type="range"] { width: 100%; }
.pe-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pe-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pe-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pe-chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.pe-seg { display: inline-flex; border: 1px solid var(--pe-line); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.pe-seg button { border: 0; background: #fff; padding: 6px 9px; font-size: .8rem; cursor: pointer; border-right: 1px solid var(--pe-line); }
.pe-seg button:last-child { border-right: 0; }
.pe-seg button.on { background: var(--pe-acc-soft); color: var(--pe-acc); font-weight: 700; }
.pe-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pe-chips .chip { font-weight: 800; font-size: .72rem; }
.pe-sw { width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--pe-line); }
.pe-sub { margin: 4px 0 0; font-weight: 700; font-size: .82rem; }
.pe-btngrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pe-btngrid .btn { justify-content: flex-start; text-align: left; white-space: normal; line-height: 1.2; }
.pe-acc { border: 1px solid var(--pe-line); border-radius: 10px; padding: 6px 10px; }
.pe-acc[open] { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; }
.pe-acc summary { cursor: pointer; font-weight: 700; list-style-position: inside; }
.pe-progress { height: 8px; border-radius: 4px; background: #e5e9f2; overflow: hidden; }
.pe-progress span { display: block; height: 100%; width: 0; background: var(--pe-acc); transition: width .3s; }

.pe-status { flex: none; min-height: 26px; padding: 4px 12px; font-size: .8rem; color: var(--pe-muted); background: var(--pe-panel); border-top: 1px solid var(--pe-line); }
.pe-status:empty { min-height: 0; padding: 0; border: 0; }

/* dialogs */
.pe-dialog { border: 0; border-radius: 16px; padding: 18px 20px; width: min(520px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.pe-dialog::backdrop { background: rgba(15, 23, 42, .5); }
.pe-dialog form { display: flex; flex-direction: column; gap: 12px; }
.pe-dialog h3 { margin: 0; font-size: 1.1rem; }
.pe-fs { border: 1px solid var(--pe-line); border-radius: 10px; padding: 8px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: .9rem; }
.pe-fs[data-dl-pdf] { grid-template-columns: 1fr; }
.pe-fs legend { font-weight: 700; font-size: .82rem; padding: 0 4px; }
.pe-sigpad { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1px dashed #b6bfcc; border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.pe-sigtype { font-family: "Patrick Hand", "Comic Sans MS", cursive; font-size: 1.6rem; }
[data-sigprev] { max-width: 100%; max-height: 120px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.pe-measure { position: absolute; left: -99999px; top: 0; visibility: hidden; white-space: pre-wrap; overflow-wrap: anywhere; word-wrap: break-word; }
.pe-printframe { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; }

/* tablets: properties float over the pages */
@media (max-width: 1180px) {
  .pe-props { position: absolute; right: 0; top: 0; bottom: 0; z-index: 20; box-shadow: -8px 0 24px rgba(0, 0, 0, .12); transform: translateX(105%); visibility: hidden; transition: transform .2s, visibility 0s .2s; }
  .pe-props.has { transform: none; visibility: visible; transition: transform .2s; }
}
/* phones */
@media (max-width: 900px) {
  .pe-app { border-radius: 10px; }
  .hide-sm { display: none !important; }
  .pe-top { gap: 0; padding: 4px; }
  .pe-b { min-width: 34px; padding: 0 6px; }
  .pe-sep { margin: 0 2px; }
  .pe-search-in { width: 120px; }
  .pe-dl span { display: none; }
  .pe-body { flex-direction: column; }
  .pe-tools { order: 3; width: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-top: 1px solid var(--pe-line); padding: 4px; }
  .pe-tool { min-width: 62px; flex: none; }
  .pe-tools-sep { width: 1px; height: auto; margin: 4px; }
  .pe-canvas { order: 1; }
  .pe-pages { padding: 10px 8px; gap: 12px; }
  .pe-thumbs { position: absolute; left: 0; top: 0; bottom: 64px; z-index: 21; width: 160px; box-shadow: 8px 0 24px rgba(0, 0, 0, .15); }
  .pe-props { position: absolute; left: 0; right: 0; top: auto; bottom: 64px; width: auto; max-height: 52%; border-left: 0; border-top: 1px solid var(--pe-line); border-radius: 16px 16px 0 0; transform: translateY(calc(100% + 80px)); box-shadow: 0 -8px 24px rgba(0, 0, 0, .15); }
  .pe-props.has { transform: none; }
  .pe-grid4 { grid-template-columns: repeat(2, 1fr); }
  .pe-fs { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .pe-props, .pe-thumbs, .pe-progress span { transition: none; } }
