/* One batch occupies one card regardless of its requested output count. */
.free-mode-gallery-v2 .free-task.is-batch {
  grid-column: auto;
  min-width: 0;
  min-height: 0;
  height: auto;
}
.free-batch-frame { min-width: 0; width: 100%; }
.free-batch-progress, .free-batch-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  min-height: 44px;
  box-sizing: border-box;
  font-size: 12px;
  color: var(--wb-text, #f1f1f5);
  font-variant-numeric: tabular-nums;
}
.free-batch-progress { flex-wrap: wrap; }
.free-batch-stage {
  height: 360px;
  min-height: 0;
  overflow: hidden;
  background: var(--wb-surface, #11141a);
}
.free-batch-stage > .free-result-block {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.free-batch-stage .free-result-block > .free-result,
.free-batch-stage > .free-task-loading {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}
.free-batch-stage .free-result-block > .free-result { height: 0; }
body .free-mode-page .free-mode-gallery-v2 .free-batch-stage .free-result img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain !important;
}
.free-batch-stage .free-result-inline-actions { flex-shrink: 0; }
.free-batch-empty { display: grid; height: 100%; place-items: center; color: var(--wb-text, #f1f1f5); }
.free-batch-pagination { justify-content: center; }
.free-batch-pagination button, .free-preview-media-status button {
  min-width: 36px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--wb-border, #686078);
  border-radius: 8px;
  color: inherit;
  background: var(--wb-surface, #191722);
  cursor: pointer;
}
.free-batch-pagination button:disabled { opacity: .45; cursor: default; }
.free-batch-pagination button:focus-visible, .free-preview-media-status button:focus-visible { outline: 2px solid #b9a4fa; outline-offset: 2px; }
.free-batch-pagination span { min-width: 70px; text-align: center; }
.free-preview-media-status { display: grid; gap: 16px; justify-items: center; color: #f1f1f5; }
@media (max-width: 640px) { .free-batch-stage { height: 300px; } }

/* Existing dark-glass rules give every failure panel a 3:4 media ratio.
 * Batch failures already have stable per-slot feedback, so the task summary
 * must stay compact instead of appending another image-sized block. */
.free-mode-gallery-v2 .free-task.is-batch.failed .free-error-message,
.free-mode-gallery-v2 .free-task.is-batch.has-batch-errors .free-error-message,
body.theme-dark .free-mode-page:not(.agent-mode-page) .free-mode-gallery-v2 .free-task.is-batch.failed .free-error-message,
body.theme-dark .free-mode-page:not(.agent-mode-page) .free-mode-gallery-v2 .free-task.is-batch.has-batch-errors .free-error-message {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  display: grid !important;
  place-items: start !important;
  gap: 4px !important;
  margin: 0 !important;
  padding: 12px 16px !important;
  text-align: left !important;
}

.free-mode-gallery-v2 .free-task.is-optimistic .free-task-actions button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.history-record-list .history-load-more {
  width: 100%;
  min-height: 40px;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
}

.asset-load-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--wb-danger, #ff8f8f) 40%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--wb-danger, #ff8f8f) 8%, transparent);
}

.asset-load-error > div {
  display: grid;
  gap: 4px;
}

.asset-load-error span {
  color: var(--wb-text-muted, rgba(255, 255, 255, 0.62));
}

.asset-load-error button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 12px;
}


/* Match the existing single-image and failure media box. Keep all batch
   controls inside it so task actions always share the same baseline. */
body .free-mode-page .free-mode-gallery-v2 .free-task.is-batch .free-batch-frame {
  display: grid !important;
  grid-template-rows: 84px minmax(0, 1fr) 48px;
  width: 100%;
  height: auto !important;
  aspect-ratio: 3 / 4;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}
body .free-mode-page .free-mode-gallery-v2 .free-batch-progress {
  padding: 52px 12px 8px;
  min-height: 0;
  flex-wrap: nowrap;
  font-size: 11px;
}
body .free-mode-page .free-mode-gallery-v2 .free-batch-stage {
  height: 100% !important;
  min-height: 0 !important;
}
body .free-mode-page .free-mode-gallery-v2 .free-batch-pagination {
  height: 48px;
  min-height: 0;
  padding: 6px 12px;
}
