:root {
  --ink: #1f2933;
  --muted: #65758b;
  --line: #d8dee8;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5d57;
  --signal: #d97706;
  --rose: #be3455;
  --blue: #2f6fb0;
  --shadow: 0 16px 45px rgba(31, 41, 51, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 24px;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  border-radius: 8px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 20px;
}

.brand p,
.empty-state p,
.api-layout p {
  color: var(--muted);
}

.brief-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.actions,
.topbar-actions {
  display: flex;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
}

.primary {
  flex: 1;
  color: #ffffff;
  background: var(--accent);
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary,
.ghost {
  color: var(--ink);
  background: #eef2f7;
}

.secondary:hover,
.ghost:hover {
  background: #e0e7ef;
}

.workspace {
  min-width: 0;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto 1fr;
  gap: 18px;
  align-items: start;
}

.topbar,
.tabs,
.product-workflow-card,
.empty-state,
.result-area {
  grid-column: 1;
}

.product-workflow-card,
.section-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h3 {
  margin-bottom: 6px;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.product-workflow-card .brief-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.product-workflow-card .brief-form > label:nth-child(3),
.product-workflow-card .brief-form > label:nth-child(4),
.product-workflow-card .brief-form > .actions {
  grid-column: 1 / -1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.topbar h2 {
  margin-bottom: 0;
  font-size: 28px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--rose);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
  font-weight: 900;
}

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

.tab {
  color: #465568;
  background: transparent;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.tab.active {
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
}

.empty-state,
.result-area {
  min-height: 240px;
}

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed #b8c3d2;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 8px;
}

.empty-state h3 {
  font-size: 26px;
  margin-bottom: 8px;
}

.hidden {
  display: none;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.result-area {
  display: grid;
  gap: 16px;
}

.result-area.hidden {
  display: none;
}

.result-area .panel.active {
  display: block;
}

.result-area #videoPanel.active {
  margin-top: 0;
}

.result-area #apiPanel.active {
  display: block;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.strategy-card,
.timeline-card,
.prompt-card,
.edit-card,
.api-layout > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.strategy-card {
  padding: 18px;
}

.card-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.pill {
  width: 10px;
  height: 28px;
  background: var(--signal);
  border-radius: 8px;
}

.hook {
  color: var(--accent-dark);
  font-weight: 800;
  line-height: 1.55;
}

dl {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

dd {
  margin: 3px 0 0;
  line-height: 1.6;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-card,
.prompt-card,
.edit-card {
  padding: 18px;
}

.timeline-card header,
.prompt-card header,
.edit-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.timecode {
  color: #ffffff;
  background: var(--blue);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

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

.meta-box {
  background: #f7f9fc;
  border: 1px solid #e5ebf2;
  border-radius: 8px;
  padding: 12px;
}

.meta-box strong {
  display: block;
  margin-bottom: 6px;
  color: #344054;
}

.prompt-grid,
.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.prompt-card code,
.api-layout code {
  white-space: pre-wrap;
  word-break: break-word;
}

pre {
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: #d8f3ee;
  background: #16232e;
  border-radius: 8px;
}

.api-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.api-layout > div {
  padding: 20px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  color: #ffffff;
  background: var(--ink);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar,
  .tabs,
  .product-workflow-card,
  .empty-state,
  .result-area {
    grid-column: 1;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .strategy-grid,
  .prompt-grid,
  .edit-grid,
  .api-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .timeline-card header,
  .prompt-card header,
  .edit-card header {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }
}

.config-card {
  display: grid;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.api-subtabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid #e5ebf2;
  border-radius: 8px;
  background: #f7f9fc;
}

.api-subtab {
  border: 0;
  background: transparent;
  color: #344054;
  padding: 10px 16px;
  border-radius: 7px;
  font-weight: 900;
}

.api-subtab.active {
  color: #ffffff;
  background: var(--ink);
}

.api-tab-panel {
  display: none !important;
}

.api-tab-panel.active {
  display: block !important;
}

.api-section.api-tab-panel.active {
  display: grid !important;
}

.actions.api-tab-panel.active {
  display: flex !important;
}

.usage-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.usage-summary-grid div {
  padding: 12px;
  border: 1px solid #e5ebf2;
  border-radius: 8px;
  background: #ffffff;
}

.usage-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.usage-summary-grid strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 18px;
}

.usage-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5ebf2;
  border-radius: 8px;
  background: #ffffff;
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  font-size: 13px;
}

.usage-table th,
.usage-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  vertical-align: top;
}

.usage-table th {
  color: #344054;
  background: #f7f9fc;
  font-size: 12px;
}

.usage-table td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  word-break: break-all;
}

.config-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.config-head h3 {
  margin-bottom: 6px;
}

.config-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.status-pill {
  min-width: 72px;
  text-align: center;
  color: #8a4b00;
  background: #fff4db;
  border: 1px solid #ffd58a;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.ready {
  color: #0b5d57;
  background: #dcf7ef;
  border-color: #9ee2d0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.test-result {
  color: #8a4b00;
  background: #fff4db;
  border: 1px solid #ffd58a;
  border-radius: 8px;
  padding: 11px 12px;
  line-height: 1.6;
  font-weight: 700;
}

.test-result.ok {
  color: #0b5d57;
  background: #dcf7ef;
  border-color: #9ee2d0;
}

.history-layout {
  display: grid;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.history-head,
.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.history-head h3 {
  margin-bottom: 6px;
}

.history-head p {
  color: var(--muted);
  margin-bottom: 0;
}

.projects-list {
  display: grid;
  gap: 10px;
}

.project-row {
  border: 1px solid #e5ebf2;
  background: #f7f9fc;
  border-radius: 8px;
  padding: 12px;
}

.project-row strong,
.project-row span {
  display: block;
}

.project-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .history-head,
  .project-row {
    align-items: stretch;
    flex-direction: column;
  }
}

.model-summary {
  margin-bottom: 12px;
}

.model-group {
  margin-top: 12px;
}

.model-group h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
}

.model-group h4 span {
  color: var(--muted);
  font-size: 12px;
}

.model-group p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.model-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  padding-right: 4px;
}

.model-tag {
  min-height: 30px;
  max-width: 100%;
  color: #0b5d57;
  background: #edf8f5;
  border: 1px solid #9ee2d0;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.model-tag:hover {
  background: #dcf7ef;
}

.prompt-editor-card {
  display: grid;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.prompt-editor-head,
.prompt-editor-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.prompt-editor-head h3 {
  margin-bottom: 6px;
}

.prompt-editor-head p,
.prompt-editor-foot {
  color: var(--muted);
}

.prompt-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.master-prompt-editor {
  min-height: 520px;
  resize: vertical;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 14px;
  line-height: 1.7;
  color: #17202a;
  background: #fbfcfe;
}

.prompt-editor-foot {
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .prompt-editor-head,
  .prompt-editor-foot {
    flex-direction: column;
  }

  .prompt-editor-actions {
    justify-content: flex-start;
  }
}

.video-generator-card {
  display: grid;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.video-generator-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.video-generator-head h3 {
  margin-bottom: 6px;
}

.video-generator-head p {
  color: var(--muted);
  margin-bottom: 0;
}

.video-settings-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.4fr) repeat(4, minmax(120px, 0.6fr));
  gap: 12px;
  align-items: start;
}

.frontend-hidden {
  display: none !important;
}

.inline-video-model-select {
  min-width: 260px;
  max-width: 360px;
  height: 38px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.storyboard-video-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-storyboard-card summary .inline-video-model-select {
  margin-left: auto;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.checkbox-row input {
  width: auto;
}

.video-prompt-editor {
  min-height: 280px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  line-height: 1.7;
}

.video-task-result {
  color: #8a4b00;
  background: #fff4db;
  border: 1px solid #ffd58a;
  border-radius: 8px;
  padding: 12px;
  line-height: 1.6;
  font-weight: 700;
}

.generated-video-player {
  width: min(420px, 100%);
  aspect-ratio: 9 / 16;
  background: #111827;
  border-radius: 8px;
}

.video-link {
  margin-top: 8px;
}

.video-link a {
  color: var(--accent-dark);
  font-weight: 900;
}

@media (max-width: 980px) {
 .video-settings-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .video-generator-head,
 .video-settings-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}

.project-sidebar {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: #f7f9fc;
  border: 1px solid #e5ebf2;
  border-radius: 8px;
}

.project-sidebar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.project-sidebar-head h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.project-sidebar-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.small-button {
  flex: initial;
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.project-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.text-button {
  min-height: 28px;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
  font-size: 12px;
}

.text-button:hover {
  color: var(--accent);
  background: transparent;
}

.sidebar-projects-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.sidebar-project {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 10px;
  text-align: left;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #e5ebf2;
  border-radius: 8px;
}

.sidebar-project:hover,
.sidebar-project.active {
  border-color: var(--accent);
  background: #edf8f5;
}

.sidebar-project strong,
.sidebar-project span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-project strong {
  font-size: 13px;
}

.sidebar-project span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compact-box {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.api-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e5ebf2;
  border-radius: 8px;
  background: #fbfcfe;
}

.compact-head h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.prompt-config-section .master-prompt-editor {
  min-height: 360px;
}

.video-progress {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #dbe6ef;
  border-radius: 8px;
  background: #f7f9fc;
}

.active-copy-preview {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #bfe2dc;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #f5fbf9;
}

.active-copy-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: #0b5d57;
  font-size: 12px;
  font-weight: 900;
}

.active-copy-preview-head em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.active-copy-preview strong {
  color: var(--ink);
  font-size: 15px;
}

.active-copy-preview p {
  margin: 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.55;
}

.active-copy-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.active-copy-preview-meta span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #dbe6ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.video-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #344054;
  font-size: 13px;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  background: #e5ebf2;
  border-radius: 999px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  border-radius: inherit;
  transition: width 260ms ease;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.progress-steps span {
  color: var(--muted);
  background: #ffffff;
  border: 1px solid #e5ebf2;
  border-radius: 8px;
  padding: 7px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.progress-steps span.active {
  color: #0b5d57;
  background: #dcf7ef;
  border-color: #9ee2d0;
}

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

.model-exposure-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.model-exposure-grid select[multiple] {
  min-height: 180px;
  padding: 8px;
  overflow: auto;
}

.video-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 190px));
  gap: 12px;
}

.video-result-card {
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(20, 35, 55, 0.08);
}

.video-result-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  display: block;
  background: #111827;
  object-fit: cover;
  cursor: zoom-in;
}

.video-result-body {
  display: grid;
  gap: 8px;
  padding: 9px;
}

.video-result-body h4 {
  margin: 0 0 3px;
  font-size: 13px;
  line-height: 1.35;
}

.video-result-body p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.video-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

@media (max-width: 980px) {
  .model-exposure-grid {
    grid-template-columns: 1fr;
  }

  .video-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

.reference-upload-field {
  min-width: 0;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.upload-row input[type="file"] {
  min-height: auto;
  padding: 8px;
  font-size: 13px;
}

.upload-row .field-hint {
  min-width: 120px;
  color: #5f6f83;
}

.copy-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.copy-grid,
.storyboard-grid {
  display: grid;
  gap: 14px;
}

.copy-card,
.storyboard-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(20, 35, 55, 0.055);
  padding: 12px;
}

.copy-card.selected,
.storyboard-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(18, 129, 119, 0.14), var(--shadow);
}

.copy-card header,
.storyboard-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.copy-text {
  color: var(--ink);
  line-height: 1.75;
  font-weight: 800;
  white-space: pre-wrap;
}

.copy-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.compact-timeline {
  margin-top: 12px;
}

.compact-box {
  box-shadow: none;
}

@media (max-width: 980px) {
  .copy-meta {
    grid-template-columns: 1fr;
  }

  .copy-card header,
  .storyboard-card header {
    display: grid;
  }
}
.copy-toolbar {
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
}

.copy-toolbar .primary {
  flex: 0 0 auto;
}

.copy-list,
.storyboard-list {
  display: grid;
  gap: 10px;
}

.check-row,
.copy-select-label,
.compact-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-weight: 900;
}

.compact-label {
  margin: 8px 0 6px;
}

.copy-card-titlebar {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
}

.copy-title-input,
.copy-meta input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  background: #ffffff;
}

.copy-edit-textarea,
.storyboard-edit-textarea,
.storyboard-copy-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: #ffffff;
  line-height: 1.55;
  resize: vertical;
}

.copy-edit-textarea {
  min-height: 84px;
  font-weight: 800;
}

.storyboard-copy-textarea {
  min-height: 86px;
  color: #465568;
  background: #f8fafc;
}

.storyboard-edit-textarea {
  min-height: 360px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
}

.compact-copy-meta label {
  display: grid;
  gap: 4px;
  color: #344054;
  font-size: 12px;
  font-weight: 900;
}

.compact-copy-meta label span {
  color: var(--muted);
}

.storyboard-card header .primary,
.copy-card header .secondary {
  flex: 0 0 auto;
}

.video-placeholder {
  min-height: 260px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 18px;
  color: #dbeafe;
  text-align: center;
}

.video-placeholder strong {
  color: #ffffff;
  font-size: 18px;
}

.video-placeholder span {
  max-width: 100%;
  color: #bfd7ff;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.video-result-card.failed {
  border-color: #f6c76f;
  background: #fffaf0;
}

.error-text {
  color: #9a5800 !important;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.video-result-actions button[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

.inline-result-section {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #e5ebf2;
  border-radius: 8px;
  background: #f8fafc;
}

.compact-empty-result {
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: 8px 10px;
}

.inline-result-section.muted-section {
  color: var(--muted);
  background: #fbfcfe;
}

.inline-result-section.muted-section p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.inline-section-head,
.inline-storyboard-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inline-section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inline-storyboard-list {
  display: grid;
  gap: 10px;
}

.inline-storyboard-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.compact-storyboard-textarea {
  min-height: 150px;
  font-size: 13px;
  line-height: 1.55;
}

.inline-storyboard-card summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.inline-storyboard-card summary::-webkit-details-marker {
  display: none;
}

.storyboard-summary-title {
  min-width: 0;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 132px));
  gap: 10px;
}

.inline-video-grid .video-result-body {
  gap: 6px;
  padding: 7px;
}

.inline-video-grid .video-result-body h4 {
  font-size: 12px;
}

.inline-video-grid .video-result-body p {
  font-size: 10px;
}

.inline-video-grid .action-link {
  min-height: 28px;
  padding: 0 6px;
  font-size: 11px;
}

.video-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.82);
}

.video-preview-dialog {
  position: relative;
  display: grid;
  place-items: center;
  max-width: min(92vw, 960px);
  max-height: 92vh;
}

.video-preview-player {
  max-width: min(92vw, 960px);
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000000;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

.video-preview-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 1;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  color: #ffffff;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
}

.copy-progress {
  grid-column: 1 / -1;
  color: #345f8b;
  background: #edf5ff;
  border: 1px solid #bfd8f4;
  border-radius: 8px;
  padding: 11px 12px;
  font-weight: 800;
  line-height: 1.5;
}

.copy-progress.ok {
  color: #0b5d57;
  background: #dcf7ef;
  border-color: #9ee2d0;
}

.copy-progress.error {
  color: #8a4b00;
  background: #fff4db;
  border-color: #ffd58a;
}

@media (max-width: 980px) {
  .product-workflow-card .brief-form {
    grid-template-columns: 1fr;
  }

  .product-workflow-card .brief-form > label,
  .product-workflow-card .brief-form > .field-grid,
  .product-workflow-card .brief-form > .actions {
    grid-column: 1 / -1;
  }
}
