/* OBSCURA OS: PDF.
 *
 * The page is an application window, laid out as Acrobat's is: the menu
 * bar, the toolbar with the file's commands, the pages and the zoom, the
 * row of tools for the tool that is open, then the working area - the
 * navigation rail and its panes on the left, the quick tools beside the
 * document, the document itself, the tools pane on the right - and a
 * status line at the foot. The document is the only thing that scrolls.
 *
 * The colours are the site's own tokens, so the window follows the light
 * or dark theme; only the grey the pages sit on is its own.
 */

body.pdf-app { --pdf-canvas: color-mix(in srgb, var(--paper-inset) 78%, #7a7a7a 22%); --pdf-bar: var(--paper-raised); margin: 0; min-height: 0; height: 100vh; height: 100dvh; overflow: hidden; }
body.pdf-app .os-topbar, body.pdf-app .os-footer, body.pdf-app .os-toolnav,
body.pdf-app #obscuraMainContent > .os-faq-fold, body.pdf-app #obscuraMainContent > .os-rel, body.pdf-app #obLicenceNote { display: none !important; }
body.pdf-app #obscuraMainContent { margin: 0; padding: 0; max-width: none; }
body.pdf-app #ppBadge { left: auto; right: 8px; bottom: 2px; min-height: 20px; padding: 1px 8px; font-size: calc(11px * var(--text-scale, 1)); box-shadow: none; }
.pdf-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.pdf-shell {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font: var(--text-xs)/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  animation: pdf-arrive .2s ease-out both;
  /* An application's frame is not text to select; the words on the pages
     and in the fields are. */
  user-select: none; -webkit-user-select: none;
}
.pdf-shell input, .pdf-shell textarea, .pdf-textlayer, .pdf-side-note, .pdf-ci-replies p, .pdf-results { user-select: text; -webkit-user-select: text; }
@keyframes pdf-arrive { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------- buttons */
.pdf-tb, .pdf-qt {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  min-width: 30px; height: 30px; padding: 0 6px; border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--ink); font: inherit; cursor: pointer;
}
.pdf-tb:hover, .pdf-qt:hover { background: var(--paper-inset); }
.pdf-tb:disabled, .pdf-qt:disabled { opacity: .4; cursor: default; background: transparent; }
.pdf-tb.on, .pdf-qt.on, .pdf-tb[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.pdf-tb svg, .pdf-qt svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pdf-tb-label { padding: 0 9px; }
.pdf-tb-sep, .pdf-qt-sep { flex: none; width: 1px; height: 22px; margin: 0 5px; background: var(--rule); }
.pdf-grow { flex: 1 1 auto; }
.pdf-link { border: 0; background: none; padding: 0; color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; }

/* ---------------------------------------------------------- the menu bar */
.pdf-menubar { flex: none; display: flex; align-items: stretch; height: 28px; padding: 0 4px; background: var(--pdf-bar); border-bottom: 1px solid var(--rule); }
.pdf-menu { position: relative; }
.pdf-menu > summary { list-style: none; display: flex; align-items: center; height: 28px; padding: 0 10px; cursor: default; -webkit-user-select: none; user-select: none; }
.pdf-menu > summary::-webkit-details-marker { display: none; }
.pdf-menu > summary:hover, .pdf-menu[open] > summary { background: var(--paper-inset); }
.pdf-menu > div, .pdf-subpanel, .pdf-menu-pop {
  display: flex; flex-direction: column; min-width: 250px; padding: 4px 0;
  background: var(--paper-raised); border: 1px solid var(--rule); border-radius: 0 0 6px 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
}
.pdf-menu > div { position: absolute; left: 0; top: 100%; z-index: 40; max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); overflow-y: auto; }
.pdf-menu button, .pdf-menu-pop button {
  display: flex; align-items: center; justify-content: space-between; gap: 30px; width: 100%;
  min-height: 25px; padding: 3px 18px 3px 26px; border: 0; background: none; color: var(--ink);
  font: inherit; text-align: left; white-space: nowrap; cursor: default; position: relative;
}
.pdf-menu button:hover, .pdf-menu button:focus-visible, .pdf-menu-pop button:hover, .pdf-menu-pop button:focus-visible { background: var(--accent-strong); color: #fff; outline: none; }
.pdf-menu kbd { font: inherit; color: var(--ink-faint); }
.pdf-menu button:hover kbd, .pdf-menu button:focus-visible kbd { color: #fff; }
.pdf-menu hr, .pdf-menu-pop hr { border: 0; border-top: 1px solid var(--rule); margin: 4px 0; }
.pdf-menu [aria-checked="true"]::before, .pdf-menu-pop [aria-checked="true"]::before { content: "✓"; position: absolute; left: 9px; }
.pdf-subhead::after { content: "›"; font-size: calc(15px * var(--text-scale, 1)); line-height: 1; }
.pdf-subpanel { display: none; position: fixed; z-index: 41; border-radius: 6px; }
.pdf-sub.is-open > .pdf-subpanel { display: flex; }
.pdf-sub.is-open > .pdf-subhead { background: var(--accent-strong); color: #fff; }

/* ---------------------------------------------------------- the toolbar */
.pdf-toolbar { flex: none; display: flex; align-items: center; gap: 2px; min-height: 42px; padding: 0 8px; background: var(--pdf-bar); border-bottom: 1px solid var(--rule); min-width: 0; }
#lsBar { display: inline-flex; }
.pdf-pagebox { display: inline-flex; align-items: center; gap: 5px; margin: 0 4px; color: var(--ink-soft); white-space: nowrap; }
.pdf-pagebox input, .pdf-zoombox {
  width: 44px; height: 26px; padding: 0 5px; border: 1px solid var(--rule-strong, var(--rule)); border-radius: 4px;
  background: var(--paper); color: var(--ink); font: inherit; text-align: center;
}
.pdf-zoombox { width: 68px; }
.pdf-docname { display: flex; flex-direction: column; align-items: center; min-width: 0; line-height: 1.2; }
.pdf-name { font-weight: 600; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-saved { font-size: calc(11.5px * var(--text-scale, 1)); color: var(--ink-soft); white-space: nowrap; }
.pdf-saved[data-state="dirty"]::before { content: "● "; color: var(--accent-strong); }
.pdf-menu-wrap { position: relative; display: inline-flex; }
.pdf-menu-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; border-radius: 6px; }
.pdf-menu-pop[hidden] { display: none; }
.pdf-toolbar .pdf-menu-wrap:last-of-type .pdf-menu-pop { left: auto; right: 0; }

/* ---------------------------------------------------------- the tool's own row */
.pdf-opts { flex: none; display: flex; align-items: center; flex-wrap: nowrap; gap: 4px 12px; min-height: 40px; padding: 4px 10px; background: var(--paper-inset); border-bottom: 1px solid var(--rule); color: var(--ink-soft); }
.pdf-opts[hidden], .pdf-opt[hidden], .pdf-set[hidden] { display: none; }
.pdf-opts-name { font-weight: 600; color: var(--ink); margin-right: 6px; }
.pdf-set, .pdf-opt { display: inline-flex; align-items: center; gap: 4px; }
.pdf-opt { gap: 8px; }
.pdf-opt-label { font-weight: 600; color: var(--ink); }
.pdf-opt input[type="range"] { width: 100px; }
.pdf-opt select { height: 26px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); font: inherit; }
.pdf-hint { flex: 1 1 200px; min-width: 0; font-size: var(--text-2xs); line-height: 1.3; color: var(--ink-soft); }
.pdf-swatches { display: inline-flex; gap: 5px; }
.pdf-swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--paper-raised); background: var(--sw); cursor: pointer; padding: 0; box-shadow: 0 0 0 1px var(--rule); }
.pdf-swatch.on { box-shadow: 0 0 0 2px var(--accent-strong); }
.pdf-org-count { min-width: 12ch; }

/* ---------------------------------------------------------- the working area */
.pdf-main { flex: 1 1 auto; position: relative; display: grid; grid-template-columns: auto 44px minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); min-height: 0; }
.pdf-nav { grid-column: 1; grid-row: 1; display: flex; min-height: 0; border-right: 1px solid var(--rule); background: var(--pdf-bar); }
.pdf-rail { display: flex; flex-direction: column; gap: 2px; width: 40px; padding: 6px 4px; border-right: 1px solid var(--rule); }
.pdf-rail-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 5px; background: none; color: var(--ink-soft); cursor: pointer; }
.pdf-rail-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.pdf-rail-btn:hover { background: var(--paper-inset); color: var(--ink); }
.pdf-rail-btn[aria-selected="true"] { color: var(--accent-strong); background: var(--accent-soft); }
.pdf-nav.collapsed .pdf-rail-btn[aria-selected="true"] { background: none; color: var(--ink-soft); }
.pdf-panes { width: 210px; display: flex; flex-direction: column; min-height: 0; }
.pdf-nav.collapsed .pdf-panes { display: none; }
.pdf-pane { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.pdf-pane[hidden] { display: none; }
.pdf-pane-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1px; padding: 6px 6px 4px 10px; border-bottom: 1px solid var(--rule); }
.pdf-pane-head h2 { flex: 1 1 100%; margin: 0 0 3px; font-size: calc(12.5px * var(--text-scale, 1)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-pane-head .pdf-tb { min-width: 26px; height: 26px; padding: 0 3px; }
.pdf-pane-head .pdf-tb svg { width: 16px; height: 16px; }

.pdf-thumbs { overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 12px; flex: 1 1 auto; --thumb-w: 132px; }
.pdf-thumb { position: relative; width: var(--thumb-w); border: 2px solid transparent; border-radius: 6px; padding: 5px 5px 22px; cursor: pointer; user-select: none; -webkit-user-select: none; outline: none; flex: none; }
.pdf-thumb:focus-visible { border-color: var(--accent); }
.pdf-thumb.on { border-color: var(--accent-strong); background: var(--accent-soft); }
.pdf-thumb.drop-before { box-shadow: 0 -3px 0 0 var(--accent-strong); }
.pdf-thumb.drop-after { box-shadow: 0 3px 0 0 var(--accent-strong); }
.pdf-thumb.dragging { opacity: .4; }
.pdf-thumb canvas { display: block; width: 100%; height: auto; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.pdf-thumb-num { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font-size: calc(11.5px * var(--text-scale, 1)); color: var(--ink-soft); }
.pdf-thumb-tools { position: absolute; right: 2px; bottom: 0; display: none; }
.pdf-thumb:hover .pdf-thumb-tools, .pdf-thumb.on .pdf-thumb-tools, .pdf-thumb:focus-within .pdf-thumb-tools { display: flex; }
.pdf-thumb-tools button { min-width: 20px; height: 20px; border: 0; border-radius: 3px; background: transparent; color: var(--ink-soft); font-size: var(--text-2xs); cursor: pointer; padding: 0 2px; }
.pdf-thumb-tools button:hover { background: var(--paper-raised); color: var(--ink); }
.pdf-thumb-tools svg { width: 13px; height: 13px; display: block; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.pdf-tree { overflow-y: auto; padding: 6px 4px; flex: 1 1 auto; }
.pdf-bm { display: flex; align-items: flex-start; gap: 2px; padding: 3px 6px; border-radius: 4px; cursor: pointer; outline: none; }
.pdf-bm:hover { background: var(--paper-inset); }
.pdf-bm.on { background: var(--accent-soft); color: var(--accent-strong); }
.pdf-bm:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.pdf-bm.gone { color: var(--ink-faint); font-style: italic; }
.pdf-bm-tw { flex: none; width: 14px; border: 0; background: none; color: inherit; padding: 0; font: inherit; cursor: pointer; }
.pdf-bm-title { overflow-wrap: anywhere; }
.pdf-bm-edit { width: 100%; font: inherit; }
.pdf-attach { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.pdf-attach li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 6px 4px; border-bottom: 1px solid var(--rule); }
.pdf-att-name { flex: 1 1 100%; font-weight: 600; overflow-wrap: anywhere; }
.pdf-att-size { color: var(--ink-faint); font-size: var(--text-2xs); }

/* The quick tools, a column beside the document. */
.pdf-tools { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; background: var(--pdf-bar); border-right: 1px solid var(--rule); overflow-y: auto; }
.pdf-qt { width: 34px; height: 34px; padding: 0; }
.pdf-qt-sep { width: 22px; height: 1px; margin: 5px 0; }

/* ---------------------------------------------------------- the document */
.pdf-stage { grid-column: 3; grid-row: 1; position: relative; overflow: auto; background: var(--pdf-canvas); outline: none; -webkit-overflow-scrolling: touch; }
.pdf-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.pdf-stage.drop { box-shadow: inset 0 0 0 3px var(--accent); }
.pdf-stage[data-tool="hand"] { cursor: grab; }
.pdf-stage.panning { cursor: grabbing; }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px 20px 60px; min-width: min-content; }
.pdf-pages:empty, .pdf-pages[hidden] { display: none; }
.pdf-pages.d-two, .pdf-pages.d-twoscroll { display: grid; grid-template-columns: repeat(2, max-content); justify-content: center; align-items: start; gap: 18px 16px; }
.pdf-pages.cover > .pdf-page:first-child { grid-column: 2; }
.pdf-pages.no-gaps { gap: 0; }
.pdf-pages.no-gaps .pdf-num { display: none; }
.pdf-page { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .22), 0 6px 20px rgba(0, 0, 0, .1); flex: none; }
.pdf-page.off { display: none; }
.pdf-stage:not([data-tool="select"]):not([data-tool="hand"]) .pdf-page { touch-action: none; }
.pdf-page.on { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.pdf-page canvas.pdf-canvas { display: block; width: 100%; height: 100%; }
.pdf-page.pending canvas.pdf-canvas { background: repeating-linear-gradient(45deg, #f2f2f2 0 10px, #fafafa 10px 20px); }
.pdf-num { position: absolute; top: -18px; left: 0; font-size: calc(11px * var(--text-scale, 1)); color: var(--ink-soft); font-weight: 600; letter-spacing: .04em; }
/* pdf.js text, invisible and selectable, so words can be copied and found. */
.pdf-textlayer { position: absolute; inset: 0; overflow: hidden; line-height: 1; opacity: .25; pointer-events: none; font-family: sans-serif; }
.pdf-stage[data-tool="select"] .pdf-textlayer { pointer-events: auto; cursor: text; }
.pdf-textlayer span { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; }
.pdf-textlayer ::selection { background: rgba(31, 79, 216, .45); }
.pdf-hitlayer { position: absolute; inset: 0; pointer-events: none; }
.pdf-hit { position: absolute; background: rgba(255, 196, 0, .5); mix-blend-mode: multiply; border-radius: 2px; }
.pdf-hit.now { background: rgba(255, 120, 0, .65); }
/* The form's fields, typed into where they are. */
.pdf-formlayer { position: absolute; inset: 0; pointer-events: none; color-scheme: light; }
.pdf-stage[data-tool="select"] .pdf-formlayer > *, .pdf-stage[data-tool="hand"] .pdf-formlayer > * { pointer-events: auto; }
/* A field is the size the PDF gives it: the site's larger touch floor for
   controls would spill it over the words round it. */
#pdfPages .pdf-field-ctl { min-width: 0; min-height: 0; }
.pdf-field-ctl { position: absolute; box-sizing: border-box; margin: 0; padding: 0 3px; border: 1px solid transparent; border-radius: 0; background: transparent; color: #000; font-family: Helvetica, Arial, sans-serif; resize: none; }
.pdf-field-ctl.lit { background: rgba(204, 215, 255, .6); }
.pdf-field-ctl:focus { outline: 2px solid var(--accent); outline-offset: 0; background: rgba(255, 255, 255, .9); }
input.pdf-field-ctl[type="checkbox"], input.pdf-field-ctl[type="radio"] { padding: 0; accent-color: #1f1f1f; }
.pdf-link-annot { position: absolute; }
.pdf-link-annot:hover { outline: 1px solid rgba(31, 79, 216, .6); background: rgba(31, 79, 216, .08); }
/* The marks a person makes, drawn as SVG over the page. */
.pdf-marks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pdf-stage:not([data-tool="select"]):not([data-tool="hand"]) .pdf-marks { pointer-events: auto; cursor: crosshair; }
.pdf-stage[data-tool="select"] .pdf-marks .mk { pointer-events: all; cursor: move; }
.pdf-stage[data-tool="select"] .pdf-marks { touch-action: none; }
.pdf-marks .mk-sel { fill: none; stroke: var(--accent-strong); stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.pdf-marks .mk-handle { fill: #fff; stroke: var(--accent-strong); stroke-width: 1.5; cursor: nwse-resize; pointer-events: all; }
.pdf-marks .mk-highlight polygon { mix-blend-mode: multiply; }
.pdf-marks .mk-redact polygon { fill-opacity: .82; stroke: #d7261d; stroke-width: 1; }
.pdf-marks .mk-text, .pdf-marks text { white-space: pre; }
.pdf-marks .pdf-decor { font-family: Helvetica, Arial, sans-serif; pointer-events: none; }
.pdf-marks .rubber { fill: rgba(31, 79, 216, .12); stroke: var(--accent-strong); stroke-width: 1; stroke-dasharray: 4 3; }
/* The box where text is typed onto the page. */
.pdf-textbox {
  position: absolute; z-index: 3; min-width: 120px; min-height: 1.4em; padding: 0 2px; margin: 0;
  border: 1px dashed var(--accent-strong); background: rgba(255, 255, 255, .92); color: #111;
  font-family: Helvetica, Arial, sans-serif; line-height: 1.2; resize: none; overflow: hidden; outline: none; white-space: pre-wrap;
}
.pdf-boxedit { min-width: 0; padding: 3px; line-height: 1.2; }

/* Organise Pages: the pages as a grid in place of the reading view. */
.pdf-organise[hidden] { display: none; }
.pdf-org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile-w, 170px), 1fr)); gap: 22px 18px; padding: 22px; }
.pdf-org-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border: 2px solid transparent; border-radius: 6px; cursor: pointer; outline: none; user-select: none; -webkit-user-select: none; }
.pdf-org-tile:hover { background: color-mix(in srgb, var(--paper-raised) 60%, transparent); }
.pdf-org-tile.on { border-color: var(--accent-strong); background: var(--accent-soft); }
.pdf-org-tile:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.pdf-org-tile.dragging { opacity: .4; }
.pdf-org-tile.drop-before { box-shadow: -4px 0 0 0 var(--accent-strong); }
.pdf-org-tile.drop-after { box-shadow: 4px 0 0 0 var(--accent-strong); }
.pdf-org-pic { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1 / 1; }
.pdf-org-pic canvas { max-width: 100%; max-height: 100%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.pdf-org-num { font-size: var(--text-2xs); color: var(--ink); }
.pdf-org-acts { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: none; gap: 2px; padding: 2px; border-radius: 5px; background: var(--paper-raised); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.pdf-org-tile:hover .pdf-org-acts, .pdf-org-tile:focus-within .pdf-org-acts { display: flex; }
@media (hover: none) { .pdf-org-tile.on .pdf-org-acts { display: flex; } }
.pdf-org-acts button:disabled { opacity: .35; cursor: default; }
.pdf-org-acts button { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 4px; background: none; color: var(--ink); cursor: pointer; }
.pdf-org-acts button:hover { background: var(--paper-inset); }
.pdf-org-acts svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------- empty state */
.pdf-empty { display: flex; align-items: center; justify-content: center; min-height: 100%; padding: 30px 16px; }
.pdf-empty[hidden] { display: none; }
.pdf-empty-card { max-width: 460px; text-align: center; padding: 34px 30px; border: 1px dashed var(--rule-strong, var(--rule)); border-radius: 12px; background: var(--paper-raised); }
.pdf-empty-card h2 { font-size: var(--text-xl); margin: 0 0 8px; }
.pdf-empty-card p { color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.6; margin: 0 0 16px; }
.pdf-empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pdf-empty-sub { margin: 14px 0 0 !important; font-size: calc(12.5px * var(--text-scale, 1)) !important; }

/* ---------------------------------------------------------- the find bar */
.pdf-findbar { grid-column: 3; grid-row: 1; align-self: start; justify-self: end; z-index: 6; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin: 8px 18px; padding: 6px 8px; max-width: calc(100% - 36px); background: var(--paper-raised); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.pdf-findbar[hidden] { display: none; }
.pdf-findbar input[type="search"] { width: 200px; height: 28px; padding: 0 8px; border: 1px solid var(--rule-strong, var(--rule)); border-radius: 4px; background: var(--paper); color: var(--ink); font: inherit; }
#pdfFindCount { min-width: 8ch; color: var(--ink-soft); font-size: var(--text-2xs); }
.pdf-findopt { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-2xs); color: var(--ink-soft); }

/* ---------------------------------------------------------- the tools pane */
.pdf-side { grid-column: 4; grid-row: 1; width: 290px; display: flex; flex-direction: column; min-height: 0; background: var(--pdf-bar); border-left: 1px solid var(--rule); }
.pdf-main.no-side .pdf-side { display: none; }
.pdf-side-head { display: flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 10px; border-bottom: 1px solid var(--rule); }
.pdf-side-head h2 { margin: 0; font-size: var(--text-sm); font-weight: 600; }
.pdf-side-body { overflow-y: auto; padding: 10px 12px; flex: 1 1 auto; }
.pdf-side-body > [hidden] { display: none; }
.pdf-side-note { color: var(--ink-soft); font-size: calc(12.5px * var(--text-scale, 1)); line-height: 1.5; margin: 0 0 10px; }
.pdf-alltools { display: grid; grid-template-columns: 1fr; gap: 2px; }
.pdf-alltools button { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 4px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.pdf-alltools button:hover, .pdf-alltools button:focus-visible { background: var(--paper-inset); }
.pdf-alltools svg { width: 22px; height: 22px; padding: 4px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; box-sizing: content-box; }
.pdf-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; }
.pdf-field > span { font-size: calc(12.5px * var(--text-scale, 1)); font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.pdf-field .pdf-field-page { font-weight: 400; color: var(--ink-faint); margin-left: 6px; }
.pdf-field input[type="text"], .pdf-field textarea, .pdf-field select, .pdf-meta input, .pdf-search input[type="search"] {
  width: 100%; box-sizing: border-box; min-height: 30px; padding: 5px 8px; border: 1px solid var(--rule); border-radius: 5px; background: var(--paper); color: var(--ink); font: inherit;
}
.pdf-field textarea { min-height: 64px; resize: vertical; }
.pdf-field.ro input, .pdf-field.ro select { opacity: .6; }
.pdf-check { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; line-height: 1.45; color: var(--ink-soft); }
.pdf-check input { margin-top: 3px; }
.pdf-field.pdf-check { flex-direction: row; }
.pdf-form-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule); }
.pdf-clist, .pdf-results { list-style: none; margin: 0; padding: 0; }
.pdf-cpage { margin: 12px 0 4px; font-size: calc(11.5px * var(--text-scale, 1)); font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.pdf-ci { margin: 0 0 8px; padding: 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); }
.pdf-ci.on { border-color: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent-strong); }
.pdf-ci-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; width: 100%; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.pdf-ci-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); flex: none; }
.pdf-ci-who { font-weight: 600; }
.pdf-ci-kind { color: var(--ink-soft); font-size: var(--text-2xs); }
.pdf-ci-when { flex: 1 1 100%; color: var(--ink-faint); font-size: calc(11.5px * var(--text-scale, 1)); }
.pdf-ci-text { display: block; width: 100%; box-sizing: border-box; margin: 6px 0 0; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper-raised); color: var(--ink); font: inherit; resize: vertical; }
.pdf-ci-replies { list-style: none; margin: 4px 0 0 14px; padding: 0; }
.pdf-ci-replies li { padding: 4px 0 0; border-top: 1px dashed var(--rule); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 0 8px; }
.pdf-ci-replies p { flex: 1 1 100%; margin: 2px 0 0; }
.pdf-ci-acts { display: flex; gap: 14px; margin-top: 6px; font-size: var(--text-2xs); }
.pdf-search-q { display: flex; flex-direction: column; gap: 4px; font-weight: 600; margin-bottom: 6px; }
.pdf-results li button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 6px 4px; border: 0; border-bottom: 1px solid var(--rule); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.pdf-results li button:hover { background: var(--paper-inset); }
.pdf-res-page { font-size: calc(11.5px * var(--text-scale, 1)); font-weight: 600; color: var(--ink-faint); }
.pdf-results mark { background: rgba(255, 196, 0, .55); color: inherit; }

/* ---------------------------------------------------------- status */
.pdf-status { flex: none; display: flex; align-items: center; gap: 16px; min-height: 24px; padding: 0 170px 0 12px; border-top: 1px solid var(--rule); background: var(--pdf-bar); font-size: var(--text-2xs); color: var(--ink-soft); white-space: nowrap; overflow: hidden; }
#pdfStatusM { overflow: hidden; text-overflow: ellipsis; }
#pdfStatusR { margin-left: auto; }

/* ---------------------------------------------------------- selected text */
.pdf-selbar { position: fixed; z-index: 50; display: flex; gap: 1px; padding: 3px; border-radius: 6px; background: var(--ink); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.pdf-selbar[hidden] { display: none; }
.pdf-selbar button { border: 0; border-radius: 4px; padding: 4px 9px; background: none; color: var(--paper); font: calc(12.5px * var(--text-scale, 1)) system-ui, sans-serif; cursor: pointer; }
.pdf-selbar button:hover { background: rgba(255, 255, 255, .15); }

/* ---------------------------------------------------------- dialogs */
.pdf-dlg { width: min(94vw, 520px); max-height: 90vh; max-height: 90dvh; overflow-y: auto; padding: 18px 22px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-raised); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); font: var(--text-xs)/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.pdf-dlg.wide { width: min(94vw, 720px); }
.pdf-dlg::backdrop { background: rgba(0, 0, 0, .35); }
.pdf-dlg h2 { margin: 0 0 12px; font-size: var(--text-md); }
.pdf-dlg-h { margin: 14px 0 4px; font-size: calc(11.5px * var(--text-scale, 1)); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.pdf-dlg-note { color: var(--ink-soft); margin: 4px 0 10px; }
.pdf-dlg-err { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; }
.pdf-dlg-tabs { display: flex; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--rule); }
.pdf-dlg-tabs button { border: 0; border-bottom: 2px solid transparent; background: none; padding: 6px 10px; color: var(--ink-soft); font: inherit; font-weight: 600; cursor: pointer; }
.pdf-dlg-tabs button[aria-selected="true"] { color: var(--accent-strong); border-bottom-color: var(--accent-strong); }
.pdf-row { display: grid; grid-template-columns: minmax(120px, auto) minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; margin: 6px 0; }
.pdf-row input, .pdf-row select { min-height: 28px; padding: 3px 7px; border: 1px solid var(--rule); border-radius: 5px; background: var(--paper); color: var(--ink); font: inherit; min-width: 0; }
.pdf-row input[type="number"] { max-width: 110px; }
.pdf-row input[type="color"] { padding: 0 2px; width: 48px; }
.pdf-dlg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 6px 0; }
.pdf-dlg-row .pdf-row { grid-template-columns: auto auto; }
.pdf-fs { margin: 8px 0; padding: 6px 12px 8px; border: 1px solid var(--rule); border-radius: 6px; }
.pdf-fs legend { padding: 0 4px; font-weight: 600; }
.pdf-fs .pdf-row { display: inline-grid; grid-template-columns: auto auto; }
.pdf-hf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.pdf-hf-slot { display: flex; flex-direction: column; gap: 3px; font-size: var(--text-2xs); color: var(--ink-soft); }
.pdf-hf-slot textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--rule); border-radius: 5px; background: var(--paper); color: var(--ink); font: inherit; resize: vertical; }
.pdf-meta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pdf-meta label { display: flex; flex-direction: column; gap: 3px; font-weight: 600; }
.pdf-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 8px; }
.pdf-dl dt { color: var(--ink-faint); }
.pdf-dl dd { margin: 0; overflow-wrap: anywhere; }
.pdf-meta-made { color: var(--ink-soft); font-size: var(--text-2xs); }
.pdf-keys { max-height: 60vh; overflow: auto; }
.pdf-keys table { width: 100%; border-collapse: collapse; }
.pdf-keys td { padding: 3px 6px; border-bottom: 1px solid var(--rule); }
.pdf-keys td:last-child { text-align: right; white-space: nowrap; }
.pdf-combine { list-style: none; margin: 8px 0; padding: 0; border: 1px solid var(--rule); border-radius: 6px; max-height: 40vh; overflow-y: auto; }
.pdf-combine li { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-bottom: 1px solid var(--rule); }
.pdf-combine li:last-child { border-bottom: 0; }
.pdf-combine-name { flex: 1 1 auto; overflow-wrap: anywhere; }
.pdf-combine-size { color: var(--ink-faint); font-size: var(--text-2xs); }
.pdf-combine-empty { color: var(--ink-faint); }
.pdf-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* The signature pad. */
.pdf-dialog { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pdf-dialog[hidden] { display: none; }
.pdf-dialog-card { width: 100%; max-width: 580px; background: var(--paper-raised); border-radius: 12px; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.pdf-dialog-card h2 { margin: 0 0 12px; font-size: var(--text-lg); }
.pdf-sig-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.pdf-sig-tabs button { border: 1px solid var(--rule); background: var(--paper); border-radius: 20px; padding: 6px 14px; font: 600 var(--text-xs) system-ui, sans-serif; color: var(--ink-soft); cursor: pointer; min-height: 34px; }
.pdf-sig-tabs button.on { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
#pdfSigPad { display: block; width: 100%; height: 180px; background: #fff; border: 1px solid var(--rule); border-radius: 8px; touch-action: none; }
#pdfSigName { width: 100%; box-sizing: border-box; min-height: 38px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; font: inherit; background: var(--paper); color: var(--ink); }
.pdf-sig-preview { margin-top: 10px; min-height: 70px; display: flex; align-items: center; padding: 8px 14px; background: #fff; border: 1px solid var(--rule); border-radius: 8px; color: #14213d; font: italic 400 calc(34px * var(--text-scale, 1)) "Spectral", Georgia, serif; overflow: hidden; }

/* ---------------------------------------------------------- the modes */
body.pdf-no-menubar .pdf-menubar, body.pdf-no-toolbar .pdf-toolbar { display: none; }
body.pdf-read .pdf-toolbar, body.pdf-read .pdf-opts, body.pdf-read .pdf-nav, body.pdf-read .pdf-tools, body.pdf-read .pdf-side { display: none; }
body.pdf-full .pdf-menubar, body.pdf-full .pdf-toolbar, body.pdf-full .pdf-opts, body.pdf-full .pdf-nav, body.pdf-full .pdf-tools, body.pdf-full .pdf-side, body.pdf-full .pdf-status, body.pdf-full .pdf-findbar { display: none; }
body.pdf-full .pdf-stage { background: #0d0d0d; }
body.pdf-full .pdf-page { box-shadow: none; }
body.pdf-full .pdf-page.on { outline: 0; }
body.pdf-full .pdf-num { display: none; }

/* ---------------------------------------------------------- print */
.pdf-print { display: none; }
@media print {
  @page { margin: 0; }
  body.pdf-printing > *, body.pdf-printing #obscuraMainContent > *:not(#pdfPrint) { display: none !important; }
  body.pdf-printing > #obscuraMainContent, body.pdf-printing #pdfPrint { display: block !important; }
  body.pdf-printing { background: #fff; }
  #pdfPrint img { display: block; width: 100%; height: auto; break-after: page; page-break-after: always; }
  #pdfPrint img:last-child { break-after: auto; page-break-after: auto; }
}

/* ---------------------------------------------------------- a phone */
@media (max-width: 900px) {
  .pdf-menubar { overflow-x: auto; scrollbar-width: none; }
  .pdf-menubar::-webkit-scrollbar { display: none; }
  .pdf-menu { position: static; }
  .pdf-menu > div { position: fixed; left: 4px; right: 4px; top: 28px; min-width: 0; max-height: 70vh; border-radius: 8px; }
  .pdf-subpanel { position: static; display: none; box-shadow: none; border: 0; border-left: 2px solid var(--rule); border-radius: 0; margin-left: 16px; min-width: 0; }
  .pdf-menu button, .pdf-menu-pop button { min-height: 40px; }
  .pdf-toolbar { overflow-x: auto; scrollbar-width: none; }
  .pdf-toolbar::-webkit-scrollbar { display: none; }
  .pdf-toolbar .pdf-grow, .pdf-docname .pdf-saved { display: none; }
  /* In a toolbar that scrolls, a name let shrink to nothing spills over the buttons. */
  .pdf-docname { flex: none; }
  .pdf-name { max-width: 40vw; }
  .pdf-menu-wrap { position: static; }
  .pdf-menu-pop { position: fixed; top: 74px; left: 8px; right: 8px; }
  .pdf-opts { flex-wrap: nowrap; overflow-x: auto; }
  .pdf-hint { display: none; }
  .pdf-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .pdf-nav { display: none; }
  /* One row of tools that scrolls sideways within itself, with the
     chevron at the edge there is more beyond (details.js), as the paid
     applications' tool rows do; the page starts under one row, not two. */
  .pdf-tools { grid-column: 1; grid-row: 1; flex-direction: row; flex-wrap: nowrap; justify-content: flex-start; padding: 4px 6px; border-right: 0; border-bottom: 1px solid var(--rule); overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; }
  .pdf-tools::-webkit-scrollbar { display: none; }
  .pdf-tools > * { flex: none; }
  .pdf-tools button:focus-visible { outline-offset: -2px; }
  .pdf-qt-sep { width: 1px; height: 22px; margin: 0 5px; }
  .pdf-stage, .pdf-findbar { grid-column: 1; grid-row: 2; }
  .pdf-findbar { margin: 6px; max-width: calc(100% - 12px); }
  .pdf-findbar input[type="search"] { width: 150px; }
  .pdf-side { display: none; }
  .pdf-main.show-side .pdf-side { display: flex; position: fixed; right: 0; top: 0; bottom: 0; width: min(92vw, 340px); z-index: 30; box-shadow: -8px 0 30px rgba(0, 0, 0, .25); }
  .pdf-pages { padding: 16px 8px 40px; gap: 14px; }
  .pdf-pages.d-two, .pdf-pages.d-twoscroll { gap: 14px 8px; }
  .pdf-status { padding-right: 60px; }
  /* The message is what a tool says when it cannot do what was asked, so it
     is the one kept; the standing note beside it is what goes. */
  .pdf-status #pdfStatusR, .pdf-status #lsStatus { display: none; }
  .pdf-status #pdfStatusM { min-width: 0; }
  .pdf-hf-grid { grid-template-columns: 1fr; }
  .pdf-row { grid-template-columns: 1fr; }
}
/* A phone's toolbar holds what a thumb reaches for without opening a menu:
   Open, Save, Find, the pages and the tools. Print, Export, the zoom and
   the page display are each in File or View above, and the file's name is
   in Window, so they give their places up rather than leaving the page
   box cut off at the edge of a strip that scrolls. */
@media (max-width: 600px) {
  .pdf-toolbar { gap: 0; padding: 0 4px; }
  .pdf-toolbar .pdf-tb-sep { margin: 0 3px; }
  .pdf-pagebox { margin: 0 2px; }
  #pdfPrintBtn, #pdfExportBtn, #pdfZoomOut, #pdfZoomBox, #pdfZoomIn, #pdfZoomFit, #pdfDisplayBtn, .pdf-toolbar .pdf-docname,
  .pdf-toolbar .pdf-pagebox + .pdf-tb-sep { display: none; }
  .pdf-toolbar .pdf-docname + .pdf-grow { display: block; }
  #pdfPanelBtn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (pointer: coarse) {
  .pdf-tb, .pdf-qt { min-width: 40px; height: 40px; }
  .pdf-swatch { width: 28px; height: 28px; }
  .pdf-thumb-tools button { min-width: 40px; height: 40px; }
  /* Four buttons of the 44px floor are wider than a thumbnail: centred,
     they stay inside the rail instead of running off its left edge. */
  .pdf-thumb-tools { right: auto; left: 50%; transform: translateX(-50%); }
  .pdf-thumb { padding-bottom: 44px; }
  .pdf-sig-tabs button { min-height: 44px; }
  .pdf-ci-acts button, .pdf-link { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .pdf-shell { animation: none; } }
