.ux-attachment-preview-open {
  overflow: hidden;
}

a.ux-attachment-preview-link {
  cursor: zoom-in;
}

.thumbnails .ux-attachment-preview__pdf-tile {
  align-items: center;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-sizing: border-box;
  color: #334155;
  display: inline-flex;
  flex-direction: column;
  height: 96px;
  justify-content: center;
  overflow: hidden;
  padding: 12px 8px 8px;
  position: relative;
  vertical-align: middle;
  width: 120px;
}

.thumbnails .ux-attachment-preview__pdf-tile::after {
  border-color: #e2e8f0 #fff transparent transparent;
  border-style: solid;
  border-width: 10px;
  content: '';
  position: absolute;
  right: 0;
  top: 0;
}

.thumbnails .ux-attachment-preview__pdf-type {
  background: #b91c1c;
  border-radius: 3px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
}

.thumbnails .ux-attachment-preview__pdf-filename {
  display: block;
  font-size: 11px;
  margin-top: 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumbnails a:hover .ux-attachment-preview__pdf-tile,
.thumbnails a:focus-visible .ux-attachment-preview__pdf-tile {
  border-color: #64748b;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.16);
}

.ux-attachment-preview {
  align-items: center;
  background: rgba(15, 23, 42, 0.88);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 24px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 100000;
}

.ux-attachment-preview[hidden] {
  display: none;
}

.ux-attachment-preview__dialog {
  background: #111827;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  height: min(92vh, 960px);
  max-width: 1500px;
  overflow: hidden;
  width: min(94vw, 1500px);
}

.ux-attachment-preview__header,
.ux-attachment-preview__toolbar {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 48px;
  padding: 8px 12px;
}

.ux-attachment-preview__header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.ux-attachment-preview__title {
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ux-attachment-preview__body {
  align-items: center;
  background: #020617;
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  min-height: 0;
  overflow: auto;
  position: relative;
}

.ux-attachment-preview__image {
  display: block;
  height: auto;
  margin: auto;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.ux-attachment-preview__pdf {
  background: #fff;
  border: 0;
  height: 100%;
  width: 100%;
}

.ux-attachment-preview__error {
  color: #fecaca;
  padding: 24px;
  text-align: center;
}

.ux-attachment-preview__toolbar {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  justify-content: center;
}

.ux-attachment-preview__button,
.ux-attachment-preview__button:link,
.ux-attachment-preview__button:visited {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  box-sizing: border-box;
  color: #f8fafc;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  justify-content: center;
  min-height: 34px;
  min-width: 38px;
  padding: 6px 10px;
  text-decoration: none;
}

.ux-attachment-preview__button:hover,
.ux-attachment-preview__button:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-decoration: none;
}

.ux-attachment-preview__button:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.ux-attachment-preview__button[hidden] {
  display: none;
}

.ux-attachment-preview__button:disabled {
  cursor: default;
  opacity: 0.4;
}

/* Keep lightbox controls independent from Modern UI and third-party themes. */
.ux-attachment-preview .ux-attachment-preview__toolbar button.ux-attachment-preview__button,
.ux-attachment-preview .ux-attachment-preview__toolbar a.ux-attachment-preview__button,
.ux-attachment-preview .ux-attachment-preview__header button.ux-attachment-preview__button {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: #f8fafc;
}

.ux-attachment-preview .ux-attachment-preview__toolbar button.ux-attachment-preview__button:hover,
.ux-attachment-preview .ux-attachment-preview__toolbar button.ux-attachment-preview__button:focus-visible,
.ux-attachment-preview .ux-attachment-preview__toolbar a.ux-attachment-preview__button:hover,
.ux-attachment-preview .ux-attachment-preview__toolbar a.ux-attachment-preview__button:focus-visible,
.ux-attachment-preview .ux-attachment-preview__header button.ux-attachment-preview__button:hover,
.ux-attachment-preview .ux-attachment-preview__header button.ux-attachment-preview__button:focus-visible {
  background-color: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.ux-attachment-preview .ux-attachment-preview__toolbar a.ux-attachment-preview__download,
.ux-attachment-preview .ux-attachment-preview__toolbar a.ux-attachment-preview__download:link,
.ux-attachment-preview .ux-attachment-preview__toolbar a.ux-attachment-preview__download:visited {
  background-color: #2563eb;
  border-color: #60a5fa;
  color: #fff;
  font-weight: 700;
}

.ux-attachment-preview .ux-attachment-preview__toolbar a.ux-attachment-preview__download:hover,
.ux-attachment-preview .ux-attachment-preview__toolbar a.ux-attachment-preview__download:focus-visible {
  background-color: #1d4ed8;
  border-color: #93c5fd;
  color: #fff;
}

.ux-attachment-preview__close {
  font-size: 24px;
  line-height: 1;
  padding: 2px 8px;
}

.ux-attachment-preview__counter {
  color: #cbd5e1;
  min-width: 60px;
  text-align: center;
}

@media screen and (max-width: 600px) {
  .ux-attachment-preview {
    padding: 0;
  }

  .ux-attachment-preview__dialog {
    border-radius: 0;
    height: 100%;
    width: 100%;
  }

  .ux-attachment-preview__toolbar {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}
