.cv-doc-preview-modal__dialog {
  max-width: min(1200px, 96vw);
  height: calc(100vh - 2rem);
  margin: 1rem auto;
}

.cv-doc-preview-modal__content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.cv-doc-preview-modal__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #f8f9fa;
}

.cv-doc-preview-modal__frame {
  display: block;
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.cv-doc-preview-modal__loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 249, 250, 0.85);
}

.cv-doc-preview-modal__loading.d-none {
  display: none !important;
}

.cv-doc-preview-modal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex-shrink: 0;
  background: #f1f3f5;
  color: #495057;
  font-size: 14px;
}

.cv-doc-preview-modal__icon.is-pdf {
  background: rgba(193, 32, 0, 0.1);
  color: #c12000;
}

.cv-doc-preview-modal__icon.is-doc {
  background: rgba(39, 99, 183, 0.1);
  color: #2763b7;
}

.cv-doc-preview-modal__icon.is-xls {
  background: rgba(39, 135, 51, 0.1);
  color: #278733;
}

.cv-doc-preview-modal__icon.is-img {
  background: rgba(213, 131, 0, 0.12);
  color: #d58300;
}

.cv-doc-preview-modal__icon.is-video {
  background: rgba(111, 66, 193, 0.1);
  color: #6f42c1;
}

.cv-doc-preview-modal__icon.is-audio {
  background: rgba(13, 110, 253, 0.1);
  color: #0d6efd;
}

.cv-doc-preview-modal__icon.is-archive {
  background: rgba(108, 117, 125, 0.12);
  color: #6c757d;
}

.cv-doc-preview-modal__header {
  gap: 12px;
  flex-wrap: nowrap;
  overflow: visible;
}

.cv-doc-preview-modal__title {
  flex: 1 1 auto;
  min-width: 0;
  margin-right: 0;
}

.cv-doc-preview-modal__chrome {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
  position: relative;
}

.cv-doc-preview-modal__toolbar,
.cv-doc-preview-modal__head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cv-doc-preview-modal__toolbar:not(:has(> :not(.d-none))),
.cv-doc-preview-modal__head-actions:not(:has(> :not(.d-none))) {
  display: none;
}

.cv-doc-preview-modal__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cv-doc-preview-modal__head {
  justify-content: flex-start;
}

.cv-doc-preview-modal__counter {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: #6c757d;
}

.cv-doc-preview-modal__close {
  flex-shrink: 0;
  margin: 0 !important;
  width: 1rem;
  height: 1rem;
  padding: 0.35rem;
  box-sizing: content-box;
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.65;
}

.cv-doc-preview-modal__head .cv-doc-preview-modal__close {
  position: static;
}

.cv-doc-preview-modal__more {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #3f3937;
  border-radius: 8px;
  flex-shrink: 0;
}

.cv-doc-preview-modal__more:hover,
.cv-doc-preview-modal__more:focus,
.cv-doc-preview-modal__more[aria-expanded="true"] {
  background: #f1eeea;
  color: #1a1513;
}

.cv-doc-preview-modal__toolbar [data-cv-preview-prev] .cv-doc-preview-modal__btn-label,
.cv-doc-preview-modal__toolbar [data-cv-preview-next] .cv-doc-preview-modal__btn-label {
  display: none;
}

#cvDocumentPreviewModal.modal {
  z-index: 1300;
}

body.modal-open:has(#cvDocumentPreviewModal.show) .modal-backdrop {
  z-index: 1290;
}

@media (max-width: 991.98px) {
  .cv-doc-preview-modal__dialog {
    max-width: 100%;
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
  }

  .cv-doc-preview-modal__content {
    height: 100%;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .cv-doc-preview-modal__header,
  .cv-doc-preview-modal__head {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    overflow: visible;
    position: relative;
    z-index: 3;
  }

  .cv-doc-preview-modal__title {
    flex: 1 1 0;
    min-width: 0;
    font-size: 0.95rem;
  }

  .cv-doc-preview-modal__more:not(.d-none) {
    display: inline-flex;
  }

  .cv-doc-preview-modal__toolbar,
  .cv-doc-preview-modal__head-actions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-width: 200px;
    margin: 0;
    padding: 6px;
    background: #fff;
    border: 1px solid #e4e1dd;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(26, 21, 19, 0.16);
    z-index: 5;
  }

  .cv-doc-preview-modal__toolbar.is-open,
  .cv-doc-preview-modal__head-actions.is-open {
    display: flex !important;
  }

  .cv-doc-preview-modal__toolbar .cv-doc-preview-modal__btn-label,
  .cv-doc-preview-modal__head-actions .cv-doc-preview-modal__btn-label {
    display: inline;
  }

  .cv-doc-preview-modal__toolbar .btn,
  .cv-doc-preview-modal__head-actions .cv-btn,
  .cv-doc-preview-modal__toolbar a.btn {
    width: 100%;
    min-height: 40px;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: #1a1513;
    box-shadow: none;
    border-radius: 8px;
    font-weight: 500;
  }

  .cv-doc-preview-modal__toolbar .btn:hover,
  .cv-doc-preview-modal__toolbar .btn:focus,
  .cv-doc-preview-modal__head-actions .cv-btn:hover,
  .cv-doc-preview-modal__head-actions .cv-btn:focus,
  .cv-doc-preview-modal__toolbar a.btn:hover,
  .cv-doc-preview-modal__toolbar a.btn:focus {
    background: #f7f5f2;
    color: #1a1513;
  }

  .cv-doc-preview-modal__toolbar .btn-primary {
    color: #a90017;
    background: transparent;
  }

  .cv-doc-preview-modal__toolbar .btn-primary:hover,
  .cv-doc-preview-modal__toolbar .btn-primary:focus {
    color: #920014;
    background: #fff4f2;
  }

  .cv-doc-preview-modal__counter {
    padding: 6px 10px;
    text-align: center;
    width: 100%;
  }

  .cv-modal.cv-doc-preview-modal {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    z-index: 1300;
  }

  .cv-modal__dialog--preview {
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    overflow: visible;
  }

  .cv-doc-preview-modal__body {
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
  }
}
