/**
 * Kazakan Tools 2.0 — Batch Image & Media Processing Workspace
 */
/* Batch image workspaces */
.image-batch-shell {
  min-width: 0;
  min-height: 260px;
}

.image-batch-tool { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* Modern Batch Image Settings Panel */
.batch-settings-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  margin-block-end: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .03);
}

.batch-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block-end: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.batch-panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.batch-title-icon-box {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary-border);
  flex-shrink: 0;
}

.batch-title-text-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.batch-panel-title {
  margin: 0;
  color: var(--text-main);
  font-size: .96rem;
  font-weight: 800;
  line-height: 1.2;
}

.batch-panel-desc {
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.2;
}

.batch-apply-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding-inline: 15px;
  font-size: .82rem;
  font-weight: 700;
  border-radius: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--brand-primary);
  cursor: pointer;
  transition: all .15s ease;
  flex-shrink: 0;
}

.batch-apply-btn:hover {
  background: var(--brand-primary-light);
  border-color: var(--brand-primary-border);
}

.batch-apply-btn[hidden] {
  display: none !important;
}

.batch-settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.batch-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--bg-subtle, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 650;
  transition: all 0.2s ease;
  user-select: none;
}

.batch-sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.batch-sync-indicator.is-updating {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #059669;
}

.batch-sync-indicator.is-updating .batch-sync-dot {
  transform: scale(1.3);
  background: #059669;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
}

.batch-sync-indicator.has-custom {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #d97706;
}

.batch-sync-indicator.has-custom .batch-sync-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

/* Card level sync badge */
.batch-card-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease;
}

.batch-card-sync-pill.is-synced {
  color: #059669;
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.22);
}

.batch-card-sync-pill.is-custom {
  color: #d97706;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.28);
}

.batch-card-reset-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--brand-primary);
  background: var(--brand-primary-light);
  border: 1px solid var(--brand-primary-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 6px;
}

.batch-card-reset-sync-btn:hover {
  background: var(--brand-primary);
  color: #ffffff;
}

.batch-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .batch-settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.batch-setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  color: var(--text-main);
  font-size: .82rem;
  font-weight: 650;
}

.batch-setting-full {
  grid-column: 1 / -1;
}

.batch-setting-label {
  color: var(--text-main);
  font-size: .82rem;
  font-weight: 700;
  display: block;
}

.batch-setting-hint {
  color: var(--text-muted);
  font-size: .74rem;
  font-weight: 500;
}

/* Hero Format Selector */
.batch-format-hero {
  grid-column: 1 / -1;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-medium);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.03);
  gap: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.batch-format-hero:hover {
  border-color: var(--brand-primary-border, var(--border-subtle));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}

.batch-format-hero-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.batch-format-hero-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary-border);
  flex-shrink: 0;
}

.batch-format-hero-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.batch-format-hero-label {
  font-size: 1.18rem !important;
  font-weight: 850 !important;
  color: var(--text-main);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.batch-format-hero-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-primary);
  line-height: 1.3;
}

.batch-format-hero .kz-select-trigger,
.batch-format-hero-select-wrap select {
  min-height: 52px !important;
  padding-block: 12px !important;
  padding-inline: 18px 46px !important;
  font-size: 1.02rem !important;
  font-weight: 750 !important;
  border-radius: 14px !important;
  border-width: 1.5px !important;
  border-color: var(--border-medium);
  background-color: var(--bg-surface) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: border-color .18s ease, box-shadow .18s ease;
}

[dir="rtl"] .batch-format-hero .kz-select-trigger,
[dir="rtl"] .batch-format-hero-select-wrap select {
  padding-inline: 18px 46px !important;
}

.batch-format-hero .kz-select-trigger:hover {
  border-color: var(--brand-primary);
  background-color: var(--bg-card) !important;
}

.batch-format-hero .kz-select-value {
  font-size: 1.02rem !important;
  font-weight: 750 !important;
  color: var(--text-main) !important;
}

.batch-format-hero .kz-select-options {
  font-size: .95rem !important;
}

@media (max-width: 640px) {
  .batch-format-hero {
    padding: 14px 16px;
    gap: 12px;
  }
  .batch-format-hero-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }
  .batch-format-hero-icon svg {
    width: 18px;
    height: 18px;
  }
  .batch-format-hero-label {
    font-size: 1.05rem !important;
  }
  .batch-format-hero .kz-select-trigger,
  .batch-format-hero-select-wrap select {
    min-height: 48px !important;
    font-size: .95rem !important;
  }
  .batch-format-hero .kz-select-value {
    font-size: .95rem !important;
  }
}

/* 1. Segmented Control Pills */
.batch-setting-segmented {
  gap: 8px;
}

.batch-segmented-track {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg-subtle, rgba(0, 0, 0, .04));
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.batch-segmented-track::-webkit-scrollbar {
  display: none;
}

.batch-segment-pill {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: 700 .9rem/1.2 var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all .15s ease;
}

.batch-segment-pill svg {
  flex-shrink: 0;
}

.batch-segment-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, .04);
}

.batch-segment-pill.is-active {
  color: var(--brand-primary);
  background: var(--bg-surface);
  border-color: var(--border-medium);
  font-weight: 750;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

/* 1.5 Cards Choice Grid (e.g. Background Removal Engine selector) */
.batch-setting-cards {
  gap: 12px;
}

.batch-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

@media (max-width: 980px) {
  .batch-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .batch-cards-grid {
    grid-template-columns: 1fr;
  }
}

.batch-choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: start;
  gap: 8px;
  padding: 16px 14px 14px;
  border-radius: 18px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  user-select: none;
  min-height: 148px;
  box-sizing: border-box;
}

[data-theme="dark"] .batch-choice-card {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(255, 255, 255, 0.08);
}

.batch-choice-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.batch-choice-card.is-active {
  border-color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 7%, var(--bg-surface));
  box-shadow: 0 4px 16px color-mix(in srgb, var(--brand-primary) 22%, transparent);
}

[data-theme="dark"] .batch-choice-card.is-active {
  background: color-mix(in srgb, var(--brand-primary) 15%, rgba(15, 23, 42, 0.85));
}

.batch-choice-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 750;
  padding: 3px 9px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
  color: var(--brand-primary);
  line-height: 1.25;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 20%, transparent);
  white-space: nowrap;
}

.batch-choice-card.is-active .batch-choice-badge {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: transparent;
}

.batch-choice-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--bg-subtle);
  color: var(--brand-primary);
  flex-shrink: 0;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.batch-choice-card:hover .batch-choice-icon {
  transform: scale(1.08);
}

.batch-choice-card.is-active .batch-choice-icon {
  background: var(--brand-primary);
  color: #ffffff;
}

.batch-choice-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
}

.batch-choice-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.batch-choice-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.batch-choice-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
}

.batch-choice-status {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.batch-choice-status[data-state="ready"] {
  color: #16a34a;
  font-weight: 700;
}

.batch-choice-status[data-state="downloading"] {
  color: var(--brand-primary);
}

.batch-choice-status[data-state="error"] {
  color: #ef4444;
}

.batch-choice-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-subtle);
  border-radius: 99px;
  overflow: hidden;
}

.batch-choice-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--brand-primary);
  border-radius: 99px;
  transition: width 0.25s ease;
}

/* Disclaimer Under Engine Cards / Settings */
.batch-setting-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 14px;
  padding: 13px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-inline-start: 3px solid var(--brand-primary);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.55;
  box-sizing: border-box;
  width: 100%;
}

.batch-setting-disclaimer .batch-disclaimer-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--brand-primary);
}

.batch-setting-disclaimer strong {
  color: var(--text-main);
  font-weight: 600;
  display: inline;
}

.batch-cursor-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 20;
}

.batch-stage-history-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
}

.batch-stage-undo-btn,
.batch-stage-redo-btn,
.batch-brush-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.batch-stage-undo-btn:hover:not(:disabled),
.batch-stage-redo-btn:hover:not(:disabled),
.batch-brush-reset-btn:hover:not(:disabled) {
  background: var(--bg-card);
  border-color: var(--border-medium);
  color: var(--brand-primary);
}

.batch-stage-undo-btn:disabled,
.batch-stage-redo-btn:disabled,
.batch-brush-reset-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.batch-canvas-wrapper {
  touch-action: none;
}

/* 2. Modern Toggle Switch Card */
.batch-setting-switch {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  cursor: pointer;
  user-select: none;
  min-height: 48px;
  box-sizing: border-box;
  transition: border-color .15s ease, background-color .15s ease;
}

.batch-setting-switch:hover {
  border-color: var(--border-medium);
  background: var(--bg-card);
}

.batch-switch-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.batch-switch-title {
  color: var(--text-main);
  font-size: .84rem;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 6px;
}

.batch-switch-hint {
  color: var(--text-muted);
  font-size: .74rem;
  font-weight: 500;
}

.batch-switch-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  direction: ltr !important;
}

.batch-switch-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.batch-switch-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-subtle, #cbd5e1);
  border-radius: 99px;
  transition: background-color .2s ease;
  pointer-events: none;
}

.batch-switch-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s ease;
}

.batch-switch-toggle input:checked + .batch-switch-slider {
  background: var(--brand-primary);
}

.batch-switch-toggle input:checked + .batch-switch-slider::before {
  transform: translateX(20px);
}

/* 3. Range Slider Card */
.batch-setting-range {
  display: grid;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  min-height: 48px;
  box-sizing: border-box;
}

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

.batch-range-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--brand-primary-light);
  color: #60a5fa;
  font: 750 .76rem/1 var(--font-mono);
  border: 1px solid var(--brand-primary-border);
}

[data-theme="light"] .batch-range-badge {
  color: #1d4ed8;
}

.batch-setting-range input[type="range"] {
  direction: ltr !important;
  box-sizing: border-box;
  width: 100%;
  height: 6px;
  margin: 6px 0 2px;
  padding: 0;
  background: var(--bg-subtle, #cbd5e1);
  border-radius: 99px;
  appearance: none;
  cursor: pointer;
  accent-color: var(--brand-primary);
  border: none;
}

.batch-setting-range input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  cursor: pointer;
}

/* 4. Styled Input with Suffix */
.batch-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.batch-input-wrap input {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 9px 42px 9px 12px;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  font: inherit;
}

[dir="rtl"] .batch-input-wrap input {
  padding: 9px 12px 9px 42px;
}

.batch-input-suffix {
  position: absolute;
  right: 12px;
  font-size: .76rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
  font-family: var(--font-mono);
}

[dir="rtl"] .batch-input-suffix {
  right: auto;
  left: 12px;
}

/* Color Picker Control */
.batch-color-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 5px 12px;
  min-height: 44px;
}

.batch-color-wrap input[type="color"] {
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  background: transparent;
}

.batch-color-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.batch-color-wrap input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.batch-color-val {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: .84rem;
  color: var(--text-main);
  text-transform: uppercase;
}

/* 5. Custom Select with SVG Arrow */
.batch-select-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.batch-select-wrap .kz-select-wrapper {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

.batch-select-wrap .kz-select-trigger {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.batch-select-wrap .kz-select-dropdown {
  z-index: 1250 !important;
}

.batch-select-wrap .kz-select-wrapper.is-active,
.batch-select-wrap:has(.kz-select-wrapper.is-active),
.batch-setting:has(.kz-select-wrapper.is-active),
.batch-format-hero:has(.kz-select-wrapper.is-active),
.batch-select-wrap.is-select-active,
.batch-setting.is-select-active,
.batch-format-hero.is-select-active {
  z-index: 1200 !important;
  position: relative !important;
}


.batch-select-wrap .kz-select-value {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.batch-select-wrap select {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 9px 44px 9px 16px;
  color: var(--text-main);
  background-color: var(--bg-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
  border: 1px solid var(--border-medium);
  border-radius: 14px;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

[dir="rtl"] .batch-select-wrap select {
  padding: 9px 16px 9px 44px;
  background-position: left 14px center;
}

.batch-setting input:focus,
.batch-setting select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}

/* Dedicated Queue Controls Bar */
.batch-queue-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 10px 14px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 16px; margin-block-end: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .03); }
.batch-queue-header.is-empty { display: none; }
.batch-queue-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.batch-queue-badge { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 99px; background: var(--brand-primary-light); color: #60a5fa; font: 750 .8rem/1 var(--font-mono); border: 1px solid var(--brand-primary-border); }
[data-theme="light"] .batch-queue-badge { color: #1d4ed8; }
.batch-queue-status { color: var(--text-muted); font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-queue-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.batch-run-all-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding-inline: 18px; font-size: .86rem; font-weight: 750; border-radius: 12px; transition: all .16s ease; }
.batch-run-all-btn.is-reprocess { background: var(--bg-card); color: var(--brand-primary); border: 1.5px solid var(--brand-primary-border); }
.batch-run-all-btn.is-reprocess:hover { background: var(--brand-primary-light); border-color: var(--brand-primary); }
.batch-run-all-btn.is-working svg { animation: kz-btn-spin .9s linear infinite; }
@keyframes kz-btn-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.batch-zip-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding-inline: 16px; font-size: .84rem; font-weight: 650; border-radius: 12px; }
.batch-zip-btn[hidden] { display: none !important; }
.batch-clear-btn { min-height: 40px; padding-inline: 12px; font-size: .8rem; border-radius: 12px; color: var(--text-muted); }
.batch-queue-actions button:disabled { opacity: .46; cursor: not-allowed; }


/* Compact Queue Cards */
.batch-queue-list { display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 2px 2px 6px; }

.batch-card { display: grid; gap: 0; min-width: 0; padding: 9px 12px; color: var(--text-main); background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 16px; box-shadow: 0 2px 10px rgba(0, 0, 0, .03); transition: border-color .15s ease, background-color .15s ease; }
.batch-card:hover { border-color: var(--border-medium); }
.batch-card-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.batch-thumb-wrap { position: relative; flex: 0 0 50px; width: 50px; height: 50px; border-radius: 12px; overflow: hidden; background: var(--bg-subtle); border: 1px solid var(--border-subtle); }
.batch-thumb-wrap.can-compare { cursor: pointer; }
.batch-thumb-wrap.can-compare:hover::after { content: ""; position: absolute; inset: 0; background: rgba(59, 130, 246, .2); }
.batch-thumbnail { width: 100%; height: 100%; object-fit: cover; display: block; }
.batch-card-body { display: grid; gap: 3px; flex: 1; min-width: 0; }
.batch-card-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.batch-card-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: .8rem; }
.batch-stat-flow { display: inline-flex; align-items: center; gap: 4px; direction: ltr; unicode-bidi: isolate; }
.batch-stat-old { color: var(--text-subtle); text-decoration: line-through; font-family: var(--font-mono); font-size: .78rem; opacity: .85; }
.batch-stat-arrow { color: var(--text-subtle); font-size: .72rem; }
.batch-stat-new { color: var(--text-main); font-weight: 750; font-family: var(--font-mono); font-size: .82rem; }
.batch-stat-orig { color: var(--text-muted); font-family: var(--font-mono); font-size: .8rem; }
.batch-status-tag { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 99px; font-size: .72rem; font-weight: 650; background: var(--bg-subtle); color: var(--text-subtle); }
.batch-saving-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font: 750 .74rem/1.2 var(--font-mono); }
.batch-saving-badge.saving-good { background: rgba(16, 185, 129, .14); color: #10b981; border: 1px solid rgba(16, 185, 129, .28); }
.batch-saving-badge.saving-neutral { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border-subtle); }
.batch-saving-badge.saving-larger { background: rgba(245, 158, 11, .14); color: #f59e0b; border: 1px solid rgba(245, 158, 11, .28); }
.batch-stat-dim { color: var(--text-subtle); font-size: .74rem; font-family: var(--font-mono); }
.batch-error-text { color: #ef4444; font-size: .78rem; font-weight: 600; }
.batch-progress-text { color: var(--brand-primary); font-size: .78rem; font-weight: 600; }

.batch-card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.batch-btn-compare { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding-inline: 12px; font-size: .8rem; font-weight: 650; border-radius: 10px; cursor: pointer; }
.batch-btn-download { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding-inline: 13px; font-size: .8rem; font-weight: 700; border-radius: 10px; text-decoration: none; }
.batch-btn-process { min-height: 36px; padding-inline: 13px; font-size: .8rem; border-radius: 10px; cursor: pointer; }
.batch-icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--bg-subtle); border: 1px solid var(--border-subtle); color: var(--text-muted); cursor: pointer; font-size: 1.1rem; transition: background .15s ease, color .15s ease; }
.batch-icon-button:hover { color: var(--text-main); background: var(--bg-elevated); }
.batch-icon-button.is-active { background: var(--brand-primary-light); color: var(--brand-primary); border-color: var(--brand-primary-border); }
.batch-icon-button:disabled, .batch-card-actions button:disabled { opacity: .46; cursor: not-allowed; }

.batch-card-progress { width: 100%; height: 2px; margin-top: 6px; overflow: hidden; border-radius: 99px; background: transparent; }
.batch-card[data-status="working"] .batch-card-progress { background: var(--bg-subtle); }
.batch-progress-bar { width: 100%; height: 2px; display: block; appearance: none; border: 0; }
.batch-progress-bar::-webkit-progress-bar { background: var(--bg-subtle); }
.batch-progress-bar::-webkit-progress-value { background: linear-gradient(90deg, var(--brand-primary), #60a5fa); border-radius: 99px; }
.batch-progress-bar::-moz-progress-bar { background: linear-gradient(90deg, var(--brand-primary), #60a5fa); border-radius: 99px; }

.batch-item-custom-panel { padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--border-subtle); }
.batch-item-custom-panel[hidden] { display: none !important; }

/* Comparison Modal Dialog (Native <dialog>) */
.batch-compare-dialog { border: 1px solid var(--border-glass); border-radius: 24px; background: var(--bg-surface); color: var(--text-main); box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .7); padding: 0; width: min(94vw, 860px); max-height: 92vh; overflow-y: auto; margin: auto; }
.batch-compare-dialog::backdrop { background: rgba(6, 9, 19, .75); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.compare-modal-box { display: grid; grid-template-rows: auto auto 1fr auto auto; min-width: 0; }
.compare-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border-subtle); }
.compare-title-wrap { display: grid; gap: 2px; min-width: 0; }
.compare-modal-title { margin: 0; font-size: .98rem; font-weight: 750; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-modal-meta { color: var(--text-muted); font-size: .78rem; font-family: var(--font-mono); }
.compare-modal-close { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--bg-subtle); border: 1px solid var(--border-subtle); color: var(--text-muted); cursor: pointer; transition: color .15s ease, background-color .15s ease; }
.compare-modal-close:hover { color: var(--text-main); background: var(--bg-elevated); }

.compare-stats-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--bg-card); border-bottom: 1px solid var(--border-subtle); }
.compare-stat-pill { display: flex; flex-direction: column; gap: 2px; min-width: 90px; }
.compare-stat-pill.stat-before { text-align: start; }
.compare-stat-pill.stat-after { text-align: end; }
.compare-stat-label { color: var(--text-muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.compare-stat-size { color: var(--text-main); font-size: 1.15rem; font-weight: 800; font-family: var(--font-mono); }
.compare-stat-diff { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.compare-diff-badge { display: inline-block; padding: 3px 11px; border-radius: 99px; font-weight: 800; font-size: .84rem; font-family: var(--font-mono); }
.compare-diff-badge.saving-good { background: rgba(16, 185, 129, .15); color: #10b981; border: 1px solid rgba(16, 185, 129, .3); }
.compare-diff-badge.saving-neutral { background: var(--bg-subtle); color: var(--text-muted); }
.compare-diff-badge.saving-larger { background: rgba(245, 158, 11, .15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, .3); }
.compare-diff-saving { color: var(--text-muted); font-size: .74rem; font-family: var(--font-mono); }

.compare-stage { position: relative; width: 100%; height: clamp(260px, 48vh, 480px); background: linear-gradient(45deg, rgba(128,128,128,.06) 25%, transparent 25%), linear-gradient(-45deg, rgba(128,128,128,.06) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(128,128,128,.06) 75%), linear-gradient(-45deg, transparent 75%, rgba(128,128,128,.06) 75%), var(--bg-canvas); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px; overflow: hidden; user-select: none; touch-action: none; }
.compare-layer { position: absolute; inset: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.compare-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.compare-layer-after { z-index: 1; }
.compare-layer-before { z-index: 2; clip-path: polygon(0 0, var(--compare-pos, 50%) 0, var(--compare-pos, 50%) 100%, 0 100%); }
.compare-badge-corner { position: absolute; top: 12px; padding: 4px 9px; border-radius: 8px; font-size: .74rem; font-weight: 700; background: rgba(6, 9, 19, .72); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .15); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); pointer-events: none; font-family: var(--font-mono); }
.badge-before { left: 12px; }
.badge-after { right: 12px; }
.compare-divider { position: absolute; top: 0; bottom: 0; left: var(--compare-pos, 50%); width: 2px; background: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, .5); transform: translateX(-50%); pointer-events: none; z-index: 3; }
.compare-handle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; background: #fff; color: #0f172a; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; gap: 1px; }
.compare-range-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; z-index: 4; touch-action: none; }
.compare-stage-hint { margin: 0; padding: 7px 16px; text-align: center; color: var(--text-muted); font-size: .75rem; background: var(--bg-card); border-top: 1px solid var(--border-subtle); }
.compare-modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border-subtle); background: var(--bg-surface); }
.compare-footer-download { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; }
/* Extracted Details Drawer (for OCR & Metadata tools) */
.batch-details-drawer { margin-top: 8px; border-top: 1px solid var(--border-subtle); padding-top: 6px; }
.batch-details-summary { color: var(--brand-primary); cursor: pointer; font-size: .8rem; font-weight: 700; user-select: none; }
.batch-drawer-body { display: grid; gap: 8px; margin-top: 6px; }
.batch-drawer-pre { max-height: 220px; margin: 0; padding: 10px 12px; overflow: auto; color: var(--text-muted); background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: 12px; font: .76rem/1.55 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.batch-btn-copy { justify-self: start; min-height: 32px; padding-inline: 12px; font-size: .78rem; border-radius: 8px; }

/* Batch Queue & Comparison Modal Mobile Responsiveness */
@media (max-width: 640px) {
  .batch-queue-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .batch-queue-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .batch-queue-actions > button { flex: 1; min-height: 44px; justify-content: center; }
  .batch-card-main { flex-wrap: wrap; gap: 10px; }
  .batch-card-body { min-width: calc(100% - 66px); }
  .batch-card-actions { width: 100%; justify-content: stretch; margin-top: 4px; padding-top: 6px; border-top: 1px dashed var(--border-subtle); }
  .batch-card-actions > .batch-btn-compare,
  .batch-card-actions > .batch-btn-download,
  .batch-card-actions > .batch-btn-process { flex: 1; min-height: 42px; justify-content: center; }
  .batch-card-actions > .batch-icon-button { min-width: 42px; min-height: 42px; }
  .compare-modal-header, .compare-stats-header, .compare-modal-footer { padding-inline: 14px; }
  .compare-stage { height: 320px; }
}
@media (max-width: 480px) {
  .batch-thumb-wrap { flex: 0 0 44px; width: 44px; height: 44px; }
  .compare-stat-size { font-size: .98rem; }
  .compare-diff-badge { font-size: .76rem; }
}

/* Compact Dropzone when items exist in queue (all image tools) & Mini Dropzone */
.batch-dropzone.is-compact,
.dropzone.is-compact,
.kz-mini-dropzone {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 68px !important;
  max-height: 82px !important;
  padding: 12px 22px !important;
  border-radius: 16px !important;
  border: 2px dashed rgba(37, 99, 235, 0.52) !important;
  gap: 16px !important;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%) !important;
  box-shadow: 0 4px 18px -2px rgba(37, 99, 235, 0.12), 0 2px 6px -1px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  cursor: pointer;
  margin-block-end: 8px;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease !important;
}

[data-theme="dark"] .batch-dropzone.is-compact,
[data-theme="dark"] .dropzone.is-compact,
[data-theme="dark"] .kz-mini-dropzone {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.25) 0%, rgba(15, 23, 42, 0.78) 100%) !important;
  border: 2px dashed rgba(96, 165, 250, 0.52) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06) inset !important;
}

.batch-dropzone.is-compact:hover,
.batch-dropzone.is-compact.is-dragging,
.batch-dropzone.is-compact.dragover,
.dropzone.is-compact:hover,
.dropzone.is-compact.dragover,
.dropzone.is-compact.is-dragging,
.kz-mini-dropzone:hover,
.kz-mini-dropzone.dragover {
  border-color: #2563eb !important;
  background: linear-gradient(135deg, rgba(224, 238, 255, 0.98) 0%, rgba(240, 246, 255, 1) 100%) !important;
  box-shadow: 0 8px 24px -2px rgba(37, 99, 235, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  transform: translateY(-2px);
}

[data-theme="dark"] .batch-dropzone.is-compact:hover,
[data-theme="dark"] .batch-dropzone.is-compact.is-dragging,
[data-theme="dark"] .batch-dropzone.is-compact.dragover,
[data-theme="dark"] .dropzone.is-compact:hover,
[data-theme="dark"] .dropzone.is-compact.dragover,
[data-theme="dark"] .dropzone.is-compact.is-dragging,
[data-theme="dark"] .kz-mini-dropzone:hover,
[data-theme="dark"] .kz-mini-dropzone.dragover {
  border-color: #60a5fa !important;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.38) 0%, rgba(15, 23, 42, 0.85) 100%) !important;
  box-shadow: 0 8px 26px -2px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(96, 165, 250, 0.35) inset !important;
  transform: translateY(-2px);
}

.batch-dropzone.is-compact .dropzone-icon,
.dropzone.is-compact .dropzone-icon,
.kz-mini-icon-wrap {
  width: 38px !important;
  height: 38px !important;
  padding: 8px !important;
  border-radius: 11px !important;
  background: rgba(37, 99, 235, 0.12) !important;
  color: #2563eb !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-block-end: 0 !important;
  flex-shrink: 0;
  transition: transform 0.2s ease, background-color 0.2s ease !important;
}

[data-theme="dark"] .batch-dropzone.is-compact .dropzone-icon,
[data-theme="dark"] .dropzone.is-compact .dropzone-icon,
[data-theme="dark"] .kz-mini-icon-wrap {
  background: rgba(59, 130, 246, 0.18) !important;
  color: #60a5fa !important;
}

.batch-dropzone.is-compact:hover .dropzone-icon,
.dropzone.is-compact:hover .dropzone-icon,
.kz-mini-dropzone:hover .kz-mini-icon-wrap {
  transform: translateY(-2px) scale(1.06) !important;
  background: rgba(37, 99, 235, 0.2) !important;
}

.batch-dropzone.is-compact .dropzone-content-default,
.dropzone.is-compact .dropzone-content-default {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 14px !important;
  min-width: 0;
  flex: 1;
  text-align: start !important;
}

[dir="rtl"] .batch-dropzone.is-compact .dropzone-content-default,
[dir="rtl"] .dropzone.is-compact .dropzone-content-default {
  text-align: right !important;
}

.batch-dropzone.is-compact strong,
.dropzone.is-compact strong,
.batch-dropzone.is-compact .dropzone-title,
.dropzone.is-compact .dropzone-title {
  font-size: 0.96rem !important;
  font-weight: 750 !important;
  margin-block-end: 0 !important;
  color: var(--text-main) !important;
  white-space: nowrap;
}

.batch-dropzone.is-compact small,
.dropzone.is-compact small,
.batch-dropzone.is-compact .dropzone-subtitle,
.dropzone.is-compact .dropzone-subtitle {
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  margin-block-end: 0 !important;
  color: var(--text-muted) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .batch-dropzone.is-compact,
  .dropzone.is-compact,
  .kz-mini-dropzone {
    min-height: 56px !important;
    padding: 8px 14px !important;
  }
  .batch-dropzone.is-compact .dropzone-icon,
  .dropzone.is-compact .dropzone-icon,
  .kz-mini-icon-wrap {
    width: 32px !important;
    height: 32px !important;
    padding: 6px !important;
  }
  .batch-dropzone.is-compact strong,
  .dropzone.is-compact strong,
  .batch-dropzone.is-compact .dropzone-title,
  .dropzone.is-compact .dropzone-title {
    font-size: 0.88rem !important;
  }
  .batch-dropzone.is-compact small,
  .dropzone.is-compact small,
  .batch-dropzone.is-compact .dropzone-subtitle,
  .dropzone.is-compact .dropzone-subtitle {
    display: none !important;
  }
}

/* Universal Smart Live Interactive Preview Stage */
.batch-live-stage,
.cropper-live-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  margin-block-end: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .03);
}

.batch-live-stage[hidden],
.cropper-live-stage[hidden] {
  display: none !important;
}

.batch-stage-header,
.cropper-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.batch-stage-title-wrap,
.cropper-stage-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.batch-stage-title,
.cropper-stage-title {
  margin: 0;
  color: var(--text-main);
  font-size: .95rem;
  font-weight: 800;
  line-height: 1.3;
}

.batch-stage-hint,
.cropper-stage-hint {
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 500;
}

.batch-stat-badge,
.cropper-stat-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary-border);
  font: 700 .76rem/1.3 var(--font-mono);
}

.batch-stage-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.batch-stage-sync-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.batch-stage-sync-wrap[hidden] {
  display: none !important;
}

.batch-stage-sync-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: help;
  user-select: none;
  transition: all 0.18s ease;
}

.batch-stage-sync-badge.is-synced {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

[data-theme="dark"] .batch-stage-sync-badge.is-synced {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.batch-stage-sync-badge.is-custom {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .batch-stage-sync-badge.is-custom {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.batch-stage-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.batch-stage-sync-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 50%;
  transform: translateX(50%);
  z-index: 70;
  min-width: 230px;
  max-width: 290px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  font-size: 0.73rem;
  font-weight: 500;
  line-height: 1.45;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: normal;
  text-align: start;
}

[dir="rtl"] .batch-stage-sync-tooltip {
  transform: translateX(50%);
}

[dir="ltr"] .batch-stage-sync-tooltip {
  transform: translateX(-50%);
}

.batch-stage-sync-badge:hover .batch-stage-sync-tooltip,
.batch-stage-sync-badge:focus-visible .batch-stage-sync-tooltip {
  opacity: 1;
  visibility: visible;
}

.batch-stage-apply-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  background: var(--brand-primary);
  color: #ffffff !important;
  border: 1px solid var(--brand-primary);
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.batch-stage-apply-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.batch-stage-apply-btn[hidden] {
  display: none !important;
}

.batch-stage-revert-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.18s ease;
}

.batch-stage-revert-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface-subtle);
  border-color: var(--border-medium, #cbd5e1);
}

.batch-stage-revert-btn[hidden] {
  display: none !important;
}

/* Stage Toolbar Directly Above Canvas Under Title */
.batch-stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px clamp(12px, 2vw, 20px);
  padding: 12px 16px;
  background: var(--bg-surface-subtle, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  margin-block-start: 12px;
  margin-block-end: 14px;
}
[data-theme="dark"] .batch-stage-toolbar {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
.batch-stage-toolbar .batch-setting {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.batch-stage-toolbar .batch-setting-label {
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--text-main);
  white-space: nowrap;
}
.batch-stage-toolbar .batch-segmented-track {
  margin: 0;
}
.batch-stage-toolbar .batch-segment-pill {
  padding: 6px 12px;
  font-size: 0.8125rem;
}
.batch-stage-toolbar .batch-setting-range {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}
.batch-stage-toolbar .batch-range-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.batch-stage-toolbar input[type="range"] {
  width: 90px;
  margin: 0;
}
.batch-stage-toolbar .batch-range-badge {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 6px;
}

/* Mini Dropzone for File Inputs (e.g. Logo Upload in Watermark) */
.kz-mini-dropzone {
  width: 100%;
  min-height: 84px;
  padding: 14px 18px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.05), rgba(255, 255, 255, 0.02)), var(--bg-surface);
  border: 1.5px dashed var(--brand-primary-border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .kz-mini-dropzone {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(239, 246, 255, 0.6));
  border-color: rgba(96, 165, 250, 0.35);
}
.kz-mini-dropzone:hover,
.kz-mini-dropzone.is-dragging,
.kz-mini-dropzone.dragover {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.12);
}
.kz-mini-dropzone:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
.kz-mini-file-input {
  display: none !important;
}
.kz-mini-dropzone-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.kz-mini-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.kz-mini-dropzone:hover .kz-mini-icon-wrap {
  transform: translateY(-2px);
}
.kz-mini-dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: start;
}
.kz-mini-dropzone-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}
.kz-mini-dropzone-sub {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.kz-mini-dropzone-filled {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.kz-mini-thumb-checker {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: repeating-conic-gradient(#e2e8f0 0% 25%, #f8fafc 0% 50%) 50% / 10px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
[data-theme="dark"] .kz-mini-thumb-checker {
  background: repeating-conic-gradient(#334155 0% 25%, #1e293b 0% 50%) 50% / 10px 10px;
}
.kz-mini-thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.kz-mini-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  text-align: start;
}
.kz-mini-file-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kz-mini-file-meta {
  font-size: 0.76rem;
  color: var(--brand-primary);
  font-weight: 600;
  font-family: var(--font-mono, monospace);
}
.kz-mini-file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.kz-mini-change-btn {
  padding: 6px 12px !important;
  font-size: 0.8rem !important;
  gap: 6px !important;
  min-height: 34px !important;
}
.kz-mini-remove-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}
.kz-mini-remove-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Visual Position Grid Field */
.batch-setting-position-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.batch-position-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.batch-position-badge {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary-border);
}
.batch-position-container {
  display: flex;
  align-items: stretch;
  gap: 16px;
  flex-wrap: wrap;
}
.batch-position-grid {
  direction: ltr !important;
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 6px;
  padding: 8px;
  background: var(--bg-surface-subtle, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .batch-position-grid {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.08);
}
.batch-position-cell {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.batch-position-cell:hover {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border-color: var(--brand-primary-border);
  transform: scale(1.05);
}
.batch-position-cell.is-active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
  transform: scale(1.08);
}
.batch-position-cell:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
.batch-position-side-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  justify-content: center;
}
.batch-position-mode-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.835rem;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 42px;
  text-align: start;
}
.batch-position-mode-btn:hover {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border-color: var(--brand-primary-border);
}
.batch-position-mode-btn.is-active {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  font-weight: 750;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.15);
}
.batch-position-mode-btn:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* Live Canvas Processing / Progress Overlay */
.batch-canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  z-index: 30;
  padding: 24px;
  text-align: center;
  border-radius: 16px;
  animation: batchOverlayFadeIn 0.2s ease;
}
.batch-canvas-overlay[hidden] {
  display: none !important;
}
@keyframes batchOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.batch-overlay-spinner {
  width: 44px;
  height: 44px;
  border: 3.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--brand-primary, #3b82f6);
  border-radius: 50%;
  animation: batchOverlaySpin 0.75s linear infinite;
}
@keyframes batchOverlaySpin {
  to { transform: rotate(360deg); }
}
.batch-overlay-title {
  font-size: 1rem;
  font-weight: 750;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.batch-overlay-sub {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 420px;
  line-height: 1.5;
}

.batch-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 24px 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  max-width: 90%;
  width: 360px;
  text-align: center;
}

.batch-overlay-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 4px;
}
.batch-overlay-progress-wrap[hidden] {
  display: none !important;
}

.batch-overlay-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  overflow: hidden;
}

.batch-overlay-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--brand-primary, #3b82f6);
  border-radius: 99px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.batch-overlay-pct {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #ffffff;
  min-width: 38px;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.batch-canvas-wrapper,
.cropper-canvas-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  max-height: 520px;
  padding: 12px;
  background: linear-gradient(45deg, rgba(128,128,128,.06) 25%, transparent 25%),
              linear-gradient(-45deg, rgba(128,128,128,.06) 25%, transparent 25%),
              linear-gradient(45deg, transparent 75%, rgba(128,128,128,.06) 75%),
              linear-gradient(-45deg, transparent 75%, rgba(128,128,128,.06) 75%),
              var(--bg-canvas);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.batch-canvas-wrapper.is-dragging,
.cropper-canvas-wrapper.is-dragging {
  cursor: grabbing;
}

.batch-canvas,
.cropper-canvas {
  display: block;
  max-width: 100%;
  max-height: 480px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.batch-image-switcher,
.cropper-image-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 4px 10px;
  scrollbar-width: thin;
}

.batch-thumb-chip,
.cropper-thumb-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 2px;
  background: var(--bg-card);
  border: 2px solid var(--border-medium);
  border-radius: 12px;
  cursor: pointer;
  transition: all .18s ease;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}

.batch-thumb-chip:hover,
.cropper-thumb-chip:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .08);
}

.batch-thumb-chip.is-active,
.cropper-thumb-chip.is-active {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-light), 0 4px 14px rgba(59, 130, 246, 0.28);
  transform: scale(1.06);
}

.batch-chip-img,
.cropper-chip-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  pointer-events: none;
}

.batch-chip-name,
.cropper-chip-name {
  display: none;
}


/* QR design studio */
.qr-generator-pro { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); align-items: start; gap: 16px; }
.qr-generator-pro [hidden] { display: none !important; }
.qr-config-panel, .qr-result-panel { display: grid; gap: 16px; min-width: 0; padding: clamp(16px, 2.4vw, 24px); background: color-mix(in srgb, var(--bg-surface) 90%, var(--brand-primary-light)); border: 1px solid var(--border-subtle); border-radius: 22px; box-shadow: 0 14px 40px rgba(31, 52, 92, .06); }
.qr-section-heading h2, .qr-result-head h2 { margin: 3px 0 4px; color: var(--text-main); font-size: 1.15rem; }
.qr-section-heading p, .qr-note { margin: 0; color: var(--text-muted); font-size: .82rem; line-height: 1.6; }
.qr-eyebrow { color: var(--brand-primary); font: 750 .68rem/1.3 var(--font-mono); letter-spacing: .08em; }
.qr-preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qr-preset-btn { display: grid; gap: 5px; min-width: 0; padding: 12px; color: var(--text-main); text-align: start; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 15px; cursor: pointer; transition: border-color .16s ease, transform .16s ease; }
.qr-preset-btn:hover { border-color: var(--brand-primary); transform: translateY(-1px); }
.qr-preset-btn > span { display: grid; place-items: center; width: 30px; height: 30px; color: var(--brand-primary); background: var(--brand-primary-light); border-radius: 10px; font-size: 1.1rem; }
.qr-preset-btn strong { font-size: .79rem; }
.qr-preset-btn small { color: var(--text-muted); font-size: .7rem; line-height: 1.45; }
.qr-field { display: grid; gap: 7px; min-width: 0; color: var(--text-main); font-size: .82rem; font-weight: 650; }
.qr-field input, .qr-field select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 43px; padding: 9px 12px; color: var(--text-main); background: var(--bg-surface); border: 1px solid var(--border-medium); border-radius: 12px; font: 500 .88rem/1.45 var(--font-system); }
.qr-field-grid, .qr-options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.qr-options-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qr-wide { grid-column: 1 / -1; }
.qr-check { display: flex; align-items: center; gap: 9px; min-height: 40px; color: var(--text-main); font-size: .82rem; }
.qr-check input { width: 17px; height: 17px; accent-color: var(--brand-primary); }
.qr-brand-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 12px; background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: 14px; }
.qr-logo-picker { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 12px; overflow: hidden; cursor: pointer; font-size: .79rem; }
.qr-logo-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
#qr-logo-name { color: var(--text-muted); font-size: .78rem; overflow-wrap: anywhere; }
.qr-brand-row .btn-tertiary { min-height: 34px; padding-inline: 8px; font-size: .76rem; }
.qr-brand-row small { flex-basis: 100%; color: var(--text-muted); font-size: .73rem; }
.qr-color-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 9px 12px; color: var(--text-main); background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 12px; font-size: .79rem; font-weight: 650; }
.qr-color-field input { width: 39px; height: 34px; padding: 3px; background: var(--bg-surface); border: 1px solid var(--border-medium); border-radius: 9px; cursor: pointer; }
.qr-config-panel,
.qr-result-panel {
  position: sticky;
  top: 84px;
  align-self: start;
}
.qr-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qr-secure-badge { flex: 0 0 auto; padding: 7px 10px; color: #16815a; background: rgba(22, 163, 104, .09); border-radius: 99px; font-size: .7rem; font-weight: 700; }
.qr-preview-box { display: flex; justify-content: center; align-items: center; width: fit-content; max-width: 100%; min-height: 0; height: auto; padding: 10px; margin-inline: auto; background: #fff; border: 1px solid var(--border-subtle); border-radius: 16px; box-shadow: 0 4px 18px rgba(0, 0, 0, .05); }
.qr-output { display: flex; justify-content: center; align-items: center; width: auto; }
.qr-canvas-preview { display: block; width: 220px; max-width: 100%; aspect-ratio: 1; height: auto; object-fit: contain; image-rendering: pixelated; }
.qr-download-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; width: 100%; }
.qr-download-row > button { flex: 1 1 120px; }
.qr-note { padding-top: 12px; border-top: 1px solid var(--border-subtle); text-align: center; }
.qr-camera-result { width: 100%; min-height: 86px; padding: 12px; color: var(--text-main); background: var(--bg-surface); border: 1px solid var(--border-medium); border-radius: 13px; resize: vertical; }

@media (max-width: 760px) {
  .qr-generator-pro { grid-template-columns: minmax(0, 1fr); }
  .qr-config-panel,
  .qr-result-panel { position: static; }
}
@media (max-width: 640px) {
  .dropzone {
    min-height: 140px !important;
    padding: 22px 14px !important;
    border-radius: 16px !important;
  }
  .dropzone-icon,
  .dropzone-icon-box {
    width: 44px !important;
    height: 44px !important;
    margin-block-end: 8px !important;
  }
  .dropzone-title,
  .dropzone h3 {
    font-size: 1.05rem !important;
    margin-block-end: 4px !important;
  }
  .dropzone-subtitle,
  .dropzone p {
    font-size: 0.72rem !important;
  }
  .batch-settings-panel { padding: 12px 10px; border-radius: 15px; gap: 12px; }
  .batch-settings-header { padding-block-end: 8px; }
  .batch-panel-title { font-size: 0.95rem; }
  .batch-badge { font-size: 0.68rem; padding: 2px 7px; }
  .batch-setting-label { font-size: 0.78rem; }
  .batch-queue-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .batch-queue-actions { width: 100%; justify-content: flex-start; }
  .batch-run-all-btn, .batch-zip-btn { flex: 1 1 auto; justify-content: center; min-height: 44px; }
  .batch-card-main { flex-wrap: wrap; gap: 10px; }
  .batch-card-body { flex-basis: calc(100% - 64px); }
  .batch-card-actions { width: 100%; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--border-subtle); }
  .batch-btn-compare, .batch-btn-download, .batch-btn-process { min-height: 40px; }
  .compare-stats-header { padding: 10px 14px; gap: 8px; }
  .compare-stat-pill { min-width: 70px; }
  .compare-stat-size { font-size: 1rem; }
  .compare-diff-badge { font-size: .78rem; padding: 2px 8px; }
  .compare-stage { height: clamp(200px, 36vh, 280px); }
  .compare-modal-footer { padding: 10px 14px; flex-direction: column; align-items: stretch; }
  .compare-modal-footer button, .compare-modal-footer a { justify-content: center; min-height: 44px; }
}
@media (max-width: 560px) {
  .qr-preset-grid { grid-template-columns: minmax(0, 1fr); }
  .qr-preset-btn { grid-template-columns: auto 1fr; align-items: center; column-gap: 9px; }
  .qr-preset-btn > span { grid-row: span 2; }
  .qr-preset-btn small { grid-column: 2; }
  .qr-options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-preview-box { min-height: 0; }
}


/* 6. Universal File Input Hiding & Dropzone Integration */
input[type="file"],
.dropzone input[type="file"],
.hidden-file-input {
  display: none !important;
  opacity: 0 !important;
  position: absolute !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  visibility: hidden !important;
  z-index: -9999 !important;
}

.dropzone {
  min-height: 180px;
  border: 2px dashed rgba(37, 99, 235, 0.48);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 3.5vw, 40px) 24px;
  cursor: pointer;
  background: linear-gradient(145deg, rgba(239, 246, 255, 0.94) 0%, rgba(255, 255, 255, 0.98) 100%);
  box-shadow: 0 8px 30px -4px rgba(37, 99, 235, 0.12), 0 2px 8px -1px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

[data-theme="dark"] .dropzone {
  background: linear-gradient(145deg, rgba(30, 58, 138, 0.22) 0%, rgba(15, 23, 42, 0.7) 100%);
  border-color: rgba(96, 165, 250, 0.48);
  box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.dropzone:hover, .dropzone.dragover {
  border-color: #2563eb;
  background: linear-gradient(145deg, rgba(224, 238, 255, 0.98) 0%, rgba(240, 246, 255, 1) 100%);
  box-shadow: 0 12px 36px -4px rgba(37, 99, 235, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transform: translateY(-2px);
}

[data-theme="dark"] .dropzone:hover, [data-theme="dark"] .dropzone.dragover {
  border-color: #60a5fa;
  background: linear-gradient(145deg, rgba(30, 58, 138, 0.35) 0%, rgba(15, 23, 42, 0.8) 100%);
  box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(96, 165, 250, 0.35) inset;
  transform: translateY(-2px);
}

/* Modern Dropzone States: Loading, Progress Bar & Error */
.dropzone-content-default {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.dropzone-loading-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  pointer-events: none;
}

.dropzone-loading-spinner {
  width: 44px;
  height: 44px;
  border: 3.5px solid rgba(37, 99, 235, 0.2);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: dropzone-spin 0.75s linear infinite;
}

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

.dropzone-loading-filename {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone-progress-wrap {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

[data-theme="dark"] .dropzone-progress-wrap {
  background: rgba(255, 255, 255, 0.08);
}

.dropzone-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 99px;
  transition: width 0.18s cubic-bezier(0.2, 0, 0, 1);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.45);
}

.dropzone-loading-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.dropzone-loading-pct {
  font-weight: 700;
  font-family: var(--font-mono);
  color: #2563eb;
}

.dropzone-loading-status {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

.dropzone-error-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
}

.dropzone-error-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.dropzone-error-msg {
  font-size: 0.88rem;
  color: #ef4444;
  text-align: center;
  margin: 0;
  line-height: 1.5;
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-block: var(--space-5);
}
.preview-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
}
.preview-card img {
  max-height: 180px;
  margin-inline: auto;
  border-radius: var(--radius-sm);
  margin-block-end: var(--space-3);
  object-fit: contain;
}


/* 10. Gaming Cropper Presets */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-2);
  margin-block: var(--space-4);
}
.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-btn:hover, .preset-btn.active {
  background-color: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}
.preset-btn span.dims {
  font-size: 0.6875rem;
  opacity: 0.8;
}


/* 13. SVG Sanitizer Code & Preview Diffs */
.svg-diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-block: var(--space-4);
}
@media (max-width: 768px) {
  .svg-diff-grid {
    grid-template-columns: 1fr;
  }
}
.svg-preview-pane {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  min-height: 200px;
}
.svg-preview-pane-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-block-end: var(--space-2);
}
.svg-canvas-render {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  max-height: 250px;
}
.svg-canvas-render svg {
  max-width: 100%;
  max-height: 200px;
  height: auto;
}
