:root {
  color-scheme: dark;
  --ink: #f9fbfc;
  --muted: #b6bbc2;
  --line: rgba(249, 251, 252, 0.14);
  --paper: #080808;
  --panel: #151516;
  --panel-soft: #1d1d1f;
  --accent: #f9fbfc;
  --accent-ink: #080808;
  --accent-2: #d5ff4f;
  --text: #f9fbfc;
  --text3: #b6bbc2;
  --surface: #1d1d1f;
  --bg: #101011;
  --border: rgba(249, 251, 252, 0.14);
  --accent-bg: rgba(213, 255, 79, 0.14);
  --accent-light: #e3ff9a;
  --error: #e85c62;
  --red: #ff979b;
  --red-bg: rgba(232, 92, 98, 0.14);
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  min-height: 38px;
  padding: 0 16px;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.95);
}

button.secondary {
  background: rgba(249, 251, 252, 0.08);
  color: var(--ink);
  border: 1px solid var(--line);
}

#recharge,
#rechargeBtn,
.op-card[href="#recharge"] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 66px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 8, 0.9);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.brand:hover {
  background: transparent;
  filter: none;
}

.brand-home {
  min-height: 42px;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 7px;
  overflow: hidden;
  background: transparent;
  color: transparent;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-copy {
  display: block;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.top-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 11px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.nav-tab:hover,
.nav-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  filter: none;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  margin: 22px 0 4px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.header-account {
  justify-self: end;
  flex: 0 0 auto;
}

.guest-home {
  max-width: 1060px;
  margin: 5vh auto 0;
}

.guest-hero {
  max-width: 740px;
  padding: 36px 0 28px;
}

.guest-hero h1 {
  margin: 10px 0 12px;
  font-size: 34px;
  line-height: 1.25;
}

.guest-hero > p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

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

.guest-entry-card {
  display: grid;
  gap: 12px;
  min-height: 250px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.guest-entry-card h2,
.guest-entry-card p {
  margin: 0;
}

.guest-entry-card p {
  color: var(--muted);
  line-height: 1.75;
}

.guest-entry-card button {
  align-self: end;
  justify-self: start;
}

.guest-entry-index {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}

.pipeline-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 22px 0;
}

.pipeline-step {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-height: 46px;
  padding: 0 12px;
  color: var(--muted);
  background: #f6f8fb;
  border: 1px solid var(--line);
}

.pipeline-step span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dfe8ef;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.pipeline-step.active,
.pipeline-step.done {
  border-color: var(--accent);
  color: var(--ink);
  background: #edf6f6;
}

.pipeline-step.active span,
.pipeline-step.done span {
  background: var(--accent);
  color: #fff;
}

.pipeline-stage {
  min-height: 410px;
}

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

.pipeline-stage-head h3,
.pipeline-stage-head p {
  margin: 0;
}

.pipeline-textarea {
  width: 100%;
  min-height: 360px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  line-height: 1.7;
  resize: vertical;
}

.pipeline-shot-list,
.pipeline-prompt-list {
  display: grid;
  gap: 12px;
}

.pipeline-shot-card,
.pipeline-prompt-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

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

.pipeline-shot-card textarea,
.pipeline-prompt-card textarea {
  width: 100%;
  min-height: 96px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  line-height: 1.6;
  resize: vertical;
}

.pipeline-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
}

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

.pipeline-draft-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fcfcfb;
}

.pipeline-brief {
  margin: 14px 0 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.pipeline-brief-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pipeline-brief-head h3,
.pipeline-brief-head p {
  margin: 0;
}

.topbar-spacer {
  flex: 1;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
}

.account-panel {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-links,
.signed-account {
  display: flex;
  align-items: center;
  gap: 10px;
}

.signed-account[hidden],
#guestAuthLinks[hidden] {
  display: none !important;
}

.link-button {
  min-height: 30px;
  padding: 0 4px;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
}

.link-button:hover {
  filter: none;
  text-decoration: underline;
}

.account-panel span,
.stat-row span,
.referral-box span,
.admin-card strong,
.admin-card span {
  display: block;
}

.account-panel span,
.stat-row span,
.referral-box span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.account-panel strong {
  display: block;
  margin: 0;
  font-size: 14px;
  color: var(--accent);
}

.signed-account button {
  min-height: 30px;
  padding: 0 10px;
}

.modal-card {
  border: 0;
  box-shadow: none;
  padding: 0;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-head h3 {
  margin: 0;
}

.icon-close {
  display: grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 6px;
  background: #eef3f6;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
}

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

.guide-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.guide-card span {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #dfe8ef;
  color: var(--ink);
  font-weight: 800;
}

.guide-card strong {
  font-size: 16px;
}

.guide-card p,
.guide-cost p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.guide-flow,
.guide-cost,
.admin-home {
  margin-top: 14px;
}

.guide-flow ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

.danger-text {
  color: #b91c1c;
}

.success-text {
  color: #15803d;
}

.hero-board,
.quick-composer,
.panel,
.auth-card,
.admin-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-board {
  overflow: hidden;
}

.hero-copy {
  padding: 24px;
}

.hero-copy h2,
.section-head h2,
.two-column h2 {
  margin: 4px 0 8px;
  font-size: 24px;
}

.hero-copy p:last-child,
.muted,
.knowledge-item p,
.asset-card p,
.memory-card p,
.referral-box p {
  color: var(--muted);
  line-height: 1.65;
}

.hero-board img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-top: 1px solid var(--line);
}

.quick-composer,
.panel {
  padding: 20px;
}

.panel {
  margin-top: 18px;
}

.app-page[hidden] {
  display: none !important;
}

.app-page {
  margin-top: 0;
}

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

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

.op-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
  text-decoration: none;
  color: inherit;
}

.op-card strong {
  font-size: 16px;
}

.op-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.section-head.compact h3 {
  margin: 4px 0 0;
  font-size: 18px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: #eef2f6;
  border-radius: 7px;
  border: 1px solid var(--line);
}

.segmented button {
  min-height: 30px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(24, 32, 44, 0.12);
}

.form-grid,
.auth-grid,
.admin-tables {
  display: grid;
  gap: 12px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ew-upload-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 480px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.ew-upload-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}
.ew-upload-form input[type="text"],
.ew-upload-form textarea {
  font-size: 0.9rem;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.ew-file-label {
  cursor: pointer;
  padding: 10px 14px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  transition: border-color .2s;
}
.ew-file-label:hover { border-color: var(--primary); color: var(--primary); }
.ew-file-label input[type="file"] { display: none; }

.compact-form {
  margin-bottom: 12px;
}

.creator-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.image-prompt-panel,
.video-prompt-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.image-prompt-heading {
  grid-column: 1 / -1;
  font-weight: 700;
  color: var(--text);
}

.field-hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(150px, 0.75fr);
  gap: 8px;
}

.wide {
  grid-column: 1 / -1;
}

.workflow-linkage {
  margin-top: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.workflow-linkage summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
}

.workflow-linkage .link-grid {
  margin-top: 12px;
}

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

.auth-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-tables {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.admin-grid,
.stat-row {
  display: grid;
  gap: 10px;
}

.admin-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-row {
  grid-template-columns: repeat(3, 1fr);
}

.admin-card,
.auth-card,
.table-card {
  padding: 16px;
}

.admin-card strong {
  color: var(--muted);
  font-size: 12px;
}

.admin-card span {
  margin-top: 8px;
  font-size: 26px;
  color: var(--ink);
  font-weight: 700;
}

.session-stats {
  margin-top: 12px;
}

.mini-table {
  display: grid;
  gap: 10px;
}

.mini-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

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

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

.table-card h3,
.auth-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 251, 252, 0.14);
}

textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.55;
}

.button-row,
.auth-tools,
.dialog-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.auth-tools {
  justify-content: flex-end;
}

#promptOutput {
  margin-top: 14px;
  min-height: 340px;
  background: #101820;
  color: #e9f7f6;
  border-color: #101820;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  line-height: 1.7;
}

.prompt-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.parameter-video-studio {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

#videoLab.parameter-video-active .creator-strip,
#videoLab.parameter-video-active .image-prompt-panel,
#videoLab.parameter-video-active .video-prompt-panel,
#videoLab.parameter-video-active .non-seedance-only,
#videoLab.parameter-video-active .image-only,
#videoLab.parameter-video-active .image-video-only,
#videoLab.parameter-video-active .workflow-linkage,
#videoLab.parameter-video-active .prompt-result-head,
#videoLab.parameter-video-active #promptOutput,
#videoLab.parameter-video-active .legacy-parameter-hidden {
  display: none !important;
}

.parameter-video-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(190px, 0.8fr) minmax(140px, auto) auto;
  align-items: end;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.parameter-video-toolbar strong {
  padding-bottom: 10px;
  white-space: nowrap;
}

.parameter-video-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.parameter-video-segments {
  display: grid;
  gap: 0;
}

.parameter-video-segment {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.parameter-video-segment:last-child {
  border-bottom: 0;
}

.parameter-video-segment > header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  margin-bottom: 12px;
}

.parameter-video-segment > header strong {
  font-size: 16px;
}

.parameter-video-segment > header span {
  color: var(--muted);
  font-size: 13px;
}

.parameter-video-segment > header button {
  margin-left: auto;
}

.parameter-video-segment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(280px, 0.85fr);
  gap: 14px;
}

.parameter-video-segment-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.parameter-video-segment-grid h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.parameter-reference-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.parameter-reference-heading h3 {
  margin: 0;
}

.parameter-reference-picker {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.parameter-reference-picker select {
  min-width: 0;
  padding: 7px 8px;
  font-size: 12px;
}

.parameter-reference-picker button,
.parameter-remove-reference-btn {
  min-height: 30px;
  padding: 0 9px;
  white-space: nowrap;
  font-size: 12px;
}

.parameter-remove-reference-btn {
  margin-left: 4px;
  border: 0;
  background: transparent;
  color: var(--accent-2);
}

.parameter-video-segment textarea {
  min-height: 260px;
  border-color: #d9e0e9;
  background: #fbfcfe;
  font-size: 13px;
}

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

.parameter-reference-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.parameter-reference-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parameter-reference-card b {
  color: var(--accent);
}

.parameter-reference-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f2f5f8;
}

.parameter-reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 900px) {
  .parameter-video-toolbar,
  .parameter-video-segment-grid {
    grid-template-columns: 1fr;
  }

  .parameter-video-toolbar strong {
    padding-bottom: 0;
  }

  .parameter-video-actions {
    justify-content: flex-start;
  }

  .parameter-reference-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .parameter-video-segment {
    padding: 12px;
  }

  .parameter-video-segment > header {
    flex-wrap: wrap;
  }

  .parameter-video-segment > header button {
    margin-left: 0;
  }
}

.knowledge-controls {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

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

.learning-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.learning-course-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.learning-course-card h3,
.learning-course-card p {
  margin: 0;
}

.learning-course-card h3 {
  font-size: 16px;
}

.learning-course-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.course-open-link {
  margin-top: auto;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}

.knowledge-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.knowledge-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.tag {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e8f2ef;
  color: #24604d;
  font-size: 12px;
  font-weight: 700;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.reference-grid {
  display: grid;
  gap: 14px;
}

.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
  font-size: 0.85rem;
}
.pagination-row .page-info {
  color: var(--muted);
  min-width: 140px;
  text-align: center;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}

.category-chip span {
  color: var(--muted);
  font-size: 12px;
}

.category-chip.active {
  border-color: var(--accent);
  background: #e8f2ef;
  color: var(--accent);
}

.visual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

.visual-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(24, 32, 44, 0.06);
}

.visual-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #eef3f6;
}

.visual-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visual-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.visual-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.visual-title {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.visual-prompt {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.visual-prompt.empty {
  color: #9aa5b5;
}

.visual-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

.visual-actions button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.visual-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.media-card {
  cursor: pointer;
}

.media-badge,
.play-mark {
  position: absolute;
  z-index: 2;
}

.media-badge {
  top: 8px;
  left: 8px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(16, 24, 32, 0.74);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.play-mark {
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 34px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.visual-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status-pending {
  background: #fff3d6;
  color: #8a5a00;
}

.status-rejected {
  background: #ffe4e6;
  color: #9f1239;
}

.danger {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}

button.danger,
button.secondary.danger {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}

.notice-inline {
  padding: 10px 12px;
  border: 1px solid #f5d78e;
  border-radius: 8px;
  background: #fff8e5;
  color: #75510b;
}

.media-preview-card {
  position: relative;
  width: min(900px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

#mediaPreviewDialog {
  width: min(900px, 90vw);
  max-height: 90vh;
  padding: 0;
  overflow: hidden;
}

.media-preview-body {
  display: block;
  min-width: 0;
  overflow: hidden;
}

.media-preview-card .modal-head {
  position: sticky;
  top: 0;
  z-index: 6;
  margin: 0;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.media-preview-card .modal-head h3 {
  margin: 0;
  max-width: calc(100% - 48px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-media {
  width: 100%;
  max-height: 450px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #101820;
}

.modal-media img,
.modal-media video {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 450px;
  object-fit: contain;
}

.modal-media video {
  outline: none;
}

.modal-body {
  padding: 20px 24px;
}

.modal-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.modal-prompt-section,
.modal-note-section {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.modal-note-section {
  background: #fbf8ff;
}

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

.prompt-header span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.modal-prompt-text,
.modal-note-text {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Legacy preview classes kept harmless for any older rendered modal. */
.preview-stage {
  display: flex;
  place-items: center;
  min-width: 0;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #101820;
}

.preview-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(16, 24, 32, 0.72);
  color: #fff;
}

.preview-copy {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  overflow: auto;
}

.preview-copy pre {
  max-height: 48vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.image-preview-layout .preview-copy {
  max-height: 24vh;
}

.image-preview-layout .preview-copy pre {
  max-height: 14vh;
}

.taxonomy-panel {
  display: grid;
  gap: 8px;
}

.taxonomy-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.taxonomy-group summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 800;
}

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

.taxonomy-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.taxonomy-items div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.taxonomy-items p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
}

.camera-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(24, 32, 44, 0.06);
}

.camera-card video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #101820;
  object-fit: cover;
}

.camera-card-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.camera-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-row span {
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef3f6;
  color: var(--muted);
  font-size: 11px;
}

.asset-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.reference-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.reference-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: linear-gradient(135deg, #e8f2ef, #f6ebe8);
  color: var(--accent);
  font-weight: 800;
}

.gate-card {
  max-width: 520px;
}

.asset-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.asset-image-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  margin: 0 0 12px;
}

.asset-card div {
  padding: 11px;
}

.asset-card strong,
.memory-card strong {
  display: block;
  margin-bottom: 6px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(280px, 1.1fr);
  gap: 18px;
}

.memory-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.list-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.memory-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 10px;
}

.flow span {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
  text-align: center;
  font-weight: 700;
}

.flow span:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -10px;
  width: 10px;
  height: 2px;
  background: var(--accent);
}

.referral-box,
.image-preview {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.referral-box strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
  color: var(--accent);
}

.schema-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.schema-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.schema-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.schema-card code {
  display: block;
  color: var(--muted);
  line-height: 1.65;
  white-space: pre-wrap;
}

.image-preview {
  min-height: 58px;
  display: grid;
  gap: 10px;
}

.image-preview img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
}

.admin-only[hidden] {
  display: none;
}

.project-list,
.mini-table {
  display: grid;
  gap: 10px;
}

.project-card,
.mini-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.project-card strong,
.mini-row strong {
  display: block;
  margin-bottom: 4px;
}

.project-card pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  color: var(--muted);
  line-height: 1.5;
  font-family: inherit;
}

dialog {
  width: min(560px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(18, 28, 39, 0.38);
}

dialog h3 {
  margin: 0 0 14px;
}

dialog form {
  display: grid;
  gap: 12px;
}

@media (max-width: 1120px) {
  .workspace-grid,
  .two-column,
  .auth-grid,
  .admin-tables {
    grid-template-columns: 1fr;
  }

  .asset-grid,
  .schema-grid,
  .admin-grid,
  .guide-grid,
  .creator-strip,
  .image-prompt-panel,
  .video-prompt-panel,
  .link-grid,
  .ops-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .flow {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }

  .flow span::after {
    display: none;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  main {
    padding: 16px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .guest-entry-grid,
  .pipeline-stepper {
    grid-template-columns: 1fr;
  }

  .guest-hero {
    padding-top: 10px;
  }

  .guest-hero h1 {
    font-size: 28px;
  }

  .pipeline-stage-head {
    align-items: stretch;
    flex-direction: column;
  }

  .pipeline-head-actions,
  .pipeline-draft-bar {
    justify-content: flex-start;
  }

  .form-grid,
  .creator-strip,
  .image-prompt-panel,
  .video-prompt-panel,
  .field-pair,
  .knowledge-controls,
  .asset-grid,
  .schema-grid,
  .admin-grid,
  .guide-grid,
  .link-grid,
  .ops-grid,
  .reference-grid,
  .visual-grid,
  .camera-grid,
  .media-preview-body,
  .taxonomy-items,
  .stat-row,
  .flow {
    grid-template-columns: 1fr;
  }

  .media-preview-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .preview-stage {
    min-height: 240px;
  }

  .image-preview-layout .preview-stage {
    aspect-ratio: 16 / 9;
    max-height: 64vh;
  }

  .preview-stage img,
  .preview-stage video {
    max-height: none;
  }
}

.global-notice {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  background: var(--error, #e5484d);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  max-width: 80vw;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
  animation: slideDown .3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ====== AI 分镜分析样式 ====== */
.analysis-loading {
  padding: 24px;
  text-align: center;
  color: var(--text3);
  background: var(--surface);
  border-radius: 12px;
  border: 1px dashed var(--border);
  margin-top: 16px;
}
.analysis-block { margin-top: 20px; }
.analysis-block h3 {
  font-size: 14px;
  margin: 0 0 10px 0;
  color: var(--text);
}
.analysis-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.analysis-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.ac-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.ac-icon {
  font-weight: 700;
  color: var(--accent);
}
.ac-prompt {
  margin-top: 10px;
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
}
.ac-prompt > span { font-size: 10px; color: var(--text3); display: block; margin-bottom: 4px; }
.ac-prompt > code {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  color: var(--text);
  font-size: 11px;
}
.copy-btn-sm {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
}
.copy-btn-sm:hover { background: var(--accent-bg); }

.ac-shots-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.btn-sm {
  font-size: 11px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn-sm:hover { background: var(--accent-bg); color: var(--accent); }

.shot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
}
.shot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.shot-num {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.shot-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.sa-item {
  padding: 4px 8px;
  background: var(--bg);
  border-radius: 5px;
}
.sa-label {
  font-size: 10px;
  color: var(--text3);
  display: block;
}
.sa-item > span:last-child { font-size: 11px; color: var(--text); }
.shot-dialogue {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(245, 158, 11, .08);
  border-radius: 6px;
  font-size: 11px;
}
.shot-dialogue > span { font-size: 10px; color: #f59e0b; }
.shot-dialogue p { margin: 4px 0 0 0; white-space: pre-wrap; line-height: 1.5; }
.shot-final-prompt {
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(124, 58, 237, .06), rgba(168, 85, 247, .03));
  border: 1px solid rgba(124, 58, 237, .2);
  border-radius: 8px;
  padding: 10px 12px;
}
.shot-final-prompt > span { font-size: 10px; color: var(--accent-light); display: block; margin-bottom: 4px; }
.shot-final-prompt > code {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-size: 11px;
  color: var(--text);
}
.notice-error {
  padding: 12px;
  background: var(--red-bg, rgba(220, 53, 69, .1));
  border-radius: 8px;
  color: var(--red, #dc3545);
  font-size: 12px;
  margin-top: 12px;
}

/* ====== 知识库关键词面板 ====== */
.kb-hint-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.kb-hint-panel .chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-hint-panel .kb-chip {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--panel);
  color: var(--ink);
  transition: all 0.15s;
  user-select: none;
}
.kb-hint-panel .kb-chip:hover { border-color: var(--accent); color: var(--accent); }
.kb-hint-panel .kb-chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.kb-hint-panel .kb-chip-more {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ====== Admin-only 可见性控制 ====== */
.admin-only { display: none !important; }
.user-is-admin .admin-only { display: revert !important; }

.vector-probe-results {
  display: grid;
  margin-top: 12px;
}

.vector-probe-row {
  display: grid;
  grid-template-columns: 28px minmax(160px, 2fr) minmax(90px, 1fr) minmax(120px, 1fr) 72px;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.vector-probe-row span:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.system-knowledge-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin: 0 0 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.knowledge-empty-state {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  line-height: 1.6;
}

.knowledge-empty-state strong {
  color: var(--ink);
}

.asset-grid-pager {
  grid-column: 1 / -1;
}

.asset-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.asset-tab {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
}

.asset-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.embedded-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.workspace-drawer,
.embedded-library-panel,
.admin-system-knowledge,
.gallery-learning-panel {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.workspace-drawer[hidden],
.gallery-learning-panel[hidden] {
  display: none !important;
}

.embedded-library-panel .section-head,
.admin-system-knowledge .section-head,
.gallery-learning-panel .section-head {
  margin-bottom: 0;
}

.gallery-content-panel[hidden] {
  display: none !important;
}

.gallery-content-panel .ew-upload-form {
  margin-top: 20px;
}

.storyboard-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.storyboard-board-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 210px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(24, 32, 44, 0.05);
  cursor: grab;
}

.storyboard-board-card:active {
  cursor: grabbing;
}

button.storyboard-board-card {
  width: 100%;
  color: var(--ink);
  text-align: left;
}

.workbench-storyboard-board .storyboard-board-card {
  cursor: pointer;
}

.workbench-storyboard-board .storyboard-board-card:active {
  cursor: pointer;
}

.storyboard-board-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(20, 106, 124, 0.14);
}

.storyboard-board-card header,
.storyboard-board-meta,
.storyboard-board-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.storyboard-board-number {
  color: var(--accent);
  font-weight: 800;
}

.storyboard-board-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyboard-board-card p {
  display: -webkit-box;
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.storyboard-board-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.storyboard-board-meta span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyboard-board-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyboard-board-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: auto;
}

.icon-text-button {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-icon {
  color: #ad3d35;
}

@media (max-width: 620px) {
  .storyboard-board {
    grid-template-columns: 1fr;
  }

  .storyboard-board-card {
    min-height: 0;
  }
}

@media (max-width: 1080px) {
  .app-header {
    grid-template-areas:
      "brand account"
      "tabs tabs";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    padding: 10px 18px 8px;
  }

  .brand-home {
    grid-area: brand;
    justify-self: start;
  }

  .header-account {
    grid-area: account;
  }

  .top-tabs {
    grid-area: tabs;
    justify-content: flex-start;
    padding-bottom: 2px;
  }
}

@media (max-width: 620px) {
  .app-header {
    gap: 6px 10px;
    min-height: 0;
    padding: 8px 12px 7px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .brand-copy span {
    display: none;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .header-account {
    max-width: 220px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .auth-links,
  .signed-account {
    justify-content: flex-end;
    gap: 3px;
  }

  .auth-links .link-button,
  .signed-account button {
    min-height: 32px;
    padding: 0 6px;
    font-size: 12px;
  }

  .nav-tab {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
  }

  .embedded-page-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .vector-probe-row {
    grid-template-columns: 24px minmax(0, 1fr) 70px;
  }

  .vector-probe-row span:nth-of-type(2) {
    display: none;
  }
}

/* ====== 视频缩略图 ====== */
.gallery-video-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #101820;
}

/* ====== 编辑弹窗 ====== */
#galleryEditDialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  background: var(--panel);
  color: var(--ink);
}
#galleryEditDialog::backdrop {
  background: rgba(0,0,0,0.5);
}
#galleryEditDialog .dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
#galleryEditDialog .dialog-header h3 { margin: 0; font-size: 1.1rem; color: var(--ink); }
#galleryEditDialog .dialog-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}
#galleryEditDialog .dialog-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#galleryEditDialog .dialog-body label {
  font-size: 0.9rem;
  color: var(--muted);
}
#galleryEditDialog .dialog-body input,
#galleryEditDialog .dialog-body textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.95rem;
}
#galleryEditDialog .dialog-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 分析结果操作栏 */
.analysis-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.project-flow-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.project-flow-panel label {
  min-width: 220px;
  flex: 1 1 220px;
}

.project-flow-panel button {
  align-self: end;
}

.script-timing-plan,
.analysis-runtime-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f6;
  color: var(--muted);
  font-size: 0.9rem;
}

.script-timing-plan {
  grid-column: 1 / -1;
}

.script-timing-plan strong,
.analysis-runtime-bar strong {
  color: var(--ink);
}

.analysis-runtime-bar {
  justify-content: space-between;
  margin: 14px 0;
}

.analysis-runtime-bar > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.timing-warning {
  color: #a04b25;
  font-weight: 700;
}

.shot-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.shot-analysis-table {
  width: 100%;
  min-width: 1700px;
  border-collapse: collapse;
  font-size: 12px;
}

.shot-analysis-table th,
.shot-analysis-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  padding: 8px;
}

.shot-analysis-table th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  text-align: left;
  white-space: nowrap;
}

.shot-analysis-table td:first-child,
.shot-analysis-table th:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
}

.shot-analysis-table input,
.shot-analysis-table textarea {
  width: 100%;
  min-width: 110px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.shot-analysis-table textarea {
  min-height: 84px;
  resize: vertical;
}

.project-flow-panel input,
.project-flow-panel select {
  width: 100%;
}

.reference-subject-panel {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.reference-asset-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.reference-asset-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reference-asset-thumb {
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.06), rgba(17, 24, 39, 0.02));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--line);
}

.reference-asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-manager-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(460px, 1.35fr);
  gap: 24px;
  align-items: start;
}

.asset-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.asset-list {
  max-height: 70vh;
  overflow: auto;
  padding-right: 4px;
}

.asset-editor {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.asset-editor h3 {
  margin: 0;
  font-size: 1rem;
}

.character-manager-grid {
  grid-template-columns: minmax(360px, 1fr) minmax(560px, 1.2fr);
}

.character-editor {
  gap: 18px;
}

.character-editor-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.character-form-grid {
  align-items: start;
}

.character-form-section {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.character-form-section h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.86rem;
  letter-spacing: 0;
}

.character-card {
  display: grid;
  gap: 12px;
}

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

.character-card-cover {
  display: grid;
  place-items: center;
  width: 92px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: linear-gradient(135deg, #eef3f6, #f7efe9);
  color: var(--accent);
  font-size: 28px;
  font-weight: 800;
}

.character-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-card-title {
  min-width: 0;
}

.character-card-name-row,
.character-completeness > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.character-card-name-row strong {
  margin: 0;
}

.character-scope {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  background: #fff;
}

.character-completeness {
  display: grid;
  gap: 6px;
}

.character-completeness span,
.character-lock-summary span,
.character-prompt-details summary {
  color: var(--muted);
  font-size: 12px;
}

.character-completeness strong {
  color: var(--accent);
  font-size: 13px;
}

.character-completeness-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f4;
}

.character-completeness-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #24604d, #d58b51);
}

.character-lock-summary {
  display: grid;
  gap: 8px;
}

.character-lock-summary div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.character-lock-summary p {
  margin: 4px 0 0;
  color: var(--ink);
}

.character-prompt-details summary {
  cursor: pointer;
  user-select: none;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfe;
}

.asset-card-actions {
  margin-top: 12px;
}

.memory-card pre,
.knowledge-item pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.6;
}

.storyboard-work-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(520px, 1.8fr);
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.storyboard-editor {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.storyboard-editor label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

.storyboard-editor textarea {
  min-height: 112px;
  line-height: 1.65;
  resize: vertical;
}

#shotImagePromptInput,
#shotVideoPromptInput {
  min-height: 220px;
}

.story-shot-row {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  text-align: left;
  cursor: pointer;
}

#storyboardShotList {
  gap: 10px;
  max-height: 68vh;
  overflow: auto;
  padding-right: 4px;
}

.story-shot-row strong {
  font-size: 0.95rem;
}

.story-shot-row span {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.story-shot-row.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(200, 154, 92, 0.18);
}

.storyboard-timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-top: 22px;
}

.storyboard-timeline {
  display: flex;
  width: 100%;
  min-height: 52px;
  gap: 3px;
  margin-top: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
}

.storyboard-timeline-block {
  min-width: 34px;
  border: 0;
  border-radius: 5px;
  padding: 6px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  background: rgba(36, 106, 115, 0.18);
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
}

.storyboard-timeline-block small {
  font-size: 0.72rem;
  opacity: 0.75;
}

.storyboard-timeline-block.active {
  background: var(--accent);
  color: #fff;
}

.asset-bundle-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(360px, 1.35fr);
  gap: 18px;
  align-items: start;
}

.asset-bundle-editor {
  position: sticky;
  top: 18px;
}

.bundle-card.active,
.asset-picker-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(200, 154, 92, 0.16);
}

.asset-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.asset-picker-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--paper);
  display: grid;
  gap: 8px;
}

.asset-picker-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.asset-picker-main {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  min-width: 0;
}

.asset-picker-main p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.asset-picker-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(36, 106, 115, 0.08);
  font-weight: 700;
}

.asset-picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 820px) {
  .asset-manager-grid {
    grid-template-columns: 1fr;
  }

  .asset-bundle-layout {
    grid-template-columns: 1fr;
  }

  .asset-bundle-editor {
    position: static;
  }

  .storyboard-work-grid {
    grid-template-columns: 1fr;
  }
}

.notice-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  background: var(--primary, #0077b6);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  max-width: 80vw;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.analysis-routing-panel,
.benchmark-panel,
.studio-panel {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.analysis-routing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.analysis-routing-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid #246a73;
  border-radius: 7px;
  background: #f8fbfc;
}

.analysis-routing-card header,
.benchmark-panel header,
.studio-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analysis-routing-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.routing-reference-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.routing-reference-list span,
.storyboard-route,
.storyboard-evidence {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 6px;
  border: 1px solid #c8dadd;
  border-radius: 5px;
  color: #246a73;
  background: #eef6f6;
  font-size: 0.72rem;
}

.storyboard-evidence {
  color: #7d4f2f;
  border-color: #e3ceb9;
  background: #fff8f0;
}

.benchmark-panel {
  border-color: #c9d9dd;
}

.benchmark-panel header h3,
.studio-panel-head h3 {
  margin: 2px 0 0;
  font-size: 1.1rem;
}

.benchmark-panel header small {
  color: var(--muted);
  font-size: 0.78rem;
}

.benchmark-grade {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #fff;
  background: #246a73;
  font-size: 0.95rem;
  font-weight: 800;
}

.benchmark-dimensions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.benchmark-dimensions > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 8px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  font-size: 0.79rem;
}

.benchmark-dimensions span {
  color: var(--muted);
}

.benchmark-dimensions i {
  grid-column: 1 / -1;
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 4px;
  background: #e8eef0;
}

.benchmark-dimensions i b {
  display: block;
  height: 100%;
  background: #246a73;
}

.benchmark-issues {
  display: grid;
  gap: 8px;
}

.benchmark-issue {
  padding: 10px 12px;
  border-left: 3px solid #d58b51;
  background: #fffaf5;
}

.benchmark-issue.info {
  border-left-color: #467a9f;
  background: #f5f9fd;
}

.benchmark-issue p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.benchmark-issue small {
  color: #7d4f2f;
  font-size: 0.76rem;
}

.benchmark-pass {
  margin: 12px 0 0;
  color: #24604d;
}

.studio-panel {
  margin-top: 28px;
}

.studio-panel-head {
  margin-bottom: 14px;
}

.studio-panel-head .eyebrow {
  margin: 0;
}

.studio-source-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-bottom: 14px;
}

.studio-source-row label,
.studio-control-panel label {
  display: grid;
  gap: 5px;
  min-width: 130px;
  color: var(--muted);
  font-size: 0.79rem;
}

.studio-source-row label:first-child {
  min-width: 190px;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(220px, 0.7fr);
  gap: 14px;
  align-items: stretch;
}

.studio-stage-wrap {
  min-width: 0;
}

.studio-stage {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid #b8cdd2;
  border-radius: 8px;
  background-color: #edf4f5;
  background-image: linear-gradient(rgba(51, 102, 112, 0.12) 1px, transparent 1px), linear-gradient(90deg, rgba(51, 102, 112, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  touch-action: none;
}

.studio-backdrop {
  position: absolute;
  top: 8%;
  left: 50%;
  width: min(64%, 420px);
  min-height: 18%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px dashed #73969d;
  border-radius: 5px;
  color: #3d6972;
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.86rem;
  text-align: center;
  pointer-events: none;
}

.studio-axis {
  position: absolute;
  top: 50%;
  left: 14%;
  width: 72%;
  border-top: 1px dashed rgba(112, 75, 52, 0.55);
  pointer-events: none;
}

.studio-object,
.studio-camera {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  min-width: 82px;
  max-width: 132px;
  padding: 7px 8px;
  border: 1px solid #537a84;
  border-radius: 6px;
  color: #123e46;
  background: #fff;
  box-shadow: 0 2px 6px rgba(19, 57, 65, 0.16);
  cursor: grab;
  user-select: none;
}

.studio-object:active,
.studio-camera:active {
  cursor: grabbing;
}

.studio-object {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
}

.studio-object span {
  color: var(--muted);
  font-size: 0.67rem;
}

.studio-object strong {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.studio-object button {
  grid-column: 2;
  grid-row: 1;
  min-height: 20px;
  padding: 0;
  color: #9b5548;
  background: transparent;
  font-size: 0.67rem;
}

.studio-object-prop {
  border-color: #b77e4a;
  color: #70411f;
  background: #fffaf3;
}

.studio-camera {
  min-width: 60px;
  border-color: #1e6475;
  color: #fff;
  background: #246a73;
  font-size: 0.78rem;
  font-weight: 700;
}

.studio-light {
  position: absolute;
  z-index: 2;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  border: 2px solid #b87d23;
  border-radius: 50%;
  background: #fff5c8;
  box-shadow: 0 0 0 6px rgba(255, 209, 94, 0.18);
  pointer-events: none;
}

.studio-control-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.studio-control-panel label {
  min-width: 0;
}

.studio-control-panel output {
  color: var(--ink);
  font-weight: 700;
}

.studio-control-panel input[type="range"] {
  width: 100%;
  accent-color: #246a73;
}

.studio-prompt-preview {
  min-height: 132px;
  padding: 10px;
  overflow: auto;
  border: 1px solid #d8e3e5;
  border-radius: 6px;
  color: #365c63;
  background: #f3f8f8;
  font-size: 0.77rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }

  .studio-control-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studio-prompt-preview {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .analysis-routing-panel,
  .benchmark-panel,
  .studio-panel {
    margin-left: -2px;
    margin-right: -2px;
    padding: 12px;
  }

  .studio-panel-head,
  .analysis-routing-card header,
  .benchmark-panel header {
    align-items: flex-start;
    flex-direction: column;
  }

  .studio-source-row {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .studio-source-row label,
  .studio-source-row label:first-child {
    min-width: 0;
  }

  .studio-source-row label:nth-child(1),
  .studio-source-row label:nth-child(2) {
    grid-column: 1 / -1;
  }

  .studio-stage {
    min-height: 330px;
  }

  .studio-control-panel {
    grid-template-columns: 1fr;
  }

  .studio-prompt-preview {
    grid-column: auto;
  }

  .studio-object {
    min-width: 68px;
    max-width: 96px;
    padding: 5px 6px;
  }
}

/* Kling-inspired product surface: dark, restrained, and legible for long work sessions. */
body,
.app-shell {
  background: var(--paper);
  color: var(--ink);
}

.app-header {
  border-bottom-color: rgba(249, 251, 252, 0.12);
}

.brand-copy strong {
  font-size: 17px;
  color: var(--ink);
}

.brand-mark {
  box-shadow: 0 0 0 1px rgba(249, 251, 252, 0.18), 0 8px 24px rgba(0, 0, 0, 0.28);
}

.account-panel,
.guest-entry-card,
.guide-card,
.dashboard-launch-card,
.pipeline-textarea,
.pipeline-shot-card,
.pipeline-prompt-card,
.pipeline-draft-bar,
.pipeline-brief,
.op-card,
.ew-upload-form,
.creator-strip,
.image-prompt-panel,
.video-prompt-panel,
.learning-course-card,
.knowledge-item,
.visual-card,
.camera-card,
.asset-card,
.reference-card,
.taxonomy-group,
.taxonomy-items div,
.project-flow-panel,
.character-card,
.memory-card,
.bundle-card,
.shot-card,
.parameter-video-segment,
.analysis-card,
.analysis-routing-panel,
.analysis-routing-card,
.benchmark-panel,
.studio-panel,
.storyboard-board-card,
.asset-picker-card,
.studio-prompt-preview,
.modal-prompt-section,
.modal-note-section,
.media-preview-card .modal-head,
#galleryEditDialog {
  background: var(--panel-soft);
  color: var(--ink);
  border-color: var(--line);
}

.panel,
.auth-card,
.admin-card,
.table-card {
  background: var(--panel);
  color: var(--ink);
}

.guide-card span,
.guest-entry-index,
.dashboard-launch-index {
  background: rgba(213, 255, 79, 0.14);
  color: var(--accent-2);
}

.guide-card span {
  border: 1px solid rgba(213, 255, 79, 0.22);
}

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

.dashboard-launch-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dashboard-launch-card h3,
.dashboard-launch-card p {
  margin: 0;
}

.dashboard-launch-card h3 {
  font-size: 17px;
}

.dashboard-launch-card p {
  color: var(--muted);
  line-height: 1.65;
}

.dashboard-launch-card button {
  align-self: end;
  justify-self: start;
  margin-top: auto;
}

.visual-reference-note {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.dashboard-launch-index {
  display: inline-grid;
  width: fit-content;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid rgba(213, 255, 79, 0.25);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea,
.pipeline-shot-card textarea,
.pipeline-prompt-card textarea,
.ew-upload-form input[type="text"],
.ew-upload-form textarea,
.shot-analysis-table textarea,
.storyboard-editor textarea {
  background: #101011;
  color: var(--ink);
  border-color: var(--line);
}

input::placeholder,
textarea::placeholder {
  color: #858b93;
}

option {
  background: #151516;
  color: var(--ink);
}

.segmented,
.tag-row span,
.visual-media,
.reference-thumb,
.studio-stage,
.studio-backdrop,
.asset-picker-thumb,
.parameter-reference-thumb {
  background: #101011;
  border-color: var(--line);
}

.segmented button,
.icon-close,
.icon-text-button,
.category-chip,
.course-open-link {
  background: rgba(249, 251, 252, 0.07);
  color: var(--ink);
  border-color: var(--line);
}

.segmented button.active,
.category-chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: none;
}

.tag {
  background: rgba(213, 255, 79, 0.14);
  color: var(--accent-2);
  border: 1px solid rgba(213, 255, 79, 0.22);
}

.eyebrow {
  color: var(--accent-2);
}

.kb-hint-panel {
  background: #101011;
  border-color: var(--line);
}

.script-keyword-tabs {
  display: flex;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.script-keyword-tab {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.script-keyword-tab:hover,
.script-keyword-tab.active {
  border-color: rgba(249, 251, 252, 0.22);
  background: rgba(249, 251, 252, 0.1);
  color: var(--ink);
}

.script-keyword-chip-list {
  min-height: 30px;
}

.kb-hint-panel .kb-chip {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(249, 251, 252, 0.06);
  color: var(--muted);
}

.kb-hint-panel .kb-chip:hover {
  border-color: rgba(249, 251, 252, 0.45);
  color: var(--ink);
}

.kb-hint-panel .kb-chip.selected {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.script-keyword-suggestions {
  display: grid;
  gap: 7px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.script-keyword-suggestions > span {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}

.kb-hint-panel .kb-chip-suggestion:not(.selected) {
  border-color: rgba(213, 255, 79, 0.3);
  color: #e3ff9a;
}

.analysis-loading,
.analysis-runtime-bar,
.notice-inline {
  background: rgba(249, 251, 252, 0.06);
  color: var(--muted);
  border-color: var(--line);
}

.shot-table-wrap {
  background: #101011;
  border-color: var(--line);
}

.shot-analysis-table th {
  background: #171719;
  color: var(--ink);
  border-color: var(--line);
}

.shot-analysis-table td:first-child,
.shot-analysis-table th:first-child {
  background: #171719;
  color: var(--ink);
}

/* The legacy light theme used a white input rule with higher specificity. */
.shot-analysis-table input,
.shot-analysis-table textarea {
  background: #101011;
  color: var(--ink);
  border-color: var(--line);
}

.shot-analysis-table input::placeholder,
.shot-analysis-table textarea::placeholder {
  color: #858b93;
  opacity: 1;
}

.routing-reference-list span,
.storyboard-route {
  background: rgba(213, 255, 79, 0.13);
  color: #e3ff9a;
  border-color: rgba(213, 255, 79, 0.3);
}

.storyboard-evidence {
  background: rgba(249, 251, 252, 0.08);
  color: #d9dde2;
  border-color: rgba(249, 251, 252, 0.2);
}

.benchmark-panel {
  background: #151516;
  border-color: var(--line);
}

.benchmark-grade {
  background: var(--accent);
  color: var(--accent-ink);
}

.benchmark-dimensions > div {
  background: #101011;
  color: var(--ink);
  border-color: var(--line);
}

.benchmark-dimensions span,
.benchmark-panel header small,
.benchmark-issue p {
  color: var(--muted);
}

.benchmark-dimensions i {
  background: rgba(249, 251, 252, 0.14);
}

.benchmark-dimensions i b {
  background: var(--accent);
}

.benchmark-issue {
  background: rgba(255, 169, 73, 0.1);
  border-left-color: #ffb15b;
  color: var(--ink);
}

.benchmark-issue.info {
  background: rgba(112, 183, 255, 0.1);
  border-left-color: #78b8ff;
}

.benchmark-issue small {
  color: #ffd199;
}

.benchmark-issue.info small {
  color: #a9d3ff;
}

.benchmark-pass {
  color: #a7e7c6;
}

.storyboard-board-meta .storyboard-layout-applied {
  padding: 2px 6px;
  border: 1px solid rgba(213, 255, 79, 0.32);
  border-radius: 4px;
  background: rgba(213, 255, 79, 0.13);
  color: #e3ff9a;
  font-weight: 700;
}

.storyboard-director-cue {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-left: 3px solid var(--accent);
  background: rgba(213, 255, 79, 0.08);
}

.storyboard-director-cue span {
  color: #e3ff9a;
  font-size: 10px;
  font-weight: 700;
}

.storyboard-director-cue strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyboard-director-cue small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-help-dialog {
  width: min(640px, calc(100vw - 28px));
  max-height: min(82vh, 760px);
  padding: 0;
  overflow: auto;
  background: #151516;
  color: var(--ink);
  border-color: var(--line);
}

.studio-help-dialog::backdrop {
  background: rgba(0, 0, 0, 0.66);
}

.studio-help-card {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.studio-help-card .modal-head {
  margin: 0;
}

.studio-help-card .modal-head h3 {
  margin: 0;
}

.studio-help-content {
  display: grid;
  gap: 18px;
}

.studio-help-content section + section {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.studio-help-content h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
}

.studio-help-legend {
  display: grid;
  gap: 10px;
  margin: 0;
}

.studio-help-legend > div {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.studio-help-legend dt,
.studio-help-legend dd {
  margin: 0;
}

.studio-help-legend dd,
.studio-help-steps,
.studio-help-note p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.studio-help-symbol {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: #101011;
  font-size: 12px;
  font-weight: 700;
}

.studio-help-symbol.camera {
  border-color: rgba(112, 183, 255, 0.45);
  color: #a9d3ff;
}

.studio-help-symbol.light {
  border-color: rgba(255, 209, 94, 0.52);
  color: #ffe39a;
}

.studio-help-symbol.character {
  border-color: rgba(213, 255, 79, 0.38);
  color: #e3ff9a;
}

.studio-help-symbol.axis {
  border-style: dashed;
  color: #c7cbd1;
}

.studio-help-symbol.backdrop {
  border-style: dashed;
  border-color: rgba(249, 251, 252, 0.36);
  color: #d7dce1;
}

.studio-help-symbol.frame {
  border-color: rgba(249, 251, 252, 0.7);
  color: #f9fbfc;
}

.studio-help-steps {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.studio-help-note p {
  margin: 0;
}

.studio-help-note strong {
  color: var(--ink);
}

.studio-prompt-preview {
  color: var(--muted);
}

.director-previs {
  margin: 18px 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151516;
}

.director-previs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.director-previs-head .eyebrow,
.director-shot-card .eyebrow {
  margin: 0 0 3px;
}

.director-previs-head h3,
.director-shot-card h3 {
  margin: 0;
  font-size: 17px;
}

.director-previs-speed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.director-previs-speed select {
  width: auto;
  min-height: 32px;
}

.director-previs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(240px, 0.85fr);
  gap: 14px;
}

.director-previs-stage-wrap {
  min-width: 0;
}

.director-previs-stage {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background-color: #101011;
  background-image: linear-gradient(rgba(249, 251, 252, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(249, 251, 252, 0.06) 1px, transparent 1px);
  background-size: 30px 30px;
}

.director-previs-backdrop {
  position: absolute;
  top: 8%;
  left: 50%;
  width: min(66%, 430px);
  min-height: 21%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed rgba(249, 251, 252, 0.28);
  border-radius: 5px;
  background: rgba(249, 251, 252, 0.04);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.director-previs-light {
  position: absolute;
  z-index: 1;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  border: 2px solid #ffe07a;
  border-radius: 50%;
  background: rgba(255, 224, 122, 0.28);
  box-shadow: 0 0 0 9px rgba(255, 224, 122, 0.1);
  transition: left 300ms ease, top 300ms ease;
}

.director-previs-actors {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.director-previs-actor {
  position: absolute;
  min-width: 80px;
  max-width: 128px;
  padding: 7px 8px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(213, 255, 79, 0.48);
  border-radius: 5px;
  background: rgba(213, 255, 79, 0.14);
  color: var(--ink);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
  transition: left 120ms linear, top 120ms linear;
}

.director-previs-actor span {
  display: block;
  margin-bottom: 2px;
  color: #e3ff9a;
  font-size: 10px;
}

.director-previs-actor strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.director-previs-frame {
  position: absolute;
  z-index: 4;
  top: var(--previs-frame-y, 50%);
  left: var(--previs-frame-x, 50%);
  width: calc(84% * var(--previs-frame-scale, 0.76));
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(249, 251, 252, 0.82);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: width 220ms ease, top 220ms ease, left 220ms ease;
}

.director-previs-overlay {
  position: absolute;
  z-index: 5;
  right: 12px;
  bottom: 12px;
  left: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(249, 251, 252, 0.16);
  border-radius: 5px;
  background: rgba(16, 16, 17, 0.88);
}

.director-previs-overlay span {
  color: #e3ff9a;
  font-size: 11px;
  font-weight: 700;
}

.director-previs-overlay strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.director-previs-overlay small {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.director-previs-notes {
  display: grid;
  align-content: start;
  gap: 10px;
}

.director-previs-notes > div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #101011;
}

.director-previs-notes span,
.director-shot-card-content span,
.pipeline-director-summary > span {
  display: block;
  margin-bottom: 4px;
  color: #e3ff9a;
  font-size: 11px;
  font-weight: 700;
}

.director-previs-notes strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.director-previs-notes p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.director-shot-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #151516;
}

.director-shot-card-content {
  display: grid;
  gap: 9px;
}

.director-shot-card-content > div {
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(249, 251, 252, 0.1);
}

.director-shot-card-content > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.director-shot-card-content p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.58;
}

.execution-prompt-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #101011;
}

.execution-prompt-panel summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.execution-prompt-panel[open] summary {
  color: var(--ink);
}

.pipeline-director-summary {
  padding: 10px;
  border-left: 3px solid var(--accent);
  background: rgba(213, 255, 79, 0.08);
}

.pipeline-director-summary strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.pipeline-director-summary p,
.pipeline-director-summary small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 620px) {
  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
    font-size: 24px;
  }

  .dashboard-launch-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-launch-card {
    min-height: 0;
  }

  .script-keyword-tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .script-keyword-tabs::-webkit-scrollbar {
    display: none;
  }

  .script-keyword-tab {
    flex: 0 0 auto;
  }

  .studio-help-card {
    padding: 16px;
  }

  .studio-help-legend > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .director-previs {
    padding: 14px;
  }

  .director-previs-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .director-previs-layout {
    grid-template-columns: 1fr;
  }

  .director-previs-stage {
    min-height: 270px;
  }
}

@media (max-width: 820px) {
  .director-previs-layout {
    grid-template-columns: 1fr;
  }
}

.app-startup {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: #080808;
  color: var(--ink);
  transition: opacity 220ms ease, visibility 220ms ease;
}

.app-startup.is-ready {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.app-startup img {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
}

.app-startup strong {
  font-size: 14px;
  font-weight: 600;
}

.app-startup span {
  width: 90px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(249, 251, 252, 0.14);
}

.app-startup span::after {
  display: block;
  width: 48%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
  content: "";
  animation: app-startup-progress 900ms ease-in-out infinite alternate;
}

@keyframes app-startup-progress {
  from { transform: translateX(-24%); }
  to { transform: translateX(130%); }
}

.feedback-fab {
  position: fixed;
  z-index: 40;
  right: 18px;
  bottom: 18px;
  min-width: 52px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(213, 255, 79, 0.52);
  border-radius: 6px;
  background: #d5ff4f;
  color: #080808;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  font-size: 13px;
  font-weight: 700;
}

.feedback-form {
  width: min(520px, calc(100vw - 28px));
}

.feedback-form .modal-head {
  align-items: flex-start;
}

.feedback-form .eyebrow {
  margin: 0 0 4px;
}

.feedback-form h3 {
  margin: 0;
  font-size: 18px;
}

.admin-feedback-list {
  display: grid;
  gap: 9px;
}

.admin-feedback-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101011;
}

.admin-feedback-item header,
.admin-feedback-item p {
  margin: 0;
}

.admin-feedback-item header {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.admin-feedback-item header strong {
  font-size: 13px;
}

.admin-feedback-item p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.admin-feedback-meta {
  display: block;
  margin-top: 8px;
  color: #858b93;
  font-size: 11px;
}

.admin-feedback-item select {
  align-self: start;
  min-width: 96px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 12px;
}

.benchmark-loading {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid rgba(213, 255, 79, 0.28);
  border-radius: 6px;
  background: rgba(213, 255, 79, 0.06);
  color: var(--muted);
  font-size: 13px;
}

/* Final dark-surface pass for legacy modules that previously carried light cards. */
dialog,
.project-card,
.mini-row,
.knowledge-item,
.asset-card,
.reference-card,
.memory-card,
.schema-card,
.flow span,
.reference-asset-card,
.storyboard-board-card,
.character-form-section,
.character-lock-summary div,
.empty-state,
.knowledge-empty-state,
.studio-control-panel,
.studio-prompt-preview {
  background: var(--panel-soft);
  color: var(--ink);
  border-color: var(--line);
}

.asset-library-toolbar,
.asset-list-head,
.asset-editor,
.asset-editor label,
.asset-library-toolbar label,
.studio-source-row label,
.studio-control-panel label {
  color: var(--muted);
}

.storyboard-board-card,
.reference-asset-card,
.character-lock-summary div,
.character-form-section,
.studio-control-panel,
.studio-prompt-preview {
  box-shadow: none;
}

.studio-stage {
  border-color: rgba(249, 251, 252, 0.24);
  background-color: #101011;
  background-image: linear-gradient(rgba(249, 251, 252, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(249, 251, 252, 0.08) 1px, transparent 1px);
}

.studio-backdrop {
  border-color: rgba(213, 255, 79, 0.46);
  background: rgba(213, 255, 79, 0.08);
  color: #e3ff9a;
}

.studio-axis { border-top-color: rgba(255, 209, 94, 0.72); }

.studio-object {
  border-color: rgba(213, 255, 79, 0.5);
  background: #1d1d1f;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
}

.studio-object span { color: var(--muted); }
.studio-object button { color: #ffaaa5; }

.studio-object-prop {
  border-color: rgba(255, 177, 91, 0.58);
  background: #221b14;
  color: #ffe1bf;
}

.studio-camera {
  border-color: rgba(112, 183, 255, 0.65);
  background: #17455b;
  color: #e8f6ff;
}

.studio-light {
  border-color: #ffe39a;
  background: #5b4514;
  box-shadow: 0 0 0 6px rgba(255, 209, 94, 0.16);
}

.studio-prompt-preview {
  color: var(--ink);
  border-color: var(--line);
}

.status-pending {
  background: rgba(255, 209, 94, 0.14);
  color: #ffe39a;
}

.status-rejected,
button.danger,
button.secondary.danger {
  border-color: rgba(255, 151, 155, 0.45);
  background: rgba(232, 92, 98, 0.14);
  color: #ffaaa5;
}

.notice-inline {
  border-color: rgba(255, 209, 94, 0.36);
  background: rgba(255, 209, 94, 0.1);
  color: #ffe39a;
}

.shot-card,
.analysis-card {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.pipeline-step.active span,
.pipeline-step.done span,
.kb-hint-panel .kb-chip.selected,
.asset-tab.active,
.storyboard-timeline-block.active {
  color: var(--accent-ink);
}

.shot-num { color: var(--accent-ink); }
.shot-dialogue p { color: var(--ink); }
.shot-final-prompt { background: rgba(213, 255, 79, 0.06); border-color: rgba(213, 255, 79, 0.24); }

@media (max-width: 620px) {
  .asset-library-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .asset-library-toolbar select { width: 100%; }
  .asset-list { max-height: none; }
  .studio-control-panel { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .feedback-fab {
    right: 12px;
    bottom: 12px;
  }

  .admin-feedback-item {
    grid-template-columns: 1fr;
  }
}

/* High-contrast navigation and workflow controls. */
.top-tabs .nav-tab {
  position: relative;
}

.top-tabs .nav-tab:nth-child(-n + 3) {
  font-size: 14px;
  font-weight: 800;
}

.top-tabs .nav-tab:nth-child(4),
.top-tabs .nav-tab:nth-child(7) {
  margin-left: 10px;
}

.top-tabs .nav-tab:nth-child(4)::before,
.top-tabs .nav-tab:nth-child(7)::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -6px;
  width: 1px;
  background: rgba(249, 251, 252, 0.28);
  content: "";
}

.workflow-linkage {
  background: var(--panel-soft);
  color: var(--ink);
  border-color: var(--line);
}

.workflow-linkage summary {
  color: var(--ink);
}

.workflow-linkage summary:hover,
.workflow-linkage[open] summary {
  color: var(--accent-2);
}

.workflow-linkage .link-grid label,
.workflow-linkage .asset-list-head,
.workflow-linkage .reference-subject-panel {
  color: var(--muted);
}

.pipeline-step {
  background: var(--panel-soft);
  color: var(--ink);
  border-color: var(--line);
}

.pipeline-step:hover {
  background: rgba(249, 251, 252, 0.12);
  color: var(--ink);
}

.pipeline-step span {
  background: rgba(249, 251, 252, 0.12);
  color: var(--ink);
}

.pipeline-step.active,
.pipeline-step.done {
  background: rgba(213, 255, 79, 0.14);
  border-color: rgba(213, 255, 79, 0.45);
  color: var(--ink);
}

.pipeline-step.active span,
.pipeline-step.done span {
  background: var(--accent-2);
  color: var(--accent-ink);
}

.pipeline-brief p.muted {
  color: #c9ced4;
}

/* Script editor: outline first, then local chapter work. */
.script-setup-panel {
  margin-bottom: 16px;
}

.script-legacy-actions {
  display: none !important;
}

.script-studio {
  display: grid;
  gap: 16px;
  margin: 18px 0 22px;
}

.script-workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.script-workflow-steps span {
  min-height: 32px;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.script-workflow-steps span.active {
  border-bottom: 2px solid var(--accent-2);
  color: var(--ink);
}

.script-workflow-steps span.done {
  color: #e3ff9a;
}

.script-ai-progress {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.script-progress-head,
.script-chapter-toolbar,
.script-workflow-head,
.script-chapter-head,
.script-chapter-tools,
.script-workflow-actions,
.script-studio-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.script-progress-head,
.script-workflow-head,
.script-chapter-toolbar,
.script-studio-footer {
  justify-content: space-between;
}

.script-progress-head strong,
.script-workflow-head h3,
.script-global-edit h3 {
  color: var(--ink);
}

.script-progress-head span {
  color: var(--muted);
  font-size: 12px;
}

.script-ai-progress ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.script-ai-progress li {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.script-ai-progress li > span {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 11px;
}

.script-ai-progress li.active,
.script-ai-progress li.done {
  color: var(--ink);
}

.script-ai-progress li.active > span {
  border-color: var(--accent-2);
  background: rgba(213, 255, 79, 0.14);
  color: var(--accent-2);
}

.script-ai-progress li.done > span {
  border-color: var(--accent-2);
  background: var(--accent-2);
  color: var(--accent-ink);
}

.script-outline-workspace,
.script-global-edit {
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.script-workflow-head {
  align-items: flex-start;
}

.script-workflow-head h3,
.script-global-edit h3,
.script-global-edit p {
  margin: 0;
}

.script-creative-brief {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.script-creative-brief > div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.script-creative-brief span,
.script-research-log small,
.script-chapter-ai-note span {
  color: var(--muted);
  font-size: 12px;
}

.script-creative-brief strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
}

.script-outline-feedback {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin: 14px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.script-outline-feedback label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.script-outline-feedback textarea {
  min-height: 66px;
  resize: vertical;
  line-height: 1.55;
}

.script-research-log {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.script-research-log > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.script-research-log span {
  max-width: 100%;
  padding: 4px 7px;
  overflow: hidden;
  border: 1px solid rgba(249, 251, 252, 0.16);
  color: #d6dbe0;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.script-workflow-actions {
  flex-wrap: wrap;
  margin: 14px 0 18px;
}

.script-import-menu {
  position: relative;
}

.script-import-menu summary {
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  list-style: none;
}

.script-import-menu summary::-webkit-details-marker {
  display: none;
}

.script-import-menu summary::after {
  margin-left: 7px;
  color: var(--muted);
  content: "+";
}

.script-import-menu[open] summary {
  border-color: rgba(213, 255, 79, 0.42);
}

.script-import-menu > div {
  position: absolute;
  z-index: 3;
  display: grid;
  min-width: 132px;
  gap: 6px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  box-shadow: var(--shadow);
}

.script-import-menu > div button {
  justify-content: flex-start;
  white-space: nowrap;
}

.script-chapter-toolbar {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.script-chapter-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.script-chapter-card {
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.script-chapter-card.dragging {
  opacity: 0.55;
}

.script-chapter-card.has-content {
  border-left: 3px solid rgba(213, 255, 79, 0.76);
}

.script-chapter-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.script-chapter-head > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.script-chapter-index {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}

.script-chapter-state {
  color: var(--muted);
  font-size: 12px;
}

.script-chapter-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.script-chapter-tools label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.script-chapter-tools .icon-text-button {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  border-color: var(--line);
  background: rgba(249, 251, 252, 0.08);
  color: var(--ink);
}

.script-chapter-fields,
.script-global-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.script-chapter-fields .wide,
.script-global-grid .wide {
  grid-column: 1 / -1;
}

.script-chapter-fields textarea,
.script-chapter-content textarea,
.script-global-grid textarea {
  line-height: 1.65;
}

.script-chapter-content {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.script-chapter-content summary {
  padding: 10px 0;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.script-chapter-content textarea {
  min-height: 190px;
  resize: vertical;
}

.script-chapter-empty {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed rgba(249, 251, 252, 0.2);
  color: var(--muted);
  font-size: 13px;
}

.script-chapter-awaiting {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.script-chapter-ai-note {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent-2);
  background: rgba(213, 255, 79, 0.07);
}

.script-chapter-ai-note strong {
  color: var(--ink);
  font-size: 13px;
}

.script-chapter-actions {
  margin-top: 12px;
}

.script-global-edit {
  display: grid;
  gap: 14px;
}

.script-studio-footer {
  padding-top: 2px;
}

.script-compiled-preview {
  border-top: 1px solid var(--line);
}

.script-compiled-preview summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.script-compiled-preview .script-compiled-source {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.script-content-upload {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.script-content-upload:hover,
.script-content-upload:focus-visible {
  background: transparent;
  color: var(--ink);
}

.script-compiled-preview textarea {
  min-height: 300px;
  resize: vertical;
}

.script-studio[data-locked="true"] .script-outline-workspace,
.script-studio[data-locked="true"] .script-global-edit {
  border-color: rgba(213, 255, 79, 0.32);
}

/* Persistent, context-aware assistant. It remains separate from the work surface. */
.director-assistant {
  position: fixed;
  right: 18px;
  bottom: 66px;
  z-index: 46;
}

.director-assistant-toggle {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(213, 255, 79, 0.55);
  border-radius: 6px;
  background: #d5ff4f;
  color: #080808;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  font-weight: 700;
}

.director-assistant-panel {
  position: absolute;
  right: 0;
  bottom: 54px;
  display: grid;
  grid-template-rows: auto auto auto minmax(200px, 1fr) auto auto;
  width: min(430px, calc(100vw - 28px));
  height: min(680px, calc(100vh - 122px));
  min-height: 480px;
  overflow: hidden;
  border: 1px solid rgba(249, 251, 252, 0.2);
  border-radius: 8px;
  background: #151516;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.48);
}

.director-assistant-panel[hidden] {
  display: none !important;
}

.director-assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 13px;
  border-bottom: 1px solid var(--line);
}

.director-assistant-head .eyebrow {
  margin: 0 0 3px;
}

.director-assistant-head h3 {
  margin: 0;
  font-size: 17px;
}

.director-assistant-head-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.director-assistant-head-actions .secondary {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.director-assistant-head-actions .icon-close {
  min-width: 32px;
  min-height: 32px;
  padding: 0;
}

.director-assistant-context {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(213, 255, 79, 0.07);
  color: var(--muted);
  font-size: 12px;
}

.director-assistant-context strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.director-assistant-context small {
  flex: 0 0 auto;
  color: var(--accent-light);
}

.director-assistant-skills-panel {
  border-bottom: 1px solid var(--line);
  background: rgba(249, 251, 252, 0.025);
}

.director-assistant-skills-panel summary {
  padding: 9px 16px;
  color: var(--accent-light);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.director-assistant-skills-list {
  display: grid;
  gap: 7px;
  max-height: 190px;
  overflow-y: auto;
  padding: 0 16px 11px;
}

.director-assistant-skill-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: start;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #202023;
}

.director-assistant-skill-card strong,
.director-assistant-skill-card p,
.director-assistant-skill-card small {
  margin: 0;
}

.director-assistant-skill-card strong {
  color: var(--ink);
  font-size: 12px;
}

.director-assistant-skill-card p,
.director-assistant-skill-card small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.director-assistant-skill-card p {
  margin-top: 3px;
}

.director-assistant-skill-card small {
  margin-top: 3px;
  color: var(--accent-light);
}

.director-assistant-skill-card button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 11px;
  white-space: nowrap;
}

.director-assistant-messages {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 15px 16px;
  scrollbar-width: thin;
}

.director-assistant-message {
  display: grid;
  max-width: 92%;
  gap: 9px;
}

.director-assistant-message.user {
  justify-self: end;
}

.director-assistant-message-content {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #202023;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.director-assistant-message.user .director-assistant-message-content {
  border-color: transparent;
  background: #d5ff4f;
  color: #080808;
}

.director-assistant-message.pending .director-assistant-message-content,
.director-assistant-message.pending {
  color: var(--muted);
  font-size: 13px;
}

.director-assistant-plan {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid rgba(213, 255, 79, 0.32);
  border-radius: 6px;
  background: rgba(213, 255, 79, 0.07);
}

.director-assistant-plan > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.director-assistant-plan-skills {
  flex-wrap: wrap;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.director-assistant-plan-skills span {
  flex: 0 0 auto;
}

.director-assistant-plan-skills strong {
  font-size: 11px;
}

.director-assistant-plan span {
  color: var(--accent-light);
  font-size: 11px;
}

.director-assistant-plan strong {
  color: var(--ink);
  font-size: 13px;
}

.director-assistant-plan ol {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.director-assistant-plan .secondary {
  justify-self: start;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.director-assistant-action {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(213, 255, 79, 0.3);
  border-radius: 5px;
  background: rgba(213, 255, 79, 0.06);
}

.director-assistant-action.blocked,
.director-assistant-action.cancelled,
.director-assistant-action.undone {
  border-color: var(--line);
  background: rgba(249, 251, 252, 0.035);
}

.director-assistant-action-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.director-assistant-action-head strong {
  color: var(--ink);
  font-size: 12px;
}

.director-assistant-action-head span,
.director-assistant-action > small,
.director-assistant-action > p,
.director-assistant-action-diff span,
.director-assistant-action-diff p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.director-assistant-action > p,
.director-assistant-action-diff p {
  margin: 0;
}

.director-assistant-action-diff {
  display: grid;
  gap: 3px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.director-assistant-action-diff span {
  color: var(--accent-light);
}

.director-assistant-action-controls {
  margin-top: 2px;
}

.director-assistant-action-controls .primary,
.director-assistant-action-controls .secondary {
  min-height: 29px;
  padding: 0 9px;
  font-size: 11px;
}

.director-assistant-action-results {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding-top: 5px;
}

.director-assistant-action-results article {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
}

.director-assistant-action-results strong {
  color: var(--ink);
  font-size: 11px;
}

.director-assistant-action-results span,
.director-assistant-action-results p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.director-assistant-action-results span {
  color: var(--accent-light);
}

.director-assistant-references {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(249, 251, 252, 0.035);
}

.director-assistant-references summary {
  padding: 9px 11px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.director-assistant-references > div {
  display: grid;
  gap: 9px;
  padding: 0 11px 11px;
}

.director-assistant-references article {
  display: grid;
  gap: 3px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.director-assistant-references article:first-child {
  padding-top: 0;
  border-top: 0;
}

.director-assistant-references strong {
  color: var(--ink);
  font-size: 12px;
}

.director-assistant-references span,
.director-assistant-references p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.director-assistant-references span {
  color: var(--accent-light);
}

.director-assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 11px;
}

.director-assistant-suggestions .secondary {
  min-height: 29px;
  padding: 0 9px;
  font-size: 12px;
}

.director-assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}

.director-assistant-form textarea {
  min-height: 42px;
  max-height: 120px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101011;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.director-assistant-form button {
  align-self: end;
  min-height: 42px;
  padding: 0 13px;
}

@media (max-width: 860px) {
  .script-creative-brief,
  .script-ai-progress ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .script-workflow-steps {
    gap: 2px;
  }

  .script-workflow-steps span {
    padding: 7px 3px;
    font-size: 12px;
  }

  .script-outline-workspace,
  .script-global-edit,
  .script-ai-progress,
  .script-chapter-card {
    padding: 12px;
  }

  .script-workflow-head,
  .script-chapter-toolbar,
  .script-studio-footer,
  .script-chapter-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .script-chapter-tools {
    justify-content: flex-start;
  }

  .script-creative-brief,
  .script-ai-progress ol,
  .script-chapter-fields,
  .script-global-grid {
    grid-template-columns: 1fr;
  }

  .script-outline-feedback {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .director-assistant {
    right: 12px;
    bottom: 62px;
  }

  .director-assistant-panel {
    right: 0;
    bottom: 52px;
    width: min(100vw - 20px, 480px);
    height: min(710px, calc(100dvh - 92px));
    min-height: 420px;
  }
}
