.fw-image-viewer {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--background, #f7f7f5);
}

.fw-image-viewer-toolbar {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border-light, #e8e8e8);
  position: relative;
  z-index: 2;
}

.fw-image-viewer-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-base, #d8d8d8);
  border-radius: 4px;
  background: #fff;
  color: var(--text-regular, #444);
  cursor: pointer;
}

.fw-image-viewer-btn:hover,
.fw-image-viewer-btn:focus-visible {
  border-color: var(--primary, #111);
  color: var(--primary, #111);
  background: var(--border-light, #f2f2f2);
  outline: none;
}

.fw-image-viewer-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fw-image-viewer-level {
  min-width: 38px;
  text-align: center;
  color: var(--text-secondary, #777);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.fw-image-viewer-stage {
  position: absolute;
  inset: 40px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.fw-image-viewer-stage.dragging { cursor: grabbing; }

/* File preview modal: a full-width, solid bottom toolbar, flush with the stage. */
.fw-image-viewer .fw-image-viewer-toolbar,
body .viewer-toolbar {
  position: absolute;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  box-sizing: border-box;
  padding: 0;
  justify-content: flex-start;
  background: #fff;
  border-bottom: 0;
  border-top: 1px solid var(--border-light, #e8e8e8);
  border-radius: 0;
  width: 100%;
  transform: none;
  box-shadow: none;
}
.fw-image-viewer .fw-image-viewer-stage,
body .viewer-stage { position: absolute; top: 0; bottom: 44px; left: 0; right: 0; height: auto; }
.preview-media-navigation { display: flex; gap: 6px; margin-left: auto; }
.preview-media-navigation button:disabled { opacity: .35; cursor: default; }
.fw-document-shell { display: flex; flex-direction: column; }
.fw-document-shell > :not(.fw-document-toolbar) { flex: 1 1 0; min-height: 0; width: 100%; overflow: auto; }
.fw-document-shell > .fw-document-toolbar { flex: 0 0 40px; width: 100%; padding: 6px 8px; border-top: 1px solid var(--border-light, #e8e8e8); border-bottom: 0; }
.admin-preview-shell #stage { position: relative; }

.fw-image-viewer-box {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 0 0;
  will-change: transform;
}

.fw-image-viewer-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  -webkit-user-drag: none;
}

@media (max-width: 640px) {
  .fw-image-viewer-toolbar { justify-content: flex-start; overflow-x: auto; }
  .fw-image-viewer-btn { flex: 0 0 30px; width: 30px; height: 30px; }
}
