/* Comprimir Imagen — cmp-studio.css v2.0.0
   Tablero de lote sobre el design system studio (style.css, idéntico a
   Quitar Fondo / Imagen Studio). Mesa grande + controles en sidebar-right. */

.hidden {
  display: none !important;
}

/* ── Mesa de trabajo: Lienzo interactivo centrado + Modo lote scrolleable ── */
.stage-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-surface-elevated, #0d0c13);
}

.stage-container.is-batch-view {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px;
}

.crop-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
  box-sizing: border-box;
}

.crop-stage-inner {
  position: relative;
  display: block;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  user-select: none;
  background: #000;
  flex-shrink: 0;
  transition: width 0.18s cubic-bezier(0.16, 1, 0.3, 1), height 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.crop-stage-inner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  user-select: none;
  pointer-events: none;
}

.stage-fit-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  border-radius: 12px;
}

.crop-box {
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 80%;
  border: 2px solid #8f6cc7;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
  cursor: move;
  box-sizing: border-box;
  touch-action: none;
}

.crop-dim-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(10, 8, 18, 0.85);
  backdrop-filter: blur(8px);
  color: #fff;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(143, 108, 199, 0.4);
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.02em;
}

.crop-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      to right,
      transparent 33.3%,
      rgba(255, 255, 255, 0.25) 33.3%,
      rgba(255, 255, 255, 0.25) 33.8%,
      transparent 33.8%,
      transparent 66.6%,
      rgba(255, 255, 255, 0.25) 66.6%,
      rgba(255, 255, 255, 0.25) 67.1%,
      transparent 67.1%
    ),
    linear-gradient(
      to bottom,
      transparent 33.3%,
      rgba(255, 255, 255, 0.25) 33.3%,
      rgba(255, 255, 255, 0.25) 33.8%,
      transparent 33.8%,
      transparent 66.6%,
      rgba(255, 255, 255, 0.25) 66.6%,
      rgba(255, 255, 255, 0.25) 67.1%,
      transparent 67.1%
    );
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2.5px solid #8f6cc7;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  touch-action: none;
}

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

.crop-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-quick-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
}

.guide-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.15s ease;
}

.guide-chip:hover {
  background: rgba(85, 55, 142, 0.18);
  border-color: rgba(143, 108, 199, 0.4);
  transform: translateX(2px);
}

.guide-chip.active {
  background: rgba(85, 55, 142, 0.35);
  border-color: #a855f7;
  box-shadow: 0 0 12px -2px rgba(168, 85, 247, 0.4);
}

.guide-chip strong {
  font-size: 0.8rem;
  color: #f1f5f9;
}

.guide-chip span {
  font-size: 0.72rem;
  color: #94a3b8;
}

.queue-item.active {
  border-color: #8f6cc7 !important;
  background: rgba(85, 55, 142, 0.18) !important;
  box-shadow: 0 0 16px -4px rgba(143, 108, 199, 0.4) !important;
}

.queue-btn-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.queue-btn-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.cmp-batch {
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Sin tope de ancho: el tablero llena toda la mesa de trabajo,
     las tarjetas se reparten en más columnas en vez de dejar vacío. */
  max-width: none;
  margin: 0;
  width: 100%;
}

/* ── Tablero: cuadrícula / lista ── */
.cmp-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.cmp-batch.view-list .cmp-board {
  grid-template-columns: 1fr;
}

/* ── Tarjeta fotográfica vertical ── */
.cmp-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(143, 108, 199, 0.35);
  transition: border-color 0.15s ease, transform 0.15s ease;
  min-width: 0;
}

.cmp-card:hover {
  border-color: var(--brand-light);
  transform: translateY(-2px);
}

.cmp-card.is-working {
  border-color: rgba(245, 158, 11, 0.5);
}

.cmp-card.is-error {
  border-color: rgba(239, 68, 68, 0.5);
}

/* Preview grande con insignia de ahorro incrustada */
.cmp-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background:
    linear-gradient(45deg, #18191d 25%, transparent 25%),
    linear-gradient(-45deg, #18191d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #18191d 75%),
    linear-gradient(-45deg, transparent 75%, #18191d 75%),
    #0f1013;
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid var(--border-subtle);
  transition: transform 0.15s ease;
}

.cmp-preview:hover {
  filter: brightness(1.05);
}

.cmp-preview .cmp-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cmp-savebadge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  color: #34d399;
  background: rgba(0, 0, 0, 0.68);
  border: 1px solid rgba(52, 211, 153, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.cmp-savebadge.pending {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.55);
}

.cmp-savebadge.err {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.55);
}

.cmp-veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.cmp-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Vista lista: fila compacta horizontal */
.cmp-batch.view-list .cmp-card {
  flex-direction: row;
  align-items: center;
}

.cmp-batch.view-list .cmp-card:hover {
  transform: none;
}

.cmp-batch.view-list .cmp-preview {
  width: 64px;
  height: 64px;
  aspect-ratio: auto;
  flex-shrink: 0;
}

.cmp-batch.view-list .cmp-body {
  flex: 1;
}

.cmp-batch.view-list .cmp-savebadge {
  top: 3px;
  right: 3px;
  font-size: 0.6rem;
  padding: 1px 6px;
}

.cmp-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmp-sizes {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.cmp-sizes .to {
  color: var(--text-dim);
  margin: 0 2px;
}

.cmp-save {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #34d399;
}

.cmp-save.pending {
  color: var(--warning);
}

.cmp-save.err {
  color: var(--danger);
}

.cmp-row-btns {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.cmp-mini-btn {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cmp-mini-btn:hover:not(:disabled) {
  border-color: var(--brand-light);
  background: rgba(85, 55, 142, 0.16);
  color: #fff;
}

.cmp-mini-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cmp-mini-btn.danger {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

.cmp-mini-btn.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--danger);
  color: #fff;
}

/* ── Estado vacío del tablero ── */
.cmp-board-empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-muted);
  font-size: 0.84rem;
  border: 1px dashed rgba(189, 160, 226, 0.35);
  border-radius: 14px;
  background: rgba(85, 55, 142, 0.05);
}

/* ── Botón gigante flotante: añadir más fotos (siempre visible al hacer scroll) ── */
.cmp-fab {
  position: sticky;
  bottom: 14px;
  align-self: flex-end;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 15px 32px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
  background: linear-gradient(180deg, #6c46b5 0%, #472d75 100%);
  border: 1px solid rgba(189, 160, 226, 0.65);
  box-shadow:
    0 14px 36px -6px rgba(139, 92, 246, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cmp-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 18px 44px -6px rgba(139, 92, 246, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.cmp-fab:active {
  transform: scale(0.97);
}

/* ── Nota de privacidad ── */
.cmp-note {
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-dim);
  margin: 0;
}

.cmp-note strong {
  color: var(--text-secondary);
}

/* ── Nota del motor ── */
.cmp-enginenote {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1.5;
  color: var(--text-dim);
}

/* ── Medidas exactas W×H ── */
.rsz-dims-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rsz-dim-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-base, #000);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  padding: 6px 10px;
}

.rsz-dim-field .studio-number-input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary, #f8fafc);
  font-family: var(--font-mono, monospace);
  font-size: 0.86rem;
  font-weight: 600;
}

.rsz-color-input {
  width: 100%;
  height: 38px;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  background: var(--bg-base, #000);
  cursor: pointer;
}

/* ── Inspector Visual de Plantillas y Plataformas (Cero Emojis) ── */
.preset-ratio-badge {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(143, 108, 199, 0.18);
  border: 1px solid rgba(143, 108, 199, 0.35);
  color: #c4b5fd;
}

/* Selector Desplegable de Red Social / Plataforma */
.preset-platform-select-wrap {
  margin-top: 4px;
  margin-bottom: 10px;
}

.preset-select-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.preset-platform-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #14161f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  padding: 9px 34px 9px 12px;
  color: #f8fafc;
  font-family: var(--font-ui, sans-serif);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.preset-platform-select:hover {
  border-color: rgba(143, 108, 199, 0.5);
  background: #1a1d29;
}

.preset-platform-select:focus {
  border-color: var(--brand-light, #8f6cc7);
  box-shadow: 0 0 0 3px rgba(143, 108, 199, 0.2);
}

.preset-select-chevron {
  position: absolute;
  right: 12px;
  pointer-events: none;
  color: #94a3b8;
  transition: transform 0.15s ease;
}

.preset-platform-select:focus + .preset-select-chevron {
  transform: rotate(180deg);
  color: var(--brand-lighter, #bda0e2);
}

/* Paneles de Formatos por Plataforma */
.preset-panels-container {
  display: flex;
  flex-direction: column;
}

.preset-platform-panel {
  display: none;
}
.preset-platform-panel.active {
  display: block;
}

/* Grilla de Presets organizada de 2 en 2 */
.preset-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* Tarjeta Visual de Formato organizada 2 en 2 (Diseño Amplio y Vistoso) */
.preset-visual-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 10px 8px 10px;
  background: rgba(18, 20, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 114px;
  box-sizing: border-box;
}

.preset-visual-card:hover {
  background: rgba(30, 32, 44, 0.9);
  border-color: rgba(143, 108, 199, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.preset-visual-card.active {
  background: linear-gradient(145deg, rgba(85, 55, 142, 0.32), rgba(143, 108, 199, 0.16));
  border-color: var(--brand-light, #8f6cc7);
  box-shadow: 0 0 16px -2px rgba(143, 108, 199, 0.5);
}

/* Caja de Silueta Wireframe Amplia y Vistosa */
.preset-wireframe-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  flex-shrink: 0;
}

.wireframe-shape {
  border: 1.5px solid rgba(189, 160, 226, 0.35);
  background: linear-gradient(135deg, rgba(85, 55, 142, 0.18), rgba(255, 255, 255, 0.03));
  border-radius: 5px;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.45);
}

/* Guía de composición interna de cámara / visor */
.wireframe-shape::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px dashed rgba(189, 160, 226, 0.2);
  border-radius: 3px;
  pointer-events: none;
  transition: all 0.2s ease;
}

.preset-visual-card:hover .wireframe-shape {
  border-color: var(--brand-lighter, #bda0e2);
  background: linear-gradient(135deg, rgba(143, 108, 199, 0.28), rgba(85, 55, 142, 0.35));
}
.preset-visual-card:hover .wireframe-shape::after {
  border-color: rgba(189, 160, 226, 0.4);
}

.preset-visual-card.active .wireframe-shape {
  border-color: var(--brand-lighter, #bda0e2);
  background: linear-gradient(135deg, rgba(143, 108, 199, 0.45), rgba(85, 55, 142, 0.6));
  box-shadow: 0 0 14px rgba(189, 160, 226, 0.4), inset 0 0 8px rgba(189, 160, 226, 0.25);
}

.preset-visual-card.active .wireframe-shape::after {
  border-color: rgba(255, 255, 255, 0.45);
}

/* Formas proporcionales exactas a gran escala */
.shape-1-1 { width: 48px; height: 48px; }
.shape-4-5 { width: 40px; height: 50px; }
.shape-9-16 { width: 30px; height: 53px; }
.shape-16-9 { width: 58px; height: 33px; }
.shape-191-1 { width: 60px; height: 31px; }
.shape-26-1 { width: 62px; height: 24px; }
.shape-4-1 { width: 64px; height: 16px; }

/* Contenido de texto */
.preset-card-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
}

.preset-card-title {
  font-family: var(--font-ui, sans-serif);
  font-size: 0.76rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}
.preset-visual-card.active .preset-card-title {
  color: #ffffff;
}

.preset-card-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.preset-card-px {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  color: #94a3b8;
  white-space: nowrap;
}
.preset-visual-card.active .preset-card-px {
  color: var(--brand-lighter, #bda0e2);
}

.preset-card-ratio {
  font-family: var(--font-mono, monospace);
  font-size: 0.62rem;
  font-weight: 600;
  color: #64748b;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 4px;
}
.preset-visual-card.active .preset-card-ratio {
  color: #ffffff;
  background: rgba(143, 108, 199, 0.35);
  border: 1px solid rgba(189, 160, 226, 0.3);
}

.preset-card-desc {
  display: none;
}

/* Fila de ratios rápidos */
.quick-ratios-container {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.quick-ratios-label {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
}

.quick-ratios-pills {
  display: flex;
  gap: 5px;
}

.ratio-pill {
  padding: 4px 8px;
  font-size: 0.7rem;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ratio-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.ratio-pill.active {
  background: #8f6cc7;
  border-color: #a855f7;
  color: #fff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.sidebar-right-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-right-footer .btn-clear-batch {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  font-family: var(--font-ui, 'Space Grotesk', sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.sidebar-right-footer .btn-clear-batch:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  box-shadow: 0 0 20px -6px rgba(239, 68, 68, 0.3);
}

.sidebar-right-footer .btn-clear-batch:active:not(:disabled) {
  transform: scale(0.98);
}

.sidebar-right-footer .btn-clear-batch svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sidebar-right-footer .btn-clear-batch:hover:not(:disabled) svg {
  transform: rotate(-10deg);
}

.sidebar-right-footer .btn-clear-batch:disabled {
  opacity: 0.35;
  cursor: not-allowed !important;
  background: rgba(255, 255, 255, 0.01);
  border-color: rgba(255, 255, 255, 0.05);
}

/* ── Selector de Modo: Exacto vs Porcentaje ── */
.segment-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.segment-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  gap: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  background: var(--bg-surface, #18191e);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.segment-mode-btn:hover {
  border-color: var(--brand-light, #8f6cc7);
  color: var(--text-primary, #f8fafc);
  background: rgba(143, 108, 199, 0.1);
}

.segment-mode-btn.active {
  border-color: var(--brand-light, #8f6cc7);
  background: rgba(143, 108, 199, 0.2);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(143, 108, 199, 0.25);
}

.segment-mode-btn .mode-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
}

.segment-mode-btn .mode-sub {
  font-size: 0.65rem;
  color: var(--text-muted, #94a3b8);
  font-weight: 500;
}

.segment-mode-btn.active .mode-sub {
  color: #d8b4fe;
}

/* ── Quality / Percentage Presets Grid ── */
.quality-presets-pct {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

/* ── Preview Modal ── */
.preview-modal-card {
  background: #111216;
  border: 1px solid rgba(143, 108, 199, 0.35);
  border-radius: 20px;
  width: 92%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(143, 108, 199, 0.2);
  animation: modalPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.preview-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.preview-stage-container {
  width: 100%;
  max-height: 380px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, #18191d 25%, transparent 25%),
    linear-gradient(-45deg, #18191d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #18191d 75%),
    linear-gradient(-45deg, transparent 75%, #18191d 75%),
    #0f1013;
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.preview-modal-img {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
}

.preview-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preview-metric-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-metric-box.highlight {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.05);
}

.preview-metric-label {
  font-size: 0.68rem;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.preview-metric-val {
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
}

.preview-metric-box.highlight .preview-metric-val {
  color: #34d399;
}

.preview-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

/* ── Responsive ── */
@media (max-width: 1023px) {
  .stage-container.cmp-stage {
    max-height: none;
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .cmp-board {
    grid-template-columns: 1fr 1fr;
  }

  .cmp-batch.view-list .cmp-board {
    grid-template-columns: 1fr;
  }

  .preview-metrics-grid {
    grid-template-columns: 1fr;
  }
}
