/* Shared result-only preview; never style the source document workspace. */
.pdf-preview {
  min-width: 0;
  max-width: 100%;
  margin: 16px 0;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  color: #0f172a;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.pdf-preview .pdf-preview__title {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 650;
}
.pdf-preview .pdf-preview__status,
.pdf-preview .pdf-preview__caption {
  min-width: 0;
  max-width: 100%;
  margin: 0 0 12px;
  color: #475569;
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.pdf-preview[data-state="error"] .pdf-preview__status { color: #b91c1c; }
.pdf-preview .pdf-preview__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 12px;
}
.pdf-preview .pdf-preview__button {
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pdf-preview .pdf-preview__button:hover:not(:disabled) { background: #f1f5f9; border-color: #475569; }
.pdf-preview .pdf-preview__button:disabled { opacity: 1; color: #64748b; border-color: #cbd5e1; background: #f8fafc; cursor: not-allowed; }
.pdf-preview .pdf-preview__counter,
.pdf-preview .pdf-preview__zoom {
  min-width: 0;
  max-width: 100%;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.pdf-preview .pdf-preview__counter { text-align: center; }
.pdf-preview .pdf-preview__zoom { color: #475569; }
.pdf-preview .pdf-preview__viewport {
  min-width: 0;
  max-width: 100%;
  max-height: min(60vh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #f1f5f9;
}
.pdf-preview .pdf-preview__canvas { display: block; max-width: none; background: #fff; }
.pdf-preview .pdf-preview__caption { margin: 10px 0 0; }
.pdf-preview :focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.pdf-preview .pdf-preview__viewport:focus-visible { outline-offset: -3px; }
.pdf-preview[hidden], .pdf-preview [hidden] { display: none !important; }

/* These two workspaces use the shared 60 CSS px sticky navbar (120px at
   CSS layout zoom 2). Reserve its actual layout height plus the 6px focus
   outline, on the scrolling root rather than only on the preview group.
   This also protects reverse Tab when a button is already partly visible. */
html:has(#export-result-box),
html:has(#result-box .pdf-preview) {
  scroll-padding-block: 72px 12px;
}
:is(#export-result-box, #result-box) .pdf-preview__controls,
:is(#export-result-box, #result-box) .pdf-preview :is(button, [tabindex]) {
  scroll-margin-block: 8px;
}
