.pm-wrap { max-width: 1100px; margin: 0 auto; padding: 0 12px 40px; }
.pm-section-title { font-weight: 700; margin-bottom: 12px; }

/* ---- Centered generating overlay ---- */
.pm-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.pm-progress-overlay.is-open { display: flex; }
body.pm-progress-lock { overflow: hidden; }
.pm-progress-card {
  width: min(320px, 86vw);
  background: #fff;
  border-radius: 16px;
  padding: 26px 24px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  animation: pm-progress-pop 0.22s ease-out;
}
@keyframes pm-progress-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.pm-progress-ring {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto 16px;
}
.pm-progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.pm-progress-ring circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}
.pm-progress-ring-bg { stroke: #E8EEF6; }
.pm-progress-ring-bar {
  stroke: #1976D2;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 0.25s ease;
}
.pm-progress-overlay.is-indeterminate .pm-progress-ring svg {
  animation: pm-progress-spin 1.1s linear infinite;
}
.pm-progress-overlay.is-indeterminate .pm-progress-ring-bar {
  stroke-dasharray: 80 234;
  stroke-dashoffset: 0;
  transition: none;
}
@keyframes pm-progress-spin {
  from { transform: rotate(-90deg); }
  to { transform: rotate(270deg); }
}
.pm-progress-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #1F2937;
}
.pm-progress-label {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1F2937;
}
.pm-progress-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.pm-progress-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1976D2;
  opacity: 0.35;
  animation: pm-progress-dot 1.2s ease-in-out infinite;
}
.pm-progress-dots span:nth-child(2) { animation-delay: 0.18s; }
.pm-progress-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes pm-progress-dot {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}
.pm-progress-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: #6B7280;
  line-height: 1.4;
}
.pm-progress-note.is-hidden { display: none; }
@media (prefers-reduced-motion: reduce) {
  .pm-progress-card,
  .pm-progress-overlay.is-indeterminate .pm-progress-ring svg,
  .pm-progress-dots span { animation: none; }
}

/* ---- View-all: left preview + right gallery ---- */
.pm-view-app {
  --ep-primary: #1976D2;
  --ep-border: #E6EAF0;
  --ep-text: #1F2937;
  --ep-muted: #6B7280;
  --ep-radius: 10px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 8px 12px;
  height: calc(100vh - 72px);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ep-text);
}
.main-content.app-content:has(.pm-view-app) {
  margin-top: 0 !important;
  padding-top: 4px;
}
.pm-view-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  padding: 8px 10px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.pm-view-toolbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.pm-view-toolbar-brand .pm-ep-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.pm-view-toolbar #pm-next {
  flex-shrink: 0;
  margin-left: auto;
}
.pm-view-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 14px;
  overflow: hidden;
}
.pm-view-preview {
  background: #F3F6FA;
  border: 1px solid var(--ep-border);
  border-radius: 12px;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
}
.pm-view-stage {
  position: relative;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}
.pm-view-stage .pm-main-media {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover;
  object-position: center;
  background: #111;
  border: 0;
}
.pm-view-stage .pm-main-media.d-none {
  display: none !important;
}
.pm-view-stage video.pm-main-media {
  background: #000;
  object-fit: contain;
}
.pm-view-side {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.pm-view-side-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ep-border);
  background: #F8F9FB;
}
.pm-view-lang-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ep-muted);
  margin: 0;
  white-space: nowrap;
}
.pm-view-lang {
  flex: 1;
  min-width: 0;
}
.pm-view-side-grid {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  gap: 12px;
  align-content: start;
  --pm-thumb-ratio-pct: 125%; /* 4:5 default → height = 125% of width */
}
.pm-view-side-grid .pm-view-thumb {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: var(--pm-thumb-ratio-pct, 125%);
  border-radius: 8px;
  border: 2px solid transparent;
  background-color: #eee;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  cursor: pointer;
  overflow: hidden;
  box-sizing: border-box;
}
.pm-view-side-grid .pm-view-thumb.active {
  border-color: var(--ep-primary, #1976D2);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}
.pm-view-side-grid .pm-view-thumb .pm-thumb-lang {
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: auto;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 8px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  border-radius: 999px;
  max-width: calc(100% - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}
@media (max-width: 992px) {
  .pm-view-app {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .pm-view-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(320px, 52vh) auto;
    overflow: visible;
  }
  .pm-view-side {
    max-height: 420px;
  }
  .pm-view-side-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* ---- Category page: section rails ---- */
.pm-cat-app {
  --ep-primary: #1976D2;
  --ep-border: #E6EAF0;
  --ep-text: #1F2937;
  --ep-muted: #6B7280;
  --ep-radius: 10px;
  width: 100%;
  padding: 0 8px 24px;
  color: var(--ep-text);
}
.main-content.app-content:has(.pm-cat-app),
.main-content.app-content:has(.pm-home-app) {
  margin-top: 0 !important;
  padding-top: 4px;
}

/* ---- Home: Festival / Greeting / General tabs ---- */
.pm-home-app {
  --ep-primary: #1976D2;
  --ep-border: #E6EAF0;
  --ep-text: #1F2937;
  --ep-muted: #6B7280;
  --ep-radius: 10px;
  width: 100%;
  padding: 0 8px 24px;
  color: var(--ep-text);
}
.pm-home-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.pm-home-toolbar .pm-ep-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.pm-home-tabs {
  display: flex;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  padding: 6px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}
.pm-home-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ep-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.pm-home-tab:hover {
  background: #F3F8FE;
  color: var(--ep-primary);
}
.pm-home-tab.is-active {
  background: #1976D2;
  color: #fff;
  box-shadow: 0 6px 16px rgba(25, 118, 210, 0.28);
}
.pm-home-tab-count {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.12);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pm-home-tab.is-active .pm-home-tab-count {
  background: rgba(255, 255, 255, 0.22);
}
.pm-home-panel[hidden],
.pm-home-category[hidden] {
  display: none !important;
}
.pm-home-chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.pm-home-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  height: 44px;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--ep-border);
  background: #fff;
  color: var(--ep-text);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.pm-home-chip:hover {
  border-color: #bfd6f3;
  background: #F3F8FE;
}
.pm-home-chip.is-active {
  border-color: #1976D2;
  background: #EAF3FC;
  color: #0F4C8A;
  box-shadow: 0 6px 16px rgba(25, 118, 210, 0.16);
}
.pm-home-chip-thumb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #eee center/cover no-repeat;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.pm-home-chip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.15;
  text-align: left;
}
.pm-home-chip-name {
  font-size: 13px;
  font-weight: 700;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pm-home-chip-date {
  font-size: 10px;
  font-weight: 600;
  color: var(--ep-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pm-home-chip.is-active .pm-home-chip-date {
  color: #1976D2;
}
.pm-home-category .pm-cat-body {
  gap: 14px;
}
@media (max-width: 768px) {
  .pm-home-tabs { gap: 4px; padding: 4px; }
  .pm-home-tab { font-size: 12px; height: 36px; gap: 4px; }
  .pm-home-chip { max-width: 180px; }
  .pm-home-chip-name { max-width: 110px; }
}
.pm-cat-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  padding: 8px 10px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.pm-cat-toolbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.pm-cat-toolbar-brand .pm-ep-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.pm-cat-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pm-cat-section {
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}
.pm-cat-section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.pm-cat-section-titles {
  flex: 1;
  min-width: 0;
}
.pm-cat-section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.25;
}
.pm-cat-section-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ep-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pm-cat-chip {
  background: #EEF2F7;
  color: #4B5563;
  border-radius: 999px;
  padding: 2px 8px;
  letter-spacing: 0;
  text-transform: none;
}
.pm-cat-chip-muted {
  background: #F8F9FB;
  border: 1px solid var(--ep-border);
}
.pm-cat-view-all {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--ep-border);
  background: #F3F8FE;
  color: var(--ep-primary);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.pm-cat-view-all:hover {
  background: #e8f2fc;
  border-color: #bfd6f3;
  color: var(--ep-primary);
}
.pm-cat-view-all i { font-size: 10px; }
.pm-cat-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.pm-cat-card {
  position: relative;
  flex: 0 0 auto;
  width: 132px;
  aspect-ratio: var(--pm-cat-ratio, 1 / 1);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ep-border);
  background: #F3F6FA;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.pm-cat-card:hover {
  transform: translateY(-2px);
  border-color: #bfd6f3;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
}
.pm-cat-card-media {
  position: absolute;
  inset: 0;
  display: block;
  background-color: #eee;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.pm-cat-card-lang {
  position: absolute;
  top: 8px;
  left: 8px;
  bottom: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 16px);
  height: 22px;
  padding: 0 9px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  box-sizing: border-box;
}
.pm-cat-card-play {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: auto;
  top: auto;
  transform: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  pointer-events: none;
}
.pm-cat-empty {
  font-size: 12px;
  color: var(--ep-muted);
}
.pm-cat-empty-state {
  background: #fff;
  border: 1px dashed var(--ep-border);
  border-radius: 12px;
  padding: 48px 16px;
  text-align: center;
  color: var(--ep-muted);
  font-size: 13px;
}
.pm-cat-empty-state i {
  font-size: 22px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.5;
}
@media (max-width: 992px) {
  .pm-cat-card { width: 112px; }
}

.pm-h-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.pm-card, .pm-card-fest {
  flex: 0 0 160px; background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); color: #222;
}
.pm-card { flex: 0 0 auto; width: 100%; }
.pm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px;
}
.pm-thumb {
  width: 100%; aspect-ratio: 3/4; background: #eee center/cover no-repeat;
}
.pm-card-fest .pm-thumb { aspect-ratio: 3/4; }
.pm-fest-meta { padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.pm-day { font-size: 22px; font-weight: 800; line-height: 1; }
.pm-mon { font-size: 12px; text-transform: uppercase; color: #666; }
.pm-name { width: 100%; font-size: 13px; font-weight: 600; }
.pm-card-body { padding: 10px; font-size: 13px; font-weight: 600; }
.pm-media-thumb {
  flex: 0 0 120px; position: relative; border-radius: 10px; overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.pm-media-thumb .pm-thumb { aspect-ratio: inherit; }
.pm-lang {
  position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.65);
  color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 4px;
}
.pm-preview-box {
  background: #111; border-radius: 12px; min-height: 320px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.pm-preview-box--light {
  background: #f3f4f6;
  min-height: 0;
  padding: 12px;
  max-width: 560px;
}
.pm-preview-box--light img {
  background: #fff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}
.pm-preview-box--pdf {
  background: #fff;
  min-height: 0;
  max-width: 420px;
  width: min(420px, 92vw);
  aspect-ratio: 9 / 16;
  padding: 0;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.pm-pdf-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.pm-main-media { max-width: 100%; max-height: 520px; display: block; }
.pm-grid-thumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px;
}
.pm-thumb-item {
  border-radius: 8px; overflow: hidden; cursor: pointer; border: 2px solid transparent;
  aspect-ratio: 1; background: #eee center/cover no-repeat;
}
.pm-thumb-item.active { border-color: var(--primary-bg-color, #6259ca); }
.pm-editor-layout {
  display: grid; grid-template-columns: 1fr 280px; gap: 16px;
}
@media (max-width: 900px) {
  .pm-editor-layout { grid-template-columns: 1fr; }
}
.pm-canvas-wrap {
  background: #1a1a1a; border-radius: 12px; padding: 12px;
  display: flex; align-items: center; justify-content: center; min-height: 420px;
  position: relative; overflow: auto;
}
#pm-stage { position: relative; background: #000; box-shadow: 0 4px 20px rgba(0,0,0,.3); overflow: hidden; }
#pm-stage canvas, #pm-stage video { display: block; max-width: 100%; }
.pm-interactive {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 5;
}
.pm-edit-item {
  position: absolute; pointer-events: auto; cursor: move;
  box-sizing: border-box; user-select: none; -webkit-user-select: none;
}
.pm-edit-item.selected {
  outline: 2px solid var(--primary-bg-color, #6259ca);
  outline-offset: 0;
}
.pm-edit-item img {
  width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none;
}
.pm-name-text {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: flex-start;
  color: #111; font-weight: 700; line-height: 1.1; text-align: left;
  text-transform: uppercase; overflow: visible; pointer-events: none;
  word-break: keep-all; white-space: nowrap;
}
.pm-fe-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  border-radius: 2px;
}
.pm-resize-handle {
  display: none; position: absolute; right: -11px; bottom: -11px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary-bg-color, #6259ca); color: #fff;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25);
  align-items: center; justify-content: center; cursor: nwse-resize;
  font-size: 9px; z-index: 6;
}
.pm-edit-item.selected .pm-resize-handle { display: flex; }
.pm-side-panel {
  background: #fff; border-radius: 12px; padding: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06); max-height: 80vh; overflow: auto;
}
.pm-frame-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pm-frame-item {
  width: 56px; height: 56px; border-radius: 8px; overflow: hidden;
  border: 2px solid #ddd; cursor: pointer; background: #f4f4f4 center/cover;
}
.pm-frame-item.active { border-color: var(--primary-bg-color, #6259ca); }
.pm-toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pm-layers { max-height: 280px; overflow: auto; }
.pm-layer-item {
  padding: 8px 10px; border: 1px solid #eee; border-radius: 8px; margin-bottom: 6px;
  cursor: pointer; font-size: 13px;
}
.pm-layer-item.active { border-color: var(--primary-bg-color, #6259ca); background: #f5f3ff; }
.pm-preview-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }

/* ---- Export / final preview page ---- */
.pm-out-app {
  --ep-primary: #1976D2;
  --ep-border: #E6EAF0;
  --ep-text: #1F2937;
  --ep-muted: #6B7280;
  --ep-radius: 10px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 8px 12px;
  height: calc(100vh - 72px);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ep-text);
}
.main-content.app-content:has(.pm-out-app) {
  margin-top: 0 !important;
  padding-top: 4px;
}
.pm-out-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  padding: 8px 10px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.pm-out-toolbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.pm-out-toolbar-brand .pm-ep-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.pm-out-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}
.pm-out-toolbar-actions .pm-ep-btn-ghost {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  border: 1px solid var(--ep-border);
  background: #fff;
  color: var(--ep-text);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.pm-out-toolbar-actions .pm-ep-btn-ghost:hover {
  border-color: #c5d6ea;
  background: #f3f8fd;
  color: var(--ep-primary);
}
.pm-out-preview {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F6FA;
  border: 1px solid var(--ep-border);
  border-radius: 12px;
  padding: 20px;
  overflow: hidden;
}
.pm-out-stage {
  position: relative;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}
.pm-out-media {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain;
  background: #fff;
  border: 0;
}
.pm-out-media.d-none {
  display: none !important;
}
.pm-out-stage video.pm-out-media {
  background: #000;
  object-fit: contain;
}
.pm-out-pdf {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
@media (max-width: 992px) {
  .pm-out-app {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .pm-out-preview {
    min-height: 52vh;
  }
  .pm-out-toolbar {
    flex-wrap: wrap;
  }
  .pm-out-toolbar-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

/* ===== App-parity photo editor layout ===== */
.pm-edit-app { max-width: 720px; }
.pm-app-editor { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.pm-app-preview-wrap {
  display: flex; justify-content: center; align-items: flex-start;
  background: #f3f3f3; border-radius: 10px; padding: 10px; min-height: 280px;
}
.pm-stage-app {
  position: relative; background: #e5e5e5; box-shadow: 0 2px 12px rgba(0,0,0,.12);
  overflow: hidden; border-radius: 2px;
}
.pm-app-toggles {
  display: flex; justify-content: center; gap: 6px; flex-wrap: wrap;
  padding: 0 8px; min-height: 42px;
}
.pm-app-toggle {
  width: 48px; height: 48px; border-radius: 6px; border: 1px solid #d0d0d0;
  background: #eee; color: #555; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; font-size: 8px; font-weight: 600; line-height: 1; user-select: none;
}
.pm-app-toggle i { font-size: 15px; }
.pm-app-toggle.active {
  background: var(--primary-bg-color, #6259ca); border-color: var(--primary-bg-color, #6259ca); color: #fff;
}
.pm-app-toggle:disabled,
.pm-app-toggle.is-disabled {
  opacity: 0.4; cursor: not-allowed;
}
.pm-app-frames {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 12px 16px;
  -webkit-overflow-scrolling: touch;
}
.pm-app-frame {
  flex: 0 0 auto; height: 96px; border-radius: 6px; overflow: hidden; cursor: pointer;
  background: #f2f2f2 center/contain no-repeat; border: 1px solid #d0d0d0;
}
.pm-app-frame.active {
  border: 2.5px solid var(--primary-bg-color, #6259ca);
}

/* Frame editor — right sidebar (same shell as editable poster) */
.pm-fe-app .pm-fe-viewport {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.pm-fe-app .pm-fe-segments {
  grid-template-columns: repeat(4, 1fr);
}
.pm-fe-app .pm-fe-segments button {
  font-size: 11px;
  padding: 8px 4px;
}
.pm-fe-sticker-cats {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.pm-fe-sticker-cat {
  flex: 0 0 auto;
  border: 1px solid var(--ep-border, #E6EAF0);
  background: #F3F6FA;
  color: #4B5563;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.pm-fe-sticker-cat.active {
  background: var(--ep-primary, #1976D2);
  border-color: var(--ep-primary, #1976D2);
  color: #fff;
}
.pm-fe-sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.pm-fe-sticker-cell {
  aspect-ratio: 1;
  border: 1px solid var(--ep-border, #E6EAF0);
  border-radius: 10px;
  background: #F8F9FB;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pm-fe-sticker-cell:hover {
  border-color: var(--ep-primary, #1976D2);
  box-shadow: 0 4px 10px rgba(25, 118, 210, 0.15);
}
.pm-fe-sticker-cell img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.pm-fe-sticker-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.pm-fe-panel { display: block; }
.pm-fe-panel.d-none { display: none !important; }
.pm-fe-app .pm-app-toggles {
  justify-content: flex-start;
  gap: 8px;
  padding: 4px 0 0;
}
.pm-fe-app .pm-app-toggle {
  width: calc(33.333% - 6px);
  min-width: 72px;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--ep-border, #E6EAF0);
  background: #F3F6FA;
  color: #4B5563;
  font-size: 10px;
  gap: 4px;
}
.pm-fe-app .pm-app-toggle i { font-size: 16px; }
.pm-fe-app .pm-app-toggle.active {
  background: var(--ep-primary, #1976D2);
  border-color: var(--ep-primary, #1976D2);
  color: #fff;
  box-shadow: 0 4px 10px rgba(25, 118, 210, 0.22);
}
.pm-fe-app .pm-app-frames {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
  padding: 4px 0 8px;
}
.pm-fe-app .pm-app-frame {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--ep-border, #E6EAF0);
  background-color: #F8F9FB;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
.pm-fe-app .pm-app-frame.active {
  border: 2px solid var(--ep-primary, #1976D2);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}
.pm-fe-app .pm-ep-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ep-muted, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pm-fe-text-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  overflow: visible;
  background: transparent;
  box-sizing: border-box;
}
.pm-fe-text-item .pm-fe-field-icon {
  flex-shrink: 0;
  object-fit: contain;
  pointer-events: none;
}
.pm-fe-text-item .pm-fe-field-text {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  font-weight: 600;
  line-height: 1.15;
  pointer-events: none;
}
.pm-fe-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ep-muted, #6B7280);
  margin-bottom: 4px;
}
.pm-fe-textarea {
  width: 100%;
  border: 1px solid var(--ep-border, #E6EAF0);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 64px;
  color: var(--ep-text, #1F2937);
  background: #fff;
}
.pm-fe-textarea:focus {
  outline: none;
  border-color: var(--ep-primary, #1976D2);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.12);
}
.pm-fe-size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pm-fe-size-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pm-fe-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pm-fe-color-input {
  width: 40px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--ep-border, #E6EAF0);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.pm-fe-color-hex {
  flex: 1;
  height: 34px;
  border: 1px solid var(--ep-border, #E6EAF0);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.pm-fe-style-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pm-fe-style-btn {
  width: 36px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--ep-border, #E6EAF0);
  background: #F3F6FA;
  color: #374151;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: inherit;
}
.pm-fe-style-btn.active {
  background: var(--ep-primary, #1976D2);
  border-color: var(--ep-primary, #1976D2);
  color: #fff;
}
.pm-fe-style-btn:hover { border-color: #c5d6ea; }

/* ===== Editable Poster — Canva-style redesign ===== */
.pm-ep-app {
  --ep-primary: #1976D2;
  --ep-bg: #F8F9FB;
  --ep-card: #ffffff;
  --ep-border: #E6EAF0;
  --ep-text: #1F2937;
  --ep-muted: #6B7280;
  --ep-radius: 10px;
  --ep-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--ep-text);
  max-width: none;
  width: 100%;
  height: calc(100vh - 72px);
  min-height: 520px;
  margin: 0;
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
  position: relative;
}

/* Pull editor up — drop agent content top margin when this page is open */
.main-content.app-content:has(.pm-ep-app) {
  margin-top: 0 !important;
  padding-top: 4px;
}

.pm-ep-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 4px 2px 10px;
}
.pm-ep-eyebrow {
  font-size: 11px;
  font-weight: 600;
  color: var(--ep-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.pm-ep-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}
.pm-ep-status {
  position: absolute;
  left: 16px;
  top: 8px;
  z-index: 5;
  margin: 0;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  color: var(--ep-muted);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.pm-ep-status:empty { display: none; }

.pm-ep-icon-btn,
.pm-ep-chip-btn,
.pm-ep-btn-primary,
.pm-ep-btn-ghost {
  border: 1px solid var(--ep-border);
  background: #fff;
  color: var(--ep-text);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: 0.15s ease;
  font-family: inherit;
  font-weight: 600;
}
.pm-ep-icon-btn {
  width: 34px;
  height: 34px;
  font-size: 13px;
}
.pm-ep-chip-btn {
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
}
.pm-ep-btn-primary {
  height: 36px;
  padding: 0 14px;
  background: var(--ep-primary);
  border-color: var(--ep-primary);
  color: #fff;
  font-size: 13px;
}
.pm-ep-btn-ghost {
  height: 42px;
  padding: 0 16px;
  font-size: 14px;
  background: #fff;
}
.pm-ep-icon-btn:hover,
.pm-ep-chip-btn:hover,
.pm-ep-btn-ghost:hover { border-color: #c5d6ea; background: #f3f8fd; color: var(--ep-primary); }
.pm-ep-btn-primary:hover { filter: brightness(1.05); }
.pm-ep-icon-btn:disabled,
.pm-ep-chip-btn:disabled,
.pm-ep-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.pm-ep-icon-btn.is-danger:hover { color: #dc2626; background: #fef2f2; border-color: #fecaca; }
.pm-ep-icon-btn.is-active { color: var(--ep-primary); background: #EAF3FC; border-color: #bfd6f3; }

.pm-ep-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  overflow: hidden;
}

.pm-ep-canvas-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pm-ep-canvas-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  padding: 8px 10px;
  box-shadow: var(--ep-shadow);
}
.pm-ep-tools-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.pm-ep-tools-titles {
  min-width: 0;
}
.pm-ep-tools-titles .pm-ep-title {
  font-size: 16px;
  margin: 0;
}
.pm-ep-tools-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}
.pm-ep-canvas-tools #pm-ep-export,
.pm-ep-canvas-tools #pm-export,
.pm-ep-canvas-tools #pm-ev-export {
  flex-shrink: 0;
  margin-left: auto;
}
.pm-ep-tools-sep {
  width: 1px;
  height: 22px;
  background: var(--ep-border);
  margin: 0 2px;
}
.pm-ep-zoom-label {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ep-muted);
}

.pm-ep-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--ep-bg);
  border-radius: var(--ep-radius);
  border: 1px solid var(--ep-border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  touch-action: none;
}
.pm-ep-stage {
  position: relative;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
  background: #fff;
  flex-shrink: 0;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
}
.pm-ep-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  vertical-align: top;
}

.pm-ep-chrome {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--ep-primary);
  pointer-events: none;
  z-index: 4;
  border-radius: 2px;
}
.pm-ep-resize {
  position: absolute;
  right: -12px;
  bottom: -12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ep-primary);
  border: 2px solid #fff;
  pointer-events: auto;
  cursor: nwse-resize;
  z-index: 8;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  touch-action: none;
}

.pm-ep-float-bar {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: 999px;
  padding: 6px 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  z-index: 12;
}
.pm-ep-float-bar button {
  border: none;
  background: transparent;
  color: var(--ep-text);
  min-width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pm-ep-float-bar button:hover { background: #f3f8fd; color: var(--ep-primary); }
.pm-ep-float-bar button.is-danger:hover { background: #fef2f2; color: #dc2626; }
.pm-ep-float-bar button span { display: none; }
@media (min-width: 1100px) {
  .pm-ep-float-bar button span { display: inline; }
}

/* Sidebar — compact Canva style */
.pm-ep-sidebar {
  width: 380px;
  min-width: 380px;
  max-width: 380px;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--ep-card);
  border-radius: 10px;
  box-shadow: var(--ep-shadow);
  border: 1px solid var(--ep-border);
  overflow: hidden;
  padding: 0;
}

.pm-ep-sidebar-sticky {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--ep-border);
  z-index: 2;
}

.pm-ep-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 8px;
  flex-shrink: 0;
}
.pm-ep-selected-line {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.pm-ep-selected-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.pm-ep-mini-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--ep-border);
  background: #F3F6FA;
  color: #374151;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  padding: 0;
}
.pm-ep-mini-btn:hover { color: var(--ep-primary); border-color: #bfd6f3; background: #f0f7ff; }
.pm-ep-mini-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pm-ep-mini-btn.is-danger:hover { color: #dc2626; background: #fef2f2; border-color: #fecaca; }

.pm-ep-segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 12px 10px;
  flex-shrink: 0;
}
.pm-ep-segments button {
  border: none;
  background: #EEF2F7;
  color: #4B5563;
  border-radius: 8px;
  height: 36px;
  min-height: 36px;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0;
  white-space: nowrap;
}
.pm-ep-segments button.active {
  background: var(--ep-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(25, 118, 210, 0.22);
}

.pm-ep-sheet {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 16px;
  background: #fff;
}

.pm-ep-card {
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: 10px;
  padding: 0;
  margin-bottom: 10px;
  overflow: hidden;
}
.pm-ep-card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: none;
  background: #fff;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ep-text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.pm-ep-card-toggle .pm-ep-caret {
  color: #9CA3AF;
  font-size: 10px;
  transition: transform .15s ease;
}
.pm-ep-card.is-collapsed .pm-ep-caret { transform: rotate(-90deg); }
.pm-ep-card.is-collapsed .pm-ep-card-body { display: none; }
.pm-ep-card-body { padding: 0 12px 12px; }
.pm-ep-card-title {
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--ep-text);
}
.pm-ep-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ep-muted);
  margin-bottom: 4px;
}
.pm-ep-field { margin-bottom: 8px; }
.pm-ep-field:last-child { margin-bottom: 0; }

.pm-ep-textarea {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--ep-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  background: #FBFCFD;
}
.pm-ep-textarea:focus {
  outline: none;
  border-color: var(--ep-primary);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.12);
}
.pm-ep-select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--ep-border);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}

.pm-ep-type-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
}
.pm-ep-type-row .pm-ep-select { min-width: 0; }
.pm-ep-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pm-ep-stepper button {
  width: 28px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--ep-border);
  background: #F3F6FA;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 0;
}
.pm-ep-stepper input {
  width: 44px;
  height: 34px;
  text-align: center;
  border: 1px solid var(--ep-border);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  padding: 0;
}
.pm-ep-biu {
  display: flex;
  gap: 4px;
}
.pm-ep-biu button {
  width: 30px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--ep-border);
  background: #F3F6FA;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}
.pm-ep-biu button.active {
  background: var(--ep-primary);
  border-color: var(--ep-primary);
  color: #fff;
}

.pm-ep-align-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.pm-ep-align-grid button {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--ep-border);
  background: #F3F6FA;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
}
.pm-ep-align-grid button.active {
  background: var(--ep-primary);
  border-color: var(--ep-primary);
  color: #fff;
}

.pm-ep-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pm-ep-color-current {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #dbe3ee;
  position: relative;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.pm-ep-color-current input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.pm-ep-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pm-ep-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #dbe3ee;
  cursor: pointer;
  padding: 0;
}
.pm-ep-swatch.active { box-shadow: 0 0 0 2px var(--ep-primary); }
.pm-ep-swatch.is-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #EEF2F7;
  color: #64748b;
  font-size: 12px;
  position: relative;
  overflow: hidden;
}
.pm-ep-swatch.is-custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.pm-ep-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pm-ep-slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--ep-primary);
  height: 22px;
  margin: 0;
}
.pm-ep-slider-val {
  min-width: 36px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--ep-muted);
}

.pm-ep-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  cursor: pointer;
}
.pm-ep-switch input {
  width: 36px;
  height: 20px;
  accent-color: var(--ep-primary);
}

.pm-ep-nudge-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.pm-ep-nudge-row button {
  height: 34px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--ep-border);
  background: #F3F6FA;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
}
.pm-ep-nudge-row button:hover { color: var(--ep-primary); border-color: #bfd6f3; }

.pm-ep-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pm-ep-action-grid-single {
  grid-template-columns: 1fr;
}
.pm-ep-action-tile {
  border: 1px solid var(--ep-border);
  background: #F7FAFC;
  border-radius: 8px;
  min-height: 56px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--ep-text);
}
.pm-ep-action-tile i { font-size: 15px; color: var(--ep-primary); }
.pm-ep-action-tile:hover { border-color: #bfd6f3; background: #f0f7ff; }

.pm-ep-seg-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.pm-ep-seg-row button {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--ep-border);
  background: #F3F6FA;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.pm-ep-seg-row button.active {
  background: var(--ep-primary);
  border-color: var(--ep-primary);
  color: #fff;
}

.pm-ep-btn-block {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  border: 1px dashed #9ec0e8;
  background: #F3F8FE;
  color: var(--ep-primary);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.pm-ep-btn-block:hover { background: #e8f2fc; }
.pm-ep-btn-ghost {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--ep-border);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.pm-ep-empty, .pm-ep-muted-note {
  font-size: 12px;
  color: var(--ep-muted);
  margin: 0;
}

.pm-ep-layer-list { display: flex; flex-direction: column; gap: 6px; }
.pm-ep-layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--ep-border);
  border-radius: 8px;
  background: #fff;
  cursor: grab;
}
.pm-ep-layer-item.active {
  border-color: var(--ep-primary);
  background: #F0F7FF;
}
.pm-ep-layer-item .pm-ep-drag { color: #9CA3AF; }
.pm-ep-layer-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  flex-shrink: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #E5E7EB;
  background: #F3F4F6;
  font-size: 13px;
  font-weight: 700;
  color: #1976D2;
}
.pm-ep-layer-thumb.is-text { background: rgba(25, 118, 210, 0.12); }
.pm-ep-layer-thumb.is-placeholder { color: #9CA3AF; font-size: 14px; }
.pm-ep-layer-thumb.is-hidden { opacity: 0.45; }
.pm-ep-layer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pm-ep-layer-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pm-ep-layer-item .pm-ep-layer-name {
  flex: none;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pm-ep-layer-sub {
  font-size: 11px;
  color: #9CA3AF;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pm-ep-layer-item button {
  width: 28px; height: 28px; border: none; background: #F3F6FA;
  border-radius: 6px; color: #4B5563; cursor: pointer; font-size: 12px;
}

.pm-ep-float-bar button {
  min-width: 34px;
  height: 34px;
  font-size: 12px;
  padding: 0 8px;
}
.pm-ep-float-bar button span { display: none; }

@media (max-width: 1100px) {
  .pm-ep-workspace {
    grid-template-columns: 1fr 360px;
  }
  .pm-ep-sidebar {
    width: 360px;
    min-width: 360px;
    max-width: 360px;
  }
}

@media (max-width: 992px) {
  .pm-ep-app {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .pm-ep-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    overflow: visible;
  }
  .pm-ep-viewport {
    height: 52vh;
    min-height: 320px;
  }
  .pm-ep-sidebar {
    height: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .pm-ep-sheet {
    max-height: 420px;
  }
}

/* Export modal lives outside .pm-ep-app — use explicit colors (no CSS vars) */
.pm-ep-export-modal {
  border-radius: 12px;
  border: 0;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}
.pm-ep-export-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  cursor: pointer;
  line-height: 1.2;
  transition: 0.15s ease;
}
.pm-ep-export-btn--primary {
  background: #1976D2;
  border: 1px solid #1976D2;
  color: #ffffff;
}
.pm-ep-export-btn--primary:hover {
  background: #1565C0;
  border-color: #1565C0;
  color: #ffffff;
}
.pm-ep-export-btn--ghost {
  background: #ffffff;
  border: 1px solid #E6EAF0;
  color: #1F2937;
}
.pm-ep-export-btn--ghost:hover {
  background: #f3f8fd;
  border-color: #c5d6ea;
  color: #1976D2;
}

/* Editable video — same shell as editable photo / frame editor */
.pm-ev-app .pm-ev-viewport {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}
.pm-ev-app .pm-ev-segments {
  grid-template-columns: repeat(2, 1fr);
}
.pm-ev-panel { display: block; }
.pm-ev-panel.d-none { display: none !important; }

.pm-ev-stage {
  position: relative;
  margin: 0 auto;
  /* Warm footer tone — if a 1px gap appears it won't read as a black bar */
  background: #c45c18;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.28);
  flex-shrink: 0;
}
.pm-ev-stage #pm-ev-lottie,
.pm-ev-stage #pm-ev-overlay-canvas,
.pm-ev-stage #pm-ev-brand {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.pm-ev-stage #pm-ev-lottie { z-index: 1; }
.pm-ev-stage #pm-ev-overlay-canvas {
  z-index: 2;
  pointer-events: none;
}
.pm-ev-stage #pm-ev-brand {
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.pm-ev-stage #pm-ev-lottie canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
#pm-ev-brand-logo {
  position: absolute;
  object-fit: contain;
  display: block;
}
.pm-ev-brand-icon {
  position: absolute;
  display: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
  /* clip viewport — inner <img> is the full sprite, offset to the glyph */
}
.pm-ev-brand-icon.is-placed {
  display: block;
}
.pm-ev-brand-icon > img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  display: block;
  pointer-events: none;
  border: 0;
}
.pm-ev-brand-text {
  position: absolute;
  white-space: nowrap;
  font-family: 'Century Gothic', 'CenturyGothic-Bold', Inter, Arial, sans-serif;
  font-weight: 700;
  line-height: 1.1;
  color: #0a3859;
}

.pm-ev-field { margin-bottom: 12px; }
.pm-ev-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ep-muted, #6B7280);
  margin: 4px 0 10px;
}
.pm-ev-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ep-muted, #6B7280);
  margin-bottom: 6px;
}
.pm-ev-field-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--ep-border, #E6EAF0);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ep-text, #1F2937);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pm-ev-field-input:focus {
  border-color: var(--ep-primary, #1976D2);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.pm-ev-photo-slot {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pm-ev-photo-preview {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--ep-border, #E6EAF0);
  background: #F3F6FA;
}
.pm-ev-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pm-ev-photo-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ep-text, #1F2937);
}
.pm-ev-app .pm-ep-btn-block {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px dashed #93c5fd;
  background: #eff6ff;
  color: #1976D2;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
}
.pm-ev-app .pm-ep-btn-block:hover {
  background: #dbeafe;
}
.pm-ev-audio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--ep-border, #E6EAF0);
  border-radius: 12px;
  background: #F8FAFC;
}
.pm-ev-audio-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(25, 118, 210, 0.12);
  color: var(--ep-primary, #1976D2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pm-ev-audio-play:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pm-ev-audio-play:not(:disabled):hover {
  background: rgba(25, 118, 210, 0.2);
}
.pm-ev-audio-meta { flex: 1; min-width: 0; }
