/* PDF editor styles: pages, search and comments (left), the pages on a grey desk (centre), properties and history (right). */
:root {
  --field: rgba(204, 224, 255, 0.55);
}
#main { display: flex; flex-direction: row; flex: 1; min-width: 0; min-height: 0; background: var(--panel); }

/* left column */
#pe-left { min-height: 0; }
#pe-pages-pane, #pe-notes-pane { display: flex; flex-direction: column; min-height: 0; }
#pe-notes-pane { flex: 0 0 180px; }
#pe-comments { flex: 1; min-height: 0; overflow: auto; }
.pe-panehead { flex: none; display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 10px; font-size: 11.5px; color: var(--muted); }
.pt-canvas, .pt-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#pe-comments { flex: 1; overflow-y: auto; padding: 4px 6px 16px; }
.cm-row { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 9px; margin-bottom: 6px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text); }
.cm-row:hover { border-color: var(--prog); }
.cm-row.mine { border-left: 3px solid #ffd54f; }
.cm-head { display: flex; gap: 6px; align-items: baseline; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.cm-kind { font-weight: 600; color: var(--text-2); }
.cm-page { margin-left: auto; font-variant-numeric: tabular-nums; }
.cm-text { white-space: pre-wrap; line-height: 1.4; overflow-wrap: anywhere; }

/* centre */
#pe-center { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#pe-scroll { position: relative; flex: 1; min-height: 0; overflow: auto; background: var(--desk); outline: none; }
#pe-scroll.panning, #pe-scroll.panning * { cursor: grabbing !important; }
.pe-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px 28px 48px; min-width: max-content; }
.pe-page { position: relative; flex: none; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 4px 14px rgba(0, 0, 0, 0.08); user-select: none; -webkit-user-select: none; touch-action: none; }
.pe-page.broken::after { content: 'This page could not be drawn'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #b3261e; font-size: 13px; }
.pe-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pe-items, .pe-over { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; overflow: visible; }
.pe-items text { user-select: none; }
.pe-forms { position: absolute; inset: 0; pointer-events: none; }
.pe-field { position: absolute; pointer-events: auto; box-sizing: border-box; margin: 0; border: 0; border-radius: 0; background: var(--field); color: #000; font-family: Arial, Helvetica, sans-serif; padding: 0 2px; outline: none; }
.pe-field:hover { background: rgba(184, 210, 255, 0.75); }
.pe-field:focus { background: rgba(255, 255, 255, 0.95); box-shadow: 0 0 0 2px var(--sel); }
.pe-field:disabled { background: transparent; }
textarea.pe-field { resize: none; padding: 1px 2px; line-height: 1.2; }
.pe-cb { appearance: auto; accent-color: #1a4fa0; padding: 0; width: auto; }
.pe-num { position: absolute; left: 0; right: 0; bottom: -17px; text-align: center; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.pe-edit { position: absolute; z-index: 5; margin: 0; border: 0; outline: 1.5px solid var(--sel); border-radius: 1px; resize: none; overflow: hidden; padding-top: 0; padding-bottom: 0; box-shadow: 0 3px 14px rgba(0, 0, 0, 0.16); }
.pe-print { position: fixed; width: 0; height: 0; border: 0; left: -10px; top: -10px; }

/* right column */
#pe-side { min-height: 0; }
#pe-props { flex: 1; min-height: 0; overflow: auto; padding-bottom: 12px; }
.pe-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.pe-sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18); cursor: pointer; padding: 0; }
.pe-sw.on { box-shadow: 0 0 0 2px var(--prog); }

/* the page widget on the top bar */
.w-page { display: inline-flex; align-items: center; gap: 2px; }
.w-page-inp { width: 38px; height: 26px; border: 1px solid var(--line); border-radius: 6px; text-align: center; font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.w-page-of { font-size: 12.5px; color: var(--muted); white-space: nowrap; padding-right: 2px; font-variant-numeric: tabular-nums; }

/* signatures */
.sig-pop { width: 290px; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.sig-title { font-size: 12px; font-weight: 600; color: var(--text-2); }
.sig-row { display: flex; align-items: center; gap: 4px; }
.sig-pick { flex: 1; height: 60px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; padding: 4px 8px; display: flex; align-items: center; justify-content: center; }
.sig-pick:hover { border-color: var(--prog); }
.sig-pick img, .sig-pick svg { max-width: 100%; max-height: 100%; }
.sig-dialog { display: flex; flex-direction: column; gap: 10px; }
.sig-tabs { display: flex; gap: 6px; }
.sig-tabs .btn.on { background: var(--prog-soft); border-color: var(--prog-soft); color: var(--prog-strong); }
.sig-pad { width: 100%; aspect-ratio: 560 / 200; border: 1px solid #d8d8de; border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }
.sig-pad[hidden], .sig-typed[hidden] { display: none; }
.sig-typed { display: flex; flex-direction: column; gap: 8px; }
.sig-typed-prev { min-height: 90px; border: 1px solid #d8d8de; border-radius: 8px; background: #fff; display: flex; align-items: center; padding: 0 16px; font: 56px Caveat, "Segoe Script", cursive; overflow: hidden; white-space: nowrap; }
.sig-foot { display: flex; align-items: center; justify-content: space-between; }
.sig-colors { display: flex; gap: 6px; }

/* dropping files */
body.dragging #pe-scroll { box-shadow: inset 0 0 0 3px var(--prog); }

/* dialogs */
.kbd-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.kbd-table td { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
kbd { font: 12px var(--mono); background: var(--hover); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
ul.feat { padding-left: 18px; margin: 4px 0; line-height: 1.55; font-size: 13px; }
.small { font-size: 12px; }
.load-error { max-width: 520px; padding: 16px; color: #b3261e; line-height: 1.5; }

@media (max-width: 760px) {
  #main { flex-direction: column; }
  #pe-left { order: 2; width: auto; height: 150px; border-right: 0; border-top: 1px solid var(--line); }
  #pe-thumbs.th-strip { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 8px; }
  #pe-center { order: 1; min-height: 0; }
  .pe-pages { padding: 14px 12px 32px; }
}
@media (max-width: 520px) {
  #pe-left { height: 130px; }
}
