.pdf-preview-panel {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  background: rgba(8, 18, 34, 0.68);
  border: 1px solid var(--panel-border);
  border-radius: 1.25rem;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  container-name: pdf-panel;
  container-type: inline-size;
  isolation: isolate;
  background-clip: padding-box;
}

.pdf-current-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-viewer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.pdf-preview-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.9rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.pdf-preview-header-title {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.pdf-preview-header-title .pdf-current-name {
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.25;
}

.pdf-preview-header-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: stretch;
  justify-content: stretch;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.pdf-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 3.25rem;
  width: fit-content;
  padding: 0 0.8rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
  flex: none;
  box-sizing: border-box;
}

.pdf-open-btn,
.pdf-download-btn {
  min-width: 0;
  max-width: 100%;
  min-height: 3.25rem;
  height: auto;
  padding: 0.85rem 1rem;
  text-align: center;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.15;
}

.pdf-open-btn.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.pdf-download-btn.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.pdf-viewer-toolbar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  gap: 0.85rem;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  min-width: 0;
}

.pdf-step-btn {
  width: 2.6rem;
  min-width: 2.6rem;
  height: 2.6rem;
  min-height: 2.6rem;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

.pdf-footer-count {
  width: 2.6rem;
  min-width: 2.6rem;
  height: 2.6rem;
}

.pdf-thumbnail-strip {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 0.6rem 0.15rem 0.6rem;
}

.pdf-thumbnail-card {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 10.5rem;
  padding: 0.7rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.pdf-thumbnail-card:hover,
.pdf-thumbnail-card:focus-visible,
.pdf-thumbnail-card.is-active {
  outline: none;
  background: rgba(78, 166, 255, 0.14);
  border-color: rgba(124, 196, 255, 0.45);
  box-shadow: 0 0 0 0.12rem rgba(124, 196, 255, 0.14);
}

.pdf-thumbnail-card:focus-visible {
  transform: translateY(-1px);
}

.pdf-thumbnail-preview {
  display: block;
  position: relative;
  overflow: hidden;
  height: 8.6rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #fff;
}

.pdf-thumbnail-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: none;
  background: #fff;
  transform: scale(0.55);
  transform-origin: top left;
  width: 181%;
  height: 181%;
}

.pdf-thumbnail-name {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.78rem;
  line-height: 1.2;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-frame-shell {
  flex: 1 1 auto;
  border-radius: 1.1rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  min-height: 0;
  width: 100%;
  max-width: 100%;
}

.pdf-frame {
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  display: block;
  background: #fff;
}

.pdf-empty-state {
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
}

.pdf-empty-path {
  display: block;
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 992px) {
  .pdf-preview-panel {
    position: static;
  }
}

@media (max-width: 1200px) {
  .pdf-preview-panel {
    position: static;
  }

  .pdf-preview-header-actions {
    justify-content: flex-start;
  }

  .pdf-open-btn,
  .pdf-download-btn {
    width: 100%;
  }
}

@container pdf-panel (max-width: 34rem) {
  .pdf-preview-header-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .pdf-preview-header {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .pdf-preview-header-actions {
    justify-content: flex-start;
  }

  .pdf-frame-shell,
  .pdf-frame {
    min-height: 52vh;
    height: 52vh;
  }
}
