.pdf-preview {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: rgb(3 9 20 / 85%);
  color: #edf3fc;
  isolation: isolate;
  overscroll-behavior: none;
}
.pdf-preview *, .pdf-preview *::before, .pdf-preview *::after { box-sizing: border-box; }
.pdf-preview__dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #566174;
  border-radius: 16px;
  background: #111b2b;
  box-shadow: 0 20px 90px rgb(0 0 0 / 50%);
}
.pdf-preview__header {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 12px;
  padding: 10px 12px 4px 18px;
  min-width: 0;
}
.pdf-preview__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font: 700 16px/1.4 system-ui, sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f3f6ff;
}
.pdf-preview__close, .pdf-preview__download {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid #667086;
  border-radius: 10px;
  background: #243149;
  color: #fff;
  font: 400 29px/1 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
}
.pdf-preview__download { font-size: 23px; background: transparent; border-color: transparent; }
.pdf-preview__close:hover, .pdf-preview__download:hover { background: #354663; }
.pdf-preview__close:focus-visible, .pdf-preview__download:focus-visible, .pdf-preview__viewport:focus-visible { outline: 3px solid #8bc4ff; outline-offset: -3px; }
.pdf-preview__status {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 18px 10px;
  color: #becbde;
  font: 400 12px/1.5 system-ui, sans-serif;
}
.pdf-preview__status--error { color: #ffceb7; }
.pdf-preview__viewport {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  scrollbar-gutter: stable;
  background: #3c4655;
  padding: 10px;
}
.attachment-preview__surface { position: relative; overflow: hidden; }
.pdf-preview__pages { position: absolute; width: 100%; min-width: 0; transform-origin: 0 0; }
.attachment-preview__zoom {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 12px 8px;
}
.attachment-preview__zoom-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid #667086;
  border-radius: 10px;
  background: #243149;
  color: #fff;
  font: 600 13px/1.2 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.attachment-preview__zoom-button:hover { background: #354663; }
.attachment-preview__zoom-button:disabled { opacity: .45; cursor: default; }
.attachment-preview__zoom-button:focus-visible { outline: 3px solid #8bc4ff; outline-offset: -3px; }
.attachment-preview__zoom-value { min-width: 62px; color: #f3f6ff; text-align: center; font: 600 13px/1.4 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.attachment-preview__magnifier {
  position: relative;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  margin: -3px 3px 0 0;
  border: 2px solid currentColor;
  border-radius: 50%;
  font: 600 17px/1 system-ui, sans-serif;
}
.attachment-preview__magnifier::after { content: ''; position: absolute; width: 9px; height: 2px; right: -7px; bottom: -4px; border-radius: 1px; background: currentColor; transform: rotate(45deg); }
.pdf-preview__page {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  color: #4b5563;
  box-shadow: 0 2px 8px rgb(0 0 0 / 28%);
  margin: 0 0 12px;
}
.pdf-preview__page:last-child { margin-bottom: 0; }
.pdf-preview__page-label {
  position: absolute;
  top: 12px;
  left: 12px;
  font: 400 12px/1.4 system-ui, sans-serif;
}
.pdf-preview__page[data-rendered] .pdf-preview__page-label { visibility: hidden; }
.pdf-preview__canvas { position: relative; display: block; width: 100%; height: auto; max-width: 100%; }
.pdf-preview__page-error { position: relative; padding: 30px 20px; font: 400 14px/1.5 system-ui, sans-serif; }
@media (max-width: 600px) {
  .pdf-preview { padding: max(6px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); }
  .pdf-preview__dialog { border-radius: 12px; }
  .pdf-preview__header { gap: 8px; padding: 7px 7px 3px 12px; }
  .pdf-preview__title { font-size: 14px; }
  .pdf-preview__status { padding: 0 12px 8px; }
  .pdf-preview__viewport { padding: 4px; }
  .pdf-preview__page { margin-bottom: 7px; }
}

/* All reading views share the PDF dialog, width and vertical scroll container. */
.attachment-preview__image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  background: #fff;
}
.pdf-preview__pages > .attachment-preview__image { width: 100%; height: 100%; max-width: none; }
.attachment-preview__document {
  width: 100%;
  min-width: 0;
  padding: clamp(14px, 3vw, 44px);
  color: #18283e;
  background: #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / 28%);
  font: 400 16px/1.65 system-ui, sans-serif;
  overflow-wrap: anywhere;
  word-break: normal;
}
.attachment-preview__paragraph { margin: 0 0 1em; white-space: pre-wrap; }
.attachment-preview__document--text .attachment-preview__paragraph {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px;
  tab-size: 4;
}
.attachment-preview__notice {
  margin: 0 0 22px;
  padding: 10px 12px;
  border: 1px solid #c5d3e6;
  border-radius: 7px;
  background: #eef4fc;
  color: #334764;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.attachment-preview__figure { max-width: 100%; margin: 1em 0; }
.attachment-preview__empty { color: #52637a; font-size: 14px; }
.attachment-preview__table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 1em 0 1.5em;
  font-size: 14px;
  line-height: 1.5;
}
.attachment-preview__table th, .attachment-preview__table td {
  min-width: 0;
  border: 1px solid #cbd5e3;
  padding: 10px;
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.attachment-preview__table th { color: #294566; background: #edf3fa; font-weight: 650; }
.attachment-preview__table th[scope="row"] { width: 4em; }
.attachment-preview__sheet { margin: 0 0 2.5em; min-width: 0; }
.attachment-preview__sheet:last-child { margin-bottom: 0; }
.attachment-preview__sheet-title {
  margin: 0 0 1em;
  padding-bottom: 10px;
  border-bottom: 2px solid #b7c9e1;
  color: #15375c;
  font: 700 21px/1.4 system-ui, sans-serif;
  overflow-wrap: anywhere;
}
.attachment-preview__sheet-row {
  margin: 0 0 16px;
  border: 1px solid #cbd5e3;
  border-radius: 8px;
  overflow: hidden;
}
.attachment-preview__sheet-row h4 {
  margin: 0;
  padding: 9px 12px;
  background: #edf3fa;
  color: #294566;
  font: 650 13px/1.5 system-ui, sans-serif;
}
.attachment-preview__cells {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1px;
  min-width: 0;
  margin: 0;
  background: #dbe4ef;
}
.attachment-preview__cell { min-width: 0; padding: 11px 12px; background: #fff; }
.attachment-preview__cell dt { color: #496180; font-size: 12px; font-weight: 650; }
.attachment-preview__cell dd { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.attachment-preview__table--stacked, .attachment-preview__table--stacked tbody,
.attachment-preview__table--stacked tr, .attachment-preview__table--stacked td { display: block; width: 100%; }
.attachment-preview__table--stacked tr { margin-bottom: 12px; border: 1px solid #cbd5e3; }
.attachment-preview__table--stacked td { border: 0; border-bottom: 1px solid #dbe4ef; }
.attachment-preview__table--stacked td:last-child { border-bottom: 0; }
.attachment-preview__table--stacked td::before {
  display: block; content: attr(data-label); color: #496180; font-size: 12px; font-weight: 650; white-space: normal;
}
@media (max-width: 760px) {
  .attachment-preview__table, .attachment-preview__table tbody, .attachment-preview__table tr,
  .attachment-preview__table td, .attachment-preview__table th[scope="row"] { display: block; width: 100%; }
  .attachment-preview__table thead { display: none; }
  .attachment-preview__table tr { margin-bottom: 12px; border: 1px solid #cbd5e3; }
  .attachment-preview__table td, .attachment-preview__table th[scope="row"] { border: 0; border-bottom: 1px solid #dbe4ef; }
  .attachment-preview__table td:last-child { border-bottom: 0; }
  .attachment-preview__table td::before {
    display: block; content: attr(data-label); color: #496180; font-size: 12px; font-weight: 650; white-space: normal;
  }
  .attachment-preview__sheet-title { font-size: 18px; }
  .attachment-preview__document { font-size: 15px; }
  .attachment-preview__cells { grid-template-columns: 1fr; }
}
