/* === Image Workbench === */
.image-workbench-page {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.digital-human-page.image-workbench-page > .studio-tool-layout--no-top,
.character-mix-page.image-workbench-page > .studio-tool-layout--no-top {
  flex: 1 1 auto;
  min-height: 0;
}

.digital-human-page .image-workbench-mode-tabs,
.character-mix-page .image-workbench-mode-tabs,
.token-usage-page .image-workbench-mode-tabs {
  margin-left: 0;
}

.digital-human-page .image-workbench-camera-summary,
.character-mix-page .image-workbench-camera-summary,
.token-usage-page .image-workbench-camera-summary {
  margin-left: auto;
}

.digital-human-page .digital-human-cancel-btn {
  margin-top: 8px;
  border-color: color-mix(in srgb, #9ca3af 66%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, #9ca3af 22%, var(--bg-elevated, #171d1b)),
    color-mix(in srgb, #6b7280 16%, var(--bg-elevated, #171d1b))
  );
  color: color-mix(in srgb, var(--fg-body, #f3f5f2) 92%, white 8%);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.08) inset, 0 10px 24px rgb(148 163 184 / 0.16);
  font-weight: 900;
  letter-spacing: 0;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, opacity 140ms ease, transform 140ms ease;
}

.digital-human-page .digital-human-cancel-btn:hover {
  border-color: color-mix(in srgb, #d1d5db 76%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, #d1d5db 28%, var(--bg-elevated, #171d1b)),
    color-mix(in srgb, #9ca3af 20%, var(--bg-elevated, #171d1b))
  );
  color: color-mix(in srgb, var(--fg-body, #f3f5f2) 96%, white 4%);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.12) inset, 0 12px 28px rgb(148 163 184 / 0.2);
  opacity: 1;
}

.digital-human-page .digital-human-cancel-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, #d1d5db 78%, transparent);
  outline-offset: 2px;
}

.digital-human-page .digital-human-cancel-btn .anticon {
  font-size: 15px;
}

.character-mix-face-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
  margin-top: 4px;
}

.character-mix-face-hint--analyzing {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text-secondary);
}

.character-mix-face-hint--ready {
  background: color-mix(in srgb, #10b981 10%, transparent);
  color: #10b981;
}

.image-workbench-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-weak);
  background: var(--bg-panel);
}

.image-workbench-back-to-more {
  padding: 6px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.image-workbench-back-to-more:hover {
  background: var(--bg-hover);
  color: var(--fg-body);
}

.image-workbench-tool-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.image-workbench-tool-strip button:hover {
  background: var(--bg-hover);
  color: var(--fg-body);
}

.image-workbench-tool-strip button.is-active {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}

.image-workbench-subbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border-weak);
  background: var(--bg-elevated);
}

.image-workbench-page--image-tool > .image-workbench-subbar {
  justify-content: flex-start;
  overflow: hidden;
  border-bottom-left-radius: var(--radius-md);
}

.image-workbench-subbar__heading {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  gap: 12px;
}

.image-workbench-subbar__next--solo {
  margin-left: auto;
}

.image-workbench-subbar strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-body);
}

.image-workbench-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}

.image-workbench-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--fg-body);
}

.image-workbench-mode-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.image-workbench-mode-tabs button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.image-workbench-mode-tabs button.is-active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.image-workbench-camera-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 13px;
  color: var(--fg-muted);
}

.image-workbench-camera-summary strong {
  color: var(--fg-body);
}

.image-workbench-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.image-workbench-layout--inpaint {
  grid-template-columns: 260px 1fr;
}

.image-workbench-layout--camera {
  grid-template-columns: 300px 1fr;
}

.image-workbench-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  border-right: 1px solid var(--border-weak);
}

.image-workbench-panel--right {
  border-right: none;
  border-left: 1px solid var(--border-weak);
}

.image-workbench-control-card {
  padding: 14px;
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.image-workbench-control-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-body);
}

.image-workbench-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.image-workbench-section-title h3 {
  margin: 0;
}

.image-workbench-section-title span {
  font-size: 12px;
  color: var(--fg-soft);
}

.image-workbench-upload-shell {
  position: relative;
}

.image-workbench-upload-shell.is-dragging {
  border-radius: var(--radius-sm);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.image-workbench-upload-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
  pointer-events: none;
}

.image-workbench-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 140px;
  padding: 20px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  color: var(--fg-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.image-workbench-upload:hover {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.04);
}

.image-workbench-upload img {
  max-width: 100%;
  max-height: 120px;
  border-radius: 6px;
  object-fit: contain;
}

.image-workbench-upload strong {
  color: var(--fg-body);
}

.image-workbench-upload--tile {
  min-height: 140px;
}

.image-workbench-upload-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

.image-workbench-control-card input[type="file"] {
  display: none;
}

.image-workbench-url-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.image-workbench-url-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  font-size: 13px;
  color: var(--fg-muted);
}

.image-workbench-url-row label input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--fg-body);
  font-size: 13px;
  outline: none;
}

.image-workbench-url-row button {
  padding: 6px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
  cursor: pointer;
}

.image-workbench-url-row button:hover {
  background: var(--bg-hover);
  color: var(--fg-body);
}

.image-workbench-reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.image-workbench-reference-grid .image-workbench-upload--tile {
  grid-column: 1 / -1;
}

.image-workbench-reference-thumb {
  position: relative;
}

.image-workbench-reference-thumb img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
}

.image-workbench-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.image-workbench-segmented button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.image-workbench-segmented button.is-active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.image-workbench-field-label {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

textarea.image-workbench-prompt {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  color: var(--fg-body);
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
}

.image-workbench-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.image-workbench-select span {
  font-size: 13px;
  color: var(--fg-muted);
}

.image-workbench-select select {
  width: 100%;
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs, 8px);
  background: var(--bg-inset);
  color: var(--fg-body);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.image-workbench-select select:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
}

.image-workbench-select select:focus {
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.12);
}

.image-workbench-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.image-workbench-count span {
  font-size: 13px;
  color: var(--fg-muted);
}

.image-workbench-count div {
  display: flex;
  gap: 4px;
}

.image-workbench-count button {
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  cursor: pointer;
}

.image-workbench-count button.is-active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.image-workbench-actions {
  display: flex;
  gap: 8px;
  padding: 12px 0 0;
}

.image-workbench-actions button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.image-workbench-actions button:hover {
  background: var(--bg-hover);
  color: var(--fg-body);
}

.image-workbench-primary {
  border-color: var(--accent) !important;
  background: rgba(var(--accent-rgb), 0.1) !important;
  color: var(--accent) !important;
}

.image-workbench-primary:hover {
  background: rgba(var(--accent-rgb), 0.18) !important;
}

.image-workbench-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle, rgba(var(--accent-rgb), 0.12) 1px, transparent 1.4px),
    var(--bg-inset);
  background-size: 22px 22px;
}

.image-workbench-canvas img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-workbench-canvas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 16px;
  width: 100%;
  align-content: start;
}

.image-workbench-canvas-grid img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
}

.image-workbench-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  color: var(--fg-muted);
  font-size: 14px;
}

.image-workbench-empty .anticon {
  font-size: 40px;
  opacity: 0.35;
}

.image-workbench-empty strong {
  font-size: 18px;
  color: var(--fg-body, #eee);
}

.image-workbench-empty span {
  max-width: 320px;
  text-align: center;
  line-height: 1.5;
}

.image-workbench-empty--button {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s;
}

.image-workbench-empty--button:hover {
  color: var(--accent);
}

.image-workbench-inpaint-stage,
.image-workbench-camera-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.image-workbench-camera-stage {
  flex-direction: column;
  gap: 16px;
}

.image-workbench-inpaint-stage img,
.image-workbench-camera-stage img {
  max-width: 95%;
  max-height: 95%;
  border-radius: 8px;
  object-fit: contain;
}

.image-workbench-camera-stage img {
  max-height: 68%;
}

.image-workbench-inpaint-stage > span {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.image-workbench-camera-stage > span {
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}

/* Inpaint mask canvas */
.image-workbench-inpaint-canvas {
  display: block;
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.image-workbench-inpaint-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.image-workbench-inpaint-tool {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.image-workbench-inpaint-tool:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.image-workbench-camera-stage > .image-workbench-result-actions {
  width: min(360px, calc(100% - 32px));
}

.image-workbench-inpaint-tool.is-active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.image-workbench-inpaint-tool--done {
  color: #2dd4bf;
}

.image-workbench-inpaint-tool--done:hover {
  color: #5eead4;
}

.image-workbench-inpaint-edit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.image-workbench-inpaint-bottom-bar > .image-workbench-inpaint-edit-btn {
  position: static;
  transform: none;
}

.image-workbench-inpaint-edit-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  border-color: rgba(255, 255, 255, 0.35);
}

.image-workbench-inpaint-stage {
  overflow: auto;
}

.image-workbench-inpaint-tool-divider {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.2);
}

.image-workbench-inpaint-zoom-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  min-width: 36px;
  text-align: center;
  padding: 0 4px;
}

.image-workbench-inpaint-bottom-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  pointer-events: auto;
}

.image-workbench-inpaint-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.image-workbench-inpaint-zoom-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  cursor: pointer;
}

.image-workbench-inpaint-zoom-controls button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.image-workbench-inpaint-zoom-controls span {
  position: static;
  transform: none;
  padding: 0 4px;
  background: none;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  min-width: 36px;
  text-align: center;
}

.image-workbench-panel--right .image-workbench-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.image-workbench-result-thumb {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  aspect-ratio: 1;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.image-workbench-result-thumb:hover {
  border-color: var(--accent, #2dd4bf);
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-workbench-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-workbench-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.image-workbench-range span {
  min-width: 56px;
  font-size: 12px;
  color: var(--fg-muted);
}

.image-workbench-range input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.image-workbench-range em {
  min-width: 40px;
  font-size: 12px;
  font-style: normal;
  color: var(--fg-soft);
  text-align: right;
}

.image-workbench-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.image-workbench-chip-grid button {
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.image-workbench-chip-grid button.is-active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.image-workbench-direction-pad {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.image-workbench-direction-pad button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  font-size: 14px;
  cursor: pointer;
}

.image-workbench-direction-pad button.is-active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.image-workbench-toggle {
  width: 36px;
  height: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-inset);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.image-workbench-toggle.is-active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.2);
}

.image-workbench-camera-prompt textarea {
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  color: var(--fg-body);
  font-size: 13px;
  resize: vertical;
}

.image-workbench-camera-prompt textarea:disabled {
  opacity: 0.5;
}

.image-workbench-right-note {
  padding: 14px;
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.image-workbench-right-note h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-body);
}

.image-workbench-right-note span {
  font-size: 12px;
  color: var(--fg-soft);
}

.image-workbench-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.image-workbench-switch-row h3 {
  margin: 0;
}

.image-workbench-status {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  border-top: 1px solid var(--border-weak);
  background: var(--bg-panel);
  font-size: 12px;
  overflow: hidden;
}

.image-workbench-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, var(--accent), rgba(var(--accent-rgb), 0.58));
  pointer-events: none;
  transform-origin: left center;
  transition: transform 0.25s ease;
}

.image-workbench-status span {
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  font-weight: 500;
}

.image-workbench-status p {
  flex: 1;
  margin: 0;
  color: var(--fg-muted);
}

.image-workbench-status em {
  font-style: normal;
  color: var(--fg-soft);
}

/* BeforeAfterCompare generic component */
.before-after-compare {
  --compare-position: 50%;
  position: relative;
  display: block;
  width: min(100%, 980px);
  aspect-ratio: 16 / 9;
  max-height: 72vh;
  overflow: hidden;
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 50%, rgba(118, 150, 255, 0.08) 50% 100%),
    var(--bg-inset);
}

.before-after-compare__layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.before-after-compare__layer--source {
  clip-path: inset(0 calc(100% - var(--compare-position)) 0 0);
  background: rgba(0, 0, 0, 0.08);
}

.before-after-compare__layer--result {
  clip-path: inset(0 0 0 var(--compare-position));
  background: rgba(105, 137, 255, 0.08);
}

.before-after-compare__layer img {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}

.before-after-compare__layer--source img {
  filter: saturate(0.82) contrast(0.86) brightness(0.88);
}

.before-after-compare__layer--result img {
  filter: saturate(1.12) contrast(1.08) brightness(1.03);
  transform: scale(1.06);
  transform-origin: center;
}

.before-after-compare__label {
  position: absolute;
  top: 0;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 20px;
  color: rgb(255 255 255);
  font-size: 14px;
  font-weight: 800;
}

.before-after-compare__label--source {
  left: 0;
  background: rgba(0, 0, 0, 0.34);
}

.before-after-compare__label--result {
  left: var(--compare-position);
  background: rgba(65, 116, 246, 0.42);
}

.before-after-compare__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--compare-position);
  z-index: 4;
  width: 2px;
  padding: 0;
  border: 0;
  background: rgb(37 102 244);
  cursor: ew-resize;
  touch-action: none;
  transform: translateX(-50%);
}

.before-after-compare__divider:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.86);
  outline-offset: 4px;
}

.before-after-compare__divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgb(37 102 244);
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.before-after-compare__divider span::before,
.before-after-compare__divider span::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.before-after-compare__divider span::before {
  left: 9px;
  border-right: 6px solid rgb(255 255 255);
}

.before-after-compare__divider span::after {
  right: 9px;
  border-left: 6px solid rgb(255 255 255);
}

/* Resolution Upscale specific */
.resolution-upscale-compare-stage {
  --resolution-compare-position: 50%;
  position: relative;
  display: block;
  width: min(100%, 980px);
  aspect-ratio: 16 / 9;
  max-height: 72vh;
  overflow: hidden;
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 50%, rgba(118, 150, 255, 0.08) 50% 100%),
    var(--bg-inset);
}

.resolution-upscale-compare__image {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.resolution-upscale-compare__image--source {
  clip-path: inset(0 calc(100% - var(--resolution-compare-position)) 0 0);
  background: rgba(0, 0, 0, 0.08);
}

.resolution-upscale-compare__image--result {
  clip-path: inset(0 0 0 var(--resolution-compare-position));
  background: rgba(105, 137, 255, 0.08);
}

.resolution-upscale-compare__image img {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}

.resolution-upscale-compare__image--source img {
  filter: saturate(0.82) contrast(0.86) brightness(0.88);
}

.resolution-upscale-compare__image--result img {
  filter: saturate(1.12) contrast(1.08) brightness(1.03);
  transform: scale(1.06);
  transform-origin: center;
}

.resolution-upscale-compare__label {
  position: absolute;
  top: 0;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 20px;
  color: rgb(255 255 255);
  font-size: 14px;
  font-weight: 800;
}

.resolution-upscale-compare__label--source {
  left: 0;
  background: rgba(0, 0, 0, 0.34);
}

.resolution-upscale-compare__label--result {
  left: var(--resolution-compare-position);
  background: rgba(65, 116, 246, 0.42);
}

.resolution-upscale-compare__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--resolution-compare-position);
  z-index: 4;
  width: 2px;
  padding: 0;
  border: 0;
  background: rgb(37 102 244);
  cursor: ew-resize;
  touch-action: none;
  transform: translateX(-50%);
}

.resolution-upscale-compare__divider:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.86);
  outline-offset: 4px;
}

.resolution-upscale-compare__divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgb(37 102 244);
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.resolution-upscale-compare__divider span::before,
.resolution-upscale-compare__divider span::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.resolution-upscale-compare__divider span::before {
  left: 9px;
  border-right: 6px solid rgb(255 255 255);
}

.resolution-upscale-compare__divider span::after {
  right: 9px;
  border-left: 6px solid rgb(255 255 255);
}

/* Video style chips */
.resolution-upscale-style-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resolution-upscale-style-chips__title {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.resolution-upscale-style-chips__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.resolution-upscale-style-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border-weak);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.resolution-upscale-style-chip:hover {
  border-color: var(--border-medium, var(--border-weak));
  background: var(--bg-hover, var(--bg-elevated));
}

.resolution-upscale-style-chip.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.resolution-upscale-style-chip__swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Video toggle */
.resolution-upscale-video-toggle {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 5;
  display: inline-flex;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  overflow: hidden;
  transform: translateX(-50%);
}

.resolution-upscale-video-toggle button {
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.resolution-upscale-video-toggle button:hover {
  color: #fff;
}

.resolution-upscale-video-toggle button.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.resolution-upscale-video-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.resolution-upscale-video-stage video {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
}

.resolution-upscale-video-stage span {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
}

.resolution-upscale-image-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 12px;
}

.resolution-upscale-image-stage > .before-after-compare {
  flex: 1;
  width: 100%;
  min-height: 0;
}

.resolution-upscale-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.resolution-upscale-result-actions button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.resolution-upscale-result-actions button:hover:not(:disabled) {
  background: var(--accent);
}

.resolution-upscale-result-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.resolution-upscale-video-header {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.resolution-upscale-video-header .resolution-upscale-video-toggle {
  position: static;
  transform: none;
}

.resolution-upscale-video-header .resolution-upscale-result-actions {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.6);
}

/* === Watermark Removal === */
.watermark-removal-hint {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.watermark-removal-actions {
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 0;
}

.watermark-removal-actions .image-workbench-primary {
  width: 100%;
  min-height: 48px;
  justify-content: center;
  font-size: 14px;
  font-weight: 750;
}

.watermark-removal-actions .image-workbench-cancel {
  width: 100%;
  min-height: 42px;
  justify-content: center;
  font-size: 13px;
}

.watermark-removal-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  height: 100%;
  padding: 16px;
}

.watermark-removal-compare__panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
}

.watermark-removal-compare__panel img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.watermark-removal-compare__label {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
}

.watermark-removal-compare__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.watermark-removal-compare__placeholder .anticon {
  font-size: 32px;
  opacity: 0.4;
}

.watermark-removal-compare__actions {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(480px, calc(100% - 32px));
}

.watermark-removal-compare__actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  padding: 0 24px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  color: var(--fg-body);
  font: inherit;
  font-size: 18px;
  font-weight: 750;
  cursor: pointer;
  backdrop-filter: none;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.watermark-removal-compare__actions button:hover:not(:disabled) {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: rgba(var(--accent-rgb), 0.11);
  color: var(--accent);
}

.watermark-removal-compare__actions button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

/* === Generation Progress & Results === */
.image-workbench-generating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  color: var(--fg-muted);
}

.image-workbench-generating strong {
  font-size: 22px;
  color: var(--fg-default);
}

.image-workbench-progress-bar {
  width: min(420px, 80%);
  height: 10px;
  border-radius: 5px;
  background: var(--bg-inset);
  overflow: hidden;
}

.image-workbench-progress-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, white));
  transition: width 0.35s ease;
}

.image-workbench-cancel {
  margin-top: 12px;
  padding: 8px 24px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.image-workbench-cancel:hover {
  background: var(--bg-hover);
  color: var(--fg-default);
}

.image-workbench-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-content: center;
  justify-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 32px;
  overflow-y: auto;
  gap: 20px;
}

.image-workbench-result-item {
  display: block;
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  border: 1px solid var(--border-weak);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.image-workbench-result-item:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(var(--accent-rgb, 45, 212, 191), 0.1);
  transform: translateY(-2px);
}

.image-workbench-result-item img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: var(--bg-inset);
  transition: transform 300ms ease;
}

.image-workbench-result-item:hover img {
  transform: scale(1.02);
}

.image-workbench-result-card {
  display: grid;
  min-width: 0;
  width: 100%;
  max-width: 560px;
  align-content: start;
  gap: 14px;
}

.image-workbench-result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.image-workbench-result-actions button {
  display: inline-flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  color: var(--fg-body);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.image-workbench-result-actions button:hover:not(:disabled) {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: rgba(var(--accent-rgb), 0.11);
  color: var(--accent);
}

.image-workbench-result-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.image-workbench-inpaint-bottom-bar .image-workbench-result-actions {
  flex: 1 1 260px;
}

.image-workbench-empty--error {
  color: var(--fg-muted);
}

.image-workbench-empty--error strong {
  color: var(--error, #ef4444);
}

.image-workbench-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Result card entrance animation */
@keyframes image-workbench-result-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.image-workbench-result-card {
  animation: image-workbench-result-enter 0.4s ease-out both;
}

.image-workbench-result-card:nth-child(2) { animation-delay: 0.08s; }
.image-workbench-result-card:nth-child(3) { animation-delay: 0.16s; }
.image-workbench-result-card:nth-child(4) { animation-delay: 0.24s; }
