.pdf-editor {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pdf-editor__grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.pdf-editor__workspace {
  display: block;
}

.pdf-editor__panel--preview .pdf-panel__header,
.pdf-editor__panel--gallery .pdf-panel__header {
  align-items: flex-start;
}

.pdf-editor__panel--preview .pdf-panel__header > .btn-group {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pdf-editor__panel--preview .pdf-panel__header {
  flex-wrap: wrap;
}

@keyframes pdfFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pdf-file-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pdf-file-controls .btn {
  flex-shrink: 0;
}

.pdf-upload-btn input[type="file"] {
  display: none;
}

.pdf-primary-preview__stage.is-dropping {
  border-color: rgba(71, 171, 252, 0.75);
  box-shadow: 0 0 0 3px rgba(71, 171, 252, 0.2);
}

.pdf-primary-preview {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pdf-primary-preview__stage {
  position: relative;
  border-radius: 1rem;
  border: 1px solid rgba(20, 60, 173, 0.15);
  background: linear-gradient(
    145deg,
    rgba(243, 247, 255, 0.8),
    rgba(219, 230, 250, 0.9)
  );
  padding: 0.75rem;
  height: 65vh;
  aspect-ratio: 210 / 297;
  max-width: 100%;
  overflow: auto;
  margin: 0 auto;
  box-shadow: inset 0 0 0 1px rgba(20, 60, 173, 0.08);
  flex: 0 1 640px;
  max-width: 640px;
  width: 100%;
}

.pdf-primary-preview__stage.is-text-tool {
  cursor: text;
}

.pdf-primary-preview__stage.is-panning {
  cursor: grabbing;
}

.pdf-primary-preview__viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0 auto;
  border-radius: 0.75rem;
  overflow: hidden;
}

.pdf-primary-preview__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.pdf-primary-preview__nav-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
}

.pdf-primary-preview__nav-controls > .btn {
  min-width: 120px;
}

.pdf-primary-preview__counter {
  min-width: 120px;
  text-align: center;
  font-weight: 600;
  color: #143cad;
  font-size: 0.95rem;
}

.dark-mode .pdf-primary-preview__counter {
  color: #e2e9ff;
}

.pdf-primary-preview__surface {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  background: #fff;
}

.pdf-primary-preview__overlay {
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  pointer-events: auto;
  z-index: 2;
  cursor: grab;
}

.pdf-primary-preview__overlay.is-text-tool {
  cursor: text;
}

.pdf-primary-preview__stage.is-panning .pdf-primary-preview__overlay {
  cursor: grabbing;
}

.pdf-inline-editor-layer {
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  pointer-events: none;
  z-index: 4;
}

.pdf-inline-editor {
  position: absolute;
  min-width: 160px;
  min-height: 0;
  font-size: 1rem;
  line-height: 1.2;
  border-radius: 0.4rem;
  border: 1px dashed rgba(71, 171, 252, 0.6);
  background: rgba(255, 255, 255, 0.85);
  color: inherit;
  padding: 0;
  box-shadow: none;
  pointer-events: auto;
  resize: none;
  box-sizing: border-box;
}

.pdf-shape-preview {
  position: absolute;
  border: 2px dashed rgba(244, 91, 105, 0.7);
  border-radius: 0.5rem;
  background: rgba(244, 91, 105, 0.18);
  pointer-events: none;
  z-index: 3;
}

.pdf-primary-preview__empty {
  position: absolute;
  inset: 0.75rem;
  border-radius: 0.75rem;
  border: 2px dashed rgba(20, 60, 173, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  color: rgba(20, 60, 173, 0.8);
  background: rgba(255, 255, 255, 0.7);
}

.pdf-primary-preview__meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pdf-text-mode-alert {
  display: none;
  margin-bottom: 0.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(20, 60, 173, 0.15);
  background: rgba(71, 171, 252, 0.12);
  color: #0f2f7d;
  font-weight: 600;
  box-shadow: 0 0.5rem 1.5rem rgba(20, 60, 173, 0.1);
}

.pdf-text-mode-alert.is-visible {
  display: block;
  animation: pdfFadeIn 0.2s ease;
}

.pdf-primary-preview__label {
  font-weight: 600;
  color: #143cad;
}

.pdf-primary-preview__hint {
  font-size: 0.85rem;
}

.pdf-primary-preview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pdf-primary-preview__zoom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.pdf-primary-preview__zoom-range {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 220px;
  min-width: 160px;
}

.pdf-primary-preview__zoom label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5c6c8c;
  margin-right: 0.25rem;
  white-space: nowrap;
}

.pdf-primary-preview__zoom input[type="range"] {
  flex: 1;
  min-width: 0;
}

#pdfPreviewZoom,
.pdf-watermark-grid .form-range {
  accent-color: var(--primary, #47abfc);
  cursor: pointer;
}

#pdfPreviewZoom::-webkit-slider-runnable-track,
.pdf-watermark-grid .form-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 60, 173, 0.18);
  border: 1px solid rgba(20, 60, 173, 0.25);
}

#pdfPreviewZoom::-webkit-slider-thumb,
.pdf-watermark-grid .form-range::-webkit-slider-thumb {
  height: 18px;
  width: 18px;
  border-radius: 999px;
  border: 0;
  background: var(--primary, #47abfc);
  box-shadow: 0 0.15rem 0.35rem rgba(20, 60, 173, 0.45);
  margin-top: -6px;
  transition: transform 0.15s ease;
}

#pdfPreviewZoom::-webkit-slider-thumb:focus,
#pdfPreviewZoom::-webkit-slider-thumb:hover,
.pdf-watermark-grid .form-range::-webkit-slider-thumb:focus,
.pdf-watermark-grid .form-range::-webkit-slider-thumb:hover {
  transform: scale(1.05);
}

#pdfPreviewZoom::-moz-range-track,
.pdf-watermark-grid .form-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 60, 173, 0.18);
  border: 1px solid rgba(20, 60, 173, 0.25);
}

#pdfPreviewZoom::-moz-range-progress,
.pdf-watermark-grid .form-range::-moz-range-progress {
  background: var(--primary, #47abfc);
  height: 6px;
  border-radius: 999px;
}

#pdfPreviewZoom::-moz-range-thumb,
.pdf-watermark-grid .form-range::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 999px;
  border: 0;
  background: var(--primary, #47abfc);
  box-shadow: 0 0.15rem 0.35rem rgba(20, 60, 173, 0.45);
}

.dark-mode #pdfPreviewZoom,
.dark-mode .pdf-watermark-grid .form-range {
  accent-color: var(--primary, #5bc8ff);
}

.dark-mode #pdfPreviewZoom::-webkit-slider-runnable-track,
.dark-mode #pdfPreviewZoom::-moz-range-track,
.dark-mode .pdf-watermark-grid .form-range::-webkit-slider-runnable-track,
.dark-mode .pdf-watermark-grid .form-range::-moz-range-track {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
}

.pdf-primary-preview__zoom-value {
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 3.5rem;
  text-align: right;
  color: #143cad;
}

.dark-mode .pdf-primary-preview__zoom label {
  color: #a3a8c2;
}

.dark-mode .pdf-primary-preview__zoom-value {
  color: #e2e9ff;
}

.pdf-primary-preview__quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  width: 100%;
}

.pdf-primary-preview__quick-actions.is-hidden {
  display: none;
}
.pdf-primary-preview__quick-actions .btn {
  flex: 1 1 120px;
}

.pdf-primary-preview__stage-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.pdf-primary-preview__ghost {
  border: 1px dashed rgba(20, 60, 173, 0.35);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.8);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: min(170px, 28%);
  min-width: 140px;
  flex: 0 0 auto;
  aspect-ratio: 210 / 297;
  color: #5c6c8c;
  filter: grayscale(1);
  opacity: 0.6;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: inset 0 0 0 1px rgba(20, 60, 173, 0.05);
}

.pdf-primary-preview__ghost {
  display: flex;
}

@media (max-width: 1234px) {
  .pdf-primary-preview__ghost {
    display: none;
  }
}

.pdf-primary-preview__ghost:not(:disabled):hover {
  opacity: 0.85;
  transform: translateY(-2px);
}

.pdf-primary-preview__ghost:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pdf-primary-preview__ghost--placeholder {
  visibility: hidden;
}

.pdf-primary-preview__ghost-surface {
  width: 100%;
  height: auto;
  border-radius: 0.6rem;
  background: #fff;
  box-shadow: 0 0.35rem 1rem rgba(20, 60, 173, 0.15);
}

.pdf-primary-preview__ghost-label {
  font-size: 0.75rem;
  text-align: center;
  line-height: 1.2;
  min-height: 1.5rem;
}

.pdf-primary-preview__quick-actions .btn.is-active {
  background: linear-gradient(135deg, #47abfc, #143cad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0.7rem 1.5rem rgba(20, 60, 173, 0.3);
}

.pdf-layer-overlay {
  position: absolute;
  border: 1px dashed rgba(20, 60, 173, 0.75);
  border-radius: 0.4rem;
  background: transparent;
  background-color: transparent !important;
  color: #143cad;
  box-shadow: 0 0.35rem 0.85rem rgba(15, 23, 42, 0.25);
  cursor: move;
  pointer-events: auto;
  overflow: visible;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pdf-layer-overlay--image {
  border-color: rgba(48, 195, 158, 0.8);
  background: rgba(48, 195, 158, 0.12);
}

.pdf-layer-overlay--shape {
  border-color: rgba(244, 91, 105, 0.85);
  background: rgba(244, 91, 105, 0.12);
}

.pdf-layer-overlay.is-active {
  border-style: solid;
  border-color: rgba(71, 171, 252, 0.95);
  box-shadow: 0 0 0 2px rgba(71, 171, 252, 0.45);
}

.pdf-layer-overlay__content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0.1rem 0.2rem;
  white-space: pre-wrap;
  pointer-events: none;
  line-height: 1.2;
  text-shadow: 0 0.15rem 0.3rem rgba(15, 23, 42, 0.35);
  background: transparent;
}

.pdf-layer-overlay__image,
.pdf-layer-overlay__shape {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pdf-layer-overlay__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.pdf-layer-overlay__shape {
  display: block;
  border-radius: 0.35rem;
  opacity: 0.85;
}

.pdf-layer-overlay__action-bar {
  position: absolute;
  top: -42px;
  right: 0;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  pointer-events: none;
}

.pdf-layer-overlay__action-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(20, 60, 173, 0.2);
  background: #fff;
  color: #143cad;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0.35rem 0.85rem rgba(15, 23, 42, 0.25);
  padding: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease,
    color 0.15s ease;
  pointer-events: auto;
}

.pdf-layer-overlay__action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.55rem 1.2rem rgba(15, 23, 42, 0.35);
}

.pdf-layer-overlay__edit {
  border-color: rgba(71, 171, 252, 0.5);
  background: rgba(255, 255, 255, 0.95);
  color: #143cad;
}

.pdf-layer-overlay__edit:hover {
  background: rgba(71, 171, 252, 0.15);
}

.pdf-layer-overlay__move {
  border-color: rgba(20, 60, 173, 0.25);
  background: rgba(255, 255, 255, 0.92);
  color: #143cad;
}

.pdf-layer-overlay__move:hover {
  background: rgba(71, 171, 252, 0.12);
}

.pdf-layer-overlay__delete {
  border-color: rgba(244, 91, 105, 0.45);
  color: #d9534f;
  background: rgba(244, 91, 105, 0.08);
}

.pdf-layer-overlay__delete:hover {
  background: rgba(244, 91, 105, 0.18);
  color: #a52f2a;
}

.pdf-layer-overlay__edit,
.pdf-layer-overlay__delete {
  font-weight: 600;
}

.pdf-layer-overlay__handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid rgba(20, 60, 173, 0.8);
  border-radius: 3px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  z-index: 3;
}

.pdf-layer-overlay__handle--n {
  top: 0;
  left: 50%;
  cursor: n-resize;
}

.pdf-layer-overlay__handle--s {
  top: 100%;
  left: 50%;
  cursor: s-resize;
}

.pdf-layer-overlay__handle--e {
  top: 50%;
  left: 100%;
  cursor: e-resize;
}

.pdf-layer-overlay__handle--w {
  top: 50%;
  left: 0;
  cursor: w-resize;
}

.pdf-layer-overlay__handle--ne {
  top: 0;
  left: 100%;
  cursor: ne-resize;
}

.pdf-layer-overlay__handle--nw {
  top: 0;
  left: 0;
  cursor: nw-resize;
}

.pdf-layer-overlay__handle--se {
  top: 100%;
  left: 100%;
  cursor: se-resize;
}

.pdf-layer-overlay__handle--sw {
  top: 100%;
  left: 0;
  cursor: sw-resize;
}

.pdf-preview-workspace {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pdf-preview-workspace .pdf-primary-preview {
  flex: 1 1 auto;
  min-width: 0;
}

.pdf-preview-toolbelt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 50px;
  max-width: 50px;
  flex: 0 0 50px;
  position: sticky;
  top: 1.5rem;
  align-self: flex-start;
  z-index: 10;
}

.pdf-preview-toolbelt__primary,
.pdf-preview-toolbelt__quick {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  width: 100%;
}

.pdf-preview-toolbelt__quick {
  justify-content: center;
}

.pdf-preview-toolbelt__btn,
.pdf-preview-toolbelt__quick-btn {
  max-width: 48px !important;
  max-height: 48px !important;
  border-radius: 12px;
  border: 1px solid
    color-mix(in srgb, var(--primary, #47abfc) 45%, transparent);
  background: color-mix(in srgb, var(--primary, #47abfc) 12%, #ffffff);
  color: color-mix(in srgb, var(--primary, #47abfc) 75%, #0f2f7d);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.4rem 1rem
    color-mix(in srgb, var(--primary, #47abfc) 25%, rgba(15, 23, 42, 0.15));
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease,
    background 0.15s ease;
}

.pdf-preview-toolbelt__btn:hover:not(:disabled),
.pdf-preview-toolbelt__quick-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--primary, #47abfc) 18%, #ffffff);
  box-shadow: 0 0.8rem 1.6rem
    color-mix(in srgb, var(--primary, #47abfc) 45%, rgba(15, 23, 42, 0.25));
}

.pdf-preview-toolbelt__btn:disabled,
.pdf-preview-toolbelt__quick-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pdf-preview-toolbelt__btn--primary {
  background: linear-gradient(
    135deg,
    var(--primary, #47abfc),
    color-mix(in srgb, var(--primary, #47abfc) 60%, #0f2f7d)
  );
  color: #fff;
  border-color: color-mix(in srgb, var(--primary, #47abfc) 75%, transparent);
  box-shadow: 0 0.9rem 1.6rem
    color-mix(in srgb, var(--primary, #47abfc) 45%, rgba(15, 23, 42, 0.35));
}

@media (max-width: 600px) {
  .pdf-preview-workspace {
    flex-direction: column;
  }
  .pdf-preview-toolbelt {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    max-width: none;
    gap: 0.5rem;
    justify-content: flex-start;
  }
  .pdf-preview-toolbelt__primary,
  .pdf-preview-toolbelt__quick {
    flex-direction: row;
    align-items: center;
    width: auto;
  }
  .pdf-preview-toolbelt__btn,
  .pdf-preview-toolbelt__quick-btn {
    width: 44px;
    height: 44px;
  }
}

.dark-mode .pdf-preview-toolbelt__btn,
.dark-mode .pdf-preview-toolbelt__quick-btn {
  background: color-mix(in srgb, var(--primary, #5bc8ff) 12%, #1f2544);
  color: color-mix(in srgb, var(--primary, #5bc8ff) 75%, #e2e9ff);
  border-color: color-mix(in srgb, var(--primary, #5bc8ff) 35%, transparent);
  box-shadow: 0 0.5rem 1.25rem
    color-mix(in srgb, var(--primary, #5bc8ff) 35%, rgba(0, 0, 0, 0.6));
}

.dark-mode .pdf-preview-toolbelt__btn--primary {
  background: linear-gradient(
    135deg,
    var(--primary, #5bc8ff),
    color-mix(in srgb, var(--primary, #5bc8ff) 65%, #1c2c5c)
  );
}

.pdf-image-drop-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pdf-image-drop-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.pdf-image-drop-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 36, 0.55);
}

.pdf-image-drop-modal__dialog {
  position: relative;
  background: #fff;
  border-radius: 1rem;
  padding: 1.5rem;
  width: min(420px, calc(100% - 2rem));
  box-shadow: 0 1.5rem 3rem rgba(15, 23, 42, 0.35);
}

.pdf-image-drop-modal__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pdf-image-drop-modal__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #0f1b3d;
}

.pdf-image-drop-modal__hint {
  margin: 0;
  color: #5c6c8c;
  font-size: 0.95rem;
}

.pdf-image-drop-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 420px) {
  .pdf-image-drop-modal__actions {
    flex-direction: row;
  }
  .pdf-image-drop-modal__actions .btn {
    flex: 1;
  }
}

.dark-mode .pdf-image-drop-modal__dialog {
  background: #1f1f32;
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.6);
}

.dark-mode .pdf-image-drop-modal__title {
  color: #f1f4ff;
}

.dark-mode .pdf-image-drop-modal__hint {
  color: #a3a8c2;
}

.pdf-primary-preview__overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none;
}

.pdf-watermark-handle {
  position: absolute;
  border: 1px dashed rgba(20, 60, 173, 0.85);
  border-radius: 0.35rem;
  background: rgba(20, 60, 173, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
  cursor: move;
  pointer-events: auto;
  z-index: 2;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.pdf-watermark-handle.is-selected {
  border-style: solid;
  border-color: rgba(71, 171, 252, 0.9);
  background: rgba(71, 171, 252, 0.15);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.pdf-watermark-handle__body {
  position: absolute;
  inset: 0;
}

.pdf-watermark-handle__edge {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid rgba(20, 60, 173, 0.85);
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.pdf-watermark-handle.is-selected .pdf-watermark-handle__edge {
  opacity: 1;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(12, 18, 36, 0.25);
}

.pdf-watermark-handle__edge--n {
  top: 0;
  left: 50%;
  cursor: n-resize;
}

.pdf-watermark-handle__edge--s {
  top: 100%;
  left: 50%;
  cursor: s-resize;
}

.pdf-watermark-handle__edge--e {
  top: 50%;
  left: 100%;
  cursor: e-resize;
}

.pdf-watermark-handle__edge--w {
  top: 50%;
  left: 0;
  cursor: w-resize;
}

.pdf-watermark-handle__edge--ne {
  top: 0;
  left: 100%;
  cursor: ne-resize;
}

.pdf-watermark-handle__edge--nw {
  top: 0;
  left: 0;
  cursor: nw-resize;
}

.pdf-watermark-handle__edge--se {
  top: 100%;
  left: 100%;
  cursor: se-resize;
}

.pdf-watermark-handle__edge--sw {
  top: 100%;
  left: 0;
  cursor: sw-resize;
}

.pdf-watermark-preview-surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.pdf-page-strip {
  margin-top: 1rem;
  border-top: 1px solid rgba(20, 60, 173, 0.08);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pdf-page-strip__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  align-items: flex-start;
}

.pdf-page-strip__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #143cad;
}

.pdf-page-preview {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 1rem 0;
  margin: 0;
  scroll-snap-type: x proximity;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.pdf-page-preview::-webkit-scrollbar {
  height: 8px;
}

.pdf-page-preview::-webkit-scrollbar-track {
  background: rgba(20, 60, 173, 0.05);
  border-radius: 999px;
}

.pdf-page-preview::-webkit-scrollbar-thumb {
  background: rgba(20, 60, 173, 0.35);
  border-radius: 999px;
}

.pdf-page-preview__card {
  position: relative;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  flex: 0 0 180px;
  scroll-snap-align: start;
}

.pdf-page-preview__card.is-active {
  border-color: rgba(71, 171, 252, 0.6);
  box-shadow: 0 0.5rem 1.25rem rgba(71, 171, 252, 0.3);
  transform: translateY(-12px);
}

.pdf-page-preview__card.is-active:hover {
  transform: translateY(-6px);
}

.pdf-page-preview__card.is-dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.pdf-page-preview__remove {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 3;
}

.pdf-editor__panel {
  background: #fff;
  border-radius: 1rem;
  border: 1px solid rgba(20, 60, 173, 0.08);
  padding: 1.25rem;
  box-shadow: 0 0.5rem 1.5rem rgba(20, 60, 173, 0.04);
  max-width: 100%;
  overflow: hidden;
}

.dark-mode .pdf-editor__panel {
  background: #1b1b2a;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5);
}

.pdf-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.pdf-panel__header h2 {
  font-size: 1rem;
  margin: 0;
}

.pdf-editor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pdf-file-list {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.pdf-file-list,
.pdf-page-list,
.pdf-layer-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pdf-file-card,
.pdf-page-item,
.pdf-layer-item {
  border-radius: 0.75rem;
  border: 1px solid rgba(20, 60, 173, 0.12);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  background: #fdfdff;
  flex-wrap: wrap;
}

.dark-mode .pdf-file-card,
.dark-mode .pdf-page-item,
.dark-mode .pdf-layer-item {
  background: #24243c;
  border-color: rgba(255, 255, 255, 0.12);
}

.pdf-page-item__actions,
.pdf-layer-item__actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}

.pdf-file-card__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.pdf-layer-item {
  position: relative;
  padding-right: 4rem;
}

.pdf-file-list.is-dropping {
  border: 1px dashed rgba(71, 171, 252, 0.6);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: rgba(71, 171, 252, 0.08);
}

.pdf-layer-empty,
.pdf-page-empty,
.pdf-files-empty {
  font-size: 0.95rem;
  color: #6c757d;
  padding: 0.5rem 0;
}

.dark-mode .pdf-layer-empty,
.dark-mode .pdf-page-empty,
.dark-mode .pdf-files-empty {
  color: #adb5bd;
}

.pdf-layer-form .form-group {
  margin-bottom: 1rem;
}

.pdf-layer-form__group {
  border: 1px solid rgba(20, 60, 173, 0.12);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.dark-mode .pdf-layer-form__group {
  border-color: rgba(255, 255, 255, 0.18);
}

.pdf-layer-form__group legend {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.pdf-layer-form__controls {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.pdf-layer-form__controls .form-group {
  margin-bottom: 0;
}

.pdf-color-input {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pdf-color-input input[type="color"] {
  flex: 0 0 46px;
  padding: 0;
}

.pdf-color-input .form-control {
  flex: 1;
  min-width: 0;
}

.pdf-watermark-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pdf-watermark-grid .form-group {
  margin-bottom: 0;
}

.pdf-hint {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.35rem;
}

.dark-mode .pdf-hint {
  color: #a3a8c2;
}

.pdf-layer-list__badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #143cad;
  background: rgba(71, 171, 252, 0.12);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

.dark-mode .pdf-layer-list__badge {
  color: #9fd0ff;
  background: rgba(71, 171, 252, 0.25);
}

.pdf-layer-item__details {
  flex: 1 1 260px;
  min-width: 0;
}

.pdf-layer-item__actions {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  margin-left: 0;
  gap: 0.4rem;
}

.pdf-layer-item__action-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(20, 60, 173, 0.2);
  background: #fff;
  color: #143cad;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pdf-layer-item__action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.5rem 1.2rem rgba(20, 60, 173, 0.15);
}

.pdf-layer-item__action-btn--danger {
  border-color: rgba(244, 91, 105, 0.45);
  color: #d9534f;
  background: rgba(244, 91, 105, 0.08);
}

.dark-mode .pdf-layer-item__action-btn {
  background: #1f2544;
  color: #e2e9ff;
  border-color: rgba(255, 255, 255, 0.15);
}

.dark-mode .pdf-layer-item__action-btn--danger {
  color: #ff9da3;
  border-color: rgba(255, 157, 163, 0.45);
  background: rgba(255, 157, 163, 0.1);
}

.pdf-output-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pdf-output-area textarea {
  min-height: 68px;
}

.pdf-page-preview__card {
  position: relative;
  border-radius: 0.9rem;
  padding: 0.85rem;
  background: #fff;
  border: 1px solid rgba(20, 60, 173, 0.12);
  color: #143cad;
  box-shadow: 0 8px 16px rgba(20, 60, 173, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  --pdf-page-preview-accent: var(--primary, #47abfc);
}

.pdf-page-preview__drop-indicator {
  width: 6px;
  border-radius: 999px;
  background: var(--primary, #47abfc);
  border: 1px solid color-mix(in srgb, var(--primary, #47abfc) 75%, transparent);
  box-shadow: 0 0.5rem 1.25rem
    color-mix(in srgb, var(--primary, #47abfc) 45%, rgba(0, 0, 0, 0.5));
  opacity: 0;
  transform: scaleY(0.5);
  transition: opacity 0.15s ease, transform 0.15s ease;
  align-self: stretch;
  min-height: 140px;
  margin: 0 0.25rem;
}

.pdf-page-preview__drop-indicator.is-visible {
  opacity: 0.75;
  transform: scaleY(1);
}

.pdf-page-preview__card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), transparent);
  pointer-events: none;
  opacity: 0.6;
}

.pdf-page-preview__card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    var(--pdf-page-preview-accent),
    transparent
  );
  opacity: 0.16;
  pointer-events: none;
}

.pdf-page-preview__card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(20, 60, 173, 0.2);
}

.pdf-page-preview__canvas {
  aspect-ratio: 3 / 4;
  width: 100%;
  border-radius: 0.65rem;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.7)
  );
  border: 1px solid rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(20, 60, 173, 0.08);
}

.pdf-page-preview__canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    145deg,
    rgba(20, 60, 173, 0.12),
    rgba(20, 60, 173, 0)
  );
  mix-blend-mode: multiply;
  pointer-events: none;
}

.pdf-page-preview__surface {
  width: 100%;
  height: auto;
  display: block;
  border-radius: inherit;
  position: relative;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.7)
  );
}

.pdf-page-preview__badge {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--pdf-page-preview-accent);
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
}

.pdf-page-preview__meta {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pdf-page-preview__order-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.pdf-page-preview__order-controls .btn {
  flex: 1 1 48%;
  min-width: 0;
}

.pdf-page-preview__label {
  font-weight: 600;
  font-size: 0.92rem;
  color: #143cad;
}

.pdf-page-preview__file {
  font-size: 0.8rem;
  color: rgba(20, 60, 173, 0.65);
}

.pdf-page-preview__empty {
  color: rgba(20, 60, 173, 0.6);
  text-align: center;
  width: 100%;
  border: 1px dashed rgba(20, 60, 173, 0.2);
  border-radius: 0.85rem;
  padding: 1.5rem 1rem;
  background: rgba(20, 60, 173, 0.05);
}

.dark-mode .pdf-page-preview__card {
  background: rgba(10, 14, 26, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  color: #f6f8ff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.55);
}

.dark-mode .pdf-page-preview__label {
  color: #f6f8ff;
}

.dark-mode .pdf-page-preview__file {
  color: rgba(246, 248, 255, 0.7);
}

.dark-mode .pdf-page-preview__empty {
  color: rgba(246, 248, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.dark-mode .pdf-page-preview__drop-indicator {
  background: var(--primary, #5bc8ff);
  border: 1px solid
    color-mix(in srgb, var(--primary, #5bc8ff) 65%, rgba(255, 255, 255, 0.35));
  box-shadow: 0 0.6rem 1.5rem
    color-mix(in srgb, var(--primary, #5bc8ff) 35%, rgba(0, 0, 0, 0.75));
}

.dark-mode .pdf-primary-preview__stage {
  background: rgba(23, 26, 45, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.dark-mode .pdf-primary-preview__label {
  color: #f6f8ff;
}

.dark-mode .pdf-primary-preview__empty {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.35);
}

.dark-mode .pdf-page-preview__card.is-active {
  box-shadow: 0 12px 32px rgba(71, 171, 252, 0.45);
}

.pdf-file-drawer {
  position: fixed;
  inset: 0;
  padding: 1.5rem;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  background: rgba(10, 14, 26, 0.4);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.pdf-file-drawer.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.pdf-file-drawer__panel {
  position: relative;
  width: min(420px, 100%);
  max-width: 100%;
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem;
  border: 1px solid rgba(20, 60, 173, 0.08);
  box-shadow: 0 1.5rem 3rem rgba(15, 23, 42, 0.35);
  transform: translateX(20px);
  transition: transform 0.25s ease;
}

.pdf-file-drawer.is-visible .pdf-file-drawer__panel {
  transform: translateX(0);
}

.pdf-file-drawer__backdrop {
  position: absolute;
  inset: 0;
}

.pdf-file-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pdf-file-drawer__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: #5c6c8c;
  line-height: 1;
  cursor: pointer;
}

.pdf-file-drawer__close:hover {
  color: #143cad;
}

.pdf-file-drawer__body {
  max-height: min(70vh, 600px);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.pdf-file-drawer__actions {
  margin-bottom: 1rem;
}

.dark-mode .pdf-file-drawer__panel {
  background: #1b1b2a;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.65);
}

.dark-mode .pdf-file-drawer__close {
  color: #a3a8c2;
}

.pdf-export-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: transparent;
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.pdf-export-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
  background: rgba(10, 14, 26, 0.55);
}

.pdf-export-modal__backdrop {
  position: absolute;
  inset: 0;
}

.pdf-export-modal__dialog {
  position: relative;
  width: min(480px, 100%);
  max-width: 100%;
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 1.5rem 3rem rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(20, 60, 173, 0.08);
}

.pdf-export-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pdf-export-modal__body {
  position: relative;
}

.pdf-export-modal__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: #5c6c8c;
  cursor: pointer;
}

.pdf-export-modal__close:hover {
  color: #143cad;
}

.pdf-layer-tool-panel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: transparent;
  z-index: 1045;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.pdf-layer-tool-panel.is-visible {
  opacity: 1;
  pointer-events: auto;
  background: rgba(10, 14, 26, 0.55);
}

.pdf-layer-tool-panel__backdrop {
  position: absolute;
  inset: 0;
}

.pdf-layer-tool-panel__dialog {
  position: relative;
  width: min(520px, 100%);
  max-width: 100%;
  background: #fff;
  border-radius: 1.1rem;
  padding: 1.25rem;
  border: 1px solid rgba(20, 60, 173, 0.08);
  box-shadow: 0 1.5rem 3rem rgba(15, 23, 42, 0.35);
  transform: translateY(20px);
  transition: transform 0.2s ease;
}

.pdf-layer-tool-panel.is-visible .pdf-layer-tool-panel__dialog {
  transform: translateY(0);
}

.pdf-layer-tool-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pdf-layer-tool-panel__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: #5c6c8c;
  cursor: pointer;
  line-height: 1;
}

.pdf-layer-tool-panel__close:hover {
  color: #143cad;
}

.dark-mode .pdf-export-modal__dialog {
  background: #1b1b2a;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.65);
}

.dark-mode .pdf-export-modal__close {
  color: #a3a8c2;
}

.dark-mode .pdf-layer-overlay {
  border-color: rgba(95, 134, 255, 0.65);
  background: rgba(31, 37, 68, 0.75);
  color: #e2e9ff;
  box-shadow: 0 0.35rem 0.85rem rgba(0, 0, 0, 0.6);
}

.dark-mode .pdf-layer-overlay__content {
  text-shadow: none;
}

.dark-mode .pdf-layer-overlay__handle {
  background: #1b1b2a;
  border-color: rgba(95, 134, 255, 0.8);
}

.dark-mode .pdf-layer-overlay__action-btn {
  background: #1b1f3a;
  color: #e2e9ff;
  border-color: rgba(95, 134, 255, 0.4);
  box-shadow: 0 0.35rem 0.85rem rgba(0, 0, 0, 0.65);
}

.dark-mode .pdf-layer-overlay__action-btn:hover {
  box-shadow: 0 0.55rem 1.2rem rgba(0, 0, 0, 0.75);
}

.dark-mode .pdf-layer-overlay__edit {
  background: rgba(95, 134, 255, 0.15);
  color: #e2e9ff;
  border-color: rgba(95, 134, 255, 0.55);
}

.dark-mode .pdf-layer-overlay__move {
  border-color: rgba(95, 134, 255, 0.45);
  background: rgba(31, 37, 68, 0.95);
  color: #e2e9ff;
}

.dark-mode .pdf-layer-overlay__delete {
  color: #ff9da3;
  border-color: rgba(255, 157, 163, 0.45);
  background: rgba(255, 157, 163, 0.12);
}

.dark-mode .pdf-inline-editor {
  background: transparent;
  color: #e2e9ff;
  border-color: rgba(95, 134, 255, 0.65);
}

.dark-mode .pdf-layer-tool-panel__dialog {
  background: #1b1b2a;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.65);
}

.dark-mode .pdf-layer-tool-panel__close {
  color: #a3a8c2;
}

.dark-mode .pdf-primary-preview__quick-actions .btn.is-active {
  background: linear-gradient(135deg, #5bc8ff, #1c34a2);
  box-shadow: 0 0.7rem 1.5rem rgba(0, 0, 0, 0.55);
}
.dark-mode .pdf-primary-preview__ghost {
  background: rgba(31, 37, 68, 0.85);
  border-color: rgba(95, 134, 255, 0.35);
  color: #e2e9ff;
}
.dark-mode .pdf-primary-preview__ghost-surface {
  background: #0f1428;
  box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.5);
}

@media (max-width: 1200px) {
  .pdf-editor__workspace {
    display: block;
  }

  .pdf-primary-preview__quick-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .pdf-page-item,
  .pdf-layer-item {
    flex-direction: column;
    align-items: stretch;
    padding-right: 1rem;
  }

  .pdf-page-item__actions,
  .pdf-layer-item__actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
    position: static;
    transform: none;
    margin-top: 0.5rem;
  }
}

@media (max-width: 768px) {
  .pdf-editor__panel--preview .pdf-panel__header {
    flex-direction: column;
    align-items: flex-start;
  }
  .pdf-primary-preview__quick-actions {
    justify-content: flex-start;
  }
  .pdf-primary-preview__nav-controls {
    flex-direction: column;
  }
  .pdf-page-preview {
    flex-wrap: wrap;
    overflow-x: visible;
    margin-left: 0;
    margin-right: 0;
    padding: 0.5rem 0;
    gap: 0.75rem;
  }
  .pdf-page-preview__card {
    flex: 1 1 calc(50% - 0.75rem);
    max-width: calc(50% - 0.75rem);
  }
}

@media (max-width: 480px) {
  .pdf-page-preview__card {
    flex-basis: 100%;
    max-width: 100%;
  }
}

@media (min-width: 1200px) {
  .pdf-primary-preview__ghost {
    width: min(220px, 22%);
    min-width: 180px;
  }
}
