/* Isolated, same-origin viewer inside the software's existing lightbox. */
:root { color-scheme: light; --pdf-bg:#e8ecef; --pdf-surface:#fff; --pdf-text:#111827; --pdf-muted:#4b5563; --pdf-border:#cbd5e1; --pdf-accent:#2e5e25; }
:root[data-theme="dark"] { color-scheme:dark; --pdf-bg:#101510; --pdf-surface:#1c241c; --pdf-text:#f0f4ef; --pdf-muted:#c2cec0; --pdf-border:#4d624a; --pdf-accent:#94b58a; }
* { box-sizing:border-box; }
[hidden] { display:none!important; }
html,body { margin:0; height:100%; }
body { display:flex; flex-direction:column; background:var(--pdf-bg); color:var(--pdf-text); font:14px/1.45 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.pdf-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:10px 14px; flex:0 0 auto; padding:12px 16px; background:var(--pdf-surface); border-bottom:1px solid var(--pdf-border); }
.pdf-title { display:flex; align-items:center; gap:10px; min-width:0; flex:1 1 220px; }
.pdf-title h1 { margin:0; font-size:15px; font-weight:700; overflow-wrap:anywhere; }
.pdf-file-icon { display:inline-flex; align-items:center; justify-content:center; min-width:34px; min-height:40px; border:1px solid #df9d9d; border-radius:5px; background:#fff0f0; color:#a82323; font-size:10px; font-weight:800; }
button,input,select,.pdf-download { min-height:36px; font:inherit; border:1px solid var(--pdf-border); border-radius:6px; color:var(--pdf-text); background:var(--pdf-surface); }
button,.pdf-download { padding:6px 10px; cursor:pointer; }
button:hover:not(:disabled),.pdf-download:hover { border-color:var(--pdf-accent); color:var(--pdf-accent); }
button:disabled,input:disabled,select:disabled { opacity:.5; cursor:default; }
:is(button,input,select,a,summary):focus-visible { outline:2px solid var(--pdf-accent); outline-offset:2px; }
.pdf-download { text-decoration:none; white-space:nowrap; font-weight:600; }
.pdf-controls { display:flex; align-items:center; flex-wrap:wrap; gap:8px; flex:1 1 100%; }
#pdfPage { width:64px; padding:5px; }
#pdfZoom { max-width:130px; padding:5px; }
#pdfStatus { flex:1 1 100%; margin:0; color:var(--pdf-muted); font-size:12px; }
.pdf-stage { flex:1 1 auto; min-height:0; overflow:auto; padding:16px; overscroll-behavior:contain; }
.pdf-stage canvas { display:block; margin:0 auto; background:#fff; box-shadow:0 2px 14px #0003; }
#pdfError { max-width:640px; margin:24px auto; padding:16px; border:1px solid var(--pdf-border); border-radius:8px; background:var(--pdf-surface); }
.pdf-text { flex:0 0 auto; border-top:1px solid var(--pdf-border); padding:8px 16px; background:var(--pdf-surface); }
.pdf-text summary { cursor:pointer; }
.pdf-text pre { max-height:25vh; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; }
@media(max-width:480px) { .pdf-toolbar{padding:10px;gap:8px}.pdf-stage{padding:10px}.pdf-title{flex-basis:100%}.pdf-controls{gap:6px}button,.pdf-download{padding:6px 8px} }
