body.ss-datasheet-open { overflow: hidden; }
.ss-datasheet-dialog {
  width: min(1080px, calc(100% - 32px));
  height: min(86vh, 960px);
  height: min(86dvh, 960px);
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  margin: auto;
  color: var(--ink);
  background: var(--paper-light);
  box-shadow: 0 24px 80px #0005;
  overflow: hidden;
}
.ss-datasheet-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.ss-datasheet-dialog:not([open]) { display: none; }
.ss-datasheet-dialog [hidden] { display: none !important; }
.ss-datasheet-dialog::backdrop { background: #151410b8; }
.ss-datasheet-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; }
.ss-datasheet-header p { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.ss-datasheet-header h2 { margin-top: 5px; font-size: 21px; line-height: 1.2; letter-spacing: -.025em; }
.ss-datasheet-close { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid var(--line); padding: 9px; background: transparent; }
.ss-datasheet-close:hover, .ss-datasheet-zoom:hover:not(:disabled) { background: #f5e5d5; }
.ss-datasheet-viewport { position: relative; min-height: 0; padding: 12px; background: #e8e4db; overflow: auto; overscroll-behavior: contain; }
.ss-datasheet-pages { display: grid; gap: 18px; }
.ss-datasheet-sheet { position: relative; min-width: 0; margin: 0; }
.ss-datasheet-sheet figcaption { padding-top: 6px; color: var(--muted); font-size: 11px; text-align: center; }
.ss-datasheet-page { display: block; width: 100%; border: 0; padding: 0; margin: 0; background: #fff; box-shadow: 0 1px 5px #0001; cursor: zoom-in; }
.ss-datasheet-page:disabled { cursor: wait; }
.ss-datasheet-page img { display: block; width: 100%; height: auto; }
.ss-datasheet-loading { position: absolute; inset: 0 0 24px; display: grid; place-items: center; padding: 24px; font-size: 14px; pointer-events: none; }
.ss-datasheet-error { margin: 0; padding: 28px; background: var(--paper-light); font-size: 14px; }
.ss-datasheet-footer { padding: 10px 22px 14px; }
.ss-datasheet-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ss-datasheet-reading-note { color: var(--muted); font-size: 12px; }
.ss-datasheet-zoom { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; border: 0; padding: 6px 9px; background: transparent; font-size: 13px; }
.ss-datasheet-zoom:disabled { opacity: .4; }
.ss-datasheet-files { display: flex; flex-wrap: wrap; align-items: center; gap: 0 22px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ss-datasheet-files a { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.ss-datasheet-files .ss-icon { width: 19px; height: 19px; color: #b63b12; }
.ss-datasheet-dialog :focus-visible { outline-offset: -3px; }
.ss-datasheet-dialog.is-expanded { width: min(1280px, calc(100% - 24px)); height: calc(100vh - 24px); height: calc(100dvh - 24px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
.ss-datasheet-dialog.is-expanded .ss-datasheet-page { cursor: zoom-out; }
@media (min-width: 601px) and (max-width: 1104px) {
  .ss-datasheet-dialog.is-expanded .ss-datasheet-pages { width: 150%; max-width: none; }
}
@media (max-width: 600px) {
  .ss-datasheet-dialog { width: calc(100% - 20px); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .ss-datasheet-header { padding: 12px; gap: 10px; }
  .ss-datasheet-header h2 { font-size: 18px; }
  .ss-datasheet-header p { font-size: 10px; }
  .ss-datasheet-footer { padding: 8px 12px 10px; }
  .ss-datasheet-controls { gap: 4px 8px; flex-wrap: wrap; }
  .ss-datasheet-zoom { gap: 4px; padding: 4px; font-size: 12px; }
  .ss-datasheet-zoom .ss-icon { width: 19px; }
  .ss-datasheet-viewport { padding: 7px; }
  .ss-datasheet-dialog.is-expanded .ss-datasheet-pages { width: 200%; max-width: none; }
}
@media (max-width: 400px) {
  .ss-datasheet-zoom .ss-icon { display: none; }
  .ss-datasheet-zoom { margin-left: auto; }
}
@media (max-height: 500px) {
  .ss-datasheet-dialog { height: calc(100vh - 16px); height: calc(100dvh - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
  .ss-datasheet-header { padding: 8px 12px; }
  .ss-datasheet-header p { display: none; }
  .ss-datasheet-header h2 { margin: 0; font-size: 18px; }
  .ss-datasheet-footer { padding: 6px 12px; }
  .ss-datasheet-files { margin-top: 2px; padding-top: 2px; }
}
@media (max-height: 500px) and (min-width: 700px) {
  .ss-datasheet-footer { display: flex; align-items: center; gap: 20px; }
  .ss-datasheet-controls { flex: 1; }
  .ss-datasheet-files { margin: 0; padding: 0; border: 0; }
}
