.drama-structure-stack,
.drama-detail-stack {
  display: grid;
  gap: 16px;
}

.drama-form-tip {
  color: var(--muted);
  font-size: 12px;
}

.drama-media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.drama-media-actions a,
.drama-media-actions button {
  min-height: 32px;
}

.drama-storyboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  position: relative;
  z-index: 2;
}

.drama-storyboard-workbench .codex-image-result {
  display: grid;
  gap: 14px;
  margin-top: 0;
}

.drama-storyboard-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.drama-storyboard-control-head h4 {
  margin: 0;
}

.drama-storyboard-control-head .primary {
  flex: 0 0 auto;
  white-space: nowrap;
}

.drama-storyboard-title-with-action {
  display: inline-flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.drama-storyboard-title-with-action .primary {
  flex: 0 0 auto;
}

.drama-storyboard-preview-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.drama-storyboard-preview-title .primary {
  flex: 0 0 auto;
}

.drama-storyboard-toolbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.drama-storyboard-toolbar-actions button {
  min-height: 30px;
  padding: 6px 10px;
  white-space: nowrap;
}

.drama-storyboard-history-card {
  margin-top: 16px;
}

.drama-storyboard-image-layout {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.drama-video-package-layout {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.drama-storyboard-image-layout .drama-storyboard-history-card {
  margin-top: 0;
}

.drama-storyboard-table .action-col {
  width: 180px;
  min-width: 180px;
}

.drama-storyboard-table .product-title-col {
  min-width: 240px;
}

.drama-storyboard-selected-row {
  background: rgba(37, 99, 235, 0.08);
}

.drama-storyboard-output-fields {
  display: grid;
  gap: 12px;
}

.drama-storyboard-workbench .codex-control-grid .wide {
  grid-column: 1 / -1;
}

.drama-storyboard-workbench textarea.drama-storyboard-input-compact {
  min-height: 150px;
}

.drama-storyboard-output-fields textarea {
  min-height: 132px;
}

#dramaStoryboardPromptOutput {
  max-height: 210px;
}

.drama-storyboard-workbench .codex-preview-stage {
  min-height: 320px;
}

.drama-storyboard-workbench .codex-preview-stage img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.drama-video-package-workbench .codex-image-result {
  display: grid;
  gap: 14px;
  margin-top: 0;
}

.drama-video-package-workbench textarea {
  min-height: 92px;
}

.drama-video-package-workbench .codex-preview-stage {
  min-height: 320px;
}

.drama-video-package-workbench .codex-preview-stage img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.drama-video-package-workbench .drama-storyboard-toolbar-actions button {
  min-height: 44px;
}

.drama-video-package-batch-btn {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

.drama-video-package-batch-btn:hover {
  background: #e0e7ff;
}

.drama-video-package-inline-check {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  min-height: 34px;
  width: auto;
}

.drama-video-package-inline-check input {
  width: auto;
}

.drama-video-package-shot-panel {
  margin-top: 0;
}

.drama-video-package-shot-grid {
  display: grid;
  gap: 14px;
}

.drama-video-package-shot-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.drama-video-package-shot-tabs button {
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--muted);
  flex: 0 0 auto;
  min-height: 38px;
  white-space: nowrap;
}

.drama-video-package-shot-tabs button.is-active {
  background: #eef2ff;
  border-color: #6366f1;
  color: #3730a3;
}

.drama-video-package-shot-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
}

.drama-video-package-shot-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-width: 0;
}

.drama-video-package-shot-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.drama-video-package-shot-title strong {
  color: var(--text);
  font-size: 15px;
}

.drama-video-package-shot-title small {
  color: var(--muted);
  line-height: 1.5;
}

.drama-video-package-shot-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.drama-video-package-prompt-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drama-video-package-prompt-grid label {
  display: grid;
  gap: 6px;
}

.drama-video-package-prompt-grid textarea {
  min-height: 130px;
}

.drama-video-package-prompt-grid .wide {
  grid-column: 1 / -1;
}

.drama-video-package-frame-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drama-video-package-frame-card {
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-rows: auto auto auto auto minmax(112px, 1fr);
  min-width: 0;
  padding: 12px;
}

.drama-video-package-frame-preview {
  aspect-ratio: 16 / 10;
  background: #f8fafc;
  border-radius: 6px;
  display: grid;
  min-height: 210px;
  overflow: hidden;
  place-items: center;
}

.drama-video-package-frame-preview img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.drama-video-package-frame-preview .empty-hint {
  display: grid;
  height: 100%;
  place-items: center;
  text-align: center;
  width: 100%;
}

.drama-video-package-frame-meta {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 4px;
}

.drama-video-package-frame-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drama-video-package-frame-actions a,
.drama-video-package-frame-actions button {
  min-height: 30px;
  padding: 6px 10px;
}

.drama-video-package-frame-error {
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.5;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 8px;
  white-space: pre-line;
  word-break: break-word;
}

.drama-video-package-frame-log {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 4px;
  line-height: 1.45;
  max-height: 132px;
  overflow: auto;
  padding: 8px;
}

.drama-review-table .action-col {
  width: 264px;
  min-width: 264px;
}

.row-actions.row-actions-wrap {
  flex-wrap: wrap;
  white-space: normal;
}

.status.active,
.status.generated,
.status.succeeded,
.status.processing,
.status.generating,
.status.charged {
  background: var(--green-light);
  color: #15803d;
}

.status.queued,
.status.submitted,
.status.pending_review {
  background: var(--amber-light);
  color: #b45309;
}

.status.review_failed,
.status.failed,
.status.canceled {
  background: var(--red-light);
  color: var(--red);
}

@media (max-width: 960px) {
  .drama-storyboard-head {
    align-items: stretch;
    flex-direction: column;
  }

  .drama-storyboard-head .primary {
    width: 100%;
  }

  .drama-storyboard-control-head {
    align-items: stretch;
    flex-direction: column;
  }

  .drama-storyboard-control-head .primary {
    width: 100%;
  }

  .drama-review-table .action-col {
    width: 220px;
    min-width: 220px;
  }

  .drama-video-package-prompt-grid,
  .drama-video-package-frame-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .drama-video-package-shot-head {
    align-items: stretch;
    flex-direction: column;
  }

  .drama-video-package-shot-actions {
    justify-content: flex-start;
  }
}
