.yz-local-edit-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 18, 22, .72);
  backdrop-filter: blur(8px);
}

.yz-local-edit-backdrop[hidden],
.yz-region-dialog[hidden] {
  display: none;
}

.yz-local-edit-dialog {
  width: min(1380px, 96vw);
  height: min(880px, 92vh);
  min-height: 640px;
  overflow: hidden;
  color: #26282c;
  background: #f7f7f8;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  box-shadow: 0 24px 72px rgba(0,0,0,.34);
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) 62px;
}

.yz-local-edit-header,
.yz-local-edit-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: #fff;
}

.yz-local-edit-header {
  border-bottom: 1px solid #e1e2e4;
}

.yz-local-edit-header strong {
  margin-right: auto;
  font-size: 15px;
}

.yz-local-edit-header button,
.yz-local-edit-toolbar button,
.yz-local-edit-footer button,
.yz-region-item button,
.yz-region-dialog button {
  min-width: 34px;
  min-height: 32px;
  color: #3b3d42;
  cursor: pointer;
  background: #fff;
  border: 1px solid #d9dadd;
  border-radius: 6px;
}

.yz-local-edit-header button:disabled,
.yz-local-edit-toolbar button:disabled,
.yz-local-edit-footer button:disabled,
.yz-region-item button:disabled {
  color: #a4a6aa;
  cursor: not-allowed;
  background: #f3f3f4;
}

.yz-local-edit-main {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
}

.yz-local-edit-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr);
  background: #1f2125;
}

.yz-local-edit-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: #2b2d32;
  border-bottom: 1px solid #3b3d42;
}

.yz-local-edit-toolbar button {
  color: #e8e9eb;
  background: #34363c;
  border-color: #474a51;
}

.yz-local-edit-toolbar button.active {
  color: #fff;
  background: #1473e6;
  border-color: #2f86ee;
}

.yz-local-edit-zoom {
  min-width: 54px;
  color: #c7c9cd;
  text-align: center;
  font-size: 12px;
}

.yz-local-edit-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  background-color: #1d1f23;
  background-image: linear-gradient(45deg,#24262b 25%,transparent 25%),linear-gradient(-45deg,#24262b 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#24262b 75%),linear-gradient(-45deg,transparent 75%,#24262b 75%);
  background-size: 24px 24px;
  background-position: 0 0,0 12px,12px -12px,-12px 0;
}

.yz-local-edit-viewport {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center;
  will-change: transform;
  box-shadow: 0 8px 38px rgba(0,0,0,.38);
}

.yz-local-edit-viewport img,
.yz-local-edit-viewport canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.yz-local-edit-viewport img {
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.yz-local-edit-viewport canvas {
  cursor: crosshair;
  touch-action: none;
}

.yz-local-edit-stage.is-panning canvas {
  cursor: grabbing;
}

.yz-local-edit-regions {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #fff;
  border-left: 1px solid #e1e2e4;
}

.yz-local-edit-regions > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 14px 11px;
  border-bottom: 1px solid #ececee;
}

.yz-region-list {
  overflow: auto;
  padding: 10px;
}

.yz-region-empty {
  color: #929499;
  padding: 30px 12px;
  text-align: center;
  font-size: 12px;
}

.yz-region-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px 30px;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e2e3e5;
  border-radius: 6px;
  margin-bottom: 7px;
  background: #fff;
}

.yz-region-item.active {
  border-color: #1473e6;
  box-shadow: 0 0 0 2px rgba(20,115,230,.12);
}

.yz-region-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #1473e6;
  font-size: 11px;
  font-weight: 700;
}

.yz-region-copy {
  min-width: 0;
  cursor: pointer;
}

.yz-region-copy strong,
.yz-region-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yz-region-copy strong { font-size: 11px; }
.yz-region-copy span { color: #73767b; margin-top: 2px; font-size: 10px; }
.yz-region-item button { min-width: 30px; min-height: 28px; padding: 0; }

.yz-local-edit-footer {
  border-top: 1px solid #e1e2e4;
}

.yz-local-edit-status {
  min-width: 0;
  margin-right: auto;
  overflow: hidden;
  color: #6f7277;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.yz-local-edit-status[data-kind="error"] { color: #b33b3b; }
.yz-local-edit-status[data-kind="success"] { color: #287a4b; }
.yz-local-edit-start { min-width: 82px; }
.yz-local-edit-start:not(:disabled) { color: #fff; background: #1473e6; border-color: #1473e6; }

.yz-region-dialog {
  position: fixed;
  inset: 0;
  z-index: 10030;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10,12,15,.55);
}

.yz-region-dialog section {
  width: min(460px, 94vw);
  padding: 18px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 58px rgba(0,0,0,.28);
}

.yz-region-dialog strong { display: block; margin-bottom: 11px; }
.yz-region-dialog textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  color: #292b2f;
  background: #fff;
  border: 1px solid #cfd1d5;
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  box-sizing: border-box;
}
.yz-region-dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.yz-region-dialog [data-action="save"] { color: #fff; background: #1473e6; border-color: #1473e6; padding: 0 16px; }

.yz-local-edit-button { white-space: nowrap; }
.yz-local-edit-card footer { flex-wrap: wrap; gap: 4px; height: auto; min-height: 48px; padding-top: 7px; padding-bottom: 7px; }
.yz-local-edit-card .yz-local-edit-error { color: #a33b3b; padding: 14px; text-align: center; font-size: 10px; line-height: 1.5; }

@media (max-width: 900px) {
  .yz-local-edit-backdrop { padding: 0; }
  .yz-local-edit-dialog { width: 100vw; height: 100vh; min-height: 0; border-radius: 0; }
  .yz-local-edit-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 210px; }
  .yz-local-edit-regions { border-left: 0; border-top: 1px solid #e1e2e4; }
}
