/* Document viewer (assets/doc-viewer.js): fills the space it is placed in, zoom/rotate toolbar floating at the bottom. */
.dv { position: relative; flex: 1; min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; }
.dv-stage { flex: 1; min-height: 0; overflow: auto; outline: none; position: relative; overscroll-behavior: contain; }
.dv-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.dv-pages { width: max-content; min-width: 100%; box-sizing: border-box; padding: 14px 14px 70px; }
.dv-pg { position: relative; width: max-content; margin: 0 auto 12px; }
.dv-canvas { display: block; margin: 0; background: #fff; border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 12px 32px -12px rgba(0, 0, 0, .28); }
@media (max-width: 600px) {   /* phone: the page edge to edge, no grey frame around it */
  .dv-pages { padding: 0 0 70px; }
  .dv-pg { margin-bottom: 0; }
  .dv-canvas { border-radius: 0; box-shadow: none; border-bottom: 1px solid #ececec; }
  .dv-stage { background: #fff; }   /* the space under a short page is paper-white too, not an empty grey band */
}
.dv-stage { touch-action: pan-x pan-y; }   /* our own pinch zoom, not the browser's whole-page zoom */
/* PDF.js text layer (from its pdf_viewer.css, 5.x/6.x): invisible text over the page, so it can be selected and copied */
.dv .textLayer { position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-align: initial; z-index: 0;
  -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText;
  --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size)); }
.dv .textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%;
  --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height));
  --scale-x: 1; --rotate: 0deg; transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv)); }
.dv .textLayer > :not(.markedContent), .dv .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.dv .textLayer span.markedContent { top: 0; height: 0; }
.dv .textLayer span[role="img"] { user-select: none; cursor: default; }
.dv .textLayer ::selection { background: rgba(0, 92, 255, .28); }
.dv .textLayer br::selection { background: transparent; }
.dv .textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.dv .textLayer.selecting .endOfContent { top: 0; }
.dv-msg { padding: 44px 18px; text-align: center; color: var(--ink-3); font-size: 13px; }
.dv-pannable .dv-stage { cursor: grab; }
.dv-dragging .dv-stage { cursor: grabbing; user-select: none; }
.dv .dv-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 2px;
  padding: 4px; border-radius: 10px; background: var(--surface); box-shadow: var(--sh-card), 0 8px 24px -8px rgba(0, 0, 0, .3); white-space: nowrap; }
.dv .dv-bar button { width: 32px; height: 32px; min-width: 0; padding: 0; margin: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); box-shadow: none; font: inherit; cursor: pointer; }
.dv .dv-bar button:hover { background: var(--hover); color: var(--ink); }
.dv .dv-bar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dv .dv-bar .dv-pct { width: auto; min-width: 54px; padding: 0 8px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dv .dv-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.dv .dv-page { font-size: 12px; color: var(--ink-3); padding: 0 8px 0 4px; font-variant-numeric: tabular-nums; }
.dv-failed .dv-bar { display: none; }
.rv-docbody > .dv { flex: 1; }
.rv-docbody:has(> .dv) { padding: 54px 0 0; }
.doc-body:has(> .dv) { display: flex; }
@media (pointer: coarse) { .dv .dv-bar button { width: 40px; height: 40px; } }

/* ---- In-app PDF viewer (assets/app-nav.js): full screen, inside the app, with a clear way back ---- */
.pdfov { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: var(--sunken, #f1f0ec);
  padding-top: env(safe-area-inset-top, 0px); }
.pdfov-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pdfov .pdfov-back { display: inline-flex; align-items: center; gap: 2px; height: 42px; min-width: 0; padding: 0 12px 0 4px; margin: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--accent); box-shadow: none; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.pdfov .pdfov-back:hover { background: var(--hover); }
.pdfov-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--ink); }
.pdfov-dl { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 9px; color: var(--ink-2); }
.pdfov-dl:hover { background: var(--hover); }
.pdfov-body { flex: 1; min-height: 0; display: flex; padding-bottom: env(safe-area-inset-bottom, 0px); }
html.pdfov-open, html.pdfov-open body { overflow: hidden; }

/* ---- back arrow in the phone's top bar (sub-pages only) ---- */
.mobile-topbar .m-back { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin: -6px 2px -6px -10px;
  border-radius: 9px; color: var(--ink); flex-shrink: 0; }
.mobile-topbar .m-back[hidden] { display: none; }
.mobile-topbar .m-back + .brand-mini { margin-right: auto; }
