/* ===================================================================
 * 썸네일 에디터 UI 스타일 (도구 껍데기)
 * 레이아웃·탭·편집 패널·내보내기 버튼
 * =================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font-family: 'Pretendard', -apple-system, sans-serif;
  background: #eaedef;
  color: #222;
  overflow: hidden;
}

.app {
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 0 0 1px #e0e4e8;
}

.app-header {
  background: #fff;
  padding: 14px 28px;
  border-bottom: 1px solid #e0e4e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.app-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-title .brand-dot {
  width: 10px;
  height: 10px;
  background: #07553B;
  border-radius: 50%;
}

.tabs {
  display: flex;
  gap: 4px;
  background: #f1f3f5;
  padding: 4px;
  border-radius: 10px;
}

.tab-button {
  padding: 8px 22px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-radius: 7px;
  font-family: inherit;
  letter-spacing: -0.2px;
  transition: background .15s, color .15s;
}

.tab-button:hover {
  color: #222;
}

.tab-button.active {
  background: #fff;
  color: #07553B;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.export-button {
  padding: 9px 14px;
  background: #07553B;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.2px;
}
.export-button.secondary {
  background: #fff;
  color: #07553B;
  border: 1px solid #07553B;
}
.export-button:hover { background: #0a6b4a; }
.export-button.secondary:hover { background: #f0f7f4; }
.export-button:active { transform: translateY(1px); }

/* 상단 도구 버튼 */
.toolbar-btn {
  padding: 8px 12px;
  background: #fff;
  color: #333;
  border: 1px solid #d5dae0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.2px;
  transition: background .12s, border-color .12s;
}
.toolbar-btn:hover:not(:disabled) { background: #f0f7f4; border-color: #07553B; color: #07553B; }
.toolbar-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.toolbar-btn.primary { background: #07553B; color: #fff; border-color: #07553B; }
.toolbar-btn.primary:hover:not(:disabled) { background: #0a6b4a; color: #fff; }
.toolbar-btn.primary.saving { opacity: 0.75; cursor: wait; }
.toolbar-btn.primary.saved { background: #2da35c; border-color: #2da35c; }
.toolbar-btn.primary.error { background: #d33; border-color: #d33; }
.toolbar-divider {
  display: inline-block;
  width: 1px; height: 20px;
  background: #e0e4e8;
  margin: 0 4px;
}

/* ===== 모달 (PIN · 도움말) ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal.visible { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  min-width: 340px;
  max-width: 440px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.5px; }
.modal-desc { font-size: 13px; color: #666; margin-bottom: 18px; line-height: 1.5; }
.modal input[type=password], .modal input[type=text] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d5dae0;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  text-align: center;
  letter-spacing: 6px;
}
.modal-error { color: #d33; font-size: 12px; margin-top: 8px; min-height: 16px; }
.modal-primary {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  background: #07553B;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.modal-primary:hover { background: #0a6b4a; }
.shortcut-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.shortcut-table td { padding: 8px 4px; font-size: 13px; }
.shortcut-table td:first-child { color: #444; }
.shortcut-table td:last-child { text-align: right; color: #07553B; font-family: monospace; font-size: 12px; }
.shortcut-table tr { border-bottom: 1px solid #f0f0f0; }

/* ===== 토스트 ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}
.toast {
  padding: 10px 16px;
  background: #333;
  color: #fff;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s, transform .22s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast-success { background: #07553B; }
.toast-error { background: #d33; }

.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ===== 좌측 히스토리 패널 ===== */
.history-panel {
  width: 250px;
  min-width: 250px;
  background: #f4f6f8;
  border-right: 1px solid #e0e4e8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-actions-bar {
  padding: 14px 14px 10px;
  border-bottom: 1px solid #e0e4e8;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-actions-bar #save-btn {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
}
.history-actions-bar .toolbar-row {
  display: flex;
  gap: 6px;
}
.history-actions-bar .toolbar-row .toolbar-btn {
  flex: 1;
  padding: 7px 4px;
  font-size: 12px;
  white-space: nowrap;
}

.history-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: #888;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 16px 18px 8px;
  border-bottom: 1px solid #e0e4e8;
}

.history-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-new-tile {
  border: 2px dashed #c4ccd4;
  background: #fff;
  border-radius: 8px;
  padding: 18px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #666;
  font-family: inherit;
  transition: border-color .12s, background .12s;
}
.history-new-tile:hover { border-color: #07553B; color: #07553B; background: #f0f7f4; }
.history-new-tile .plus { font-size: 24px; font-weight: 300; line-height: 1; }
.history-new-tile .label { font-size: 12px; font-weight: 600; }

.history-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 10px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.history-item:hover { border-color: #d5dae0; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.history-item.active { border-color: #07553B; box-shadow: 0 0 0 3px rgba(7,85,59,.12); }

.history-thumb {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  background: #e8eaec center/cover no-repeat;
  border-radius: 6px;
}
.history-thumb.no-thumb {
  background: repeating-linear-gradient(45deg, #e8eaec 0 6px, #f4f6f8 6px 12px);
}

.history-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.history-title {
  font-size: 13px;
  font-weight: 700;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}
.history-sub {
  font-size: 11px;
  color: #888;
  letter-spacing: 0.2px;
}

.history-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .12s;
}
.history-item:hover .history-actions { opacity: 1; }

.history-action {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 15px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.history-action:hover { background: #07553B; }
.history-action-delete:hover { background: #d33; }

.history-empty {
  text-align: center;
  color: #aaa;
  font-size: 12px;
  padding: 20px 10px;
}

/* ===== 중앙 편집 패널 ===== */
.edit-panel {
  width: 420px;
  min-width: 400px;
  max-width: 450px;
  background: #f4f6f8;
  border-right: 1px solid #e0e4e8;
  overflow-y: auto;
  padding: 12px 12px;
}

.panel-section {
  background: #fff;
  border: 1px solid #e3e7ea;
  border-radius: 10px;
  padding: 14px 16px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.02);
}

.panel-section-title {
  font-size: 12px;
  font-weight: 800;
  color: #07553B;
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef2f4;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.field input[type=text],
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d5dae0;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  letter-spacing: -0.2px;
  resize: vertical;
}

.field input[type=text]:focus,
.field textarea:focus {
  outline: none;
  border-color: #07553B;
  background: #fff;
}

.field textarea { min-height: 52px; }

.field.collapsible {
  margin-bottom: 14px;
}
.field.collapsible details {
  background: #f7f8fa;
  border: 1px solid #e2e6ea;
  border-radius: 7px;
  overflow: hidden;
}
.field.collapsible summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7177;
  display: flex;
  align-items: center;
  gap: 8px;
}
.field.collapsible summary::-webkit-details-marker { display: none; }
.field.collapsible summary::before {
  content: '▸';
  font-size: 10px;
  color: #9aa0a6;
  transition: transform 0.15s;
}
.field.collapsible details[open] summary::before {
  transform: rotate(90deg);
}
.field.collapsible summary:hover {
  background: #eef0f2;
  color: #2c2f33;
}
.field.collapsible details[open] summary {
  border-bottom: 1px solid #e2e6ea;
  background: #fff;
}
.field.collapsible details input[type=text] {
  width: calc(100% - 20px);
  margin: 10px;
  padding: 9px 12px;
  border: 1px solid #d5dae0;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.field.collapsible details input[type=text]:focus {
  outline: none;
  border-color: #07553B;
}

.field-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.field-row .field {
  flex: 1;
  margin-bottom: 0;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-field input[type=color] {
  width: 38px;
  height: 38px;
  border: 1px solid #d5dae0;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  padding: 2px;
}

.color-field input[type=text] {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
}

.image-upload {
  position: relative;
}

.image-upload input[type=file] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.image-upload-button {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #07553B;
  border-radius: 7px;
  background: #07553B;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-align: center;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}

.image-upload-button:hover {
  background: #0a6b4a;
  border-color: #0a6b4a;
}
.image-upload-button::before {
  content: '📷 ';
  margin-right: 6px;
}

.image-upload-preview {
  margin-top: 8px;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  background: #f0f0f0 center/cover no-repeat;
  border: 1px solid #e0e4e8;
  display: none;
}

.image-upload-preview.visible { display: block; }

.hint {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  line-height: 1.4;
}

/* 크기 슬라이더 */
.size-slider {
  display: flex;
  align-items: center;
  gap: 10px;
}

.size-slider input[type=range] {
  flex: 1;
  accent-color: #07553B;
  height: 4px;
  cursor: pointer;
}

.size-slider-value {
  min-width: 46px;
  font-family: monospace;
  font-size: 12px;
  color: #555;
  text-align: right;
  background: #f4f6f8;
  padding: 4px 6px;
  border-radius: 4px;
}

/* ===== 우측 프리뷰 ===== */
.preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #eaedef;
  padding: 40px 16px;
  overflow-y: auto;
}

.preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 640px;
}

.preview-meta {
  margin-top: 16px;
  font-size: 12px;
  color: #888;
  text-align: center;
}

.preview-meta strong { color: #555; }

/* 탭별 편집 패널 숨김/노출 */
.edit-tab { display: none !important; }
.edit-tab.active { display: block !important; }

/* 프리뷰 카드 전환 — 템플릿 CSS의 display:flex를 반드시 덮어써야 함 */
.preview-card { display: none !important; }
.preview-card.active { display: flex !important; }
/* 일괄 저장 시 비활성 카드를 화면 밖에서 임시 노출해 썸네일 캡처 */
.preview-card.capturing {
  display: flex !important;
  position: fixed !important;
  left: -10000px !important;
  top: 0 !important;
  z-index: -1 !important;
  pointer-events: none;
}

/* ===== 팔레트 스와치 UI ===== */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.palette-swatch {
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: #fff;
  overflow: hidden;
  transition: transform .12s, border-color .12s, box-shadow .12s;
  font-family: inherit;
}

.palette-swatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.palette-swatch.active {
  border-color: #07553B;
  box-shadow: 0 0 0 3px rgba(7, 85, 59, .15);
}

.palette-swatch-preview {
  height: 50px;
  border-radius: 5px 5px 0 0;
  position: relative;
  overflow: hidden;
}

.palette-swatch-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  top: 8px;
  left: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .3);
}

.palette-swatch-accent {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  bottom: 8px;
  right: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .3);
}

.palette-swatch-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #444;
  padding: 6px 6px 7px;
  text-align: center;
  line-height: 1.2;
  letter-spacing: -0.2px;
  background: #fafbfc;
  border-top: 1px solid #eef0f3;
}

.palette-category-label {
  font-size: 10px;
  font-weight: 700;
  color: #888;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 14px;
  margin-bottom: 6px;
}
.palette-category-label:first-child { margin-top: 0; }

/* 파일명 입력 (내보낼 때) */
.export-name-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 14px;
}

.export-name-field label {
  font-size: 12px;
  color: #666;
  font-weight: 600;
}

.export-name-field input {
  padding: 7px 10px;
  border: 1px solid #d5dae0;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  width: 220px;
}

.header-right { display: flex; align-items: center; }

/* ===== 레이어 호스트 — 카드 전체 덮는 절대 배치 ===== */
.layers-host {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.layers-host .image-frame-interactive {
  pointer-events: auto;
}
/* 빈 레이어 플레이스홀더 — 템플릿별 기본 이미지 슬롯 위치에 맞춤 */
.empty-layers-placeholder {
  position: absolute;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed rgba(0, 0, 0, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.35);
  color: rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}
/* 프로그램: 우하단 45% 슬롯 (imageDefault 와 동일) */
.card-program .empty-layers-placeholder {
  left: 49%; top: 49%; width: 45%; height: 45%;
}
/* 강의·전자책·교구: 상단 중앙 60% 슬롯 */
.card-lecture .empty-layers-placeholder,
.card-ebook .empty-layers-placeholder,
.card-product .empty-layers-placeholder {
  left: 20%; top: 12%; width: 60%; height: 60%;
}
.empty-layers-placeholder { z-index: 1; }
.empty-layers-placeholder.visible { display: flex; }
.empty-layers-placeholder .ph-plus {
  font-size: 72px;
  font-weight: 200;
  line-height: 1;
}
.empty-layers-placeholder .ph-label {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.card-program .empty-layers-placeholder {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
}

/* ===== 레이어 프레임 ===== */
.image-frame-interactive {
  position: absolute;
  cursor: move;
  outline: 1px dashed transparent;
  transition: outline-color .15s;
}
/* 비활성 레이어: 핸들 숨김, 호버에만 살짝 표시 */
.image-frame-interactive:hover {
  outline-color: rgba(7, 85, 59, 0.4);
}
/* 활성 레이어: 항상 아웃라인 + 핸들 */
.image-frame-interactive.active-layer {
  outline-color: rgba(7, 85, 59, 0.8);
}
.image-frame-interactive.active-layer.dragging,
.image-frame-interactive.active-layer.resizing,
.image-frame-interactive.active-layer.cropping {
  outline-color: rgba(7, 85, 59, 0.9);
}
.image-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.image-frame-interactive .image-content {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-frame-interactive .image-content img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  filter: none;
  display: block;
}
.image-frame-interactive .image-content .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px dashed rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.35);
  color: rgba(0, 0, 0, 0.55);
  font-size: inherit !important;
  filter: none !important;
  box-sizing: border-box;
}
.image-frame-interactive .image-content .placeholder .ph-plus {
  font-size: 48px;
  font-weight: 200;
  line-height: 1;
}
.image-frame-interactive .image-content .placeholder .ph-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
/* 어두운 배경 카드(프로그램) 에서 placeholder 대비 확보 */
.card-program .image-frame-interactive .image-content .placeholder {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
}

/* 핸들 — 투명 히트 박스. 실제 보이는 부분은 ::before 로 그려 중앙에 배치. */
.image-handle {
  position: absolute;
  background: transparent;
  border: none;
  opacity: 0;
  transition: opacity .12s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.image-frame-interactive.active-layer .image-handle {
  pointer-events: auto;
}
.image-handle::before {
  content: '';
  background: #fff;
  border: 2px solid #07553B;
  box-shadow: 0 2px 4px rgba(0,0,0,.25);
}
.image-frame-interactive.active-layer .image-handle { opacity: 1; }

/* 모서리 — 24x24 히트, 14x14 원형 표시 */
.image-handle.handle-corner {
  width: 28px; height: 28px;
}
.image-handle.handle-corner::before {
  width: 14px; height: 14px; border-radius: 50%;
}
.image-handle.handle-tl { top: -14px;    left: -14px;   cursor: nwse-resize; }
.image-handle.handle-tr { top: -14px;    right: -14px;  cursor: nesw-resize; }
.image-handle.handle-bl { bottom: -14px; left: -14px;   cursor: nesw-resize; }
.image-handle.handle-br { bottom: -14px; right: -14px;  cursor: nwse-resize; }

/* 변 — 길고 두꺼운 히트 박스, 중앙에 작은 바. */
.image-handle.handle-edge::before {
  border-radius: 3px;
}
.image-handle.handle-t,
.image-handle.handle-b {
  left: 20%; right: 20%; height: 22px; cursor: ns-resize;
}
.image-handle.handle-t { top: -11px; }
.image-handle.handle-b { bottom: -11px; }
.image-handle.handle-t::before,
.image-handle.handle-b::before { width: 36px; height: 8px; }

.image-handle.handle-l,
.image-handle.handle-r {
  top: 20%; bottom: 20%; width: 22px; cursor: ew-resize;
}
.image-handle.handle-l { left: -11px; }
.image-handle.handle-r { right: -11px; }
.image-handle.handle-l::before,
.image-handle.handle-r::before { width: 8px; height: 36px; }

/* 배경 제거 체크박스 — 업로드 버튼 위 */
.remove-bg-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #f4f6f8;
  border: 1px solid #e3e7ea;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.remove-bg-toggle:hover {
  background: #f0f7f4;
  border-color: #07553B;
  color: #07553B;
}
.remove-bg-toggle input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: #07553B;
  cursor: pointer;
}

/* 이미지 갤러리 — 업로드 누적 썸네일 */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
}
.image-gallery.empty { display: none; }
.gallery-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f4f6f8 center/cover no-repeat;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .12s, transform .08s;
}
.gallery-thumb:hover { border-color: #b9cec5; transform: translateY(-1px); }
.gallery-thumb.active { border-color: #07553B; box-shadow: 0 0 0 2px rgba(7,85,59,.15); }
.gallery-thumb-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  border: none;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, background .12s;
}
.gallery-thumb:hover .gallery-thumb-remove { opacity: 1; }
.gallery-thumb-remove:hover { background: #d33; }

/* 순서 변경 버튼 — 2x2 그리드 */
.zorder-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
/* 정렬 버튼 — 3행 2열 (세로정렬 / 가로정렬) */
.align-row {
  display: grid;
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.align-toolbar-sep { display: none; }
.align-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid #d5dae0;
  background: #fff;
  border-radius: 7px;
  cursor: pointer;
  color: #333;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition: background .12s, border-color .12s, color .12s;
}
.align-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.align-btn-label { line-height: 1; }
.align-btn:hover {
  background: #f0f7f4;
  border-color: #07553B;
  color: #07553B;
}
.align-btn:active { background: #d7e8df; }

/* ===== 빈 상태 오버레이 ===== */
.preview-stage.empty-stage .preview-card { display: none !important; }
.preview-stage.empty-stage .preview-meta { opacity: 0.4; }
.empty-overlay {
  width: 600px;
  height: 600px;
  background: #fff;
  border: 2px dashed #c4ccd4;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #888;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, color .15s, background .15s;
}
.empty-overlay:hover {
  border-color: #07553B;
  color: #07553B;
  background: #f0f7f4;
}
.empty-overlay .big-plus {
  font-size: 72px;
  font-weight: 200;
  line-height: 1;
}
.empty-overlay .label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
/* 작업이 있는데 미선택 상태 — 안내만, 클릭 불가 */
.empty-overlay.unselected-overlay {
  cursor: default;
}
.empty-overlay.unselected-overlay:hover {
  border-color: #c4ccd4;
  color: #888;
  background: #fff;
}
.empty-overlay.unselected-overlay .label {
  font-size: 17px;
  color: #6b7380;
}
