.publish-redesign [data-step-panel="edit"] {
  grid-template-columns: minmax(0, 1fr) 536px;
  gap: clamp(32px, 4.5vw, 58px);
  align-items: start;
}

.publish-redesign [data-step-panel="edit"] .publish-media-editor,
.publish-redesign [data-step-panel="edit"] .publish-tool-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.publish-redesign [data-step-panel="edit"] .publish-media-editor {
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: 0;
}

.publish-redesign [data-step-panel="edit"] .publish-tool-panel {
  position: sticky;
  top: 88px;
  align-self: center;
  padding: 0;
  z-index: 30;
}

.edit-hero-media {
  width: 100%;
  min-height: min(62vh, 640px);
  display: grid;
  place-items: center;
}

.chim-editor-canvas {
  width: min(620px, 100%);
  display: grid;
  place-items: center;
}

.chim-editor-stage {
  position: relative;
  width: min(620px, 100%);
  aspect-ratio: var(--editor-aspect, 1);
  max-height: min(68vh, 640px);
  border-radius: 16px;
  overflow: hidden;
  background: #eeeeee;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  user-select: none;
  touch-action: none;
}

.chim-editor-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #ffffff;
  transform-origin: top left;
  transition: filter 160ms ease, opacity 160ms ease;
}

.chim-editor-empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  color: #7a7470;
  font-weight: 800;
}

.chim-editor-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, calc(var(--vignette, 0) * 0.52)) 100%);
}

.chim-editor-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chim-editor-drawing-layer {
  z-index: 4;
}

.chim-editor-object-layer {
  z-index: 5;
}

.chim-editor-layer-item {
  position: absolute;
  z-index: 6;
  pointer-events: auto;
  cursor: move;
  outline: 0;
  transform-origin: center;
  transition: box-shadow 140ms ease, outline-color 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.chim-editor-layer-item.selected {
  outline: 1.5px solid rgba(255, 122, 26, 0.95);
  outline-offset: 5px;
}

.chim-editor-text-item {
  min-width: 80px;
  max-width: 82%;
  padding: 3px 6px;
  border-radius: 8px;
  line-height: 1.18;
  white-space: pre-wrap;
  word-break: break-word;
}

.chim-editor-text-item:focus {
  background: rgba(0, 0, 0, 0.16);
}

.chim-editor-label-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 78px;
  max-width: 78%;
  padding: 7px 12px 7px 9px;
  border-radius: 999px;
  background: var(--label-bg);
  color: var(--label-color);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px);
  transform: translate(-50%, -50%);
}

.chim-editor-label-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 999px;
  background: var(--label-dot);
}

.chim-editor-label-text {
  min-width: 56px;
  outline: 0;
  color: inherit;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.chim-editor-sticker-item {
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #211916;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.chim-editor-crop-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
  animation: chimFadeIn 180ms ease both;
}

.chim-crop-box {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
  cursor: move;
  transition: left 180ms cubic-bezier(0.22, 1, 0.36, 1), top 180ms cubic-bezier(0.22, 1, 0.36, 1), width 180ms cubic-bezier(0.22, 1, 0.36, 1), height 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.chim-crop-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, transparent 33.25%, rgba(255, 255, 255, 0.65) 33.25%, rgba(255, 255, 255, 0.65) calc(33.25% + 1px), transparent calc(33.25% + 1px), transparent 66.5%, rgba(255, 255, 255, 0.65) 66.5%, rgba(255, 255, 255, 0.65) calc(66.5% + 1px), transparent calc(66.5% + 1px)),
    linear-gradient(to bottom, transparent 33.25%, rgba(255, 255, 255, 0.65) 33.25%, rgba(255, 255, 255, 0.65) calc(33.25% + 1px), transparent calc(33.25% + 1px), transparent 66.5%, rgba(255, 255, 255, 0.65) 66.5%, rgba(255, 255, 255, 0.65) calc(66.5% + 1px), transparent calc(66.5% + 1px));
  pointer-events: none;
}

.chim-crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid #ff6b1a;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.chim-crop-handle.nw { left: -5px; top: -5px; cursor: nwse-resize; }
.chim-crop-handle.n { left: 50%; top: -5px; transform: translateX(-50%); cursor: ns-resize; }
.chim-crop-handle.ne { right: -5px; top: -5px; cursor: nesw-resize; }
.chim-crop-handle.e { right: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.chim-crop-handle.se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.chim-crop-handle.s { left: 50%; bottom: -5px; transform: translateX(-50%); cursor: ns-resize; }
.chim-crop-handle.sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.chim-crop-handle.w { left: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.chim-cover-badge {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 8;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #24211f;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 750;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
}

.chim-brush-cursor {
  position: absolute;
  z-index: 9;
  display: none;
  border: 1.5px solid #ff7a1a;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  mix-blend-mode: difference;
}

.chim-brush-cursor.visible {
  display: block;
}

.chim-editor-canvas.tool-brush .chim-editor-stage {
  cursor: none;
}

.edit-thumb-strip {
  width: min(620px, 100%);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
  overflow-x: auto;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  scrollbar-width: none;
}

.edit-thumb-strip::-webkit-scrollbar {
  display: none;
}

.chim-editor-thumb {
  width: 66px;
  height: 78px;
  flex: 0 0 66px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 3px;
  background: #ffffff;
  overflow: hidden;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.chim-editor-thumb:hover {
  transform: translateY(-1px);
}

.chim-editor-thumb.active {
  border-color: #ff6b1a;
  box-shadow: 0 6px 16px rgba(255, 107, 26, 0.14);
}

.chim-editor-thumb img,
.chim-editor-thumb video {
  width: 100%;
  height: 52px;
  display: block;
  border-radius: 9px;
  object-fit: cover;
}

.chim-editor-thumb em,
.chim-editor-add-thumb em {
  display: block;
  margin-top: 4px;
  color: #5f5f5f;
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
  line-height: 1;
}

.chim-editor-add-thumb {
  width: 86px;
  height: 78px;
  flex: 0 0 86px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(0, 0, 0, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  color: #686868;
}

.chim-editor-add-thumb span {
  display: block;
  color: #555555;
  font-size: 24px;
  line-height: 1;
}

.chim-editor-side-inner {
  width: 520px;
  display: grid;
  grid-template-columns: 156px 340px;
  align-items: flex-start;
  gap: 24px;
}

.chim-editor-toolbar {
  width: 156px;
  display: grid;
  grid-auto-rows: 56px;
  gap: 12px;
}

.chim-editor button,
.chim-editor-side button {
  cursor: pointer;
}

.chim-editor-tool {
  position: relative;
  width: 156px;
  height: 56px;
  min-height: 56px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #2f2c2a;
  padding: 0 18px;
  box-sizing: border-box;
  overflow: hidden;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  transition: color 150ms ease;
}

.chim-editor-tool::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 32px;
  border-radius: 999px;
  background: #ff7a1a;
  opacity: 0;
  transition: opacity 150ms ease;
}

.chim-editor-tool::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  opacity: 0;
  transition: opacity 150ms ease, background 150ms ease;
}

.chim-editor-tool > * {
  position: relative;
  z-index: 1;
}

.chim-editor-tool span {
  white-space: nowrap;
}

.chim-editor-tool-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: grayscale(1) opacity(0.62);
  transition: filter 150ms ease;
}

.chim-editor-tool:hover {
  color: #111111;
}

.chim-editor-tool:hover::after {
  opacity: 1;
}

.chim-editor-tool:hover .chim-editor-tool-icon {
  filter: grayscale(1) opacity(0.88);
}

.chim-editor-tool.active {
  color: #e26408;
}

.chim-editor-tool.active::before {
  opacity: 1;
}

.chim-editor-tool.active::after {
  background: rgba(255, 107, 26, 0.12);
  opacity: 1;
}

.chim-editor-tool.active .chim-editor-tool-icon {
  filter: brightness(0) saturate(100%) invert(52%) sepia(89%) saturate(1860%) hue-rotate(348deg) brightness(101%) contrast(101%);
}

.chim-editor-panel {
  width: 340px;
  min-height: 480px;
  max-height: min(68vh, calc(100vh - 188px));
  overflow: auto;
  padding: 32px;
  box-sizing: border-box;
  border: 0;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.07);
  backdrop-filter: blur(18px);
}

.chim-editor-panel.animate-in {
  animation: chimPanelIn 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chim-editor-panel::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.chim-editor-panel-section {
  display: grid;
  gap: 30px;
}

.chim-editor-panel h3 {
  margin: 0;
  color: #171412;
  font-size: 22px;
  font-weight: 700;
}

.chim-panel-group {
  display: grid;
  gap: 18px;
}

.chim-panel-group h4 {
  margin: 0;
  color: #3d3936;
  font-size: 16px;
  font-weight: 650;
}

.chim-editor-hint {
  margin: 0;
  color: #746963;
  font-size: 12px;
  line-height: 1.5;
}

.chim-chip-grid,
.chim-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chim-chip,
.chim-segmented button,
.chim-secondary-button,
.chim-primary-button,
.chim-danger-button {
  border: 1px solid rgba(20, 20, 20, 0.08);
  border-radius: 12px;
  background: #ffffff;
  color: #312d2a;
  min-width: 84px;
  min-height: 44px;
  padding: 0 18px;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 600;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.chim-chip:hover,
.chim-segmented button:hover,
.chim-secondary-button:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
}

.chim-chip.active,
.chim-segmented .active {
  border-color: rgba(255, 107, 26, 0.55);
  background: rgba(255, 107, 26, 0.11);
  color: #ff6b1a;
}

.chim-primary-button {
  border-color: #ff6b1a;
  background: #ff6b1a;
  color: #ffffff;
}

.chim-secondary-button {
  background: #f7f7f7;
}

.chim-danger-button {
  border-color: rgba(217, 45, 32, 0.18);
  background: rgba(217, 45, 32, 0.08);
  color: #b42318;
}

.chim-primary-button.full,
.chim-secondary-button.full,
.chim-danger-button.full {
  width: 100%;
}

.chim-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chim-editor-actions .chim-secondary-button,
.chim-editor-actions .chim-primary-button,
.chim-editor-actions .chim-danger-button {
  min-height: 48px;
  border-radius: 999px;
}

.chim-editor-slider {
  display: grid;
  gap: 8px;
}

.chim-editor-slider span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #5e5651;
  font-size: 12px;
}

.chim-editor-slider strong {
  font-weight: 850;
}

.chim-editor-slider em {
  color: #9a918a;
  font-style: normal;
}

.chim-editor-slider input[type="range"] {
  width: 100%;
  accent-color: #ff7a1a;
}

.chim-editor-color {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #5e5651;
  font-size: 12px;
  font-weight: 850;
}

.chim-editor-color input {
  width: 38px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.chim-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.chim-filter-card {
  display: grid;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  padding: 4px;
  color: #4b4541;
  text-align: center;
  font-size: 11px;
  font-weight: 850;
}

.chim-filter-card span {
  display: block;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f1f1;
}

.chim-filter-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chim-filter-card em {
  font-style: normal;
}

.chim-filter-card:hover,
.chim-filter-card.active {
  border-color: rgba(255, 107, 26, 0.36);
  background: rgba(255, 107, 26, 0.1);
  color: #ff6b1a;
}

.chim-icon-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.chim-icon-action-grid button {
  min-height: 76px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid rgba(20, 20, 20, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  color: #2f2c2a;
  font-size: 24px;
}

.chim-icon-action-grid span {
  color: #68615d;
  font-size: 13px;
  font-weight: 600;
}

.chim-empty-state {
  display: grid;
  gap: 6px;
  border-radius: 14px;
  background: rgba(246, 246, 246, 0.78);
  padding: 18px 14px;
  color: #6b6662;
}

.chim-empty-state strong {
  color: #2f2c2a;
  font-size: 13px;
}

.chim-empty-state span {
  font-size: 12px;
  line-height: 1.45;
}

.chim-adjust-list {
  display: grid;
  gap: 11px;
}

.chim-adjust-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: end;
}

.chim-adjust-row > button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: #f4f4f4;
  color: #746963;
}

.chim-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chim-color-row button,
.chim-color-row input {
  width: 28px;
  height: 28px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgba(20, 20, 20, 0.12);
}

.chim-color-row .active {
  box-shadow: 0 0 0 2px #ff7a1a;
}

.chim-sticker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.chim-sticker-grid button {
  border: 1px solid rgba(20, 20, 20, 0.08);
  border-radius: 999px;
  background: #fafafa;
  color: #2f2c2a;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
}

.chim-collage-pick-list {
  display: grid;
  gap: 8px;
}

.chim-collage-pick-list label {
  display: grid;
  grid-template-columns: 18px 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(20, 20, 20, 0.08);
  border-radius: 12px;
  padding: 6px;
  color: #3b3530;
  font-size: 12px;
  font-weight: 850;
}

.chim-collage-pick-list label.active {
  border-color: rgba(255, 122, 26, 0.42);
  background: rgba(255, 122, 26, 0.08);
}

.chim-collage-pick-list span {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f1f1;
}

.chim-collage-pick-list img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes chimPanelIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes chimFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 980px) {
  .publish-redesign [data-step-panel="edit"] {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .publish-redesign [data-step-panel="edit"] .publish-tool-panel {
    position: static;
    width: 100%;
  }

  .chim-editor-side-inner {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .chim-editor-toolbar {
    width: 100%;
    grid-auto-rows: 64px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .chim-editor-tool {
    width: 100%;
    height: 64px;
    min-height: 64px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 5px;
    text-align: center;
  }

  .chim-editor-tool::before {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: -2px;
    transform: none;
    width: auto;
    height: 3px;
  }

  .chim-editor-panel {
    width: 100%;
    max-height: none;
  }

  .edit-hero-media {
    min-height: 420px;
  }
}
