:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-soft: #f4f7f9;
  --line: #dce3e8;
  --line-strong: #c9d4dc;
  --text: #111827;
  --muted: #687581;
  --muted-2: #94a0aa;
  --teal: #007f8f;
  --teal-dark: #00636f;
  --teal-soft: #e6f6f7;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #dc2626;
  --shadow: 0 14px 35px rgba(28, 41, 54, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 168px minmax(940px, 1fr) 262px;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar,
.tool-rail {
  background: var(--surface);
  border-color: var(--line);
  border-style: solid;
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-width: 0 1px 0 0;
}

.brand {
  display: grid;
  grid-template-columns: 28px 1fr 24px;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}

.brand strong {
  display: block;
  max-width: 92px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand span {
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #2d3a44;
}

.icon-button:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.module-nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 9px;
}

.module-button,
.plain-nav {
  display: grid;
  grid-template-columns: 27px 1fr;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #192630;
  text-align: left;
}

.module-button {
  padding: 10px 8px;
}

.module-button i,
.plain-nav i {
  font-size: 18px;
}

.module-button b {
  display: block;
  font-weight: 700;
  line-height: 1.2;
}

.module-button span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.module-button.active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 10px 20px rgba(0, 127, 143, 0.2);
}

.module-button.active span {
  color: rgba(255, 255, 255, 0.82);
}

.module-button:not(.active):hover,
.plain-nav:hover {
  background: var(--surface-soft);
}

.sidebar-bottom {
  margin-top: auto;
  padding: 14px 9px 16px;
  border-top: 1px solid var(--line);
}

.plain-nav {
  padding: 8px 8px;
  color: #33404a;
}

.plain-nav.active-soft {
  color: var(--teal);
}

.profile {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 9px;
  align-items: center;
  margin-top: 14px;
}

.profile img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.profile b {
  display: block;
  font-size: 13px;
}

.profile small {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dff8e8;
  color: #15803d;
  font-size: 11px;
  font-weight: 700;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  min-height: 62px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.top-section-nav {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 8px;
  width: auto;
  min-width: 0;
}

.remote-session-summary {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: 12px;
}

.remote-api-status {
  max-width: 220px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-api-status.is-online {
  color: #0a7e52;
}

.remote-session-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.remote-session-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.remote-session-dialog-header,
.remote-session-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.remote-session-dialog-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.remote-session-dialog-header h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.remote-session-fields {
  display: grid;
  gap: 13px;
  padding: 18px 20px 10px;
}

.remote-session-message {
  min-height: 22px;
  padding: 0 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.remote-session-message.is-error {
  color: #b93b2f;
}

.remote-session-actions {
  padding: 14px 20px 20px;
}

.remote-session-actions span {
  flex: 1;
}

.top-section-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 132px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #526273;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.top-section-button i {
  color: #718096;
  font-size: 18px;
}

.top-section-button:hover {
  border-color: #c9d4df;
  background: #f8fafc;
  color: #1f2d3a;
}

.top-section-button.active {
  border-color: rgba(8, 143, 157, 0.26);
  background: #e9fbfd;
  color: var(--teal-dark);
  box-shadow: inset 0 -2px 0 var(--teal);
}

.top-section-button.active i {
  color: var(--teal);
}

.digital-human-manager-workspace {
  display: grid;
  gap: 14px;
  padding: 16px 18px 24px;
}

.digital-human-manager-workspace[hidden] {
  display: none;
}

.digital-human-manager-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 2px 2px;
}

.digital-human-manager-header h2 {
  margin: 4px 0 0;
  color: #17242f;
  font-size: 22px;
  letter-spacing: 0;
}

.digital-human-manager-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.workspace-kicker {
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.digital-human-library-summary {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #cfe5e7;
  border-radius: 8px;
  background: #f4fbfc;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.digital-human-manager-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.72fr);
  align-items: start;
  gap: 14px;
}

.digital-human-library-panel,
.digital-human-upload-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.digital-human-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.digital-human-card {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  min-height: 192px;
  overflow: hidden;
  border: 1px solid #d9e2ea;
  border-radius: 8px;
  background: #fbfcfd;
}

.digital-human-card.is-selected {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px rgba(8, 143, 157, 0.18);
}

.digital-human-card.is-ineligible {
  background: #fcf9f8;
}

.digital-human-card-preview {
  position: relative;
  min-height: 192px;
  overflow: hidden;
  background: #17242f;
}

.digital-human-card-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.digital-human-status {
  position: absolute;
  left: 7px;
  bottom: 7px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.digital-human-status.is-ready {
  background: rgba(10, 126, 82, 0.9);
}

.digital-human-status.is-rejected {
  background: rgba(185, 59, 47, 0.92);
}

.digital-human-card-body {
  display: flex;
  min-width: 0;
  padding: 13px;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.digital-human-card-title {
  display: grid;
  gap: 5px;
}

.digital-human-card-title b {
  overflow-wrap: anywhere;
  color: #1f2d3a;
  font-size: 14px;
}

.digital-human-card-title span {
  color: #0a7e52;
  font-size: 11px;
  font-weight: 800;
}

.digital-human-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.digital-human-card-meta span {
  padding: 4px 6px;
  border-radius: 6px;
  background: #edf2f6;
  color: #536273;
  font-size: 10px;
  font-weight: 800;
}

.digital-human-select {
  justify-content: center;
  width: 100%;
}

.digital-human-validation-error {
  margin: 0;
  color: #b93b2f;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.digital-human-empty {
  display: grid;
  grid-column: 1 / -1;
  min-height: 210px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #cbd6df;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.digital-human-empty i {
  color: var(--teal);
  font-size: 26px;
}

.digital-human-empty.is-error i {
  color: #b93b2f;
}

.digital-human-file-field {
  display: grid;
  min-height: 132px;
  margin-top: 14px;
  padding: 16px;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed #9eb9c1;
  border-radius: 8px;
  background: #f5fafb;
  color: #2a3c48;
  cursor: pointer;
  text-align: center;
}

.digital-human-file-field:hover {
  border-color: var(--teal);
  background: #eef9fa;
}

.digital-human-file-field i {
  color: var(--teal-dark);
  font-size: 28px;
}

.digital-human-file-field b {
  font-size: 13px;
}

.digital-human-file-field span {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
}

.digital-human-file-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.digital-human-constraints {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.digital-human-constraints span {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  color: #536273;
  font-size: 11px;
  line-height: 1.45;
}

.digital-human-constraints i {
  flex: 0 0 auto;
  color: var(--teal-dark);
  font-size: 15px;
}

.digital-human-upload-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.digital-human-upload-action {
  justify-content: center;
  width: 100%;
  margin-top: 14px;
}

.digital-human-upload-status {
  min-height: 18px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.digital-human-upload-status.is-error {
  color: #b93b2f;
}

.digital-human-upload-status.is-success {
  color: #0a7e52;
}

.digital-human-upload-status.is-working {
  color: var(--teal-dark);
}

.voice-manager-workspace {
  display: grid;
  gap: 14px;
  padding: 16px 18px 24px;
}

.voice-manager-workspace[hidden] {
  display: none;
}

.voice-manager-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 2px 2px;
}

.voice-manager-header h2 {
  margin: 4px 0 0;
  color: #17242f;
  font-size: 22px;
}

.voice-manager-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.voice-library-summary {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #cfe5e7;
  border-radius: 8px;
  background: #f4fbfc;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.voice-manager-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.72fr);
  align-items: start;
  gap: 14px;
}

.voice-library-panel,
.voice-upload-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.voice-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.voice-library-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d9e2ea;
  border-radius: 8px;
  background: #fbfcfd;
}

.voice-library-card.is-selected {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px rgba(8, 143, 157, 0.18);
}

.voice-library-card.is-ineligible {
  background: #fcf9f8;
}

.voice-library-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.voice-library-card-title b {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #1f2d3a;
  font-size: 14px;
}

.voice-status {
  flex: 0 0 auto;
  padding: 4px 6px;
  border-radius: 6px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.voice-status.is-ready {
  background: #0a7e52;
}

.voice-status.is-rejected {
  background: #b93b2f;
}

.voice-library-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.voice-library-card audio {
  width: 100%;
  height: 34px;
}

.voice-select {
  justify-content: center;
  width: 100%;
}

.voice-empty {
  display: grid;
  grid-column: 1 / -1;
  min-height: 180px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #cbd6df;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.voice-empty i {
  color: var(--teal);
  font-size: 26px;
}

.voice-empty.is-error i {
  color: #b93b2f;
}

.voice-file-field {
  display: grid;
  min-height: 132px;
  margin-top: 14px;
  padding: 16px;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed #9eb9c1;
  border-radius: 8px;
  background: #f5fafb;
  color: #2a3c48;
  cursor: pointer;
  text-align: center;
}

.voice-file-field:hover {
  border-color: var(--teal);
  background: #eef9fa;
}

.voice-file-field i {
  color: var(--teal-dark);
  font-size: 28px;
}

.voice-file-field b {
  font-size: 13px;
}

.voice-file-field span {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
}

.voice-file-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.voice-constraints {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.voice-constraints span {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  color: #536273;
  font-size: 11px;
  line-height: 1.45;
}

.voice-constraints i {
  flex: 0 0 auto;
  color: var(--teal-dark);
  font-size: 15px;
}

.voice-upload-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.voice-upload-action {
  justify-content: center;
  width: 100%;
  margin-top: 14px;
}

.voice-upload-status {
  min-height: 18px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.voice-upload-status.is-error {
  color: #b93b2f;
}

.voice-upload-status.is-success {
  color: #0a7e52;
}

.voice-upload-status.is-working {
  color: var(--teal-dark);
}

.motion-output-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.motion-output-meta > span:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.spinning {
  animation: autovideo-spin 0.8s linear infinite;
}

@keyframes autovideo-spin {
  to { transform: rotate(360deg); }
}

.project-select {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  border-right: 1px solid var(--line);
}

.project-select button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #33404a;
  font-size: 13px;
  padding-left: 20px;
}

.env-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.env-pill.connected span {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.env-pill.dry-run span {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16);
}

.env-pill.unconnected span {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.primary-button,
.ghost-button,
.mini-button,
.full-button,
.table-more,
.docs-link,
.chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: #23313c;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  font-weight: 700;
}

.primary-button {
  border-color: var(--teal-dark);
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button:hover,
.mini-button:hover,
.full-button:hover,
.chip:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.ghost-button.compact {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 22px 56px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.real-run-panel {
  display: grid;
  gap: 12px;
  margin: 12px 14px 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.real-run-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.real-run-panel h2 {
  margin: 0;
  color: #16232d;
  font-size: 15px;
  font-weight: 800;
}

.real-run-panel header span {
  color: var(--muted);
  font-size: 12px;
}

.toggle-field,
.real-stage-row label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #2f3d48;
  font-size: 12px;
  font-weight: 700;
}

.toggle-field input,
.real-stage-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.real-run-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
}

.real-run-grid .wide {
  grid-column: span 1;
}

.real-stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding-top: 2px;
}

.real-stage-row .guard {
  color: #865a00;
}

.stage-step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #687581;
}

.stage-step::before {
  content: "";
  position: absolute;
  top: 18px;
  left: calc(-50% + 23px);
  right: calc(50% + 23px);
  height: 2px;
  background: var(--line-strong);
}

.stage-step:first-child::before {
  display: none;
}

.stage-step.completed::before,
.stage-step.active::before {
  background: var(--teal);
}

.step-badge {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #eef2f5;
  color: #58636d;
  font-weight: 800;
  z-index: 1;
}

.stage-step.active .step-badge {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal-dark);
  box-shadow: 0 0 0 5px rgba(0, 127, 143, 0.14);
}

.stage-step.completed:not(.active) .step-badge {
  background: #e9fbf6;
  color: var(--teal);
  border-color: var(--teal);
}

.stage-step b {
  color: #23313c;
  font-size: 13px;
}

.stage-step span {
  font-size: 12px;
}

.stage-card,
.queue-card,
.backend-panel,
.work-panel,
.copy-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stage-card {
  margin: 12px 14px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.section-header h2,
.tool-rail h2,
.work-panel h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.section-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.copywriting-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 14px 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.copywriting-titlebar h2 {
  margin: 0;
  color: #16232d;
  font-size: 18px;
  font-weight: 800;
}

.copywriting-titlebar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.copywriting-workspace {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 12px;
  padding: 12px 14px 0;
}

.copywriting-workspace[hidden] {
  display: none;
}

.title-topic-workspace {
  display: grid;
  padding: 12px 14px 0;
}

.title-topic-workspace[hidden] {
  display: none;
}

.audio-video-workspace {
  display: grid;
  padding: 12px 14px 0;
}

.audio-video-workspace[hidden] {
  display: none;
}

.audio-video-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(440px, 1.25fr);
  gap: 12px;
}

.av-panel {
  min-width: 0;
  min-height: 438px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.av-panel-header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin-bottom: 16px;
}

.av-panel h3 {
  margin: 0;
  color: #1c2a35;
  font-size: 15px;
  font-weight: 800;
}

.av-panel small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.av-field {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: #27343f;
  font-size: 12px;
  font-weight: 800;
}

.engine-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.engine-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #cfe5e7;
  border-radius: 8px;
  background: #f4fbfc;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.av-main-action {
  justify-content: center;
  width: 100%;
  margin-top: 14px;
}

.audio-preview {
  display: grid;
  min-height: 168px;
  margin-top: 16px;
  place-items: center;
  border: 1px solid #cfe5e7;
  border-radius: 8px;
  background: #f7fcfc;
}

.audio-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.audio-empty i {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 22px;
}

.audio-ready {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 14px;
}

.audio-ready b,
.audio-ready span {
  display: block;
}

.audio-ready b {
  color: #17242e;
  font-size: 14px;
}

.audio-ready span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.audio-ready audio {
  width: 100%;
}

.artifact-path {
  overflow-wrap: anywhere;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #31414c;
  font-size: 12px;
  line-height: 1.45;
}

.video-panel {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
}

.video-config-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr);
  gap: 12px;
}

.loop-mode-field {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.loop-mode-field legend {
  grid-column: 1 / -1;
  margin-bottom: -1px;
  color: #27343f;
  font-size: 12px;
  font-weight: 800;
}

.loop-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: #26343f;
  font-size: 12px;
  font-weight: 800;
}

.loop-option input {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

.digital-human-stage {
  display: grid;
  min-height: 440px;
  margin-top: 16px;
  place-items: center;
  border: 1px solid #d6e0e6;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(241, 247, 248, 0.96)),
    repeating-linear-gradient(90deg, transparent 0 20px, rgba(0, 127, 143, 0.05) 20px 21px);
}

.phone-preview {
  position: relative;
  width: min(258px, 92%);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 8px solid #111827;
  border-radius: 28px;
  background: linear-gradient(180deg, #e8f8f8 0%, #f7fbfb 48%, #dce9ee 100%);
  box-shadow: 0 24px 42px rgba(17, 24, 39, 0.16);
}

.phone-preview .generated-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #020617;
  z-index: 1;
}

.remotion-preview-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  width: min(360px, 100%);
}

.remotion-preview-strip img {
  aspect-ratio: 9 / 16;
  width: 100%;
  object-fit: cover;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: #020617;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.remotion-prompt-artifact {
  display: grid;
  grid-template-columns: 18px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: min(360px, 100%);
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(14, 165, 167, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.remotion-prompt-artifact i {
  color: var(--teal);
  font-size: 16px;
}

.remotion-prompt-artifact b {
  min-width: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtitle-motion-workspace {
  min-width: 0;
  padding: 24px 28px 36px;
}

.subtitle-motion-workspace[hidden] {
  display: none;
}

.publisher-workspace {
  min-width: 0;
  padding: 24px 28px 36px;
}

.publisher-workspace[hidden] {
  display: none;
}

.subtitle-motion-header,
.publisher-header,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.subtitle-motion-header,
.publisher-header {
  margin-bottom: 20px;
}

.subtitle-motion-header h2,
.publisher-header h2,
.section-heading h3 {
  margin: 0;
  color: #172033;
  letter-spacing: 0;
}

.subtitle-motion-header h2,
.publisher-header h2 {
  margin-top: 4px;
  font-size: 24px;
}

.subtitle-motion-header p,
.publisher-header p,
.section-heading small {
  display: block;
  margin: 5px 0 0;
  color: #718096;
}

.workspace-kicker {
  color: #0e9f6e;
  font-size: 12px;
  font-weight: 800;
}

.subtitle-motion-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(440px, 1.2fr);
  gap: 18px;
  align-items: start;
}

.publisher-grid {
  display: grid;
  grid-template-columns: minmax(430px, 1.05fr) minmax(360px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.publisher-settings,
.publisher-jobs {
  min-width: 0;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  background: #fff;
  padding: 20px;
}

.publisher-settings {
  display: grid;
  gap: 16px;
}

.publisher-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.publisher-targets {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.publisher-targets legend {
  margin-bottom: 8px;
  color: #536274;
  font-size: 12px;
  font-weight: 800;
}

.publisher-platform-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.publisher-platform {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
}

.publisher-platform > i {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  font-size: 17px;
}

.publisher-platform b {
  min-width: 0;
  overflow: hidden;
  color: #243044;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.publisher-readiness,
.publisher-job-summary {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: #edf2f7;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.publisher-readiness.ready,
.publisher-job-summary.published {
  background: #e8f8f1;
  color: #087f5b;
}

.publisher-job-summary.preparing,
.publisher-job-summary.waiting_confirmation,
.publisher-job-summary.publishing {
  background: #e8f1ff;
  color: #2563eb;
}

.publisher-job-summary.waiting_login,
.publisher-job-summary.needs_attention,
.publisher-job-summary.completed_with_errors {
  background: #fff7df;
  color: #a16207;
}

.publisher-job-summary.failed {
  background: #fff0f0;
  color: #d64545;
}

#publisherDescription {
  min-height: 170px;
  resize: vertical;
  line-height: 1.65;
}

.publisher-safety-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid #2563eb;
  padding: 12px 14px;
  background: #f1f6ff;
  color: #52647b;
  font-size: 13px;
  line-height: 1.6;
}

.publisher-safety-note i {
  margin-top: 2px;
  color: #2563eb;
  font-size: 18px;
}

.publisher-job-list {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.publisher-empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #cbd5e1;
  color: #8291a5;
  text-align: center;
}

.publisher-empty i {
  color: #2563eb;
  font-size: 32px;
}

.publisher-empty b {
  color: #405168;
}

.publisher-empty span {
  max-width: 280px;
  font-size: 12px;
  line-height: 1.5;
}

.publisher-job {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fbfcfe;
}

.publisher-job > i {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  font-size: 18px;
}

.publisher-job-copy {
  min-width: 0;
}

.publisher-job-copy b,
.publisher-job-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.publisher-job-copy b {
  color: #243044;
  font-size: 13px;
}

.publisher-job-copy span {
  margin-top: 3px;
  color: #75849a;
  font-size: 11px;
}

.publisher-job-actions {
  display: flex;
  gap: 6px;
}

.publisher-job-actions button {
  min-height: 30px;
  border: 1px solid #cfd8e5;
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
  color: #42526a;
  font-size: 11px;
  font-weight: 800;
}

.publisher-job-actions button.primary {
  border-color: #0e9f6e;
  background: #0e9f6e;
  color: #fff;
}

.subtitle-motion-source,
.subtitle-motion-output {
  min-width: 0;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  background: #fff;
  padding: 20px;
}

.subtitle-motion-source {
  display: grid;
  gap: 16px;
}

.source-readiness,
.render-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: #edf2f7;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.source-readiness.ready,
.render-status.succeeded {
  background: #e8f8f1;
  color: #087f5b;
}

.render-status.running {
  background: #e8f1ff;
  color: #2563eb;
}

.render-status.failed {
  background: #fff0f0;
  color: #d64545;
}

#subtitleMotionScript {
  min-height: 150px;
  resize: vertical;
  line-height: 1.7;
}

.alignment-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-left: 3px solid #10b981;
  background: #f0fbf7;
  padding: 12px 14px;
  color: #476257;
  font-size: 13px;
  line-height: 1.6;
}

.alignment-note i {
  margin-top: 2px;
  color: #0e9f6e;
  font-size: 18px;
}

.subtitle-motion-preview-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-height: 128px;
  margin-top: 18px;
}

.subtitle-motion-preview-strip img,
.preview-placeholder {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  border: 1px solid #dfe6ef;
  background: #f5f7fa;
  object-fit: cover;
}

.preview-placeholder {
  grid-column: 1 / -1;
  aspect-ratio: auto;
  display: grid;
  min-height: 128px;
  place-items: center;
  color: #94a3b8;
  font-size: 13px;
}

.subtitle-motion-stage {
  margin-top: 14px;
  min-height: 380px;
  border-radius: 8px;
  background: #101722;
  overflow: hidden;
}

.subtitle-motion-stage video {
  display: block;
  width: 100%;
  max-height: 620px;
  background: #080c12;
  object-fit: contain;
}

.motion-empty {
  min-height: 380px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: #d5dee9;
}

.motion-empty i {
  color: #34d399;
  font-size: 34px;
}

.motion-empty span {
  color: #8190a5;
  font-size: 12px;
}

.subtitle-motion-artifacts {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.subtitle-motion-artifacts:empty {
  display: none;
}

.motion-artifact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 9px;
  align-items: center;
  border-bottom: 1px solid #edf1f5;
  padding: 8px 0;
  color: #667085;
  font-size: 12px;
}

.motion-artifact i {
  grid-row: 1 / 3;
  color: #0e9f6e;
  font-size: 18px;
}

.motion-artifact b {
  overflow-wrap: anywhere;
  color: #2e3a4d;
  font-weight: 600;
}

.phone-status {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 74px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #111827;
  z-index: 2;
}

.human-figure {
  position: absolute;
  left: 50%;
  bottom: 92px;
  width: 134px;
  height: 210px;
  transform: translateX(-50%);
}

.human-head,
.human-body,
.human-mic {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.human-head {
  top: 0;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f7d7bd, #e8b58f);
  box-shadow: inset 0 -6px 0 rgba(126, 74, 45, 0.12);
}

.human-body {
  bottom: 0;
  width: 130px;
  height: 148px;
  border-radius: 48px 48px 18px 18px;
  background: linear-gradient(180deg, var(--teal), #104e5d);
}

.human-mic {
  top: 92px;
  width: 20px;
  height: 54px;
  border-radius: 999px;
  background: #111827;
}

.stage-caption,
.stage-meta {
  position: absolute;
  left: 14px;
  right: 14px;
  z-index: 3;
}

.stage-caption {
  bottom: 46px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.82);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.stage-meta {
  bottom: 14px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
}

.stage-meta span {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-preview.is-generated .human-head {
  animation: avTalk 1.2s ease-in-out infinite;
}

@keyframes avTalk {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(3px);
  }
}

.title-topic-panel {
  min-height: 438px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.title-topic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.title-topic-header h2 {
  margin: 0;
  color: #17242e;
  font-size: 18px;
  font-weight: 900;
}

.title-topic-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.title-topic-fields {
  display: grid;
  gap: 16px;
  max-width: 760px;
  margin-top: 18px;
}

.title-topic-field {
  display: grid;
  gap: 8px;
  color: #26343f;
  font-size: 13px;
  font-weight: 800;
}

.copy-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 438px;
  padding: 14px;
}

.copy-panel header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin-bottom: 12px;
}

.extract-panel header {
  grid-template-columns: 34px minmax(0, 1fr);
}

.copy-step {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.copy-panel h3 {
  margin: 0;
  color: #1c2a35;
  font-size: 15px;
  font-weight: 800;
}

.copy-panel small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.copy-field {
  display: grid;
  gap: 7px;
  color: #27343f;
  font-size: 12px;
  font-weight: 800;
}

.copy-action {
  justify-content: center;
  width: 100%;
  margin-top: 12px;
}

.extract-progress {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #cfe5e7;
  border-radius: 8px;
  background: #f7fcfc;
}

.extract-progress[hidden] {
  display: none;
}

.extract-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #31414c;
  font-size: 12px;
  font-weight: 800;
}

.extract-progress-meta b {
  color: var(--teal-dark);
  font-variant-numeric: tabular-nums;
}

.extract-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3eef0;
}

.extract-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #16a34a);
  transition: width 0.35s ease;
}

.extract-progress.is-complete {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.extract-progress.is-error {
  border-color: #fecaca;
  background: #fff7f7;
}

.extract-progress.is-error .extract-progress-fill {
  background: var(--red);
}

.extract-progress.is-error .extract-progress-meta b {
  color: var(--red);
}

.copy-editor {
  flex: 1;
  min-height: 360px;
  resize: vertical;
  color: #1f2d38;
  font-size: 14px;
  line-height: 1.65;
}

.editor-panel .compact {
  white-space: nowrap;
}

.stage-config {
  display: grid;
  grid-template-columns: 330px 1fr;
  min-height: 156px;
}

.account-box,
.settings-box {
  padding: 14px 16px;
}

.account-box {
  border-right: 1px solid var(--line);
}

.box-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #24323d;
  font-size: 13px;
  font-weight: 800;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.account {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 9px;
}

.account img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.account b,
.form-field label,
.metric-label {
  display: block;
  color: #27343f;
  font-size: 12px;
  font-weight: 800;
}

.account span {
  color: var(--muted);
  font-size: 12px;
}

.add-account {
  border: 1px dashed var(--line-strong);
  background: transparent;
  border-radius: 8px;
  min-height: 40px;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-grid .wide {
  grid-column: span 2;
}

.form-field {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  height: 34px;
  padding: 0 10px;
}

textarea {
  resize: none;
  padding: 10px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 127, 143, 0.12);
}

.queue-card {
  margin: 12px 14px 0;
  overflow: hidden;
}

.queue-metrics {
  display: grid;
  grid-template-columns: 78px 78px 78px 78px 78px 1fr 110px 110px;
  align-items: center;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
}

.metric {
  padding: 0 16px;
  border-right: 1px solid var(--line);
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.metric strong.green { color: var(--green); }
.metric strong.blue { color: var(--blue); }
.metric strong.amber { color: var(--amber); }
.metric strong.red { color: var(--red); }

.progress-metric {
  padding: 0 18px;
  border-right: 1px solid var(--line);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: #33404a;
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  height: 5px;
  margin: 9px 0 5px;
  border-radius: 999px;
  background: #e2e8ee;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.queue-table {
  font-size: 12px;
}

.table-head,
.queue-row {
  display: grid;
  grid-template-columns: 2fr 1.6fr 1.4fr 1fr 1fr 1fr 80px;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.table-head {
  color: var(--muted);
  font-weight: 800;
}

.queue-row:hover {
  background: #fbfcfd;
}

.task-name {
  display: flex;
  align-items: center;
  gap: 9px;
}

.task-name i {
  color: var(--teal);
  font-size: 16px;
}

.mini-progress {
  display: grid;
  grid-template-columns: 1fr 38px;
  align-items: center;
  gap: 8px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.row-actions button {
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
}

.row-actions button:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.table-more {
  width: 100%;
  min-height: 34px;
  border-width: 0;
  border-radius: 0;
  color: var(--blue);
  font-weight: 700;
}

.backend-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px 0;
}

.backend-panel {
  min-width: 0;
  padding: 10px;
}

.backend-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
}

.backend-panel h3 {
  margin: 0;
  color: #23313c;
  font-size: 15px;
  font-weight: 800;
}

.log-list,
.artifact-list {
  display: grid;
  gap: 6px;
  min-height: 78px;
  max-height: 158px;
  margin-top: 9px;
  overflow: auto;
}

.log-line,
.artifact-line {
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  color: #33404a;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.log-line b,
.artifact-line b {
  color: var(--teal-dark);
  font-weight: 800;
}

.work-panels {
  display: grid;
  grid-template-columns: 1.15fr 1.05fr 1.05fr 0.98fr 1.18fr 0.98fr;
  gap: 8px;
  padding: 12px 14px 14px;
}

.work-panel {
  min-width: 0;
  min-height: 252px;
  padding: 10px;
}

.work-panel header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 26px;
}

.work-panel h3 {
  flex: 0 0 auto;
  white-space: nowrap;
}

.work-panel header span {
  color: var(--muted);
  font-size: 11px;
}

.success-pill {
  margin-left: 0;
  padding: 3px 7px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 11px;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 10px;
}

.thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  background: #111;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb span {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 10px;
}

.work-panel footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.mini-button,
.full-button {
  min-height: 30px;
  padding: 0 10px;
  font-weight: 700;
}

.full-button {
  width: 100%;
  margin-top: 9px;
}

.transcript-list {
  display: grid;
  gap: 8px;
  margin-top: 11px;
  color: #33404a;
}

.transcript-line time {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  margin-bottom: 3px;
}

.transcript-line p {
  margin: 0;
  line-height: 1.42;
}

.field-label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.slider-row {
  display: grid;
  grid-template-columns: 34px 1fr 48px;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  color: #34424d;
  font-size: 12px;
}

input[type="range"] {
  height: 4px;
  padding: 0;
  accent-color: var(--teal);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.chip.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.voice-card {
  position: relative;
  min-height: 82px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.voice-card img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  object-position: center;
  opacity: 0.9;
}

.round-play {
  position: absolute;
  left: 10px;
  top: 25px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  z-index: 1;
}

.voice-card span {
  position: absolute;
  right: 8px;
  top: 30px;
  color: #4b5563;
  font-size: 11px;
  font-weight: 800;
}

.video-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  margin-top: 9px;
  border-radius: 7px;
  background: #111;
}

.video-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 35px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.caption b {
  color: #facc15;
}

.video-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  font-size: 11px;
}

.video-controls i:nth-last-child(2) {
  margin-left: auto;
}

.platform-list {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.platform {
  display: flex;
  align-items: center;
  gap: 8px;
}

.platform i {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  font-size: 15px;
}

.platform span {
  flex: 1;
  font-weight: 700;
}

.switch {
  position: relative;
  width: 34px;
  height: 19px;
  border: 0;
  border-radius: 999px;
  background: #cbd5df;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.switch.on {
  background: var(--teal);
}

.switch.on::after {
  transform: translateX(15px);
}

.tool-rail {
  border-width: 0 0 0 1px;
  padding: 16px 14px;
}

.tool-rail header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tool-list {
  display: grid;
  gap: 10px;
}

.tool-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tool-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 127, 143, 0.1);
}

.tool-card img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: cover;
}

.api-tool {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

.tool-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 20px;
}

.tool-card b {
  display: block;
  font-size: 13px;
}

.tool-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.tool-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.25;
}

.tool-badges {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.status-badge {
  min-width: 46px;
  padding: 4px 6px;
  border-radius: 7px;
  background: #e5e7eb;
  color: #374151;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

.status-badge.configured {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.missing {
  background: #fee2e2;
  color: #b91c1c;
}

.status-badge.unknown {
  background: #fef3c7;
  color: #92400e;
}

.star-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 54px;
  justify-content: center;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #27343f;
  font-size: 12px;
  font-weight: 800;
}

.docs-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  border: 0;
  color: #33404a;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  max-width: 360px;
  transform: translate(-50%, 20px);
  padding: 10px 14px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.35);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal h2 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding: 16px;
  color: #33404a;
  line-height: 1.6;
}

.modal-body ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

@media (max-width: 1390px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .tool-rail {
    display: none;
  }

  .brand {
    grid-template-columns: 34px;
    justify-content: center;
  }

  .brand div,
  .collapse-button,
  .module-button span,
  .module-button b,
  .plain-nav span,
  .profile div {
    display: none;
  }

  .module-button,
  .plain-nav {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .profile {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .work-panels {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .copywriting-workspace {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .digital-human-manager-grid,
  .voice-manager-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  }

  .extract-panel {
    grid-column: 1 / -1;
    min-height: 188px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    padding: 12px;
  }

  .top-section-nav {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .top-section-button {
    flex: 0 0 auto;
    min-width: 118px;
    padding: 0 12px;
  }

  .pipeline {
    overflow-x: auto;
    grid-template-columns: repeat(5, 150px);
    padding-inline: 16px;
  }

  .stage-config,
  .settings-grid,
  .real-run-grid,
  .backend-panels,
  .work-panels,
  .copywriting-workspace,
    .title-topic-fields,
    .audio-video-grid,
    .digital-human-manager-grid,
    .voice-manager-grid,
    .subtitle-motion-grid,
  .video-config-grid,
  .loop-mode-field {
    grid-template-columns: 1fr;
  }

  .digital-human-manager-header,
  .voice-manager-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .digital-human-manager-workspace,
  .voice-manager-workspace {
    padding: 14px 12px 22px;
  }

  .digital-human-constraints,
  .voice-constraints {
    grid-template-columns: 1fr;
  }

  .copywriting-titlebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .copy-panel,
  .extract-panel {
    grid-column: auto;
    min-height: 0;
  }

  .copy-editor {
    min-height: 280px;
  }

  .title-topic-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .subtitle-motion-header,
  .publisher-header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .subtitle-motion-preview-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .publisher-grid,
  .publisher-field-grid,
  .publisher-platform-list {
    grid-template-columns: 1fr;
  }

  .real-run-panel header {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-box {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .queue-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-head,
  .queue-row {
    grid-template-columns: 1.3fr 1fr 1fr;
  }

  .table-head span:nth-child(n + 4),
  .queue-row > span:nth-child(n + 4),
  .queue-row > div:nth-child(n + 4) {
    display: none;
  }
}
