.character-batches { max-width: 1800px; }
.batch-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .9fr); gap: 28px; align-items: start; }
.batch-characters, .batch-compose { min-width: 0; }
.batch-characters h2, .batch-preview-panel h2, .batch-progress h2 { margin-bottom: 0; }
.batch-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.batch-selection-actions { margin-bottom: 12px; }
.batch-character-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; max-height: calc(100vh - 315px); min-height: 280px; overflow-y: auto; padding: 4px 8px 8px 4px; scrollbar-gutter: stable; }
.batch-character { border: 1px solid var(--line); border-radius: 7px; background: var(--panel); overflow: hidden; padding-bottom: 8px; align-self: start; }
.batch-character.is-selected { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
.batch-character-choice { position: relative; margin: 0; cursor: pointer; color: var(--text); }
.batch-character-choice > input { position: absolute; top: 8px; right: 8px; z-index: 1; width: 21px; height: 21px; margin: 0; }
.batch-character-image { aspect-ratio: 4 / 5; display: flex; align-items: center; justify-content: center; background: var(--stage); overflow: hidden; }
.batch-character-image img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.batch-character-name { display: block; font-weight: 600; line-height: 1.35; padding: 8px 9px 3px; font-size: 13px; }
.batch-source-name { display: block; padding: 0 9px 6px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-character > button { margin: 0 8px; min-height: 28px; padding: 3px 7px; font-size: 12px; font-weight: 500; }
.batch-extra-references { padding: 8px; font-size: 12px; }
.batch-extra-references label { margin-top: 8px; }
.batch-empty { grid-column: 1 / -1; padding: 32px 0; }
.batch-compose { border-left: 1px solid var(--line); padding-left: 28px; }
.batch-compose > textarea { font-size: 15px; margin-bottom: 12px; }
.batch-compose .batch-check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.batch-check input { margin: 0; }
.batch-settings, .batch-assistant { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; margin-bottom: 16px; }
.batch-settings summary, .batch-assistant summary { cursor: pointer; font-weight: 600; }
.batch-settings[open] summary, .batch-assistant[open] summary { margin-bottom: 12px; }
.batch-assistant summary span { display: block; font-weight: 400; margin-top: 3px; overflow-wrap: anywhere; }
#batch-assistant-draft { margin-top: 12px; }
#batch-assistant-error { margin-top: 10px; }
.batch-seed { display: flex; gap: 10px; align-items: end; margin-bottom: 14px; }
.batch-seed label { margin: 0; flex: 1; }
.batch-generate-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#batch-preview-state { margin-top: 10px; }
.batch-preview-panel, .batch-progress { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 22px; }
.batch-preview-list { margin-top: 16px; max-height: 620px; overflow-y: auto; }
.batch-preview-list > details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.batch-preview-list summary { cursor: pointer; font-weight: 600; }
.batch-preview-list summary span { margin-left: 12px; font-weight: 400; }
.batch-preview-item { display: grid; grid-template-columns: 135px minmax(0, 1fr); gap: 20px; margin-top: 16px; }
.batch-preview-item pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 0; max-width: 85ch; }
.batch-preview-sources img { display: block; width: 100%; max-height: 175px; object-fit: contain; background: var(--stage); }
.batch-preview-sources span { display: block; overflow-wrap: anywhere; margin-top: 5px; color: var(--muted); }
.batch-reference-dialog { width: min(1000px, 94vw); max-height: 90vh; padding: 24px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); }
.batch-reference-dialog::backdrop { background: rgba(20, 25, 32, .6); }
.batch-reference-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-top: 20px; }
.batch-reference-options > button { display: block; min-width: 0; padding: 0; text-align: left; overflow: hidden; }
.batch-reference-options > button.is-selected { outline: 3px solid var(--blue); }
.batch-reference-options img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--stage); }
.batch-reference-options button > span { display: block; padding: 10px; font-size: 13px; }
.batch-reference-options small { display: block; margin-top: 4px; font-weight: 400; overflow-wrap: anywhere; color: var(--muted); }
.batch-run-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 24px; max-height: 480px; overflow-y: auto; }
.batch-run { display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 13px; }
.batch-run p { width: 100%; margin: 0; }
@media (max-width: 1100px) { .batch-layout { grid-template-columns: minmax(0, 1fr) minmax(310px, .9fr); gap: 20px; } .batch-compose { padding-left: 20px; } .batch-character-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
@media (max-width: 800px) { .batch-layout { grid-template-columns: 1fr; } .batch-compose { border-left: 0; border-top: 1px solid var(--line); padding: 22px 0 0; } .batch-character-grid { max-height: 52vh; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } .batch-filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .batch-filters { grid-template-columns: 1fr; gap: 0; } .batch-preview-item { grid-template-columns: 85px minmax(0, 1fr); gap: 12px; } .batch-reference-dialog { padding: 16px; } .batch-reference-options { grid-template-columns: 1fr 1fr; gap: 10px; } .batch-reference-options button > span { font-size: 11px; padding: 6px; } }

.batch-run-images { display: flex; width: 100%; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.batch-run-images a { display: block; flex: 0 0 130px; min-width: 0; text-decoration: none; }
.batch-run-images img { display: block; width: 130px; height: 170px; object-fit: contain; background: var(--stage); border-radius: 4px; }
.batch-run-images span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }

.batch-history { margin-top: 24px; max-width: 680px; }
.batch-history:not([hidden]) + .batch-progress { margin-top: 16px; }
