/* Shared reader: quiet document surface, visible commands, generous touch targets. */
.pdf-dialog { position:fixed; inset:0; margin:auto; box-sizing:border-box; width:min(1200px,calc(100vw - 48px)); height:calc(100dvh - 48px); max-width:none; max-height:none; padding:0; overflow:hidden; border:1px solid #dce3ee; border-radius:18px; background:#edf0f6; color:#24314b; box-shadow:0 24px 80px #151c2c40; }
.pdf-dialog[open] { display:flex; flex-direction:column; }
.pdf-dialog::backdrop { background:#151c2c99; }
.pdf-dialog-header { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:16px; padding:16px 20px; background:#fff; border-bottom:1px solid #dce3ee; flex:none; }
.pdf-dialog-heading { min-width:0; }
.pdf-dialog-kicker { font-size:10px; font-weight:700; letter-spacing:.1em; color:#6b7890; }
.pdf-dialog h2 { font-size:17px; line-height:1.4; margin:3px 0 0; overflow-wrap:anywhere; }
.pdf-dialog-header .modal-close { grid-column:3; grid-row:1; width:44px; height:44px; flex:none; }
.pdf-dialog-download { grid-column:2; grid-row:1; min-height:44px; }
body .pdf-dialog .pdf-dialog-download { background:#fff; color:#24314b; border:1px solid #dce3ee; }
.pdf-dialog-content { flex:1; min-height:0; padding:0; overflow:hidden; }
.pdf-dialog-content>p { padding:24px; }
.pdf-dialog>.native-file-status { bottom:calc(16px + env(safe-area-inset-bottom)); }
.pdf-dialog-open { overflow:hidden; }
.msg-pdf-viewer { position:relative; width:100%; height:100%; min-width:0; min-height:0; display:flex; flex-direction:column; background:#edf0f6; }
.msg-pdf-toolbar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px 16px; padding:10px 12px; background:#fff; border-bottom:1px solid #dce3ee; flex:none; }
.msg-pdf-controls { display:flex; align-items:center; justify-content:center; gap:8px; }
.msg-pdf-toolbar button { display:inline-flex; align-items:center; justify-content:center; min-width:44px; height:44px; padding:0 10px; border:1px solid #dce3ee; border-radius:10px; background:#f7f9fc; color:#354b79; font:500 22px/1 system-ui; cursor:pointer; touch-action:manipulation; }
.msg-pdf-toolbar .msg-pdf-fit { min-width:80px; font-size:13px; }
.msg-pdf-toolbar button[aria-pressed="true"] { background:#e7edfa; border-color:#a8b8d8; color:#243e72; }
.msg-pdf-toolbar button:disabled { opacity:.4; cursor:default; }
.msg-pdf-toolbar button:focus-visible { outline:2px solid #506ba7; outline-offset:2px; }
.msg-pdf-counter { min-width:94px; font-size:13px; font-variant-numeric:tabular-nums; color:#4f5e75; text-align:center; }
.msg-pdf-status { position:absolute; z-index:1; top:50%; left:50%; transform:translate(-50%,-50%); width:max-content; max-width:calc(100% - 32px); box-sizing:border-box; margin:0; padding:16px 20px; border-radius:12px; background:#fff; box-shadow:0 2px 12px #24334c20; text-align:center; color:#53627a; font-size:14px; line-height:1.5; }
.msg-pdf-retry { align-self:center; margin:0 12px 12px; min-height:44px; flex:none; }
.msg-pdf-retry[hidden] { display:none; }
.msg-pdf-stage { flex:1; min-height:0; overflow:auto; padding:16px; scrollbar-gutter:stable both-edges; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.msg-pdf-stage canvas { display:block; margin-inline:auto; background:white; box-shadow:0 2px 12px #24334c20; }
@media (hover:hover) and (pointer:fine) { .msg-pdf-toolbar button:hover:not(:disabled) { background:#edf1fc; border-color:#a8b8d8; } }
@media (max-width:767px) {
 body dialog.pdf-dialog { width:100%; height:100dvh; max-height:100dvh; margin:0; border:0; border-radius:0; }
 .pdf-dialog-header { grid-template-columns:minmax(0,1fr) auto 44px; gap:10px; padding:calc(12px + env(safe-area-inset-top)) 16px 12px; }
 .pdf-dialog-header .modal-close { grid-column:3; }
 .pdf-dialog-download { justify-content:center; }
 .pdf-dialog h2 { font-size:16px; max-height:4.2em; overflow:auto; }
 .msg-pdf-toolbar { justify-content:center; padding:8px 12px; gap:6px 16px; }
 .msg-pdf-stage { padding:12px; padding-bottom:calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width:540px) {
 .pdf-dialog-header { grid-template-columns:minmax(0,1fr) 44px; }
 .pdf-dialog-header .modal-close { grid-column:2; }
 .pdf-dialog-download { grid-column:1 / -1; grid-row:2; }
 .msg-pdf-controls { flex-basis:100%; }
}
@media (max-height:500px) and (min-width:541px) {
 body dialog.pdf-dialog { width:100%; height:100dvh; margin:0; border:0; border-radius:0; }
 .pdf-dialog-header { padding:calc(6px + env(safe-area-inset-top)) 12px 6px; }
 .pdf-dialog-kicker { display:none; }
 .msg-pdf-toolbar { padding:6px 12px; }
 .msg-pdf-stage { padding:8px; padding-bottom:calc(8px + env(safe-area-inset-bottom)); }
}
