.page-template-page-photobook-editor,
.page-template-page-photobook-editor-php {
  background: #f4f2ee;
}

.page-template-page-photobook-editor .site-header,
.page-template-page-photobook-editor .site-footer,
.page-template-page-photobook-editor-php .site-header,
.page-template-page-photobook-editor-php .site-footer {
  display: none;
}

.photobook-editor-main {
  min-height: 70vh;
  color: var(--pb-copy);
  background: #f4f2ee;
}

.photobook-editor {
  position: relative;
  width: 100%;
}

.editor-server-notices {
  padding: 14px clamp(18px, 3vw, 56px) 0;
  background: var(--pb-white);
}

.editor-server-notices .woocommerce-error,
.editor-server-notices .woocommerce-message,
.editor-server-notices .woocommerce-info {
  margin: 0;
}

.editor-error {
  display: grid;
  justify-items: start;
  gap: 16px;
  padding-block: 100px;
}

.editor-error i {
  font-size: 42px;
  color: #9b4438;
}

.editor-error h1,
.editor-error p {
  margin: 0;
}

.editor-toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 44px minmax(180px, 1fr) auto auto auto;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  padding: 12px clamp(18px, 3vw, 56px);
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--pb-line);
  border-bottom: 1px solid var(--pb-line);
  box-shadow: 0 10px 30px rgba(61, 43, 40, 0.06);
}

.editor-back,
.editor-icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--pb-ink);
  background: var(--pb-white);
  border: 1px solid var(--pb-line);
  border-radius: 50%;
}

.editor-back:hover,
.editor-icon-button:hover:not(:disabled) {
  color: var(--pb-white);
  background: var(--pb-ink);
  border-color: var(--pb-ink);
}

.editor-icon-button:disabled {
  cursor: default;
  opacity: 0.34;
}

.editor-history-actions {
  display: flex;
  gap: 6px;
}

.editor-history-actions .editor-icon-button {
  width: 38px;
  height: 38px;
}

.editor-back i,
.editor-icon-button i {
  font-size: 20px;
}

.editor-toolbar-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.editor-toolbar-title > span {
  display: flex;
  align-items: baseline;
  gap: 8px;
  overflow: hidden;
  color: var(--pb-ink);
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-toolbar-title > span > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-toolbar-brand {
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 400;
}

.editor-toolbar-divider {
  flex: 0 0 auto;
  color: var(--pb-line-strong);
  font-weight: 400;
}

.editor-toolbar-title small,
.editor-toolbar-summary span,
.editor-panel-heading small {
  color: var(--pb-muted);
  font-size: 12px;
}

.editor-toolbar-summary {
  display: grid;
  justify-items: end;
  min-width: 105px;
}

.editor-toolbar-summary strong {
  color: var(--pb-ink);
  font-size: 18px;
}

.editor-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 12px 22px;
  color: var(--pb-white);
  font-weight: 700;
  background: var(--pb-ink);
  border: 1px solid var(--pb-ink);
  border-radius: 6px;
}

.editor-primary-action:hover:not(:disabled) {
  background: var(--pb-bronze);
  border-color: var(--pb-bronze);
}

.editor-primary-action:disabled {
  cursor: wait;
  opacity: 0.56;
}

.editor-primary-action i {
  font-size: 20px;
}

.editor-upload-progress {
  position: sticky;
  top: 76px;
  z-index: 39;
  height: 28px;
  overflow: hidden;
  color: var(--pb-white);
  font-size: 12px;
  font-weight: 700;
  line-height: 28px;
  text-align: center;
  background: var(--pb-ink);
}

.editor-upload-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--pb-olive);
  transition: width 180ms ease;
}

.editor-upload-progress span {
  position: relative;
  z-index: 1;
}

.editor-workspace {
  display: grid;
  grid-template-columns: minmax(142px, 184px) minmax(0, 1fr) minmax(310px, 362px);
  align-items: stretch;
  height: calc(100svh - 76px);
  min-height: 640px;
}

.editor-pages,
.editor-controls {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--pb-white);
}

.editor-pages {
  border-right: 1px solid var(--pb-line);
}

.editor-controls {
  border-left: 1px solid var(--pb-line);
}

.editor-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--pb-ink);
  font-size: 14px;
  font-weight: 700;
}

.editor-panel-heading i {
  color: var(--pb-bronze);
  font-size: 20px;
}

.editor-pages > .editor-panel-heading {
  min-height: 54px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--pb-line);
}

.editor-page-list {
  display: grid;
  justify-items: center;
  gap: 16px;
  height: calc(100% - 54px);
  max-height: none;
  padding: 18px 14px 34px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.editor-page-thumbnail {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px;
  color: var(--pb-muted);
  font-size: 11px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.editor-page-thumbnail:hover,
.editor-page-thumbnail.is-active {
  color: var(--pb-ink);
  background: var(--pb-cream);
  border-color: var(--pb-bronze);
}

.editor-page-thumbnail-visual {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  gap: 2px;
  width: min(76px, 100%);
  aspect-ratio: 210 / 297;
  padding: 4px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dcd5cd;
  box-shadow: 0 5px 13px rgba(61, 43, 40, 0.08);
}

.editor-page-thumbnail-visual.layout-2 {
  grid-template-rows: repeat(2, 1fr);
}

.editor-page-thumbnail-visual.layout-2.variant-horizontal {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr;
}

.editor-page-thumbnail-visual.layout-3,
.editor-page-thumbnail-visual.layout-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.editor-page-thumbnail-visual.layout-3 > span:first-child {
  grid-column: 1 / -1;
}

.editor-page-thumbnail-visual.layout-3.variant-hero-left > span:first-child {
  grid-column: auto;
  grid-row: 1 / -1;
}

.editor-page-thumbnail-visual.layout-4.variant-mosaic {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.editor-page-thumbnail-visual.layout-4.variant-mosaic > span:first-child {
  grid-column: span 2;
  grid-row: span 2;
}

.editor-page-thumbnail-visual.layout-4.variant-mosaic > span:nth-child(4) {
  grid-column: 2 / -1;
}

.editor-page-thumbnail-visual > span {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #efede9;
}

.editor-page-thumbnail-visual img,
.editor-page-thumbnail.is-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
}

.editor-page-thumbnail.is-cover .editor-page-thumbnail-visual {
  padding: 0;
  background: var(--pb-ink);
}

.editor-page-thumbnail.is-cover .editor-page-thumbnail-visual.cover-frame {
  padding: 7px 5px 18px;
  background: var(--pb-cream);
}

.editor-page-thumbnail.is-cover .editor-page-thumbnail-visual.cover-minimal {
  display: grid;
  place-items: center;
  padding: 8px;
}

.editor-page-thumbnail.is-cover img.is-template-image {
  opacity: 0.35;
  filter: grayscale(1);
}

.editor-page-thumbnail-visual .editor-page-mini-title {
  position: absolute;
  inset: auto 5px 6px;
  z-index: 1;
  overflow: hidden;
  color: #fff;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 7px;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
}

.editor-page-thumbnail-visual.cover-frame .editor-page-mini-title,
.editor-page-thumbnail-visual.cover-minimal .editor-page-mini-title {
  color: var(--pb-ink);
  text-shadow: none;
}

.editor-quality-warning {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #fff;
  font-size: 14px;
  background: #9b4438;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(44, 31, 28, 0.24);
}

.editor-page-thumbnail > .editor-quality-warning {
  top: 2px;
  left: auto;
  right: 2px;
  width: 22px;
  height: 22px;
  font-size: 12px;
}

.editor-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  min-width: 0;
  padding: 16px clamp(22px, 4vw, 72px) 24px;
  overflow: hidden;
  background: #eae7e1;
}

.editor-stage-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: 50px;
  color: var(--pb-ink);
}

.editor-stage-heading .editor-icon-button {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.72);
}

.editor-stage-heading strong {
  min-width: 118px;
  font-size: 14px;
  text-align: center;
}

.editor-canvas-shell {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
}

.editor-cover-canvas,
.editor-page-canvas {
  position: relative;
  width: auto;
  height: min(65vh, 690px);
  max-width: 100%;
  aspect-ratio: 210 / 297;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 58px rgba(61, 43, 40, 0.18);
}

.editor-cover-canvas[hidden],
.editor-page-canvas[hidden] {
  display: none;
}

.editor-cover-canvas > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  pointer-events: none;
}

.editor-cover-shade {
  position: absolute;
  inset: 0;
  background: rgba(44, 31, 28, 0.24);
  pointer-events: none;
}

.editor-cover-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16%;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.34);
  pointer-events: none;
}

.editor-cover-copy strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  line-height: 1.08;
}

.editor-cover-copy span {
  font-size: clamp(12px, 1vw, 17px);
  font-weight: 600;
}

.editor-cover-canvas.has-own-photo {
  cursor: grab;
  touch-action: none;
}

.editor-cover-canvas.has-own-photo.is-cropping {
  cursor: grabbing;
}

.editor-cover-canvas.is-template-photo > img {
  opacity: 0.34;
  filter: grayscale(0.8);
}

.editor-cover-empty {
  position: absolute;
  inset: 18px 18px auto;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 9px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  background: rgba(44, 31, 28, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 6px;
  pointer-events: none;
}

.editor-cover-empty[hidden] {
  display: none;
}

.editor-cover-empty i {
  flex: 0 0 auto;
  font-size: 22px;
}

.editor-cover-spine {
  position: absolute;
  inset: 8% auto 8% 0;
  z-index: 4;
  display: grid;
  place-items: center;
  max-width: 28px;
  padding: 8px 5px;
  overflow: hidden;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  background: rgba(44, 31, 28, 0.4);
  pointer-events: none;
}

.editor-cover-spine[hidden] {
  display: none;
}

.editor-cover-canvas.cover-frame > img {
  clip-path: inset(7% 7% 31% 7%);
}

.editor-cover-canvas.cover-frame .editor-cover-shade,
.editor-cover-canvas.cover-minimal .editor-cover-shade {
  display: none;
}

.editor-cover-canvas.cover-frame .editor-cover-copy {
  justify-content: flex-end;
  padding: 12% 12% 8%;
  color: var(--pb-ink);
  text-shadow: none;
}

.editor-cover-canvas.cover-frame .editor-cover-empty {
  inset: 10% 12% auto;
  color: var(--pb-ink);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(61, 43, 40, 0.16);
}

.editor-cover-canvas.cover-minimal > img,
.editor-cover-canvas.cover-minimal .editor-cover-empty {
  display: none;
}

.editor-cover-canvas.cover-minimal .editor-cover-copy {
  color: var(--pb-ink);
  text-shadow: none;
}

.editor-cover-canvas.cover-frame .editor-cover-spine,
.editor-cover-canvas.cover-minimal .editor-cover-spine {
  color: var(--pb-ink);
  background: rgba(255, 255, 255, 0.58);
}

.editor-page-canvas {
  display: grid;
  gap: clamp(5px, 0.65vw, 10px);
  padding: clamp(10px, 1.4vw, 22px);
}

.editor-page-canvas.layout-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.editor-page-canvas.layout-2 {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(2, 1fr);
}

.editor-page-canvas.layout-1.variant-inset {
  padding: clamp(28px, 5vw, 74px);
}

.editor-page-canvas.layout-2.variant-horizontal {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr;
}

.editor-page-canvas.layout-3,
.editor-page-canvas.layout-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.editor-page-canvas.layout-3 > .editor-photo-slot:first-child {
  grid-column: 1 / -1;
}

.editor-page-canvas.layout-3.variant-hero-left > .editor-photo-slot:first-child {
  grid-column: auto;
  grid-row: 1 / -1;
}

.editor-page-canvas.layout-4.variant-mosaic {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.editor-page-canvas.layout-4.variant-mosaic > .editor-photo-slot:first-child {
  grid-column: span 2;
  grid-row: span 2;
}

.editor-page-canvas.layout-4.variant-mosaic > .editor-photo-slot:nth-child(4) {
  grid-column: 2 / -1;
}

.editor-page-canvas.has-caption {
  padding-bottom: clamp(42px, 5vw, 66px);
}

.editor-page-canvas.layout-1.variant-inset.has-caption {
  padding-bottom: clamp(58px, 7vw, 92px);
}

.editor-page-caption {
  position: absolute;
  inset: auto clamp(14px, 2vw, 28px) clamp(11px, 1.5vw, 22px);
  z-index: 4;
  margin: 0;
  overflow: hidden;
  color: var(--pb-ink);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(11px, 1vw, 15px);
  line-height: 1.3;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-page-canvas.is-dark-background .editor-page-caption {
  color: #fff;
}

.editor-photo-slot {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  color: var(--pb-muted);
  background: #f3f0eb;
  border: 1px dashed #cfc5ba;
  border-radius: 2px;
}

.editor-photo-slot > i {
  margin-bottom: -4px;
  font-size: 22px;
}

.editor-photo-slot > span {
  font-size: 11px;
}

.editor-photo-slot > .editor-quality-warning {
  top: 7px;
  left: 7px;
  font-size: 14px;
}

.editor-photo-slot.has-photo {
  cursor: grab;
  touch-action: none;
  background: #ddd;
  border-style: solid;
  border-color: transparent;
}

.editor-photo-slot.has-photo:active,
.editor-photo-slot.is-cropping {
  cursor: grabbing;
}

.editor-photo-slot.is-selected,
.editor-photo-slot.is-drop-target {
  border-color: var(--pb-bronze);
  box-shadow: inset 0 0 0 2px var(--pb-bronze);
}

.editor-slot-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  pointer-events: none;
}

.editor-stage-hint {
  min-height: 20px;
  margin: 15px 0 0;
  color: #756a65;
  font-size: 12px;
  text-align: center;
}

.editor-controls-scroll {
  height: 100%;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
}

.editor-control-section {
  display: grid;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--pb-line);
}

.editor-control-section[hidden],
.editor-photo-controls[hidden],
.editor-cover-photo-controls[hidden],
.editor-library-empty[hidden] {
  display: none;
}

.editor-field {
  display: grid;
  gap: 7px;
}

.editor-field > span,
.editor-layout-field legend,
.editor-photo-control-heading > span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--pb-ink);
  font-size: 12px;
  font-weight: 700;
}

.editor-field > span small,
.editor-field output {
  color: var(--pb-muted);
  font-size: 11px;
  font-weight: 500;
}

.editor-field input[type="text"],
.editor-field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--pb-ink);
  background: #fff;
  border: 1px solid #dcd5cd;
  border-radius: 6px;
}

.editor-field select:disabled {
  color: var(--pb-muted);
  background: var(--pb-cream);
}

.editor-range-field input[type="range"] {
  width: 100%;
  min-height: 36px;
  margin: 0;
  accent-color: var(--pb-olive);
  cursor: pointer;
}

.editor-layout-field {
  padding: 0;
  border: 0;
}

.editor-layout-field legend {
  margin-bottom: 8px;
}

.editor-segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  padding: 4px;
  background: var(--pb-cream);
  border: 1px solid var(--pb-line);
  border-radius: 6px;
}

.editor-segmented button {
  min-height: 38px;
  color: var(--pb-copy);
  font-weight: 700;
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.editor-segmented button:hover,
.editor-segmented button.is-active {
  color: var(--pb-white);
  background: var(--pb-ink);
}

.editor-cover-layouts {
  grid-template-columns: repeat(3, 1fr);
}

.editor-cover-photo-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--pb-copy);
  font-size: 11px;
  background: var(--pb-cream);
  border: 1px solid var(--pb-line);
  border-radius: 6px;
}

.editor-cover-photo-status > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-cover-photo-status [hidden] {
  display: none;
}

.editor-cover-photo-controls {
  display: grid;
  gap: 12px;
}

.editor-layout-variants {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.editor-layout-variants button {
  min-height: 42px;
  padding: 7px 9px;
  color: var(--pb-copy);
  font-size: 11px;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--pb-line);
  border-radius: 6px;
}

.editor-layout-variants button:hover,
.editor-layout-variants button.is-active {
  color: #fff;
  background: var(--pb-ink);
  border-color: var(--pb-ink);
}

.editor-color-field {
  padding: 0;
  border: 0;
}

.editor-color-field legend {
  margin-bottom: 9px;
  color: var(--pb-ink);
  font-size: 12px;
  font-weight: 700;
}

.editor-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.editor-color-swatches button {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--swatch-color);
  border: 1px solid #cfc5ba;
  border-radius: 50%;
}

.editor-color-swatches button::after {
  position: absolute;
  inset: 5px;
  border: 2px solid transparent;
  border-radius: 50%;
  content: "";
}

.editor-color-swatches button:hover,
.editor-color-swatches button.is-active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pb-bronze);
}

.editor-photo-controls {
  display: grid;
  gap: 14px;
  padding-top: 4px;
}

.editor-photo-control-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.editor-photo-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-photo-controls-close {
  display: none;
}

.editor-text-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px;
  color: #8d3d35;
  font-size: 11px;
  font-weight: 700;
  background: transparent;
  border: 0;
}

.editor-order-actions {
  display: flex;
  gap: 8px;
}

.editor-order-actions .editor-icon-button {
  width: 38px;
  height: 38px;
}

.editor-upload-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--pb-cream);
  border: 1px dashed var(--pb-bronze);
  border-radius: 6px;
}

.editor-upload-button:hover {
  background: #fff5e8;
}

.editor-upload-button > i {
  color: var(--pb-bronze);
  font-size: 26px;
}

.editor-upload-button > span {
  display: grid;
  gap: 2px;
}

.editor-upload-button strong {
  color: var(--pb-ink);
  font-size: 13px;
}

.editor-upload-button small {
  color: var(--pb-muted);
  font-size: 10px;
}

.editor-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.editor-library-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 14px 8px;
  color: var(--pb-muted);
  text-align: center;
}

.editor-library-empty i {
  font-size: 25px;
}

.editor-library-empty p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.editor-photo-library {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.editor-library-item {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--pb-cream);
  border: 1px solid transparent;
  border-radius: 6px;
}

.editor-library-item.has-warning {
  border-color: rgba(155, 68, 56, 0.56);
}

.editor-library-item.is-selected {
  border-color: var(--pb-bronze);
  box-shadow: 0 0 0 2px rgba(185, 145, 111, 0.2);
}

.editor-library-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
}

.editor-library-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editor-library-photo > span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  color: #fff;
  font-size: 12px;
  background: var(--pb-olive);
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

.editor-library-photo > .editor-quality-warning {
  top: 4px;
  right: auto;
  bottom: auto;
  left: 4px;
  width: 25px;
  height: 25px;
  background: #9b4438;
  border: 2px solid #fff;
  border-radius: 50%;
}

.editor-library-item.is-unassigned .editor-library-photo > span {
  background: var(--pb-bronze);
}

.editor-library-item.is-used .editor-library-photo img {
  opacity: 0.66;
}

.editor-library-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #fff;
  background: rgba(61, 43, 40, 0.82);
  border: 0;
  border-radius: 50%;
  opacity: 0;
}

.editor-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(34, 32, 31, 0.62);
}

.editor-dialog-backdrop[hidden] {
  display: none;
}

.editor-dialog-open {
  overflow: hidden;
}

.editor-dialog {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(580px, 100%);
  max-height: min(760px, calc(100svh - 40px));
  padding: clamp(24px, 4vw, 42px);
  overflow-y: auto;
  color: var(--pb-copy);
  text-align: center;
  background: #fff;
  border: 1px solid var(--pb-line);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(34, 32, 31, 0.32);
}

.editor-dialog-compact {
  width: min(470px, 100%);
}

.editor-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--pb-ink);
  background: #fff;
  border: 1px solid var(--pb-line);
  border-radius: 50%;
}

.editor-dialog-icon {
  margin-bottom: 14px;
  color: var(--pb-olive);
  font-size: 42px;
}

.editor-dialog-icon.is-warning,
.editor-dialog-icon.is-danger {
  color: #9b4438;
}

.editor-dialog h2 {
  max-width: 460px;
  margin: 0;
  color: var(--pb-ink);
  font-size: clamp(23px, 3vw, 32px);
}

.editor-dialog > p {
  max-width: 470px;
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.55;
}

.editor-review-issues {
  display: grid;
  gap: 8px;
  width: 100%;
  max-height: 330px;
  margin: 22px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.editor-review-issues:empty {
  display: none;
}

.editor-review-issues button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  color: var(--pb-copy);
  text-align: left;
  background: #fff8f2;
  border: 1px solid #ead6c3;
  border-radius: 6px;
}

.editor-review-issues button:hover {
  border-color: var(--pb-bronze);
}

.editor-review-issues button > i:first-child {
  color: #9b4438;
  font-size: 20px;
}

.editor-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 24px;
}

.editor-dialog-actions .button {
  min-height: 46px;
}

.editor-danger-action {
  color: #fff;
  background: #963f36;
  border-color: #963f36;
}

.editor-library-item:hover .editor-library-remove,
.editor-library-remove:focus-visible {
  opacity: 1;
}

.editor-toast {
  position: fixed;
  right: clamp(16px, 3vw, 42px);
  bottom: 26px;
  z-index: 100;
  width: min(390px, calc(100vw - 32px));
  padding: 14px 18px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: var(--pb-ink);
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(61, 43, 40, 0.24);
}

.editor-toast.is-success {
  background: var(--pb-olive);
}

.editor-toast.is-error {
  background: #963f36;
}

.editor-mobile-action {
  display: none;
}

@media (max-width: 1180px) {
  .editor-workspace {
    grid-template-columns: 130px minmax(0, 1fr) 320px;
  }

  .editor-stage {
    padding-inline: 26px;
  }

  .editor-control-section {
    padding-inline: 18px;
  }
}

@media (max-width: 960px) {
  .editor-toolbar {
    top: 0;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    min-height: 68px;
    padding: 9px 18px;
  }

  .editor-toolbar-summary {
    display: none;
  }

  .editor-toolbar > .editor-primary-action {
    display: none;
  }

  .editor-upload-progress {
    top: 68px;
  }

  .editor-workspace {
    display: block;
    height: auto;
    min-height: 0;
  }

  .editor-pages,
  .editor-controls {
    overflow: visible;
    border: 0;
  }

  .editor-pages {
    position: sticky;
    top: 68px;
    z-index: 20;
    border-bottom: 1px solid var(--pb-line);
  }

  .editor-pages > .editor-panel-heading {
    display: none;
  }

  .editor-page-list {
    display: flex;
    justify-items: initial;
    gap: 8px;
    height: auto;
    max-height: none;
    padding: 9px 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .editor-page-list::-webkit-scrollbar {
    display: none;
  }

  .editor-page-thumbnail {
    flex: 0 0 58px;
    gap: 3px;
    padding: 4px;
  }

  .editor-page-thumbnail-visual {
    width: 40px;
    padding: 2px;
  }

  .editor-stage {
    min-height: 620px;
    padding: 12px 20px 22px;
  }

  .editor-cover-canvas,
  .editor-page-canvas {
    height: min(68vh, 640px);
  }

  .editor-controls {
    background: var(--pb-white);
    border-top: 1px solid var(--pb-line);
  }

  .editor-controls-scroll {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .editor-control-section {
    min-width: 0;
    border-right: 1px solid var(--pb-line);
  }

  .editor-library-section {
    grid-column: 1 / -1;
  }

  .editor-photo-library {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .editor-mobile-action {
    position: sticky;
    bottom: 0;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--pb-line);
    box-shadow: 0 -12px 30px rgba(61, 43, 40, 0.09);
  }

  .editor-mobile-action > div {
    display: grid;
  }

  .editor-mobile-action span {
    color: var(--pb-muted);
    font-size: 11px;
  }

  .editor-mobile-action strong {
    color: var(--pb-ink);
    font-size: 16px;
  }

  .editor-toast {
    bottom: 86px;
  }
}

@media (max-width: 620px) {
  .editor-toolbar {
    gap: 10px;
    padding-inline: 12px;
  }

  .editor-history-actions {
    gap: 4px;
  }

  .editor-history-actions .editor-icon-button {
    width: 34px;
    height: 34px;
  }

  .editor-back {
    width: 38px;
    height: 38px;
  }

  .editor-toolbar-title > span {
    font-size: 14px;
  }

  .editor-toolbar-brand,
  .editor-toolbar-divider {
    display: none;
  }

  .editor-toolbar-title small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .editor-stage {
    min-height: 510px;
    padding-inline: 12px;
  }

  .editor-stage-heading {
    min-height: 44px;
  }

  .editor-cover-canvas,
  .editor-page-canvas {
    width: min(78vw, 365px);
    height: auto;
  }

  .editor-stage-hint {
    padding-inline: 16px;
  }

  .editor-controls-scroll {
    display: block;
  }

  .editor-control-section {
    padding: 18px;
    border-right: 0;
  }

  .editor-photo-library {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .editor-photo-controls:not([hidden]) {
    position: fixed;
    right: 10px;
    bottom: 82px;
    left: 10px;
    z-index: 90;
    max-height: min(390px, calc(100svh - 120px));
    padding: 16px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--pb-line);
    border-radius: 8px;
    box-shadow: 0 -20px 60px rgba(44, 31, 28, 0.24);
  }

  .editor-photo-controls-close {
    display: inline-grid;
  }

  .photobook-editor.has-photo-controls .editor-toast {
    bottom: min(486px, calc(100svh - 76px));
  }

  .editor-library-remove {
    opacity: 1;
  }

  .editor-dialog-backdrop {
    align-items: end;
    padding: 10px;
  }

  .editor-dialog {
    max-height: calc(100svh - 20px);
    padding: 30px 18px 20px;
  }

  .editor-dialog h2 {
    padding-inline: 26px;
    font-size: 23px;
  }

  .editor-dialog-actions {
    flex-direction: column-reverse;
  }

  .editor-dialog-actions .button {
    width: 100%;
  }

  .editor-mobile-action {
    padding-inline: 14px;
  }

  .editor-mobile-action .editor-primary-action {
    min-height: 46px;
    padding-inline: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .editor-upload-progress-bar {
    transition: none;
  }
}
