/* The document viewer (static/pdfview.js): a popup that fills nearly the whole window, or a page that is only the viewer. One stylesheet for the new look and the old look (colors are the tokens both define). */
html.pdfview-open { overflow: hidden; }
dialog.pdfview { width: 96vw; height: 94vh; height: 94dvh; max-width: none; max-height: none; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); overflow: hidden; box-shadow: 0 12px 40px rgb(0 0 0 / .35); }
dialog.pdfview[open] { display: flex; flex-direction: column; }
dialog.pdfview::backdrop { background: rgb(0 0 0 / .6); }
.pdfview-page-host { display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: var(--color-surface); color: var(--color-text); }
.pdfview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; padding: .55rem .8rem; border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.pdfview-title { flex: 1 1 12rem; min-width: 0; margin: 0; font-size: 1rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; outline: none; }
.pdfview-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.pdfview-btn { padding: .45rem .8rem; min-height: 2.5rem; text-decoration: none; display: inline-flex; align-items: center; }
.pdfview-close { order: 2; }
.pdfview-pageno { display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; }
.pdfview-pagebox { width: 4rem; min-height: 2.5rem; padding: .3rem .4rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-bg); color: var(--color-text); font: inherit; }
.pdfview-zoom { min-width: 3.2rem; text-align: center; font-size: .9rem; }
.pdfview-status { margin: 0; padding: .6rem .9rem; font-size: .95rem; }
.pdfview-status:empty { display: none; }
.pdfview-error { color: var(--color-text); border-left: 4px solid var(--color-focus); background: var(--color-surface-2); }
.pdfview-scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; background: var(--color-surface-2); padding: .75rem; -webkit-overflow-scrolling: touch; }
.pdfview-scroll:focus-visible { outline: 3px solid var(--color-focus); outline-offset: -3px; }
.pdfview-pages { display: flex; flex-direction: column; align-items: center; gap: .75rem; min-width: min-content; }
.pdfview-page { position: relative; flex: none; background: #fff; box-shadow: 0 2px 10px rgb(0 0 0 / .25); overflow: hidden; }
.pdfview-canvas { display: block; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pdfview-text { position: absolute; inset: 0; overflow: clip; line-height: 1; transform-origin: 0 0; user-select: none; -webkit-user-select: none; forced-color-adjust: none;
  --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size)); }
.pdfview-text :is(span, br) { color: transparent; position: absolute; white-space: pre; transform-origin: 0 0; }
.pdfview-text > :not(.markedContent), .pdfview-text .markedContent span:not(.markedContent) { --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)); }
.pdfview-text .markedContent { display: contents; }
/* The small prompt for the reason of a download (only a person who may download ever sees it). */
dialog.pdfview-reason { width: min(28rem, 92vw); padding: 1.1rem 1.2rem; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); box-shadow: 0 12px 40px rgb(0 0 0 / .35); }
dialog.pdfview-reason::backdrop { background: rgb(0 0 0 / .5); }
.pdfview-reason-title { margin: 0 0 .4rem; font-size: 1.1rem; }
.pdfview-reason-help { margin: 0 0 .8rem; font-size: .92rem; }
.pdfview-reason-label { display: block; margin-bottom: .3rem; font-weight: 600; }
.pdfview-reason-input { width: 100%; min-height: 2.5rem; padding: .4rem .6rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-bg); color: var(--color-text); font: inherit; box-sizing: border-box; }
.pdfview-reason-input[aria-invalid="true"] { border-color: var(--color-focus); border-width: 2px; }
.pdfview-reason-error { min-height: 1.2rem; margin: .4rem 0; font-size: .92rem; font-weight: 600; }
.pdfview-reason-actions { display: flex; gap: .6rem; justify-content: flex-end; }
/* The old look: the popup keeps its own size (the old modal rules set a narrow one) and its header reads like the old modal's. */
:root[data-look="old"] dialog.pdfview.old-modal { width: 96vw; height: 94vh; height: 94dvh; max-width: none; max-height: none; overflow: hidden; border: 0; border-radius: var(--radius-lg); }
:root[data-look="old"] dialog.pdfview.old-modal[open] { display: flex; flex-direction: column; }
:root[data-look="old"] .pdfview-title { font-size: 1.25rem; font-weight: 600; }
@media (max-width: 40rem) {
  dialog.pdfview, :root[data-look="old"] dialog.pdfview.old-modal { width: 100vw; height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
  .pdfview-bar { padding: .45rem .6rem; }
  .pdfview-close { order: 1; }
  .pdfview-tools { order: 2; flex: 1 1 100%; }
  .pdfview-scroll { padding: .4rem; }
  .pdfview-btn { padding: .4rem .6rem; }
}
/* A courtesy, not a guarantee: a printout of the page does not carry the document. */
@media print { dialog.pdfview, .pdfview-page-host { display: none !important; } }

.pdfview-nojs { padding: 1rem; }
