:root {
  --image-edit-panel: rgba(15, 23, 42, 0.94);
  --image-edit-line: rgba(148, 163, 184, 0.18);
  --image-edit-text: #f8fafc;
  --image-edit-muted: #94a3b8;
  --image-edit-blue: #60a5fa;
  --image-edit-cyan: #22d3ee;
}

.image-edit-workspace {
  gap: 18px;
}

.image-edit-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
  width: min(1380px, calc(100vw - 300px));
  margin: 0 auto 48px;
}

.image-edit-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.image-edit-card {
  border: 1px solid var(--image-edit-line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--image-edit-panel), rgba(11, 18, 32, 0.94));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.image-edit-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 132px;
  border-color: rgba(96, 165, 250, 0.3);
  padding: 18px;
}

.image-edit-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--image-edit-blue);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.image-edit-intro h2 {
  margin: 0;
  color: var(--image-edit-text);
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0;
}

.image-edit-intro p {
  margin: 8px 0 0;
  color: var(--image-edit-muted);
  line-height: 1.65;
}

.image-edit-credit {
  display: grid;
  gap: 6px;
  min-width: 132px;
  border: 1px solid rgba(249, 115, 22, 0.28);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(249, 115, 22, 0.08);
}

.image-edit-credit span {
  color: var(--image-edit-muted);
  font-size: 12px;
  font-weight: 750;
}

.image-edit-credit strong {
  color: #fed7aa;
  font-size: 20px;
}

.image-edit-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.image-edit-card-head h3 {
  margin: 0;
  color: var(--image-edit-text);
  font-size: 15px;
}

.image-edit-actions,
.image-edit-save-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-edit-history-btn {
  min-width: 64px;
}

.image-edit-history-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.image-edit-canvas.is-overlay-hidden .ocr-mark,
.image-edit-canvas.is-overlay-hidden .ai-annotation-mark,
.image-edit-canvas.is-overlay-hidden .arrow-preview-line {
  opacity: 0;
  pointer-events: none;
}

.image-edit-btn,
.image-edit-tab,
.image-edit-field,
.image-edit-textarea {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--image-edit-text);
  font: inherit;
}

.image-edit-btn,
.image-edit-tab {
  min-height: 38px;
  padding: 0 12px;
  font-weight: 750;
  cursor: pointer;
}

.image-edit-btn.primary {
  min-height: 44px;
  border-color: rgba(34, 211, 238, 0.48);
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: 0 16px 34px rgba(59, 130, 246, 0.24);
}

.image-edit-btn.subtle {
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.38);
}

.image-edit-preview-body {
  padding: 16px;
}

.image-edit-canvas {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 500px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at center, rgba(96, 165, 250, 0.12), transparent 48%),
    rgba(2, 6, 23, 0.22);
}

.image-edit-canvas.is-selecting {
  cursor: crosshair;
}

.image-edit-canvas.is-ocr-loading .image-edit-stage {
  filter: saturate(0.8) brightness(0.82);
}

.image-edit-selection-tip {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 12;
  display: none;
  border: 1px solid rgba(34, 211, 238, 0.42);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(8, 47, 73, 0.82);
  color: #cffafe;
  font-size: 12px;
  font-weight: 850;
  backdrop-filter: blur(12px);
}

.image-edit-selection-tip:not([hidden]) {
  display: inline-flex;
}

.image-edit-empty {
  position: absolute;
  inset: 16px;
  z-index: 20;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(148, 163, 184, 0.42);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(15, 23, 42, 0.9)),
    rgba(2, 6, 23, 0.82);
  cursor: pointer;
}

.image-edit-canvas.has-image .image-edit-empty {
  display: none;
}

.image-edit-empty-inner {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 360px;
  padding: 28px;
  text-align: center;
}

.image-edit-upload-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: rgba(96, 165, 250, 0.14);
  color: #bfdbfe;
  font-size: 28px;
}

.image-edit-empty-inner strong {
  color: var(--image-edit-text);
  font-size: 18px;
}

.image-edit-empty-inner span:last-child {
  color: var(--image-edit-muted);
  font-size: 13px;
  line-height: 1.5;
}

.image-edit-compare {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(12px);
}

.image-edit-compare button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.image-edit-compare button.active {
  color: white;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.image-edit-zoom-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 12;
  display: inline-flex;
  overflow: hidden;
  border: 1px solid rgba(96, 165, 250, 0.32);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.76);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.28);
  backdrop-filter: blur(12px);
}

.image-edit-zoom-actions button {
  min-width: 32px;
  min-height: 30px;
  border: 0;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  padding: 0 9px;
  background: transparent;
  color: #dbeafe;
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.image-edit-zoom-actions button:last-child {
  border-right: 0;
}

.image-edit-zoom-actions button:hover {
  background: rgba(37, 99, 235, 0.3);
}

.image-edit-zoom-actions #imageEditZoomResetBtn {
  min-width: 52px;
  color: #bfdbfe;
  font-size: 11px;
}

.image-edit-canvas-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 6px;
}

.image-edit-canvas-actions .image-edit-history-btn {
  min-width: auto;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}

.image-edit-tooltip-wrap {
  position: relative;
  display: inline-flex;
}

.image-edit-tooltip-wrap::after {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 30;
  width: 248px;
  padding: 9px 10px;
  border: 1px solid rgba(96, 165, 250, 0.34);
  border-radius: 8px;
  background: rgba(9, 16, 36, 0.96);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.4);
  color: #dbeafe;
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.image-edit-tooltip-wrap:hover::after,
.image-edit-tooltip-wrap:focus-within::after {
  opacity: 1;
  transform: translateY(0);
}

.image-edit-stage-viewport {
  position: relative;
  width: min(430px, 84%);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 24px 72px rgba(2, 6, 23, 0.36);
}

.image-edit-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 246, 239, 0.96), rgba(235, 246, 255, 0.96)),
    #f8fafc;
  transform-origin: 0 0;
  transition: transform 0.16s ease;
}

.image-edit-canvas.is-zoomed .image-edit-stage {
  cursor: grab;
}

.image-edit-canvas.is-panning .image-edit-stage {
  cursor: grabbing;
  transition: none;
}

.image-edit-ocr-loading {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.34);
  color: #e0f2fe;
  font-size: 13px;
  font-weight: 850;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

.image-edit-ocr-loading[hidden] {
  display: none;
}

.image-edit-ocr-loading span {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(96, 165, 250, 0.2);
  border-top-color: #22d3ee;
  border-radius: 999px;
  animation: image-edit-spin 0.8s linear infinite;
}

@keyframes image-edit-spin {
  to {
    transform: rotate(360deg);
  }
}

#imageEditUploadedImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(15, 23, 42, 0.95);
}

.sample-title {
  position: absolute;
  top: 28px;
  left: 28px;
  z-index: 2;
  color: #111827;
  font-size: 35px;
  font-weight: 900;
  line-height: 1.08;
  -webkit-text-stroke: 4px white;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(17, 24, 39, 0.16);
}

.sample-badge {
  position: absolute;
  top: 150px;
  left: 32px;
  z-index: 2;
  border-radius: 999px;
  padding: 12px 18px;
  background: #fee2e2;
  color: #111827;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.82);
}

.sample-product {
  position: absolute;
  right: 58px;
  bottom: 56px;
  width: 178px;
  height: 220px;
  border-radius: 32px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.94), rgba(148, 163, 184, 0.68) 48%, rgba(255, 255, 255, 0.8)),
    #cbd5e1;
  box-shadow: inset -24px 0 36px rgba(71, 85, 105, 0.22), 0 26px 60px rgba(71, 85, 105, 0.22);
}

.sample-chip {
  position: absolute;
  left: 32px;
  bottom: 34px;
  z-index: 2;
  border-radius: 16px;
  padding: 10px 16px;
  background: #fef3c7;
  color: #111827;
  font-size: 18px;
  font-weight: 900;
}

.text-mark,
.manual-selection-box {
  position: absolute;
  z-index: 8;
  border: 2px solid rgba(34, 211, 238, 0.9);
  border-radius: 12px;
  background: rgba(34, 211, 238, 0.08);
  box-shadow: 0 0 0 5px rgba(34, 211, 238, 0.13);
}

.ai-annotation-mark {
  --ai-annotation-color: rgba(96, 165, 250, 0.96);
  --ai-annotation-fill: rgba(96, 165, 250, 0.12);
  --ai-annotation-glow: rgba(96, 165, 250, 0.16);
  position: absolute;
  z-index: 13;
  display: grid;
  place-items: center;
  border: 2px solid var(--ai-annotation-color);
  border-radius: 12px;
  background: var(--ai-annotation-fill);
  color: #dbeafe;
  font-size: 28px;
  font-weight: 900;
  pointer-events: none;
  box-shadow: 0 0 0 5px var(--ai-annotation-glow);
}

.ai-annotation-mark.arrow {
  border-radius: 12px;
}

.manual-selection-box {
  z-index: 12;
  border-color: rgba(96, 165, 250, 0.95);
  background: rgba(96, 165, 250, 0.12);
  pointer-events: none;
}

.mark-title {
  top: 22px;
  left: 22px;
  width: 294px;
  height: 102px;
}

.mark-badge {
  top: 144px;
  left: 26px;
  width: 196px;
  height: 78px;
}

.mark-chip {
  left: 26px;
  bottom: 28px;
  width: 204px;
  height: 50px;
}

.image-edit-ai-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: none;
  pointer-events: none;
}

.ai-mode .image-edit-ai-layer {
  display: block;
}

.image-edit-ai-note {
  position: absolute;
  right: 72px;
  top: 108px;
  min-width: 126px;
  border: 1px solid rgba(236, 72, 153, 0.55);
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(88, 28, 64, 0.86);
  color: #fce7f3;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(88, 28, 64, 0.28);
}

.image-edit-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--image-edit-muted);
  font-size: 12px;
}

.image-edit-editor {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 164px);
}

.image-edit-editor-body {
  display: grid;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}

.image-edit-editor-modes {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.18);
}

.image-edit-editor-actions {
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.24);
}

.image-edit-mode-tabs,
.image-edit-basic-style {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.image-edit-tab {
  position: relative;
  min-height: 54px;
  padding: 10px 12px;
  border-color: rgba(96, 165, 250, 0.34);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(15, 23, 42, 0.78)),
    rgba(15, 23, 42, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 10px 24px rgba(2, 6, 23, 0.24);
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.image-edit-tab:hover {
  border-color: rgba(125, 211, 252, 0.72);
  transform: translateY(-1px);
}

.image-edit-tab.ai {
  border-color: rgba(168, 85, 247, 0.46);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.34), rgba(168, 85, 247, 0.24)),
    rgba(15, 23, 42, 0.88);
}

.image-edit-tab strong,
.image-edit-tab span {
  display: block;
}

.image-edit-tab strong {
  margin-bottom: 5px;
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.1;
}

.image-edit-tab span {
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 850;
}

.image-edit-tab.active {
  border-color: rgba(34, 211, 238, 0.9);
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.36), rgba(8, 145, 178, 0.24)),
    rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.13), 0 14px 30px rgba(8, 145, 178, 0.24);
}

.image-edit-tab.ai.active {
  border-color: rgba(168, 85, 247, 0.9);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.62), rgba(168, 85, 247, 0.56)),
    rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.14), 0 14px 30px rgba(88, 28, 135, 0.3);
}

.image-edit-text-list {
  display: grid;
  gap: 8px;
}

.image-edit-ai-text-notice {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(56, 189, 248, 0.34);
  border-radius: 6px;
  background: rgba(14, 116, 144, 0.12);
  color: #bae6fd;
  font-size: 12px;
  line-height: 1.55;
}

.image-edit-scan-card {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 8px;
  background: rgba(15, 23, 42, 0.5);
}

.image-edit-scan-card.is-modified {
  border-color: rgba(34, 211, 238, 0.58);
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.12), transparent),
    rgba(15, 23, 42, 0.62);
  box-shadow: inset 3px 0 0 rgba(34, 211, 238, 0.86);
}

.image-edit-scan-card.is-active {
  border-color: rgba(34, 211, 238, 0.9);
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.16), transparent 64%),
    rgba(8, 47, 73, 0.62);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.13), inset 3px 0 0 rgba(34, 211, 238, 0.9);
}

.image-edit-scan-card.is-low-confidence {
  border-color: rgba(251, 191, 36, 0.38);
}

.image-edit-scan-card.manual {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(37, 99, 235, 0.1);
}

.image-edit-scan-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.image-edit-scan-card-header b {
  min-width: 52px;
}

.image-edit-scan-card-header span {
  color: var(--image-edit-muted);
  font-size: 11px;
  font-weight: 750;
}

.changed-badge {
  margin-left: auto;
  border: 1px solid rgba(34, 211, 238, 0.34);
  border-radius: 999px;
  padding: 2px 7px;
  color: #67e8f9;
  font-style: normal;
  font-size: 11px;
  font-weight: 850;
  background: rgba(8, 145, 178, 0.14);
}

.image-edit-textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 9px;
  line-height: 1.35;
  resize: vertical;
  outline: none;
}

.image-edit-scan-empty,
.image-edit-annotation-empty {
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 12px;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
  background: rgba(15, 23, 42, 0.32);
}

.image-edit-label {
  display: grid;
  gap: 7px;
  color: #cbd5e1;
  font-size: 12px;
}

.image-edit-field {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  outline: none;
}

.image-edit-color-field {
  padding: 4px;
  cursor: pointer;
}

.image-edit-range {
  accent-color: var(--image-edit-cyan);
}

.image-edit-add-btn {
  width: 100%;
  min-height: 40px;
  border: 1px dashed rgba(96, 165, 250, 0.45);
  border-radius: 13px;
  background: rgba(37, 99, 235, 0.1);
  color: #bfdbfe;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.image-edit-ai-tools {
  border: 1px solid rgba(236, 72, 153, 0.24);
  border-radius: 16px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(236, 72, 153, 0.12), transparent),
    var(--image-edit-panel);
}

.image-edit-ai-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.image-edit-ai-tool-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  border: 1px solid rgba(236, 72, 153, 0.18);
  border-radius: 12px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.36);
}

.image-edit-instruction-panel {
  border-color: rgba(56, 189, 248, 0.22);
  background: rgba(8, 47, 73, 0.18);
}

.image-edit-ai-tools-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.image-edit-ai-tools strong {
  color: #fce7f3;
  font-size: 13px;
}

.image-edit-ai-tools-head span {
  color: var(--image-edit-muted);
  font-size: 12px;
}

.image-edit-annotation-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.45;
}

.image-edit-annotation-guide span {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
}

.image-edit-annotation-guide b {
  color: #e0f2fe;
  font-weight: 850;
}

.image-edit-ai-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-edit-ai-tool-row button {
  flex: 1 1 160px;
}

.image-edit-ai-tool-row button,
.image-edit-instruction-add {
  min-height: 36px;
  border: 1px solid rgba(236, 72, 153, 0.25);
  border-radius: 12px;
  background: rgba(131, 24, 67, 0.18);
  color: #fce7f3;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.image-edit-ai-tool-row button:hover {
  border-color: rgba(236, 72, 153, 0.55);
  background: rgba(131, 24, 67, 0.3);
}

.image-edit-instruction-add {
  border-color: rgba(56, 189, 248, 0.34);
  background: rgba(8, 145, 178, 0.13);
  color: #cffafe;
}

.image-edit-instruction-guide,
.image-edit-mode-hint {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

.image-edit-mode-hint {
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 8px;
  padding: 7px 8px;
  background: rgba(120, 53, 15, 0.18);
  color: #fde68a;
}

.image-edit-instruction-list {
  display: grid;
  gap: 8px;
}

.image-edit-instruction-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.image-edit-instruction-index {
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 850;
}

.image-edit-instruction-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 7px;
  padding: 7px 8px;
  background: rgba(15, 23, 42, 0.5);
  color: #e0f2fe;
  font: inherit;
  font-size: 12px;
  outline: none;
}

.image-edit-instruction-input:focus {
  border-color: rgba(34, 211, 238, 0.72);
}

.image-edit-instruction-delete {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  cursor: pointer;
}

.image-edit-instruction-panel.is-locked,
.image-edit-annotation-panel.is-locked {
  opacity: 0.62;
}

@media (max-width: 860px) {
  .image-edit-ai-tools-grid {
    grid-template-columns: 1fr;
  }
}

.image-edit-ai-tool-row button.is-active,
.image-edit-ai-tool-row button:disabled {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(8, 145, 178, 0.22);
  color: #cffafe;
}

.image-edit-annotation-list {
  display: grid;
  gap: 8px;
}

.image-edit-annotation-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(236, 72, 153, 0.2);
  border-radius: 12px;
  padding: 9px 10px;
  background: rgba(15, 23, 42, 0.45);
}

.image-edit-annotation-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.image-edit-annotation-item b {
  color: #fce7f3;
  font-size: 12px;
}

.image-edit-annotation-item span {
  color: var(--image-edit-muted);
  font-size: 12px;
  line-height: 1.45;
}

.image-edit-annotation-input {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
}

.image-edit-annotation-input:focus {
  border-color: rgba(56, 189, 248, 0.5);
}

.image-edit-annotation-input::placeholder {
  color: #64748b;
}

.image-edit-annotation-delete {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: none;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.image-edit-annotation-delete:hover {
  background: rgba(239, 68, 68, 0.3);
}

.image-edit-save-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.image-edit-save-actions .image-edit-btn {
  min-height: 36px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 750;
}

.is-hidden {
  display: none !important;
}

/* ── Toast notifications ── */
.image-edit-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.image-edit-toast {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  pointer-events: auto;
  max-width: 360px;
}

.image-edit-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.image-edit-toast.success {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(20, 83, 45, 0.92);
}

.image-edit-toast.error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(127, 29, 29, 0.92);
}

.image-edit-toast.warn {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(113, 63, 18, 0.92);
}

/* ── Card delete button ── */
.image-edit-card-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  background: rgba(127, 29, 29, 0.3);
  color: #fca5a5;
  font-size: 14px;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  transition: all 0.15s;
}

.image-edit-card-delete:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #fff;
}

.image-edit-card-delete[data-confirm="true"] {
  width: auto;
  padding: 0 6px;
  border-color: rgba(248, 113, 113, 0.76);
  background: rgba(185, 28, 28, 0.74);
  color: #fff;
  font-size: 11px;
}

/* ── Highlighted card (scroll target) ── */
.image-edit-scan-card.is-highlighted {
  border-color: rgba(34, 211, 238, 0.6);
  background: rgba(14, 116, 144, 0.2);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
  transition: all 0.3s;
}

/* ── Loading state ── */
.image-edit-btn.is-loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.image-edit-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── OCR tooltip on marks ── */
.ocr-tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 20;
}

/* ── OCR marks clickable ── */
.ocr-mark {
  border: 1px dashed rgba(125, 211, 252, 0.72);
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.15s;
}

.ocr-mark:hover {
  border-color: rgba(34, 211, 238, 1);
  background: rgba(34, 211, 238, 0.18);
}

.ocr-mark.is-adjustable {
  border-style: solid;
  border-color: rgba(34, 211, 238, 0.96);
  background: rgba(34, 211, 238, 0.08);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
  cursor: move;
}

.ocr-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid #082f49;
  border-radius: 2px;
  background: #22d3ee;
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.24);
  z-index: 2;
}

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

.ocr-mark.rough {
  border-color: rgba(251, 191, 36, 0.86);
  background: rgba(251, 191, 36, 0.08);
  box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.12);
}

.ocr-mark.low-confidence {
  border-style: dashed;
}

@media (max-width: 1180px) {
  .image-edit-board {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .image-edit-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-edit-canvas-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: calc(100% - 160px);
  }
}

/* Per-annotation input and controls */
.annotation-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.annotation-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.annotation-card-label {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.annotation-card-label .ann-icon {
  font-size: 14px;
}

.annotation-card-delete {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: none;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.annotation-card-delete:hover {
  background: rgba(239, 68, 68, 0.3);
}

.annotation-card-input {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
  resize: vertical;
}

.annotation-card-input:focus {
  border-color: rgba(56, 189, 248, 0.5);
}

.annotation-card-input::placeholder {
  color: #64748b;
}

/* Arrow annotation overlay - line from start to end */
.annotation-arrow-line {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

.annotation-arrow-line::before {
  content: '';
  position: absolute;
  background: var(--ai-annotation-color);
  height: 2px;
  top: 50%;
  left: 0;
  right: 12px;
  transform: translateY(-50%);
}

.annotation-arrow-line::after {
  content: '➜';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ai-annotation-color);
  font-size: 16px;
}

/* Arrow annotation mark styles */
.ai-annotation-mark.arrow {
  display: flex;
  align-items: center;
  justify-content: center;
}

.arrow-line {
  position: absolute;
  top: 50%;
  left: 4px;
  right: 20px;
  height: 2px;
  background: var(--ai-annotation-color);
  transform: translateY(-50%);
}

.arrow-head {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ai-annotation-color);
  font-size: 16px;
  line-height: 1;
}

/* Annotation label (shown next to area/arrow) */
.ai-annotation-label {
  font-size: 11px;
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(96, 165, 250, 0.42);
  border-radius: 6px;
  padding: 3px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 6;
  max-width: 180px;
}

/* Arrow SVG line */
.arrow-svg {
  pointer-events: none;
  overflow: visible;
}

/* Arrow line mark container */
.ai-annotation-mark.arrow-line-mark {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Area annotation mark */
.ai-annotation-mark.area {
  position: absolute;
  border: 2px solid var(--ai-annotation-color);
  background: var(--ai-annotation-fill);
  border-radius: 12px;
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 0 0 5px var(--ai-annotation-glow);
}

.ai-annotation-mark.area.is-active {
  --ai-annotation-color: rgba(34, 211, 238, 1);
  --ai-annotation-fill: rgba(34, 211, 238, 0.18);
  --ai-annotation-glow: rgba(34, 211, 238, 0.25);
  border-width: 3px;
  animation: image-edit-active-annotation 1.5s ease-in-out infinite;
}

.image-edit-annotation-item.is-active {
  border-color: rgba(34, 211, 238, 0.72);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.1);
}

.image-edit-ai-tool-row button.is-ready {
  border-color: rgba(34, 211, 238, 0.76);
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.36), rgba(37, 99, 235, 0.2));
  color: #ecfeff;
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.1);
}

@keyframes image-edit-active-annotation {
  50% { box-shadow: 0 0 0 8px rgba(34, 211, 238, 0.16); }
}

/* Arrow preview line (during drawing) */
.arrow-preview-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 14;
  overflow: visible;
}

.arrow-preview-stem {
  stroke: #60a5fa;
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.9));
}

.arrow-preview-origin {
  fill: #dbeafe;
  stroke: #2563eb;
  stroke-width: 3;
  filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.86));
}

.arrow-preview-label {
  fill: #dbeafe;
  font-size: 12px;
  font-weight: 850;
  paint-order: stroke;
  stroke: rgba(15, 23, 42, 0.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.ai-annotation-mark.group-mark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}
