.document-preview{width:min(1120px,calc(100vw - 32px));max-width:1120px;max-height:calc(100dvh - 32px);padding:0;border:1px solid #cad8e6;border-radius:10px;background:#fff;color:#183b59;box-sizing:border-box;overflow:auto;box-shadow:0 18px 60px rgb(16 42 64 / 20%)}
.document-preview::backdrop{background:rgb(14 34 53 / 35%)}
.dp-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;padding:18px 22px;border-bottom:1px solid #e0e8f0;background:#fff}
.dp-heading h2{font-size:19px;line-height:1.4;font-weight:600;margin:0;min-width:0;overflow-wrap:anywhere}
.dp-window-actions{display:flex;flex:none;gap:4px;margin-inline-start:auto}
.document-preview .dp-window-actions>button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:44px;height:44px;min-height:44px;margin:0;padding:0;border:1px solid transparent;background:transparent;color:#526b81;font-size:22px;line-height:1}
.document-preview .dp-window-actions>button:hover{background:#edf3f8;border-color:#d4e0ea}
dialog.document-preview.dp-maximised{position:fixed;inset:0;margin:0;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0}
.dp-minimised{position:fixed;inset-inline-end:16px;bottom:16px;display:flex;align-items:center;gap:4px;box-sizing:border-box;width:min(400px,calc(100vw - 32px));padding:6px;z-index:80;border:1px solid #cad8e6;border-radius:8px;background:#fff;box-shadow:0 6px 24px #183b5926}
.dp-minimised[hidden]{display:none!important}
.dp-minimised>button{min-height:44px;margin:0;background:transparent;color:#244761}
.dp-minimised>button:first-child{flex:1;min-width:0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;text-align:start;font-size:14px}
.dp-minimised>button:last-child{flex:none;width:44px;padding:0;font-size:22px}
.dp-heading>button{flex:0 0 40px;min-height:40px;min-width:40px;width:40px;margin:-5px -7px 0 0;padding:0;border:0;background:transparent;font-size:24px;font-weight:400;color:#62758a}
.dp-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:12px 22px;background:#f8fafc;border-bottom:1px solid #e0e8f0}
.dp-tools>button,.dp-pager button{font-size:13px;min-height:36px;margin:0;padding:7px 12px;border-radius:5px}
.dp-version{font-size:13px;color:#62758a;margin-right:4px}
.dp-pager{display:flex;gap:8px;align-items:center;margin-left:auto;flex-wrap:wrap}.dp-pager>span{font-size:13px;white-space:nowrap}
.dp-status{font-size:14px;line-height:1.5;margin:0;padding:12px 22px;color:#62758a;overflow-wrap:anywhere}.dp-status:empty{display:none}
.dp-content{min-height:140px;padding:20px 22px;overflow:auto;min-width:0;max-height:calc(100dvh - 220px)}
.dp-content>img{display:block;max-width:100%;height:auto;margin:auto;border:1px solid #e1e8ee;background:#fff}
.dp-readonly{font-size:13px;font-weight:600;color:#506d87;margin:0 0 6px}.dp-help{font-size:14px;line-height:1.6;color:#62758a;margin:0 0 16px;overflow-wrap:anywhere}
.dp-text{font:15px/1.75 "Segoe UI",Arial,sans-serif;white-space:pre-wrap;overflow-wrap:anywhere;tab-size:4;margin:0;padding:20px;border:1px solid #e1e8ef;border-radius:6px;background:#fff;color:#233e54}
@media(max-width:1100px),(any-pointer:coarse){.document-preview button{min-height:44px;box-sizing:border-box}.dp-text{font-size:16px}.dp-heading>button{flex-basis:44px;min-width:44px;width:44px}}
@media(max-width:600px){.document-preview{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);border-radius:8px}.dp-heading{padding:16px}.dp-heading h2{font-size:17px}.dp-tools{padding:10px 16px}.dp-pager{width:100%;margin:0;justify-content:space-between}.dp-status{padding:10px 16px}.dp-content{padding:16px;max-height:calc(100dvh - 260px)}.dp-text{padding:14px}.dp-tools>button{max-width:100%;white-space:normal}}
@media(max-width:600px){.dp-heading{flex-wrap:wrap;gap:8px}.dp-heading h2{flex:1 1 160px}.dp-window-actions{align-self:flex-start}}
@media print{.document-preview::backdrop{background:none}.document-preview{max-height:none;overflow:visible;box-shadow:none}.dp-tools,.dp-heading>button{display:none}.dp-content{max-height:none;overflow:visible}}

/* Fixed outer frame: image decoding and page dimensions cannot recenter the modal. */
dialog.document-preview{height:min(840px,calc(100dvh - 32px));max-height:calc(100dvh - 32px);overflow:hidden}
dialog.document-preview[open]{display:flex;flex-direction:column}
.document-preview>.dp-heading,.document-preview>.dp-tools{flex:0 0 auto}
/* Reserve the message area before paging so an error never pushes the PDF down. */
.document-preview>.dp-status{display:block;flex:0 0 auto;box-sizing:border-box;block-size:calc(4.5em + 16px);padding-top:8px;padding-bottom:8px;overflow:auto}
.document-preview>.dp-status:empty{display:flex;visibility:hidden}
.document-preview>.dp-content{flex:1 1 auto;min-height:0;max-height:none;overflow:auto;overflow-anchor:none;scrollbar-gutter:stable both-edges;box-sizing:border-box}
.document-preview .dp-pager{flex-wrap:nowrap;min-width:0}
.document-preview .dp-pager>span{min-width:110px;text-align:center;font-variant-numeric:tabular-nums}
.document-preview .dp-pager>button{min-width:0}
@media(max-width:600px){dialog.document-preview{height:calc(100dvh - 16px);max-height:calc(100dvh - 16px)}.document-preview .dp-pager{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:6px}.document-preview .dp-pager>span{min-width:0;font-size:12px;white-space:normal}.document-preview .dp-pager>button{width:100%;white-space:normal;padding:7px 6px}.document-preview>.dp-content{max-height:none}}
@media print{dialog.document-preview{height:auto;max-height:none;overflow:visible}.document-preview>.dp-content{overflow:visible}.document-preview>.dp-status:empty{display:none}}
@media print{.dp-window-actions,.dp-minimised{display:none!important}}
