:root {
  color-scheme: dark;
  --bg: #07030f;
  --panel: #120d20;
  --panel-soft: #1a1230;
  --text: #edf4fb;
  --muted: #a698bd;
  --line: #34264e;
  --accent: #ff4057;
  --accent-soft: rgba(255, 64, 87, 0.16);
  --green: #23d7ba;
  --nav: #05020a;
  --nav-soft: #140d23;
  --asset-role: #55a7ff;
  --asset-background: #b784ff;
  --asset-prop: #f6bf55;
  --shadow: 0 22px 64px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-width: 1180px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgba(101, 61, 179, 0.22), transparent 32%),
    radial-gradient(circle at 82% 18%, rgba(255, 64, 87, 0.12), transparent 28%),
    linear-gradient(rgba(79, 57, 116, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 57, 116, 0.13) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  color: var(--text);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

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

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

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  overflow: hidden;
}

.main-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  background: var(--nav);
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 3px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.brand-title {
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.brand-subtitle {
  margin-top: 2px;
  color: #98a3af;
  font-size: 9px;
}

.module-list {
  margin-top: 10px;
  display: grid;
  gap: 5px;
}

.module-item {
  width: 100%;
  min-height: 32px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #dce3ea;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.module-item.active {
  color: #fff;
  background: rgba(180, 35, 42, 0.24);
  border-color: rgba(255, 255, 255, 0.13);
}

.workspace {
  height: 100vh;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
  padding: 10px 14px 14px;
}

.topbar {
  display: grid;
  gap: 5px;
  min-height: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.05;
}

.service-health {
  margin-top: auto;
  padding-top: 10px;
  display: grid;
  gap: 7px;
}

.health-pill {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 6px;
  background: var(--panel);
}

.health-pill.ok {
  border-left-color: var(--green);
}

.health-pill.bad {
  border-left-color: var(--accent);
}

.health-pill strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.health-pill span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
}

.role-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.role-rail,
.role-detail {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.role-rail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.role-rail.studio-rail {
  grid-template-rows: minmax(0, 1fr);
}

.role-rail.studio-rail .rail-head {
  display: none;
}

.rail-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.rail-head strong {
  display: block;
  font-size: 13px;
}

.rail-head small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.icon-button,
.primary-button,
.danger-outline-button,
.secondary-button,
.create-project-button,
.secondary-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.danger-outline-button {
  border-color: var(--accent);
  background: #fff;
  color: var(--accent);
  font-weight: 700;
}

.secondary-button,
.secondary-link {
  background: var(--panel-soft);
}

.role-list {
  min-height: 0;
  overflow-y: auto;
  padding: 9px;
}

.create-asset-button {
  width: 100%;
  min-height: 34px;
  margin: 0 0 9px;
  border: 1px dashed rgba(15, 118, 110, 0.45);
  border-radius: 6px;
  background: rgba(15, 118, 110, 0.06);
  color: var(--green);
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

.create-asset-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.role-list.studio-rail-list {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
  padding: 10px;
}

.role-row,
.project-row,
.shot-row {
  width: 100%;
  margin: 0 0 7px;
  padding: 7px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.project-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 8px;
}

.project-row-main {
  min-width: 0;
}

.shot-row {
  grid-template-columns: 26px minmax(0, 1fr);
  padding: 8px;
}

.role-row.active,
.project-row.active,
.shot-row.active {
  border-color: rgba(180, 35, 42, 0.45);
  background: var(--accent-soft);
}

.role-cover {
  width: 52px;
  height: 68px;
  border-radius: 5px;
  object-fit: cover;
  background: #dfe3e8;
}

.role-cover.empty-cover {
  display: block;
  border: 1px dashed var(--line);
}

.role-copy {
  min-width: 0;
}

.role-copy strong,
.project-row strong,
.shot-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.role-copy small,
.project-row small,
.shot-row small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}

.create-project-button {
  width: 100%;
  margin-bottom: 0;
}

.rail-action-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.row-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.mini-button {
  min-height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.mini-button.danger {
  color: #b4232a;
  border-color: rgba(180, 35, 42, 0.28);
  background: rgba(180, 35, 42, 0.04);
}

.rail-action-row .mini-button {
  min-width: 44px;
  padding: 0 8px;
}

.rail-action-row .mini-button:first-child {
  min-width: 68px;
}

.row-actions .mini-button {
  min-height: 17px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1d5fd1;
  font-size: 11px;
  line-height: 1;
}

.row-actions .mini-button.danger {
  color: #1d5fd1;
  border: 0;
  background: transparent;
}

.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.rail-select-label {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
}

.project-select {
  margin-bottom: 0;
}

.rail-divider {
  margin: 3px 3px 0;
  color: var(--muted);
  font-size: 11px;
}

.episode-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.role-detail {
  padding: 14px;
}

.detail-header,
.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 760;
}

.detail-header h2,
.studio-header h2,
.asset-section h2,
.studio-panel h2,
.settings-panel h2 {
  margin: 0;
  font-size: 18px;
}

.detail-header p,
.studio-header p,
.studio-panel p,
.settings-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-avatar {
  width: 94px;
  height: 118px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.detail-avatar.wide {
  width: 160px;
  height: 100px;
}

.asset-section,
.studio-panel,
.settings-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.role-detail > .studio-panel {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

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

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

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 10px;
}

.creation-panel {
  max-width: 980px;
}

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

.creation-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

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

.asset-create-summary {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.asset-create-summary span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.generation-job-list {
  display: grid;
  gap: 7px;
}

.generation-job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.generation-job-row strong,
.generation-job-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-job-row span {
  color: var(--green);
  font-size: 12px;
}

.generation-job-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

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

.voice-card strong,
.voice-card small {
  display: block;
}

.voice-card small,
.voice-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.voice-card audio {
  width: 100%;
  height: 34px;
}

.voice-card.missing {
  background: #fbfcfd;
}

.image-tile {
  display: grid;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.tile-media {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  background: #e7ebef;
}

.image-tile.landscape .tile-media {
  aspect-ratio: 16 / 10;
}

.tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-caption {
  display: grid;
  gap: 3px;
  padding: 8px;
}

.tile-caption strong,
.tile-caption small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-caption strong {
  font-size: 12px;
}

.tile-caption small {
  color: var(--muted);
  font-size: 11px;
}

.empty-slot {
  width: 28px;
  height: 28px;
  border: 2px solid #b9c1ca;
  border-top-color: var(--accent);
  border-radius: 50%;
}

.generating .empty-slot {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.studio-stepper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0;
}

.studio-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.studio-step-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.topbar-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 26px;
}

.topbar-steps:empty {
  display: none;
  min-height: 0;
}

.step-chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.step-chip span {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e5e9ee;
  color: var(--muted);
  font-size: 9px;
}

.step-chip.done {
  color: var(--green);
  border-color: rgba(15, 118, 110, 0.35);
}

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

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

.step-arrow {
  color: #9aa5b1;
  font-size: 12px;
}

.sop-brief {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #fbfcfd;
}

.sop-brief strong {
  flex: 0 0 auto;
  font-size: 13px;
}

.sop-brief span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.asset-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.asset-stage-head strong {
  font-size: 15px;
}

.asset-stage-head p {
  max-width: 780px;
  margin: 4px 0 0;
}

.asset-stage-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.asset-stage-status span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.asset-sop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.asset-sop-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.asset-sop-card span {
  color: var(--muted);
  font-size: 11px;
}

.asset-sop-card strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.asset-sop-card p {
  margin-top: 6px;
  font-size: 12px;
}

.production-asset-board {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.production-asset-lane {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

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

.production-asset-lane header span {
  color: var(--muted);
  font-size: 11px;
}

.production-asset-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.production-asset-card {
  width: 96px;
  min-width: 96px;
  display: grid;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.production-asset-card.used {
  border-color: rgba(15, 118, 110, 0.35);
  background: #f5fbfa;
}

.production-asset-thumb {
  width: 82px;
  height: 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef2f6;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

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

.production-asset-card strong,
.production-asset-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-asset-card strong {
  font-size: 11px;
}

.production-asset-card small {
  color: var(--muted);
  font-size: 10px;
}

.field-label,
.shot-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.text-input,
.script-input,
.mini-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.text-input {
  min-height: 34px;
  padding: 7px 9px;
}

.script-input {
  min-height: 210px;
  padding: 10px;
  resize: vertical;
  line-height: 1.6;
}

.mini-textarea {
  min-height: 76px;
  padding: 8px;
  resize: vertical;
  line-height: 1.45;
}

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

.action-row.compact {
  margin-top: 8px;
}

.shot-grid,
.video-list,
.settings-grid {
  display: grid;
  gap: 10px;
}

.shot-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.shot-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.breakdown-workbench {
  min-height: 560px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.breakdown-list {
  max-height: calc(100vh - 250px);
  min-height: 560px;
  overflow-y: auto;
  padding: 10px;
  background: #fbfcfd;
}

.breakdown-item {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.breakdown-item + .breakdown-item {
  margin-top: 5px;
}

.breakdown-item.active {
  border-color: rgba(180, 35, 42, 0.32);
  background: var(--accent-soft);
}

.breakdown-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.breakdown-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.breakdown-copy small,
.breakdown-item em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.breakdown-item em {
  justify-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5f7fa;
}

.breakdown-detail {
  min-width: 0;
  padding: 14px;
  border-left: 4px solid var(--accent);
}

.breakdown-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.breakdown-detail-head > div:first-child {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 10px;
  flex-wrap: nowrap;
}

.breakdown-detail-head span:first-child {
  flex: 0 0 auto;
  margin-bottom: 0;
  color: var(--accent);
  font-size: 18px;
  font-weight: 860;
  line-height: 1;
}

.breakdown-detail-head h3 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.breakdown-detail-head p {
  flex: 0 0 auto;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.breakdown-form {
  display: grid;
  grid-template-columns: 280px 92px 160px minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.breakdown-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

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

.timeline-textarea {
  min-height: 260px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
}

.shot-table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
}

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

.shot-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
}

.shot-index-cell {
  width: 42px;
  color: var(--muted);
  font-weight: 760;
}

.basic-info-cell {
  width: 240px;
}

.script-structure-cell {
  min-width: 460px;
}

.asset-cell {
  width: 128px;
}

.dialogue-cell {
  width: 190px;
}

.shot-number {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
}

.inline-fields {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.inline-fields label,
.mini-field,
.script-structure-cell label,
.dialogue-cell small {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.time-range-pill {
  margin-top: 6px;
  padding: 5px 7px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 5px;
  background: rgba(15, 118, 110, 0.06);
  color: #0f766e;
  font-size: 12px;
  font-weight: 760;
}

.timeline-script-line {
  margin-bottom: 7px;
  padding: 7px 8px;
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  background: #fff7f7;
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.45;
}

.auto-note {
  display: block;
  margin-top: 6px;
  padding: 5px 6px;
  border-radius: 5px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--green);
  font-size: 11px;
  line-height: 1.35;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.table-input,
.table-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.table-input {
  min-height: 30px;
  padding: 6px 7px;
}

.table-input.narrow {
  width: 54px;
}

.table-textarea {
  min-height: 84px;
  padding: 7px;
  resize: vertical;
  line-height: 1.42;
}

.table-textarea.small {
  min-height: 58px;
}

.table-textarea.tiny {
  min-height: 42px;
}

.continuity-select,
.continuity-prev {
  margin-bottom: 5px;
}

.table-actions {
  display: grid;
  gap: 6px;
}

.asset-mini-stack {
  min-height: 72px;
  display: flex;
  align-items: center;
  padding-left: 10px;
}

.asset-mini {
  position: relative;
  width: 54px;
  height: 72px;
  flex: 0 0 auto;
  overflow: hidden;
  display: grid;
  align-content: end;
  padding: 0;
  border: 1px solid #cfd6de;
  border-radius: 6px;
  background: #eef1f4;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(19, 25, 32, 0.12);
}

.asset-mini + .asset-mini {
  margin-left: -16px;
}

.asset-mini img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-mini span,
.asset-mini small {
  position: relative;
  z-index: 1;
  padding: 2px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  font-size: 10px;
}

.asset-mini small {
  padding-top: 0;
  color: rgba(255, 255, 255, 0.82);
}

.asset-mini.empty {
  place-items: center;
  color: var(--muted);
  box-shadow: none;
}

.shot-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.shot-tab {
  flex: 0 0 auto;
  min-height: 30px;
  max-width: 180px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}

.shot-tab span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10px;
}

.shot-tab.active {
  border-color: rgba(180, 35, 42, 0.45);
  background: var(--accent-soft);
}

.visual-input-panel {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

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

.visual-input-head h3 {
  margin: 0;
  font-size: 14px;
}

.visual-input-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.visual-control-row {
  display: grid;
  grid-template-columns: 190px 190px minmax(180px, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.visual-control-row label,
.visual-slot-note {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.continuity-strip {
  margin: 0 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.continuity-strip span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
}

.visual-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.visual-slot-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
}

.visual-slot-card {
  width: 118px;
  min-width: 118px;
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.visual-slot-card.required.empty {
  border-color: rgba(180, 35, 42, 0.34);
  background: #fffafa;
}

.visual-slot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.visual-slot-top strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visual-slot-top span {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 10px;
}

.visual-slot-card.required .visual-slot-top span {
  background: var(--accent-soft);
  color: var(--accent);
}

.visual-slot-inline-input,
.visual-slot-inline-select,
.visual-slot-mini-note {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.visual-slot-inline-input {
  min-width: 0;
  padding: 3px 5px;
  font-size: 11px;
  font-weight: 760;
}

.visual-slot-inline-select {
  width: 48px;
  padding: 2px;
  color: var(--muted);
  font-size: 10px;
}

.visual-slot-mini-note {
  min-height: 44px;
  padding: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  resize: vertical;
}

.visual-slot-actions {
  display: flex;
  justify-content: flex-end;
}

.visual-slot-text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 11px;
}

.visual-slot-text-button.danger {
  color: var(--accent);
}

.visual-slot-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}

.visual-slot-note {
  margin-top: 9px;
}

.visual-control-row.compact {
  grid-template-columns: minmax(210px, 320px) minmax(0, 1fr) auto;
  align-items: end;
}

.visual-add-button {
  grid-column: 3;
  justify-self: end;
}

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

.visual-input-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  gap: 12px;
  align-items: start;
}

.visual-video-inputs {
  min-width: 0;
}

.visual-subhead,
.storyboard-frame-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.visual-subhead strong,
.storyboard-frame-head strong {
  color: var(--text);
  font-size: 12px;
}

.visual-subhead span,
.storyboard-frame-head span {
  color: var(--muted);
  font-size: 11px;
}

.video-input-grid .visual-slot-card {
  width: 112px;
  min-width: 112px;
}

.video-input-grid .visual-slot-card .visual-thumb {
  height: 118px;
}

.storyboard-frame-panel {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.storyboard-frame-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #dfe3e8;
  color: var(--muted);
  cursor: pointer;
}

.storyboard-frame-thumb.empty {
  cursor: default;
}

.storyboard-frame-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.storyboard-frame-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.storyboard-frame-actions .secondary-button {
  width: 100%;
  min-height: 30px;
  padding: 6px 8px;
  font-size: 12px;
}

.storyboard-asset-details {
  margin-top: 10px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fff;
}

.storyboard-asset-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.storyboard-asset-details p {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 11px;
}

.storyboard-asset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.storyboard-asset-token {
  width: 150px;
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.storyboard-asset-token.required {
  border-color: rgba(180, 35, 42, 0.3);
}

.modal-image-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 10px;
}

.modal-image-stage img {
  max-height: min(56vh, 620px);
}

.modal-section-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.modal-asset-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.modal-asset-card {
  width: 86px;
  min-width: 86px;
  display: grid;
  gap: 5px;
}

.modal-asset-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-asset-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.modal-asset-thumb {
  width: 86px;
  height: 86px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #dfe3e8;
  padding: 0;
}

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

.modal-asset-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.compact-material-panel .visual-input-head.simple {
  align-items: center;
  margin-bottom: 8px;
}

.compact-material-panel .visual-input-head.simple h3 {
  margin: 0;
  font-size: 15px;
}

.material-add-button {
  min-height: 28px;
  padding: 5px 10px;
  white-space: nowrap;
}

.visual-control-row.inline-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.visual-control-row.inline-control label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.visual-control-row.inline-control .text-input {
  width: 170px;
  min-height: 32px;
}

.material-line {
  align-items: flex-start;
}

.material-line .visual-slot-card,
.storyboard-inline-card {
  width: 112px;
  min-width: 112px;
}

.storyboard-inline-card .visual-thumb,
.material-line .visual-slot-card .visual-thumb {
  height: 118px;
}

.storyboard-inline-actions {
  justify-content: stretch;
}

.storyboard-inline-actions .secondary-button {
  width: 100%;
  min-height: 28px;
  padding: 5px 6px;
  font-size: 11px;
}

.lean-shot-form {
  grid-template-columns: minmax(220px, 320px) 120px minmax(0, 1fr);
  align-items: start;
}

.lean-shot-form .wide {
  grid-column: 1 / -1;
}

.asset-mention-picker {
  position: absolute;
  z-index: 40;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(19, 25, 32, 0.18);
}

.mention-picker-head {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mention-picker-list {
  max-height: calc(100vh - 74px);
  overflow: auto;
  padding: 6px;
}

.mention-group + .mention-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(209, 216, 225, 0.72);
}

.mention-group-title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 5px 6px;
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mention-group-empty {
  margin: 2px 6px 4px;
  color: var(--muted);
  font-size: 11px;
}

.mention-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.mention-item:hover {
  background: var(--panel-soft);
}

.mention-item img,
.mention-empty {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 6px;
  background: #dfe3e8;
  object-fit: cover;
}

.mention-item strong,
.mention-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-item strong {
  font-size: 12px;
}

.mention-item small {
  color: var(--muted);
  font-size: 10px;
}

.visual-asset {
  width: 88px;
  min-width: 88px;
  display: grid;
  gap: 6px;
}

.visual-asset.pending {
  padding: 8px;
  border: 1px solid rgba(180, 35, 42, 0.26);
  border-radius: 6px;
  background: #fffafa;
}

.visual-asset strong {
  font-size: 12px;
}

.visual-thumb {
  width: 88px;
  height: 118px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #dfe3e8;
  padding: 0;
  cursor: pointer;
}

.visual-slot-card .visual-thumb {
  width: 100%;
  height: 126px;
}

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

.visual-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  cursor: default;
}

.visual-asset small,
.visual-slot-card small,
.visual-meta {
  color: var(--muted);
  font-size: 11px;
}

.visual-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.shot-card,
.video-shot {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 11px;
}

.shot-card header,
.video-shot {
  display: grid;
  gap: 8px;
}

.video-shot.video-shot-split {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.video-shot-left,
.video-shot-side {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.video-shot-side {
  grid-template-rows: auto minmax(170px, 1fr) auto auto;
  align-self: stretch;
}

.video-shot-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.video-preview {
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111820;
}

.video-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #111820;
}

.delivery-preview-card {
  width: min(420px, 100%);
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.delivery-preview-card strong {
  font-size: 13px;
}

.delivery-preview-card video {
  width: 100%;
  max-height: 62vh;
  aspect-ratio: 9 / 16;
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111820;
  object-fit: contain;
}

.video-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #d8e4ef;
  font-size: 12px;
}

.video-materials {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 100%;
  overflow-y: hidden;
  overflow-x: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.video-material-section {
  min-width: max-content;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.video-material-section h4 {
  margin: 0;
  padding-top: 2px;
  min-width: 48px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.video-material-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.video-material-row .empty-note {
  margin: 0;
  min-width: 82px;
}

.video-material-card {
  width: 82px;
  min-width: 82px;
  display: grid;
  gap: 5px;
}

.video-material-card strong,
.video-material-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-material-card strong {
  font-size: 11px;
}

.video-material-card small {
  color: var(--muted);
  font-size: 10px;
}

.video-material-thumb {
  width: 82px;
  height: 88px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef1f4;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.video-material-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.video-prompt-box {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 5px;
  min-height: 0;
}

.video-prompt-box span {
  color: var(--muted);
  font-size: 12px;
}

.video-prompt-box textarea {
  height: 100%;
  min-height: 0;
  max-height: 360px;
  overflow-y: hidden;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--text);
  resize: none;
  line-height: 1.5;
}

.video-prompt-box:hover textarea,
.video-prompt-box textarea:focus {
  overflow-y: auto;
}

.continuity-note {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.video-regenerate-row {
  margin-top: 0;
  justify-content: flex-end;
  align-self: end;
}

.shot-card header {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.shot-card header span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
}

.shot-card header strong,
.video-shot strong {
  font-size: 13px;
}

.shot-card header small,
.video-shot p,
.logline {
  color: var(--muted);
  font-size: 12px;
}

.shot-card p {
  min-height: 48px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.shot-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.shot-card dl div {
  min-width: 0;
}

.shot-card dt {
  color: var(--muted);
  font-size: 10px;
}

.shot-card dd {
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

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

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

.compact-shot-form {
  margin-top: 4px;
}

.advanced-shot-settings {
  margin-top: 4px;
  padding: 9px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fff;
}

.advanced-shot-settings summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.advanced-grid {
  margin-top: 9px;
}

.status-pill {
  width: max-content;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
}

.sfx-note {
  color: var(--muted);
  font-size: 12px;
}

pre {
  max-height: 220px;
  overflow: auto;
  padding: 9px;
  border-radius: 6px;
  background: #111820;
  color: #d8e4ef;
  font-size: 11px;
}

.settings-row {
  display: grid;
  grid-template-columns: 160px 58px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.settings-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.ok-text {
  color: var(--green);
}

.bad-text {
  color: var(--accent);
}

.empty-state,
.empty-note {
  color: var(--muted);
  font-size: 13px;
}

.error-banner {
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(180, 35, 42, 0.3);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
}

.success-banner {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(16, 128, 96, 0.3);
  border-radius: 6px;
  background: rgba(16, 128, 96, 0.08);
  color: #0b7658;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10, 14, 20, 0.72);
}

.image-modal {
  width: min(86vw, 980px);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
}

.image-modal header,
.image-modal footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.image-modal footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.image-modal img {
  max-width: 100%;
  max-height: calc(92vh - 104px);
  width: auto;
  height: auto;
  justify-self: center;
  align-self: center;
  object-fit: contain;
}

.modal-shot-editor {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.modal-shot-editor label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.modal-shot-editor small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.storyboard-image-modal {
  width: min(92vw, 1180px);
}

.storyboard-modal-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  overflow: hidden;
}

.storyboard-modal-left {
  min-width: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 12px;
  background: #111820;
}

.storyboard-modal-left > img {
  max-width: 100%;
  max-height: calc(92vh - 104px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.storyboard-modal-side {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border-left: 1px solid var(--line);
  background: var(--panel-soft);
}

.storyboard-modal-assets-block {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
}

.storyboard-modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.storyboard-modal-section-head strong {
  color: var(--text);
  font-size: 13px;
}

.storyboard-modal-assets {
  max-height: 260px;
  overflow: auto;
  align-content: flex-start;
  margin-bottom: 0;
}

.storyboard-modal-asset {
  width: 104px;
  min-width: 104px;
}

.storyboard-modal-asset .modal-asset-title {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.storyboard-modal-asset .modal-asset-title strong {
  min-width: 0;
}

.storyboard-modal-asset .modal-asset-thumb {
  width: 100%;
  height: 90px;
}

.storyboard-modal-asset .modal-asset-thumb img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

.modal-asset-input,
.modal-asset-note {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.modal-asset-input {
  padding: 3px 5px;
  font-size: 11px;
  font-weight: 760;
}

.modal-asset-note {
  min-height: 42px;
  padding: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  resize: vertical;
}

.modal-asset-lock {
  color: var(--muted);
  font-size: 10px;
}

.storyboard-modal-prompt {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.storyboard-modal-prompt textarea {
  min-height: 190px;
}

.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 900px) {
  .storyboard-modal-body {
    grid-template-columns: 1fr;
  }

  .storyboard-modal-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

.l3-run-panel {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #fff;
}

.l3-run-panel.active {
  background: #f7fbfa;
}

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

.l3-run-head h2 {
  margin: 2px 0 3px;
  font-size: 18px;
}

.l3-run-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.l3-kicker {
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.l3-run-actions,
.l3-run-status,
.l3-run-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.l3-run-actions {
  justify-content: flex-end;
}

.l3-run-status {
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
}

.l3-run-status strong {
  color: var(--text);
}

.l3-progress {
  height: 8px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 4px;
  background: #e2e7e9;
}

.l3-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.25s ease;
}

.l3-run-foot {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.l3-events {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.l3-events summary {
  cursor: pointer;
  font-weight: 700;
}

.l3-events div {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.text-danger-button {
  padding: 7px 9px;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

.qc-score-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.qc-score-row strong {
  color: var(--green);
  font-size: 15px;
}

.qc-issues {
  color: var(--accent);
  line-height: 1.5;
}

/* LumenX visual layer: dark pipeline studio */
.main-nav {
  border-right: 1px solid #1d2b3d;
  background: linear-gradient(180deg, #05070b 0%, #071019 100%);
}

.brand {
  border-bottom-color: #26364a;
}

.brand-mark {
  border: 1px solid rgba(255, 64, 87, 0.65);
  border-radius: 4px;
  box-shadow: 0 0 18px rgba(255, 64, 87, 0.28);
}

.brand-subtitle,
.module-item {
  letter-spacing: 0;
}

.module-item {
  border-radius: 4px;
  color: #a8bbcf;
}

.module-item:hover {
  border-color: rgba(35, 215, 186, 0.35);
  color: #f6fbff;
  background: rgba(35, 215, 186, 0.08);
}

.module-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 64, 87, 0.28), rgba(35, 215, 186, 0.06));
  border-color: rgba(255, 64, 87, 0.48);
}

.workspace {
  gap: 10px;
  padding: 12px 16px 16px;
}

.topbar {
  padding: 2px 0;
}

.topbar h1 {
  color: #f8fbff;
  font-size: 18px;
  font-weight: 860;
  text-transform: uppercase;
}

.role-workspace {
  grid-template-columns: 248px minmax(0, 1fr);
}

.role-rail,
.role-detail,
.studio-panel,
.settings-panel,
.asset-section,
.shot-table-wrap,
.breakdown-workbench,
.visual-input-panel,
.shot-card,
.video-shot,
.production-asset-lane,
.asset-stage-head,
.asset-sop-card,
.l3-run-panel {
  border-color: var(--line);
  border-radius: 4px;
  background: rgba(15, 21, 30, 0.94);
  box-shadow: var(--shadow);
}

.role-detail {
  background:
    linear-gradient(180deg, rgba(18, 28, 40, 0.92), rgba(10, 15, 22, 0.96));
}

.rail-head,
.role-row,
.project-row,
.shot-row,
.health-pill,
.production-asset-card,
.visual-slot-card,
.storyboard-frame-panel,
.storyboard-asset-token,
.modal-asset-card,
.video-materials,
.delivery-preview-card,
.sop-brief,
.storyboard-inline-card {
  border-color: var(--line);
  border-radius: 4px;
  background: #0b121b;
}

.rail-head {
  background: rgba(10, 16, 24, 0.98);
}

.project-row.active,
.role-row.active,
.shot-row.active,
.breakdown-item.active,
.shot-tab.active {
  border-color: rgba(255, 64, 87, 0.52);
  background: rgba(255, 64, 87, 0.12);
}

.role-cover,
.detail-avatar,
.gallery-tile img,
.visual-thumb,
.storyboard-frame-thumb,
.production-asset-thumb,
.video-material-thumb,
.modal-asset-thumb,
.mention-item img {
  border-radius: 4px;
  background: #111a25;
}

.icon-button,
.primary-button,
.danger-outline-button,
.secondary-button,
.create-project-button,
.secondary-link,
.create-asset-button {
  min-height: 30px;
  border-radius: 4px;
  border-color: #32445b;
  background: #121c28;
  color: #e9f3fb;
}

.primary-button {
  border-color: rgba(255, 64, 87, 0.72);
  background: linear-gradient(180deg, #ff4a61, #c9273b);
  color: #fff;
  box-shadow: 0 0 18px rgba(255, 64, 87, 0.2);
}

.danger-outline-button {
  border-color: rgba(255, 64, 87, 0.62);
  background: rgba(255, 64, 87, 0.08);
  color: #ff6d7f;
}

.secondary-button:hover,
.create-project-button:hover,
.secondary-link:hover {
  border-color: rgba(35, 215, 186, 0.55);
  color: #f7fffd;
}

.create-asset-button {
  border-style: solid;
  background: rgba(35, 215, 186, 0.07);
  color: var(--green);
}

.studio-step-head {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -1px 0 14px;
  padding: 8px 0 12px;
  border-bottom-color: #304056;
  background: linear-gradient(180deg, rgba(15, 21, 30, 0.98), rgba(15, 21, 30, 0.9));
  backdrop-filter: blur(10px);
}

.studio-stepper {
  gap: 8px;
}

.step-chip {
  min-height: 28px;
  padding: 4px 10px 4px 5px;
  border-radius: 4px;
  border-color: #314258;
  background: #0a111a;
  color: #a9bdd0;
  font-weight: 760;
}

.step-chip span {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: #172334;
  color: #8fa2b6;
}

.step-chip.done {
  color: var(--green);
  border-color: rgba(35, 215, 186, 0.4);
  background: rgba(35, 215, 186, 0.07);
}

.step-chip.active {
  color: #fff;
  border-color: rgba(255, 64, 87, 0.72);
  background: linear-gradient(90deg, rgba(255, 64, 87, 0.92), rgba(255, 64, 87, 0.42));
}

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

.step-arrow {
  color: #557189;
}

.text-input,
.script-input,
.mini-textarea,
.timeline-textarea,
.visual-slot-inline-input,
.visual-slot-inline-select,
.visual-slot-mini-note,
.modal-asset-input,
.modal-asset-note,
.video-prompt-box textarea,
select {
  border-color: #314258;
  border-radius: 4px;
  background: #081019;
  color: var(--text);
}

.text-input:focus,
.script-input:focus,
.mini-textarea:focus,
.timeline-textarea:focus {
  outline: 1px solid rgba(35, 215, 186, 0.55);
  border-color: rgba(35, 215, 186, 0.65);
}

.sop-brief {
  border-left-color: var(--green);
  background: linear-gradient(90deg, rgba(35, 215, 186, 0.11), rgba(18, 28, 40, 0.72));
}

.asset-stage-head,
.asset-sop-card,
.production-asset-lane,
.l3-run-panel {
  background: linear-gradient(180deg, #101924, #0b121b);
}

.asset-stage-status span,
.status-pill,
.breakdown-item em,
.visual-slot-top span,
.continuity-strip span {
  border: 1px solid #304056;
  background: #121c28;
  color: #a9bdd0;
}

.asset-sop-card {
  border-top: 2px solid rgba(35, 215, 186, 0.34);
}

.production-asset-card.used {
  border-color: rgba(35, 215, 186, 0.48);
  background: rgba(35, 215, 186, 0.08);
}

.breakdown-workbench {
  border-color: #304056;
  background: #0b121b;
}

.breakdown-list {
  background: #081019;
}

.breakdown-detail {
  border-left-color: var(--accent);
  background: #0f151e;
}

.breakdown-detail-head {
  border-bottom-color: #304056;
}

.visual-input-panel {
  background: linear-gradient(180deg, #101924, #0d151f);
}

.visual-slot-card.required.empty {
  border-color: rgba(255, 64, 87, 0.42);
  background: rgba(255, 64, 87, 0.08);
}

.visual-slot-card.required .visual-slot-top span {
  background: rgba(255, 64, 87, 0.14);
  color: #ff7b8b;
}

.video-shot.video-shot-split {
  border-color: #314258;
  background: linear-gradient(180deg, #0f151e, #0a111a);
}

.video-preview,
.delivery-preview-card video {
  border-color: #32445b;
  background: #03060a;
}

.video-materials {
  background: #081019;
}

.mention-picker-head,
.mention-picker-list,
.asset-mention-picker,
.image-modal,
.storyboard-modal {
  border-color: var(--line);
  background: #0f151e;
  color: var(--text);
}

.mention-item {
  background: #0b121b;
  color: var(--text);
}

.mention-item:hover {
  border-color: rgba(35, 215, 186, 0.55);
  background: rgba(35, 215, 186, 0.08);
}

.studio-panel,
.planning-panel,
.episode-asset-summary,
.shot-list-card,
.shotmaker-controls,
.shotmaker-stage,
.shotmaker-preview-card {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(26, 18, 48, 0.96), rgba(13, 8, 25, 0.96));
  color: var(--text);
}

.text-input,
.script-input,
.timeline-textarea,
.mini-textarea,
.video-prompt-box textarea {
  border-color: #3b2b5b;
  background: #0b0714;
  color: var(--text);
}

.text-input:focus,
.script-input:focus,
.timeline-textarea:focus,
.mini-textarea:focus {
  outline: 2px solid rgba(183, 132, 255, 0.32);
  border-color: rgba(183, 132, 255, 0.76);
}

.step-chip {
  background: #130d23;
  border-color: #3d2c61;
  color: #b9aacd;
}

.step-chip span {
  background: #281b40;
  color: #b9aacd;
}

.step-chip.done {
  color: var(--green);
  border-color: rgba(35, 215, 186, 0.5);
  background: rgba(35, 215, 186, 0.08);
}

.step-chip.active {
  background: linear-gradient(135deg, #c51f3a, #7b4dff);
  border-color: rgba(255, 255, 255, 0.18);
}

.planning-grid,
.episode-script-layout,
.shotmaker-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  gap: 14px;
  min-height: 0;
}

.planning-panel,
.episode-asset-summary,
.shotmaker-controls,
.shotmaker-stage {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

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

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

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

.planning-fields label,
.shotmaker-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.planning-fields .wide,
.shotmaker-controls .wide {
  grid-column: 1 / -1;
}

.upload-choice-grid {
  display: grid;
  gap: 10px;
}

.upload-card {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 12px;
  border: 1px dashed #4a3970;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.upload-card.active {
  border-style: solid;
  border-color: rgba(35, 215, 186, 0.48);
  background: rgba(35, 215, 186, 0.08);
}

.episode-script-main {
  min-width: 0;
}

.episode-asset-summary {
  align-self: start;
  display: grid;
  gap: 10px;
}

.episode-asset-summary span {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.shot-list-production {
  display: grid;
  gap: 12px;
}

.shot-list-card {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.shot-list-title-row,
.shotmaker-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.shot-list-info {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.shot-list-meta {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.shotmaker-shell {
  grid-template-columns: 360px minmax(0, 1fr);
}

.shotmaker-controls {
  align-self: start;
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
}

.shotmaker-title {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.shotmaker-title span {
  color: var(--accent);
  font-size: 28px;
  font-weight: 800;
}

.shotmaker-title strong {
  font-size: 20px;
}

.shotmaker-stage {
  display: grid;
  gap: 12px;
}

.shotmaker-preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.shotmaker-preview-card .video-preview {
  width: min(320px, 100%);
}

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

.mention-preview {
  max-height: 120px;
  overflow-y: auto;
  padding: 9px;
  border: 1px solid #34264e;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: #d9d0e8;
  font-size: 12px;
  line-height: 1.6;
}

.asset-mention {
  display: inline;
  font-weight: 760;
}

.asset-mention.role {
  color: var(--asset-role);
}

.asset-mention.background {
  color: var(--asset-background);
}

.asset-mention.prop {
  color: var(--asset-prop);
}

.expression-suggestion-row {
  display: grid;
  gap: 7px;
}

.expression-suggestion-row > div {
  display: flex;
  gap: 7px;
  overflow-x: auto;
}

.expression-mini {
  width: 58px;
  min-width: 58px;
  display: grid;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.expression-mini img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.video-materials,
.video-prompt-box textarea {
  background: rgba(255, 255, 255, 0.035);
}

.video-material-card {
  width: 78px;
  min-width: 78px;
}

.video-material-thumb {
  width: 78px;
  height: 82px;
  background: #0b0714;
}

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

  .breakdown-list {
    max-height: 260px;
    min-height: 0;
  }

  .breakdown-detail {
    border-top: 4px solid var(--accent);
    border-left: 0;
  }

  .breakdown-form {
    grid-template-columns: 1fr;
  }

  .studio-step-head,
  .video-shot.video-shot-split {
    grid-template-columns: 1fr;
    display: grid;
  }

  .studio-step-actions {
    justify-content: flex-start;
  }

  .l3-run-head {
    display: grid;
  }

  .l3-events div {
    grid-template-columns: 1fr;
  }
}

/* NSFW Section Styles */
.nsfw-section { margin-top: 16px; }

.nsfw-section-head {
  align-items: center;
}

.nsfw-display-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  user-select: none;
}

.nsfw-display-toggle input {
  width: 34px;
  height: 18px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0a0f19;
  cursor: pointer;
  position: relative;
}

.nsfw-display-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
  transition: transform 0.16s ease, background 0.16s ease;
}

.nsfw-display-toggle input:checked {
  border-color: var(--green);
  background: rgba(39, 226, 196, 0.14);
}

.nsfw-display-toggle input:checked::after {
  transform: translateX(15px);
  background: var(--green);
}

.nsfw-hidden-state {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.role-nsfw-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.role-nsfw-tile .tile-media {
  aspect-ratio: 3 / 4;
}

.role-nsfw-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nsfw-btn {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.nsfw-btn:hover:not(:disabled) {
  background: var(--panel-soft);
}

.nsfw-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.nsfw-btn-upload {
  border-color: var(--asset-role);
  color: var(--asset-role);
}

.nsfw-btn-upload:hover:not(:disabled) {
  background: rgba(85, 167, 255, 0.1);
}

.nsfw-btn-clear {
  border-color: var(--accent);
  color: var(--accent);
}

.nsfw-btn-clear:hover:not(:disabled) {
  background: rgba(255, 64, 87, 0.1);
}

.role-nsfw-modal-backdrop {
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 18%, rgba(148, 74, 211, 0.2), transparent 36%),
    rgba(2, 5, 13, 0.82);
  backdrop-filter: blur(8px);
}

.role-nsfw-modal {
  position: relative;
  width: min(1180px, calc(100vw - 52px));
  max-height: min(760px, calc(100vh - 52px));
  border: 1px solid rgba(146, 91, 210, 0.72);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(18, 28, 43, 0.98), rgba(9, 13, 23, 0.98)),
    #0b101a;
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 42px rgba(137, 75, 209, 0.18);
}

.role-nsfw-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 64, 87, 0.22), transparent 26%, transparent 74%, rgba(124, 92, 255, 0.2)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 18%);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  padding: 1px;
}

.role-nsfw-modal header div {
  display: grid;
  gap: 4px;
}

.role-nsfw-modal header {
  min-height: 76px;
  padding: 16px 18px;
  border-bottom-color: rgba(118, 79, 168, 0.55);
  background: linear-gradient(90deg, rgba(17, 27, 43, 0.98), rgba(15, 14, 31, 0.98));
}

.role-nsfw-modal header strong {
  color: #f7f2ff;
  font-size: 20px;
  letter-spacing: 0;
}

.role-nsfw-modal header span {
  color: var(--muted);
  font-size: 12px;
}

.role-nsfw-modal header button {
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid rgba(169, 141, 212, 0.48);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #f5efff;
  font-size: 13px;
  font-weight: 800;
}

.role-nsfw-modal header button:hover {
  border-color: rgba(255, 91, 120, 0.72);
  background: rgba(255, 64, 87, 0.16);
}

.role-nsfw-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 18px 12px;
  padding: 4px;
  border: 1px solid rgba(94, 65, 132, 0.52);
  border-radius: 12px;
  background: rgba(7, 10, 19, 0.72);
}

.role-nsfw-tabs button {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 9px;
  border-color: transparent;
  background: transparent;
  color: #afa2c7;
  font-size: 13px;
  font-weight: 850;
}

.role-nsfw-tabs button.active {
  border-color: rgba(255, 64, 87, 0.62);
  background: linear-gradient(135deg, rgba(255, 64, 87, 0.2), rgba(124, 92, 255, 0.12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.role-nsfw-panel {
  display: none;
  padding: 0 18px 18px;
}

.role-nsfw-panel.active {
  display: block;
}

.role-nsfw-upload-drop {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px dashed rgba(141, 105, 194, 0.62);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(47, 32, 74, 0.46), rgba(8, 13, 22, 0.78));
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.role-nsfw-upload-drop:hover {
  border-color: rgba(255, 91, 120, 0.78);
  background:
    linear-gradient(135deg, rgba(70, 38, 86, 0.56), rgba(11, 18, 30, 0.82));
  transform: translateY(-1px);
}

.role-nsfw-upload-drop input {
  display: none;
}

.role-nsfw-upload-drop span {
  color: var(--text);
  font-weight: 700;
}

.role-nsfw-upload-drop small {
  color: var(--muted);
}

.role-nsfw-upload-drop.compact {
  padding: 12px;
}

.role-nsfw-upload-preview {
  min-height: 96px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(92, 67, 129, 0.64);
  border-radius: 12px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  background: rgba(4, 6, 12, 0.78);
}

.role-nsfw-upload-preview.small {
  min-height: 74px;
}

.role-nsfw-upload-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  object-fit: contain;
}

.role-nsfw-modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.role-nsfw-create-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(300px, 1.1fr);
  gap: 18px;
  min-height: 500px;
}

.role-nsfw-create-left,
.role-nsfw-create-right {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(92, 67, 129, 0.64);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(18, 14, 32, 0.92), rgba(7, 10, 18, 0.92));
}

.role-nsfw-create-right {
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: stretch;
}

.role-nsfw-prompt-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.role-nsfw-prompt-label textarea {
  min-height: 150px;
  resize: vertical;
  border: 1px solid rgba(92, 67, 129, 0.72);
  border-radius: 12px;
  background: rgba(4, 6, 12, 0.86);
  color: var(--text);
  padding: 10px;
}

.role-nsfw-generated-preview {
  width: min(330px, 100%);
  max-height: 100%;
  aspect-ratio: 9 / 16;
  justify-self: center;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(141, 105, 194, 0.68);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 45%, rgba(126, 85, 194, 0.16), transparent 44%),
    #050710;
  color: var(--muted);
  text-align: center;
  padding: 12px;
  box-shadow: inset 0 0 38px rgba(124, 92, 255, 0.08);
}

.role-nsfw-generated-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.role-nsfw-generated-preview strong,
.role-nsfw-generated-preview span {
  display: block;
}

.role-nsfw-generated-preview span {
  margin-top: 6px;
  font-size: 12px;
}

@media (max-width: 760px) {
  .role-nsfw-create-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

/* K Plan package 1: product skeleton and frontend state model */
.topbar:has(.studio-stepper) {
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 2px 0 4px;
}

.topbar:has(.studio-stepper) h1 {
  color: #f7f2ff;
  font-size: 17px;
}

.topbar-steps .studio-stepper {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(112px, 1fr));
  gap: 7px;
}

.topbar-steps .step-arrow {
  display: none;
}

.topbar-steps .step-chip {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #3b2c54;
  border-radius: 6px;
  background: #100a1b;
  color: #b8abc9;
  cursor: pointer;
  white-space: nowrap;
}

.topbar-steps .step-chip span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid #55406f;
  border-radius: 50%;
  color: #d7cce8;
  font-size: 11px;
}

.topbar-steps .step-chip.active {
  border-color: #b86cff;
  background: #241333;
  color: #fff;
  box-shadow: inset 0 -2px 0 #b86cff;
}

.topbar-steps .step-chip.done {
  border-color: #5f4778;
  color: #e8deef;
}

.role-rail.studio-rail {
  background: #0b0712;
}

.studio-rail-list {
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
}

.k-new-series-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid #8d53bd;
  border-radius: 6px;
  background: #241333;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.k-rail-list {
  display: grid;
  align-content: start;
  gap: 8px;
  margin-top: 12px;
}

.k-rail-card {
  overflow: hidden;
  border: 1px solid #2f243f;
  border-radius: 7px;
  background: #110c1a;
}

.k-rail-card.active {
  border-color: #a25dd4;
  background: #1c1128;
}

.k-rail-card-main {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 0;
  background: transparent;
  color: #f4eef9;
  cursor: pointer;
  text-align: left;
}

.k-rail-card-main strong,
.k-rail-card-main span,
.k-rail-card-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-rail-card-main span {
  color: #c3b5d2;
  font-size: 12px;
}

.k-rail-card-main small {
  color: #847593;
  font-size: 10px;
}

.k-rail-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid #2f243f;
}

.k-rail-card-actions button {
  min-height: 30px;
  border: 0;
  border-right: 1px solid #2f243f;
  background: #0d0914;
  color: #a998b8;
  cursor: pointer;
  font-size: 11px;
}

.k-rail-card-actions button:last-child {
  border-right: 0;
}

.k-rail-card-actions button:hover {
  background: #21142d;
  color: #fff;
}

.k-rail-card-actions button.danger {
  color: #ff7f91;
}

.k-rail-context {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #342747;
  border-radius: 7px;
  background: #171021;
}

.k-rail-context small,
.k-rail-section-title {
  color: #9484a5;
  font-size: 11px;
}

.k-rail-section-title {
  margin-top: 16px;
  text-transform: uppercase;
}

.k-plan-page {
  min-height: 100%;
  padding: 18px;
  border: 0;
  background: #0e0917;
}

.k-page-title,
.k-page-toolbar,
.k-shot-meta,
.k-action-row,
.k-shot-actions,
.k-page-actions,
.k-first-frame-card .section-head,
.k-master-preview .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.k-page-title {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #342747;
}

.k-page-title span,
.k-page-title small,
.k-breadcrumb {
  color: #9d8eac;
  font-size: 13px;
}

.k-page-title h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.k-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 14px;
}

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

.k-breadcrumb strong {
  color: #e8deef;
}

.k-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #342747;
}

.k-tabs button,
.k-source-modes button,
.k-segmented button,
.k-modal-tabs button,
.k-shot-actions button {
  border: 1px solid #3a2b4f;
  border-radius: 5px;
  background: #130d1d;
  color: #b8a9c7;
  cursor: pointer;
}

.k-tabs button {
  min-width: 118px;
  padding: 10px 14px;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}

.k-tabs button.active,
.k-source-modes button.active,
.k-segmented button.active,
.k-modal-tabs button.active {
  border-color: #a45ed5;
  background: #29163a;
  color: #fff;
}

.k-tab-panel {
  padding-top: 18px;
}

.k-style-grid,
.k-source-grid,
.k-episode-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.k-style-grid label,
.k-source-grid label,
.k-field-block,
.k-episode-editor label,
.k-shotmaker-controls label,
.k-modal-panel label {
  display: grid;
  gap: 7px;
  color: #cfc3da;
  font-size: 12px;
}

.k-style-grid textarea,
.k-source-grid textarea,
.k-episode-editor textarea,
.k-shotmaker-controls textarea,
.k-modal-panel textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid #3b2d4e;
  border-radius: 6px;
  outline: none;
  background: #09060e;
  color: #f0e9f5;
  line-height: 1.55;
}

.k-style-grid textarea:focus,
.k-source-grid textarea:focus,
.k-episode-editor textarea:focus,
.k-shotmaker-controls textarea:focus {
  border-color: #a45ed5;
}

.k-span-all,
.k-episode-editor > section {
  grid-column: 1 / -1;
}

.k-source-modes,
.k-segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

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

.k-source-modes button,
.k-segmented button {
  min-height: 38px;
}

.k-upload-field {
  position: relative;
  align-content: center;
  min-height: 92px;
  padding: 14px;
  border: 1px dashed #5e4278;
  border-radius: 7px;
  background: #100a19;
}

.k-upload-field input {
  width: 100%;
}

.k-inline-notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #5f447c;
  border-radius: 6px;
  background: #1a1026;
  color: #decfea;
  font-size: 12px;
}

.k-inline-notice.busy {
  position: relative;
  padding-left: 34px;
}

.k-inline-notice.busy::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -6px;
  border: 2px solid #6d547f;
  border-top-color: #f0e9f5;
  border-radius: 50%;
  animation: k-plan-spin 0.8s linear infinite;
}

.k-analysis-state {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #342747;
  border-radius: 6px;
  background: #0d0913;
  color: #a99bb5;
  font-size: 12px;
}

.k-analysis-state strong {
  flex: 0 0 auto;
  color: #f0e9f5;
}

.k-analysis-state.error {
  border-color: #76404f;
  color: #f0a9b9;
}

@keyframes k-plan-spin {
  to { transform: rotate(360deg); }
}

.k-asset-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.k-asset-thumb {
  flex: 0 0 138px;
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #342747;
  border-radius: 6px;
  background: #120c1b;
}

.k-asset-thumb img,
.k-asset-thumb > span {
  width: 46px;
  height: 54px;
  display: grid;
  place-items: center;
  object-fit: cover;
  border-radius: 4px;
  background: #241632;
}

.k-asset-thumb div {
  min-width: 0;
}

.k-asset-thumb strong,
.k-asset-thumb small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-asset-thumb small {
  margin-top: 4px;
  color: #8f809e;
  font-size: 10px;
}

.k-shot-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.k-shot-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid #342747;
  border-radius: 7px;
  background: #120c1b;
}

.k-shot-video {
  min-height: 148px;
  overflow: hidden;
  border: 1px solid #2a2038;
  border-radius: 6px;
  background: #050308;
}

.k-shot-video video,
.k-shot-video > div {
  width: 100%;
  height: 100%;
  min-height: 148px;
}

.k-shot-video video {
  object-fit: contain;
}

.k-shot-video > div {
  display: grid;
  place-content: center;
  gap: 8px;
  color: #82748f;
  text-align: center;
}

.k-shot-video span {
  color: #c38bf0;
  font-size: 25px;
  font-weight: 800;
}

.k-shot-info {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.k-shot-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.k-shot-meta strong {
  margin-right: auto;
}

.k-shot-meta span,
.k-shot-meta em {
  padding: 4px 8px;
  border: 1px solid #3b2d4e;
  border-radius: 4px;
  color: #a998b8;
  font-size: 10px;
  font-style: normal;
}

.k-shot-info > p {
  margin: 0;
  color: #d5cadf;
  line-height: 1.55;
}

.k-shot-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.k-shot-actions button {
  min-height: 31px;
  padding: 6px 10px;
}

.k-shot-actions .primary-button {
  border-color: #b05ee3;
  background: #6f348f;
}

.k-shotmaker-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  gap: 14px;
}

.k-shotmaker-controls,
.k-shotmaker-stage {
  min-width: 0;
  padding: 14px;
  border: 1px solid #342747;
  border-radius: 7px;
  background: #120c1b;
}

.k-shotmaker-controls {
  display: grid;
  align-content: start;
  gap: 13px;
}

.k-shotmaker-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid #342747;
}

.k-shotmaker-number strong {
  color: #c486f0;
  font-size: 28px;
}

.k-first-frame-card {
  display: grid;
  gap: 8px;
}

.k-first-frame-card h3 {
  margin: 0;
  font-size: 13px;
}

.k-first-frame-card .section-head button {
  border: 0;
  background: transparent;
  color: #c486f0;
  cursor: pointer;
}

.k-first-frame-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px dashed #63467f;
  border-radius: 6px;
  background: #08050c;
  color: #8f809e;
  cursor: pointer;
}

.k-first-frame-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.k-stage-video {
  min-height: 360px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #2b2039;
  border-radius: 7px;
  background: #030205;
}

.k-stage-video video {
  width: 100%;
  max-height: 520px;
}

.k-stage-video > div {
  display: grid;
  gap: 8px;
  color: #81748d;
  text-align: center;
}

.k-horizontal-shot-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 12px;
  padding-bottom: 4px;
}

.k-horizontal-shot-list > button {
  flex: 0 0 128px;
  min-height: 58px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid #342747;
  border-radius: 6px;
  background: #0d0914;
  color: #b8a9c7;
  cursor: pointer;
  text-align: left;
}

.k-horizontal-shot-list > button.active {
  border-color: #ad65dd;
  color: #fff;
}

.k-horizontal-shot-list .k-add-shot {
  grid-template-columns: 24px minmax(0, 1fr);
  border-style: dashed;
}

.k-assembly-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #241832;
}

.k-assembly-progress span {
  display: block;
  height: 100%;
  background: #a45ed5;
}

.k-stage-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 7px;
  margin: 14px 0;
}

.k-stage-list > div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #342747;
  border-radius: 6px;
  background: #110b19;
}

.k-stage-list > div.done {
  border-color: #6e4d86;
  background: #20122c;
}

.k-stage-list span,
.k-stage-list small {
  color: #8f809e;
  font-size: 10px;
}

.k-master-preview {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.k-master-preview video {
  width: 100%;
  max-height: 560px;
  border: 1px solid #342747;
  border-radius: 7px;
  background: #030205;
}

.k-download-link {
  text-decoration: none;
}

.k-empty-note,
.k-empty-page {
  min-height: 90px;
  display: grid;
  place-content: center;
  gap: 12px;
  color: #9788a7;
  text-align: center;
}

.k-first-frame-backdrop {
  z-index: 120;
}

.k-first-frame-modal {
  width: min(860px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-color: #4d3764;
  background: #0e0917;
}

.k-first-frame-modal header div {
  display: grid;
  gap: 3px;
}

.k-first-frame-modal header small {
  color: #9181a1;
}

.k-modal-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 14px 16px 0;
}

.k-modal-tabs button {
  min-height: 40px;
}

.k-modal-panel {
  display: none;
  min-height: 260px;
  padding: 16px;
}

.k-modal-panel.active {
  display: grid;
  align-content: start;
  gap: 12px;
}

.k-upload-drop {
  min-height: 132px;
  place-content: center;
  padding: 18px;
  border: 1px dashed #654981;
  border-radius: 7px;
  background: #100a19;
  text-align: center;
}

.k-upload-preview {
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9788a7;
}

.k-upload-preview img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 5px;
  background: #030205;
}

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

.k-tail-frame-list button {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid #342747;
  border-radius: 6px;
  background: #100a19;
  color: #b8a9c7;
  cursor: pointer;
}

.k-tail-frame-list button.selected {
  border-color: #b86cff;
}

.k-tail-frame-list img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
}

.asset-mention-picker {
  width: min(560px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  max-height: min(460px, calc(100vh - 64px));
  overflow: auto;
}

@media (max-width: 1380px) {
  .topbar:has(.studio-stepper) {
    grid-template-columns: 116px minmax(0, 1fr);
  }

  .topbar-steps .step-chip {
    font-size: 11px;
  }

  .k-shotmaker-layout {
    grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  }

  .k-stage-list {
    grid-template-columns: repeat(4, minmax(90px, 1fr));
  }
}

.k-shotmaker-stage {
  grid-template-rows: auto auto auto auto;
}

/* K Plan package 3: shot production routing and single-shot preview */
.k-production-route {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.k-production-route > div,
.k-reference-assets,
.k-production-advanced {
  border: 1px solid var(--k-line);
  border-radius: 8px;
  background: #0a0e15;
}

.k-production-route > div {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
}

.k-production-route span,
.k-production-route small,
.k-first-frame-card > small {
  color: var(--k-muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.k-production-route strong {
  color: #f0dce3;
  font-size: 12px;
}

.k-reference-assets {
  padding: 10px;
}

.k-production-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.k-production-asset {
  display: grid;
  grid-template-columns: 28px auto 20px;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 7px;
  min-width: 138px;
  padding: 5px 6px;
  border: 1px solid #334155;
  border-radius: 7px;
  background: #101722;
}

.k-production-asset.role { border-color: rgba(226, 83, 97, 0.62); }
.k-production-asset.background { border-color: rgba(73, 149, 201, 0.62); }
.k-production-asset.prop { border-color: rgba(183, 142, 76, 0.62); }

.k-production-asset img {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
}

.k-production-asset strong,
.k-production-asset small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-production-asset strong { font-size: 11px; }
.k-production-asset small { color: var(--k-muted); font-size: 9px; }

.k-production-asset button {
  grid-column: 3;
  grid-row: 1 / 3;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #a7b0c0;
}

.k-production-empty {
  color: var(--k-muted);
  font-size: 11px;
}

.k-face-toggle {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 7px;
}

.k-face-toggle input { width: 15px; height: 15px; }

.k-production-advanced {
  padding: 9px 10px;
}

.k-production-advanced summary {
  cursor: pointer;
  color: #d8dee8;
  font-size: 11.5px;
}

.k-production-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.k-production-slot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  padding: 7px 8px;
  border: 1px solid #2a3447;
  border-radius: 6px;
  background: #0e141e;
}

.k-production-slot.ready { border-color: rgba(56, 201, 168, 0.42); }
.k-production-slot.missing { border-color: rgba(226, 83, 97, 0.42); }
.k-production-slot span { font-size: 11px; }
.k-production-slot strong { color: var(--k-muted); font-size: 9px; }
.k-production-slot small { grid-column: 1 / 3; color: var(--k-muted); font-size: 9px; }

.k-production-advanced pre,
.k-production-preview pre {
  max-height: 210px;
  overflow: auto;
  padding: 9px;
  border: 1px solid #242d3d;
  border-radius: 6px;
  background: #05070b;
  color: #cfd7e4;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.k-shotmaker-stage {
  grid-template-rows: auto auto auto auto;
}

.k-refresh-job {
  width: min(430px, 100%);
  margin-top: 8px;
}

.k-maker-shot-strip {
  display: flex;
  gap: 7px;
  width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  padding: 4px 2px 8px;
}

.k-maker-shot-strip button {
  flex: 0 0 78px;
  min-height: 48px;
  border: 1px solid #2a3447;
  border-radius: 7px;
  background: #0b1018;
  color: #d8dee8;
}

.k-maker-shot-strip button.active {
  border-color: rgba(226, 83, 97, 0.78);
  background: rgba(226, 83, 97, 0.12);
}

.k-maker-shot-strip button span,
.k-maker-shot-strip button small { display: block; }
.k-maker-shot-strip button small { margin-top: 3px; color: var(--k-muted); font-size: 9px; }
.k-maker-shot-strip .k-add-shot { flex-basis: 48px; font-size: 19px; }

.k-production-preview-backdrop {
  z-index: 1400;
}

.k-production-preview {
  width: min(760px, calc(100vw - 28px));
  max-height: min(86vh, 860px);
  overflow: auto;
}

.k-production-preview > section {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--k-line);
  border-radius: 8px;
  background: #0a0e15;
}

.k-preview-route {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  align-items: center;
}

.k-preview-route p { grid-column: 1 / 3; margin: 0; color: var(--k-muted); font-size: 11px; }
.k-inline-notice.success { border-color: rgba(56, 201, 168, 0.44); background: rgba(56, 201, 168, 0.1); color: #a9e8d7; }
.k-inline-notice.error { border-color: rgba(226, 83, 97, 0.5); background: rgba(226, 83, 97, 0.12); color: #f4c9cf; }

@media (max-width: 980px) {
  .k-production-route,
  .k-production-slots {
    grid-template-columns: 1fr;
  }
}
.k-action-dialog-backdrop {
  z-index: 1400;
}

.k-action-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid #40304d;
  background: #141119;
  color: #f5f1f8;
}

.k-action-dialog-head,
.k-action-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.k-action-dialog-head h3,
.k-action-dialog p {
  margin: 0;
}

.k-action-dialog p {
  margin-top: 14px;
  color: #c9c0cf;
  line-height: 1.65;
}

.k-action-dialog label {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.k-action-dialog-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

.danger-button {
  border: 1px solid #853d52;
  background: #4a1f2b;
  color: #ffdce5;
}

.danger-button:hover {
  background: #612739;
}

/* K Plan package 2 UI polish: compact production-console layout */
:root {
  --k-bg: #0b0d12;
  --k-panel: #111722;
  --k-panel-soft: #151d2a;
  --k-line: #293244;
  --k-line-soft: #202838;
  --k-text: #eef2f7;
  --k-muted: #9aa6b8;
  --k-accent: #e25361;
  --k-accent-soft: rgba(226, 83, 97, 0.16);
  --k-good: #38c9a8;
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(226, 83, 97, 0.12), transparent 30%),
    radial-gradient(circle at 88% 10%, rgba(55, 74, 102, 0.18), transparent 28%),
    linear-gradient(180deg, #080b11 0%, #05070b 100%);
}

.topbar {
  min-height: 0;
  padding-bottom: 6px;
  gap: 9px;
}

.topbar:has(.studio-stepper) {
  min-height: 78px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 0 0 6px;
}

.topbar:has(.studio-stepper) h1 {
  font-size: 21px;
  line-height: 1.05;
}

.topbar-steps {
  display: block;
  min-height: 32px;
  grid-column: 1 / -1;
}

.topbar-steps:empty {
  display: none;
}

.topbar-steps .studio-stepper {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  padding: 4px;
  border: 1px solid rgba(58, 69, 92, 0.78);
  border-radius: 9px;
  background: rgba(8, 11, 17, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.topbar-steps .step-arrow {
  display: none;
}

.topbar-steps .step-chip {
  min-width: 0;
  min-height: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #8f9bad;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
}

.topbar-steps .step-chip span {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(143, 155, 173, 0.45);
  border-radius: 999px;
  color: #aeb8c7;
  font-size: 10px;
  line-height: 1;
}

.topbar-steps .step-chip.done {
  color: #c7d0dc;
  background: rgba(21, 29, 42, 0.58);
}

.topbar-steps .step-chip.done span {
  border-color: rgba(56, 201, 168, 0.55);
  color: #8ce6d3;
}

.topbar-steps .step-chip.active {
  border-color: rgba(226, 83, 97, 0.86);
  background: rgba(226, 83, 97, 0.18);
  color: #fff5f6;
  box-shadow: 0 10px 28px rgba(226, 83, 97, 0.08);
}

.topbar-steps .step-chip.active span {
  border-color: rgba(255, 121, 136, 0.9);
  background: rgba(226, 83, 97, 0.2);
  color: #ffffff;
}

.role-workspace.studio-no-rail {
  grid-template-columns: minmax(0, 1fr);
}

.role-rail.is-hidden {
  display: none;
}

.role-rail.studio-rail {
  background: #0a0d13;
  border-color: #202838;
}

.studio-rail-list {
  padding: 10px;
}

.k-new-series-button {
  min-height: 36px;
  border-color: rgba(226, 83, 97, 0.72);
  border-radius: 8px;
  background: rgba(226, 83, 97, 0.13);
  font-size: 12px;
}

.k-rail-list {
  gap: 8px;
}

.k-rail-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  align-items: stretch;
  overflow: visible;
  border-color: var(--k-line);
  border-radius: 8px;
  background: var(--k-panel);
}

.k-rail-card.active {
  border-color: rgba(226, 83, 97, 0.72);
  background: #171d28;
  box-shadow: inset 3px 0 0 var(--k-accent);
}

.k-rail-card-main {
  min-width: 0;
  padding: 10px 11px;
}

.k-rail-card-main strong {
  font-size: 12px;
}

.k-rail-card-main span,
.k-rail-card-main small {
  font-size: 10.5px;
}

.k-rail-card-actions {
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(28px, 1fr);
  border-top: 0;
  border-left: 1px solid var(--k-line);
}

.k-rail-card-actions button {
  min-height: 28px;
  border-right: 0;
  border-bottom: 1px solid var(--k-line-soft);
  background: #0d121b;
  color: #aab4c3;
  font-size: 11px;
  white-space: nowrap;
}

.k-rail-card-actions button:last-child {
  border-bottom: 0;
}

.k-rail-card-actions button:hover {
  background: #182131;
}

.k-insert-popover {
  position: fixed;
  z-index: 1600;
  width: 188px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #374155;
  border-radius: 10px;
  background: #111722;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}

.k-insert-popover button {
  min-height: 32px;
  border: 1px solid #2a3447;
  border-radius: 7px;
  background: #151d2a;
  color: #eef2f7;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.k-insert-popover button:hover {
  border-color: rgba(226, 83, 97, 0.75);
  background: rgba(226, 83, 97, 0.14);
}

.k-rail-context {
  padding: 11px;
  border-color: var(--k-line);
  border-radius: 8px;
  background: var(--k-panel);
}

.k-rail-context strong {
  color: var(--k-text);
  font-size: 13px;
}

.k-plan-page {
  min-height: 100%;
  padding: 14px;
  border: 1px solid #1f2735;
  border-radius: 10px;
  background: linear-gradient(180deg, #0f141e, #0b0d12);
}

.k-page-title {
  margin-bottom: 13px;
  padding-bottom: 11px;
  border-bottom-color: var(--k-line);
}

.k-page-title h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.k-page-title span,
.k-page-title small,
.k-breadcrumb {
  color: var(--k-muted);
  font-size: 11px;
}

.k-tabs {
  border-bottom-color: var(--k-line);
}

.k-tabs button {
  min-width: 104px;
  padding: 8px 11px;
  border-color: var(--k-line);
  border-radius: 7px 7px 0 0;
  background: #101722;
  font-size: 12px;
}

.k-tabs button.active,
.k-source-modes button.active,
.k-segmented button.active,
.k-modal-tabs button.active {
  border-color: rgba(226, 83, 97, 0.76);
  background: var(--k-accent-soft);
}

.k-tab-panel {
  padding-top: 14px;
}

.k-style-grid,
.k-source-grid,
.k-episode-editor {
  gap: 11px;
}

.k-style-grid label,
.k-source-grid label,
.k-field-block,
.k-episode-editor label,
.k-shotmaker-controls label,
.k-modal-panel label {
  font-size: 11.5px;
}

.k-style-grid textarea,
.k-source-grid textarea,
.k-episode-editor textarea,
.k-shotmaker-controls textarea,
.k-modal-panel textarea {
  min-height: 92px;
  padding: 9px 10px;
  border-color: var(--k-line);
  border-radius: 8px;
  background: #0a0e15;
  line-height: 1.48;
  font-size: 12px;
}

.k-style-grid textarea:focus,
.k-source-grid textarea:focus,
.k-episode-editor textarea:focus,
.k-shotmaker-controls textarea:focus {
  border-color: rgba(226, 83, 97, 0.84);
}

.k-source-modes button,
.k-segmented button {
  min-height: 34px;
  border-color: var(--k-line);
  border-radius: 7px;
  background: #101722;
  font-size: 11.5px;
}

.k-upload-field,
.k-analysis-state,
.k-episode-editor > section {
  border-color: var(--k-line);
  border-radius: 8px;
  background: var(--k-panel);
}

.k-inline-notice {
  margin-bottom: 11px;
  border-color: rgba(226, 83, 97, 0.38);
  border-radius: 8px;
  background: rgba(226, 83, 97, 0.11);
  color: #f4c9cf;
  font-size: 12px;
}

.k-action-row,
.k-page-actions,
.k-source-grid > .k-action-row,
.k-style-grid > .k-action-row,
.k-assembly-actions {
  justify-content: flex-end;
}

.k-action-row button,
.k-action-row a {
  min-height: 34px;
  border-radius: 7px;
  font-size: 12px;
}

.k-shot-list-frame {
  min-height: 220px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--k-line);
  border-radius: 10px;
  background: rgba(12, 17, 25, 0.72);
}

.k-shot-list {
  margin-top: 0;
  gap: 10px;
}

.k-shot-row {
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border-color: var(--k-line);
  border-radius: 9px;
  background: var(--k-panel);
}

.k-shot-video {
  min-height: 118px;
  border-color: #202838;
}

.k-shot-video video,
.k-shot-video > div {
  min-height: 118px;
}

.k-shot-video span {
  color: #d35b67;
  font-size: 19px;
}

.k-shot-info {
  gap: 8px;
}

.k-shot-meta {
  gap: 7px;
}

.k-shot-meta span,
.k-shot-meta em {
  padding: 3px 7px;
  border-color: #2a3447;
  border-radius: 999px;
  font-size: 10px;
}

.k-shot-info > p {
  color: #d8dee8;
  line-height: 1.5;
  font-size: 12px;
}

.k-shot-actions {
  gap: 6px;
}

.k-shot-actions button {
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11px;
}

.k-shot-actions .primary-button {
  border-color: rgba(226, 83, 97, 0.78);
  background: #8c3440;
}

.k-shotmaker-layout {
  grid-template-columns: minmax(320px, 0.84fr) minmax(480px, 1.16fr);
  gap: 12px;
}

.k-shotmaker-controls,
.k-shotmaker-stage {
  padding: 12px;
  border-color: var(--k-line);
  border-radius: 10px;
  background: var(--k-panel);
}

.k-shotmaker-controls {
  gap: 11px;
}

.k-shotmaker-number {
  padding-bottom: 8px;
  border-bottom-color: var(--k-line);
}

.k-shotmaker-number strong {
  color: var(--k-accent);
  font-size: 20px;
}

.k-shotmaker-controls > .k-action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.k-shotmaker-controls > .k-action-row button {
  width: 100%;
}

.k-first-frame-preview {
  border-color: #3a465c;
  border-radius: 8px;
  background: #090d14;
}

.k-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--k-text);
}

.k-stage-head span {
  color: var(--k-muted);
  font-size: 11px;
}

.k-stage-video {
  min-height: 392px;
  border-color: #202838;
  border-radius: 9px;
  background: #05070b;
}

.k-horizontal-shot-list {
  display: none;
}

.k-stage-list > div,
.k-master-preview video {
  border-color: var(--k-line);
  border-radius: 8px;
  background: var(--k-panel);
}

.k-stage-list > div.done {
  border-color: rgba(56, 201, 168, 0.45);
  background: rgba(56, 201, 168, 0.09);
}

@media (max-width: 1380px) {
  .k-shotmaker-layout {
    grid-template-columns: minmax(300px, 0.9fr) minmax(400px, 1.1fr);
  }
}

/* K Plan package 2 UI fix2: restore stepper, flatten middle panels, 9:16 previews */
.role-detail > .k-plan-page,
.role-detail > .studio-panel.k-plan-page {
  min-height: 100%;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.role-workspace.studio-no-rail .role-detail > .k-plan-page {
  padding: 12px 16px;
}

.k-shot-list-frame {
  min-height: 220px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--k-line);
  border-radius: 10px;
  background: rgba(12, 17, 25, 0.42);
}

.k-shot-row {
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: start;
}

.k-shot-video {
  width: 118px;
  min-height: 0;
  aspect-ratio: 9 / 16;
  justify-self: center;
}

.k-shot-video video,
.k-shot-video > div {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.k-shot-video video {
  object-fit: contain;
  background: #030509;
}

.k-shotmaker-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  justify-items: center;
  align-content: start;
}

.k-shotmaker-stage .k-stage-head {
  width: min(430px, 100%);
}

.k-stage-video {
  width: min(430px, 100%);
  min-height: 0;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
}

.k-stage-video video,
.k-stage-video > div {
  width: 100%;
  height: 100%;
}

.k-stage-video video {
  max-height: none;
  object-fit: contain;
  background: #030509;
}

.k-master-preview {
  display: grid;
  justify-items: center;
}

.k-master-preview .section-head {
  width: 100%;
}

.k-master-preview video {
  width: min(430px, 100%);
  aspect-ratio: 9 / 16;
  height: auto;
  object-fit: contain;
  background: #030509;
}

@media (max-width: 1380px) {
  .k-shot-row {
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .k-shot-video {
    width: 104px;
  }

  .k-stage-video,
  .k-shotmaker-stage .k-stage-head,
  .k-master-preview video {
    width: min(380px, 100%);
  }
}

/* K Plan package 3 listfix: flatter shot list, visible assets, interactive feedback */
.k-shot-list-frame {
  min-height: 0;
  margin-top: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.k-shot-list {
  gap: 12px;
}

.k-shot-row {
  width: 100%;
  box-sizing: border-box;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
  will-change: transform;
}

.k-shot-row:hover {
  border-color: rgba(226, 83, 97, 0.34);
  box-shadow: 0 12px 36px rgba(3, 6, 12, 0.24);
}

.k-shot-assets {
  width: 100%;
}

.asset-mini-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding-left: 0;
}

.asset-mini + .asset-mini {
  margin-left: 0;
}

.asset-mini {
  width: 62px;
  height: 78px;
  flex: 0 0 auto;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.asset-mini:hover {
  transform: translateY(-2px);
  border-color: rgba(183, 112, 255, 0.62);
  box-shadow: 0 10px 22px rgba(91, 45, 138, 0.22);
}

.asset-mini-stack.empty {
  align-items: stretch;
}

.asset-mini-placeholder {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 0 12px;
  border: 1px dashed rgba(159, 173, 196, 0.42);
  border-radius: 8px;
  color: var(--k-muted);
  background: rgba(10, 14, 22, 0.58);
}

.k-shot-empty-script {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px dashed rgba(159, 173, 196, 0.38);
  border-radius: 999px;
  color: var(--k-muted);
  background: rgba(10, 14, 22, 0.52);
}

button,
.primary-button,
.secondary-button,
.danger-button,
.danger-outline-button {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease, opacity 140ms ease;
}

button:not(:disabled):active,
.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active,
.danger-button:not(:disabled):active,
.danger-outline-button:not(:disabled):active {
  transform: translateY(1px) scale(0.985);
}

.button-pressed {
  animation: k-button-press 420ms ease;
}

.k-shot-row-inserted {
  animation: k-shot-insert 900ms ease;
}

.k-shot-row-moving-up {
  animation: k-shot-move-up 760ms ease;
}

.k-shot-row-moving-down {
  animation: k-shot-move-down 760ms ease;
}

@keyframes k-button-press {
  0% {
    transform: scale(1);
    box-shadow: none;
  }
  42% {
    transform: translateY(-1px) scale(1.025);
    box-shadow: 0 0 0 3px rgba(226, 83, 97, 0.22), 0 10px 24px rgba(226, 83, 97, 0.18);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

@keyframes k-shot-insert {
  0% {
    opacity: 0;
    transform: translateY(-14px) scale(0.985);
    border-color: rgba(226, 83, 97, 0.88);
    background: rgba(226, 83, 97, 0.15);
  }
  58% {
    opacity: 1;
    transform: translateY(4px) scale(1.006);
    border-color: rgba(226, 83, 97, 0.72);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes k-shot-move-up {
  0% {
    transform: translateY(14px);
    border-color: rgba(183, 112, 255, 0.72);
    background: rgba(183, 112, 255, 0.12);
  }
  56% {
    transform: translateY(-8px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes k-shot-move-down {
  0% {
    transform: translateY(-14px);
    border-color: rgba(183, 112, 255, 0.72);
    background: rgba(183, 112, 255, 0.12);
  }
  56% {
    transform: translateY(8px);
  }
  100% {
    transform: translateY(0);
  }
}

/* K Plan package 3 listfix6+: automatic shotmaker params and stronger first-frame modal */
.k-auto-production-note {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(73, 149, 201, 0.26);
  border-radius: 8px;
  background: rgba(11, 18, 28, 0.72);
}

.k-auto-production-note span {
  color: #e7edf7;
  font-size: 12px;
  font-weight: 800;
}

.k-auto-production-note small {
  color: var(--k-muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.k-first-frame-modal {
  width: min(1120px, calc(100vw - 56px));
  border: 1px solid rgba(183, 112, 255, 0.46);
  border-radius: 14px;
  background: linear-gradient(180deg, #111827 0%, #0b1018 100%);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.56), 0 0 0 1px rgba(226, 83, 97, 0.12);
}

.k-first-frame-modal-head {
  align-items: flex-start;
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(63, 74, 96, 0.72);
}

.k-first-frame-modal-head strong {
  font-size: 20px;
}

.k-first-frame-modal-head span {
  margin-top: 3px;
  color: var(--k-muted);
  font-size: 12px;
}

.k-first-frame-modal-head button {
  border-color: rgba(159, 173, 196, 0.28);
  background: rgba(15, 23, 36, 0.86);
}

.k-first-frame-modal .k-modal-tabs {
  padding: 14px 20px 0;
}

.k-first-frame-modal .k-modal-tabs button {
  border-radius: 9px;
  background: #0b1018;
}

.k-first-frame-modal .k-modal-tabs button.active {
  border-color: rgba(226, 83, 97, 0.88);
  background: rgba(226, 83, 97, 0.16);
  color: #fff;
}

.k-storyboard-create-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(360px, 1.05fr);
  gap: 14px;
  min-height: 520px;
}

.k-storyboard-create-left,
.k-storyboard-create-right {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--k-line);
  border-radius: 12px;
  background: rgba(9, 14, 22, 0.78);
}

.k-storyboard-create-left {
  grid-template-rows: minmax(230px, 1fr) auto auto;
}

.k-storyboard-create-right {
  grid-template-rows: minmax(0, 1fr) auto;
}

.k-storyboard-prompt-label {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.k-storyboard-prompt-label textarea {
  min-height: 260px;
  resize: vertical;
}

.k-modal-reference-block {
  min-height: 108px;
  padding: 10px;
  border: 1px solid rgba(63, 74, 96, 0.68);
  border-radius: 10px;
  background: rgba(12, 17, 25, 0.72);
}

.k-modal-reference-block .section-head {
  margin-bottom: 8px;
}

.k-modal-reference-assets {
  max-height: 124px;
  overflow: auto;
}

.k-modal-left-actions,
.k-modal-right-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.k-modal-left-actions .primary-button,
.k-modal-right-actions .primary-button {
  min-width: 148px;
}

.k-storyboard-preview-card {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #293449;
  border-radius: 12px;
  background: #030509;
}

.k-storyboard-preview-card img {
  width: min(360px, 100%);
  height: 100%;
  max-height: 620px;
  object-fit: contain;
}

.k-storyboard-preview-card > div {
  display: grid;
  gap: 8px;
  text-align: center;
  color: var(--k-muted);
}

.k-storyboard-preview-card strong {
  color: #e7edf7;
  font-size: 18px;
}

.mention-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mention-picker-head button {
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(159, 173, 196, 0.34);
  background: rgba(12, 17, 25, 0.92);
  color: #dbe4f0;
}

.asset-mention-picker {
  z-index: 260;
}

@media (max-width: 1180px) {
  .k-storyboard-create-layout {
    grid-template-columns: 1fr;
  }

  .k-storyboard-create-right {
    min-height: 460px;
  }
}

/* K Plan package 4: inline shot-making console */
.k-inline-shot-page {
  background:
    radial-gradient(circle at 8% 0%, rgba(116, 64, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(18, 10, 32, 0.96), rgba(7, 4, 14, 0.98));
}

.k-inline-shot-page .k-page-toolbar {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(150, 118, 255, 0.24);
}

.k-inline-shot-page .k-breadcrumb {
  font-size: 15px;
  font-weight: 800;
}

.k-inline-shot-frame {
  overflow: visible;
  padding: 4px 0 10px;
  scrollbar-color: rgba(161, 116, 255, 0.64) rgba(15, 9, 27, 0.88);
}

.k-inline-shot-list {
  width: 100%;
  min-width: 0;
  gap: 14px;
}

.k-inline-maker-row {
  grid-template-columns: clamp(178px, 10vw, 218px) clamp(136px, 8vw, 168px) minmax(560px, 1fr) clamp(132px, 7vw, 154px);
  justify-content: space-between;
  align-items: stretch;
  gap: 10px;
  min-height: 0;
  height: clamp(360px, calc(100vh - 360px), 432px);
  padding: 12px;
  border: 1px solid rgba(151, 108, 255, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(37, 26, 58, 0.96), rgba(16, 11, 29, 0.98)),
    #110b1d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025), 0 18px 46px rgba(0, 0, 0, 0.34);
}

.k-inline-maker-row:hover {
  transform: translateY(-2px);
  border-color: rgba(238, 78, 118, 0.62);
  box-shadow: 0 20px 58px rgba(9, 3, 24, 0.58), 0 0 0 1px rgba(188, 126, 255, 0.18);
}

.k-inline-video-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.k-shot-order-label {
  color: #f5efff;
  font-size: 13px;
  font-weight: 900;
}

.k-inline-maker-row .k-shot-video {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 9 / 16;
  align-self: start;
  border-color: rgba(130, 109, 255, 0.38);
  border-radius: 10px;
  background: #05030a;
}

.k-inline-maker-row .k-shot-video video,
.k-inline-maker-row .k-shot-video > div {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.k-frame-column,
.k-inline-generate-panel,
.k-inline-prompt {
  display: grid;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  gap: 8px;
  align-content: stretch;
  align-self: stretch;
}

.k-frame-column {
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
}

.k-inline-frame-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 5px;
  min-height: 0;
  padding: 7px;
  text-align: left;
  border: 1px solid rgba(119, 93, 160, 0.54);
  border-radius: 10px;
  background: rgba(16, 13, 29, 0.92);
  color: #f5f0ff;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.k-inline-frame-card:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 180, 255, 0.74);
  box-shadow: 0 14px 30px rgba(64, 104, 255, 0.16);
}

.k-inline-frame-card:active,
.k-generate-video-button:active,
.k-inline-row-actions button:active,
.k-inline-assets-head button:active {
  transform: translateY(1px) scale(0.985);
}

.k-inline-frame-card > span {
  font-size: 12px;
  font-weight: 900;
}

.k-inline-frame-card > div {
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 0;
  border-radius: 8px;
  background: rgba(4, 3, 9, 0.88);
}

.k-inline-frame-card strong {
  color: #9b91aa;
  font-size: 13px;
}

.k-inline-frame-card small {
  overflow: hidden;
  color: #a998bf;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-inline-frame-card.first small {
  display: none;
}

.k-tail-frame-fold {
  min-width: 0;
}

.k-tail-frame-fold summary {
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(119, 93, 160, 0.46);
  border-radius: 9px;
  color: #e9defa;
  background: rgba(11, 8, 20, 0.92);
}

.k-tail-frame-fold summary small {
  color: #a998bf;
}

.k-tail-frame-strip {
  display: flex;
  max-width: 100%;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.k-tail-frame-strip .k-inline-frame-card {
  flex: 0 0 206px;
}

.k-inline-prompt {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.k-compact-shot-controls {
  display: flex;
  align-items: center;
  min-height: 22px;
}

.k-compact-shot-controls span {
  color: #e9defa;
  font-size: 12px;
  font-weight: 900;
}

.k-inline-prompt textarea {
  height: 100%;
  min-height: 0;
  resize: none;
  overflow-y: hidden;
  border: 1px solid rgba(119, 93, 160, 0.58);
  border-radius: 11px;
  background: rgba(7, 5, 14, 0.82);
  color: #fff;
  font-size: 15px;
  line-height: 1.7;
}

.k-duration-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.k-duration-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e9defa;
  font-size: 12px;
  font-weight: 900;
}

.k-duration-row select {
  width: 92px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(119, 93, 160, 0.58);
  border-radius: 8px;
  background: rgba(7, 5, 14, 0.86);
  color: #f8f2ff;
}

.k-duration-row small {
  overflow: hidden;
  color: #9f92b0;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-inline-prompt textarea:hover,
.k-inline-prompt textarea:focus {
  overflow-y: auto;
}

.k-inline-prompt textarea:focus {
  border-color: rgba(238, 78, 118, 0.72);
  box-shadow: 0 0 0 3px rgba(238, 78, 118, 0.12);
}

.k-inline-generate-panel {
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.k-inline-assets-box {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 7px;
  border: 1px solid rgba(119, 93, 160, 0.48);
  border-radius: 10px;
  background: rgba(12, 8, 22, 0.84);
}

.k-inline-assets-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  color: #e9defa;
  font-size: 12px;
  font-weight: 900;
}

.k-inline-row-actions button {
  min-height: 26px;
  padding: 4px 5px;
  border-color: rgba(137, 113, 188, 0.52);
  border-radius: 6px;
  background: rgba(21, 16, 35, 0.92);
  color: #dacdff;
  font-size: 12px;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.k-inline-assets {
  align-content: start;
  max-height: none;
  overflow-y: hidden;
  overflow-x: hidden;
  padding: 2px 0 0;
}

.k-inline-assets:hover {
  overflow-y: auto;
}

.k-inline-assets .k-production-empty {
  display: grid;
  min-height: 72px;
  place-items: center;
  padding: 10px;
  border: 1px dashed rgba(137, 113, 188, 0.44);
  border-radius: 9px;
  text-align: center;
}

.k-inline-row-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.k-generate-video-button {
  min-height: 34px;
  width: 100%;
  border-color: rgba(255, 73, 115, 0.78);
  border-radius: 8px;
  background: linear-gradient(135deg, #ff416f, #af39ff);
  box-shadow: 0 14px 30px rgba(255, 65, 111, 0.18);
  font-size: 13px;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.k-generate-video-button:hover {
  filter: brightness(1.08);
  box-shadow: 0 18px 36px rgba(181, 57, 255, 0.28);
}

.asset-mention-picker {
  max-height: min(520px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(151, 108, 255, 0.46);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(28, 20, 45, 0.98), rgba(9, 6, 18, 0.98));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.mention-picker-list {
  max-height: 454px;
  overflow: auto;
}

/* K Plan package 5: compact in-row shot maker */
.topbar-steps .studio-stepper {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.topbar-steps .step-chip {
  width: 100%;
  justify-self: stretch;
  border-color: rgba(100, 89, 145, 0.56);
  background: rgba(16, 12, 28, 0.72);
}

.topbar-steps .step-chip.done,
.topbar-steps .step-chip.active,
.topbar-steps .step-chip.todo {
  min-height: 30px;
  border-radius: 9px;
}

.topbar-steps .step-chip.todo {
  color: #9c91af;
  background: rgba(16, 12, 28, 0.72);
}

.k-inline-shot-frame,
.k-inline-shot-page {
  max-width: 100%;
}

.k-inline-maker-row {
  max-width: 100%;
  overflow: hidden;
  align-items: stretch;
}

.k-inline-maker-row .k-shot-video {
  max-height: 100%;
}

.k-inline-frame-card.tail > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .k-inline-shot-list {
    min-width: 0;
  }

  .k-inline-maker-row {
    grid-template-columns: 150px 136px minmax(300px, 1fr) 132px;
  }
}

/* Planning flow: natural-language setup, script planning, and fixed preview stages. */
.k-page-title-compact {
  min-height: 0;
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.k-page-title-compact h2 { margin: 0; }

.k-ai-analysis {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid rgba(139, 92, 246, 0.38);
  border-radius: 8px;
  background: rgba(16, 11, 27, 0.72);
}

.k-ai-analysis > label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.k-ai-analysis > label span {
  color: #f5efff;
  font-size: 14px;
  font-weight: 800;
}

.k-ai-analysis > label small {
  color: #a99bb5;
  font-size: 12px;
}

.k-ai-analysis > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 10px;
}

.k-ai-analysis textarea { min-height: 88px; resize: vertical; }
.k-ai-analysis button { min-width: 116px; }
.k-aspect-field { grid-column: 1 / -1; width: min(420px, 100%); }

.k-full-outline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(139, 92, 246, 0.26);
  border-radius: 8px;
  background: rgba(11, 8, 18, 0.7);
}

.k-full-outline .k-upload-field { min-height: 112px; }
.k-plan-script-button { width: 188px; white-space: nowrap; }

.k-planning-result {
  width: min(780px, 92vw);
  color: #efe9f7;
  background: #0f1118;
}

.k-planning-result header,
.k-planning-result footer {
  border-color: rgba(139, 92, 246, 0.28);
  background: #131620;
}

.k-planning-result header div { display: grid; gap: 3px; }
.k-planning-result header small,
.k-planning-result-summary span { color: #9f96ad; }
.k-planning-result > section { min-height: 0; overflow: auto; padding: 16px; }

.k-planning-result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.k-planning-result-list { display: grid; gap: 8px; }

.k-planning-result-list article {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(139, 92, 246, 0.24);
  border-radius: 7px;
  background: #0b0d13;
}

.k-planning-result-list article > span { color: #ff547a; font-weight: 900; }
.k-planning-result-list p { margin: 5px 0 0; color: #b7adbf; line-height: 1.65; }

.k-shot-video,
.k-inline-maker-row .k-shot-video,
.k-stage-video {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #030509;
}

.k-shot-video.k-ratio-16-9 video,
.k-inline-maker-row .k-shot-video.k-ratio-16-9 video,
.k-stage-video.k-ratio-16-9 video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.k-shot-video.k-ratio-9-16 video,
.k-inline-maker-row .k-shot-video.k-ratio-9-16 video,
.k-stage-video.k-ratio-9-16 video {
  width: 100%;
  height: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
}

.k-shot-video > div,
.k-inline-maker-row .k-shot-video > div,
.k-stage-video > div { width: 100%; height: 100%; }

@media (max-width: 860px) {
  .k-ai-analysis > label,
  .k-planning-result-summary { align-items: flex-start; flex-direction: column; }
  .k-ai-analysis > div,
  .k-full-outline { grid-template-columns: 1fr; }
  .k-ai-analysis button,
  .k-plan-script-button { width: 100%; }
}

.k-episode-page .k-breadcrumb {
  margin: 4px 0 18px;
  color: #d9d0e8;
  font-size: 16px;
  font-weight: 850;
}

.k-episode-page .k-breadcrumb span,
.k-episode-page .k-breadcrumb strong,
.k-episode-page .k-breadcrumb b {
  font-size: 16px;
}

.k-episode-waterfall {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.k-episode-waterfall label,
.k-episode-param {
  display: grid;
  gap: 7px;
  color: #cfc3da;
  font-size: 12px;
}

.k-episode-waterfall label > span,
.k-episode-param > span,
.k-episode-assets-section .section-head h3 {
  color: #cfc3da;
  font-size: 12px;
  font-weight: 800;
}

.k-episode-content-field textarea {
  min-height: 286px;
  max-height: 52vh;
  overflow: auto;
  resize: vertical;
  font-size: 14px;
  line-height: 1.7;
}

.k-episode-analysis-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.k-derived-duration,
.k-episode-param {
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--k-line);
  border-radius: 8px;
  background: rgba(12, 15, 24, 0.78);
}

.k-derived-duration {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 14px;
  min-width: 0;
}

.k-derived-duration span,
.k-derived-duration small {
  color: #9d8eac;
  font-size: 12px;
}

.k-derived-duration small {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-derived-duration strong,
.k-episode-param strong {
  color: #f7f2ff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.k-episode-analysis-row button {
  width: 86px;
  min-height: 44px;
  align-self: center;
  padding-inline: 10px;
}

.k-episode-assets-section {
  padding: 12px;
  border: 1px solid rgba(139, 92, 246, 0.24);
  border-radius: 8px;
  background: rgba(12, 15, 24, 0.58);
}

.k-episode-assets-section .section-head {
  margin-bottom: 10px;
}

.k-episode-assets-section .section-head span {
  color: #9d8eac;
  font-size: 12px;
}

.k-episode-page .k-asset-strip {
  gap: 10px;
}

.k-episode-page .k-asset-thumb {
  min-width: 148px;
  padding: 8px;
}

.k-episode-page .k-asset-thumb strong {
  font-size: 12px;
}

.k-episode-page .k-asset-thumb small {
  font-size: 11px;
}

/* K Plan package 8: compact first-frame/storyboard modal. */
.k-first-frame-backdrop {
  padding: 12px;
  align-items: center;
}

.k-first-frame-modal {
  width: min(1280px, 92vw);
  height: min(760px, 92vh);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.k-first-frame-modal-head {
  padding: 10px 14px 8px;
}

.k-first-frame-modal-head strong {
  font-size: 16px;
}

.k-first-frame-modal-head span,
.k-first-frame-modal-head small {
  font-size: 11px;
}

.k-first-frame-modal-head button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.k-first-frame-modal .k-modal-tabs {
  position: relative;
  z-index: 2;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(63, 74, 96, 0.72);
  background: #0d1420;
}

.k-first-frame-modal .k-modal-tabs button {
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 12px;
}

.k-first-frame-modal .k-modal-panel {
  min-height: 0;
  padding: 10px 14px;
  overflow: auto;
}

.k-first-frame-modal .k-modal-panel.active {
  align-content: stretch;
}

.k-first-frame-modal [data-k-first-panel="create"].active {
  overflow: hidden;
}

.k-first-frame-modal .k-upload-drop {
  min-height: 86px;
  padding: 12px;
}

.k-first-frame-modal .k-upload-preview {
  min-height: 60px;
}

.k-storyboard-create-layout {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  grid-template-columns: minmax(300px, 0.9fr) minmax(300px, 1fr);
  gap: 10px;
}

.k-storyboard-create-left,
.k-storyboard-create-right {
  min-height: 0;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
}

.k-storyboard-create-left {
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.k-storyboard-create-right {
  grid-template-rows: minmax(0, 1fr) auto;
}

.k-storyboard-prompt-label {
  min-height: 0;
  gap: 6px;
}

.k-storyboard-prompt-label span,
.k-modal-reference-block .section-head h3,
.k-modal-reference-block .section-head span {
  font-size: 12px;
}

.k-storyboard-prompt-label textarea {
  min-height: 0;
  height: 100%;
  resize: none;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.k-modal-reference-block {
  min-height: 72px;
  max-height: 116px;
  padding: 8px;
  border-radius: 8px;
}

.k-modal-reference-block .section-head {
  margin-bottom: 6px;
}

.k-modal-reference-assets {
  max-height: 66px;
}

.k-modal-left-actions .primary-button,
.k-modal-right-actions .primary-button {
  min-width: 108px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
}

.k-storyboard-preview-card {
  min-height: 0;
  border-radius: 10px;
}

.k-storyboard-preview-card img {
  width: 100%;
  max-width: 320px;
  height: 100%;
  max-height: 100%;
}

.k-storyboard-preview-card > div {
  gap: 5px;
  padding: 12px;
}

.k-storyboard-preview-card strong {
  font-size: 14px;
}

.k-storyboard-preview-card span {
  font-size: 11px;
}

.k-first-frame-modal footer {
  padding: 8px 14px;
}

.k-first-frame-modal footer span {
  font-size: 11px;
}

.k-first-frame-modal footer .primary-button {
  min-height: 30px;
  padding: 6px 12px;
  font-size: 12px;
}

.k-first-frame-modal .k-tail-frame-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* K Plan package 13: compact planning controls. */
.k-plan-page .k-style-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.k-plan-page .k-ai-analysis {
  padding: 12px;
}

.k-plan-page .k-ai-analysis > label span {
  font-size: 15px;
}

.k-plan-page .k-ai-analysis > div {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.k-plan-page .k-ai-analysis textarea {
  min-height: 92px;
}

.k-plan-page .k-ai-analysis .primary-button,
.k-plan-page .k-plan-script-button {
  width: auto;
  min-width: 88px;
  max-width: 150px;
  min-height: 34px;
  align-self: end;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.2;
  white-space: nowrap;
}

.k-plan-page .k-aspect-field {
  grid-column: auto;
  width: auto;
}

.k-plan-page .k-source-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

.k-plan-page .k-source-modes button {
  position: relative;
  min-height: 26px;
  padding: 2px 0 2px 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #cbbfd5;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  box-shadow: none;
}

.k-plan-page .k-source-modes button:hover {
  color: #fff;
}

.k-plan-page .k-source-modes button::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(170, 154, 196, 0.76);
  border-radius: 50%;
  transform: translateY(-50%);
  background: rgba(8, 12, 19, 0.85);
}

.k-plan-page .k-source-modes button.active {
  background: transparent;
  color: #fff;
}

.k-plan-page .k-source-modes button.active::before {
  border-color: #ff5b78;
  box-shadow: inset 0 0 0 3px #0b0f18;
  background: #ff5b78;
}

.k-plan-page .k-full-outline {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 10px;
  overflow: hidden;
  transform-origin: top;
  transition:
    max-height 0.28s ease,
    opacity 0.22s ease,
    transform 0.24s ease,
    padding-top 0.24s ease,
    padding-bottom 0.24s ease,
    border-color 0.24s ease,
    margin 0.24s ease;
}

.k-plan-page .k-full-outline.is-open {
  max-height: 150px;
  opacity: 1;
  transform: translateY(0);
}

.k-plan-page .k-full-outline.is-closed {
  max-height: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

.k-plan-page .k-full-outline .k-upload-field {
  min-height: 82px;
}

.k-plan-page .k-span-all {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .k-plan-page .k-style-grid,
  .k-plan-page .k-ai-analysis > div,
  .k-plan-page .k-full-outline {
    grid-template-columns: 1fr;
  }
}

/* K Plan package 18: dock shot assets in a narrow fixed rail and give prompt the remaining width. */
.k-inline-maker-row {
  grid-template-columns: clamp(230px, 15vw, 318px) clamp(154px, 8.4vw, 186px) minmax(0, 1fr);
  gap: 10px;
  height: clamp(394px, calc(100vh - 330px), 510px);
  padding: 12px;
}

.k-inline-video-column,
.k-frame-column,
.k-prompt-assets-column {
  height: 100%;
  min-height: 0;
}

.k-inline-video-column {
  grid-template-rows: auto minmax(0, 1fr);
}

.k-inline-maker-row .k-shot-video {
  height: 100%;
  align-self: stretch;
}

.k-prompt-assets-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 9px;
  overflow: hidden;
  min-width: 0;
}

.k-prompt-assets-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(230px, 14vw, 280px);
  gap: 12px;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.k-prompt-assets-main .k-inline-prompt {
  grid-template-rows: auto minmax(0, 1fr);
}

.k-prompt-assets-main .k-inline-prompt textarea {
  font-size: 14px;
  line-height: 1.58;
}

.k-prompt-assets-main .k-inline-generate-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  min-width: 0;
  min-height: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.k-inline-assets-box {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.k-inline-assets-head {
  min-height: 22px;
  padding: 0;
  color: #e9defa;
  font-size: 12px;
  line-height: 1.2;
}

.k-inline-assets-head span {
  font-size: 12px;
  font-weight: 900;
}

.k-inline-assets {
  min-height: 0;
  height: 100%;
  margin-top: 0;
  padding: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(119, 93, 160, 0.48);
  border-radius: 10px;
  background: rgba(12, 8, 22, 0.84);
  align-content: start;
}

.k-inline-assets .k-production-asset {
  grid-template-columns: 28px minmax(0, 1fr) 20px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.k-inline-assets .k-production-asset img {
  min-width: 28px;
  max-width: 28px;
}

.k-inline-assets .k-production-asset strong,
.k-inline-assets .k-production-asset small {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-inline-assets .k-production-asset button {
  justify-self: end;
  min-width: 20px;
}

.k-inline-panel-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.k-inline-duration-actions {
  flex: 1 1 auto;
  min-width: 220px;
}

.k-inline-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.k-inline-panel-actions .k-inline-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.k-inline-panel-actions button,
.k-inline-panel-actions .k-generate-video-button {
  width: auto;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}

.k-inline-panel-actions .k-generate-video-button {
  min-width: 96px;
}

@media (max-width: 1600px) {
  .k-inline-maker-row {
    grid-template-columns: 218px 146px minmax(0, 1fr);
    gap: 8px;
  }

  .k-prompt-assets-main {
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 10px;
  }
}

@media (max-width: 1280px) {
  .k-inline-maker-row {
    grid-template-columns: 198px 136px minmax(0, 1fr);
  }

  .k-prompt-assets-main {
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 8px;
  }
}

/* K Plan package 19: local UI polish layer. No business logic changes. */
:root {
  --k-polish-pink: rgba(255, 64, 112, 0.72);
  --k-polish-pink-soft: rgba(255, 64, 112, 0.2);
  --k-polish-purple: rgba(155, 91, 255, 0.46);
  --k-polish-panel: rgba(12, 16, 27, 0.86);
  --k-polish-panel-strong: rgba(10, 12, 22, 0.95);
}

.topbar-steps .studio-stepper {
  gap: 8px;
}

.topbar-steps .step-chip {
  min-height: 40px;
  border-radius: 9px;
  border-color: rgba(104, 76, 145, 0.68);
  background:
    linear-gradient(180deg, rgba(28, 22, 42, 0.92), rgba(10, 13, 24, 0.92)),
    #0b0f18;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 8px 22px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.topbar-steps .step-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 90, 122, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 24px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(255, 64, 112, 0.08);
}

.topbar-steps .step-chip.active {
  border-color: rgba(255, 64, 112, 0.78);
  background:
    linear-gradient(135deg, rgba(55, 24, 52, 0.96), rgba(25, 15, 43, 0.96)),
    #130a1a;
  box-shadow:
    inset 0 -2px 0 rgba(255, 64, 112, 0.7),
    0 12px 28px rgba(255, 64, 112, 0.12);
}

.topbar-steps .step-chip.done {
  border-color: rgba(42, 224, 187, 0.42);
  background:
    linear-gradient(135deg, rgba(16, 42, 45, 0.9), rgba(15, 17, 32, 0.94)),
    #0b1018;
}

.primary-button,
.secondary-button,
.danger-outline-button,
.create-project-button,
.create-asset-button,
.k-new-series-button,
.k-generate-video-button,
.role-nsfw-modal header button,
.role-nsfw-modal-actions button,
.role-nsfw-create-left button,
.role-nsfw-create-right button {
  border-radius: 8px;
  letter-spacing: 0;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease;
}

.primary-button,
.create-project-button,
.create-asset-button,
.k-generate-video-button {
  border-color: rgba(255, 86, 126, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 64, 112, 0.9), rgba(188, 56, 228, 0.86)),
    #ff4070;
  color: #fff;
  box-shadow:
    0 10px 24px rgba(255, 64, 112, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.primary-button:hover:not(:disabled),
.create-project-button:hover:not(:disabled),
.create-asset-button:hover:not(:disabled),
.k-generate-video-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: saturate(1.08) brightness(1.03);
  box-shadow:
    0 13px 28px rgba(255, 64, 112, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.secondary-button:hover:not(:disabled),
.danger-outline-button:hover:not(:disabled),
.role-nsfw-modal header button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.k-plan-page,
.k-inline-maker-row,
.role-page .studio-panel,
.asset-management-grid > section,
.asset-detail {
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 64, 112, 0.08), transparent 30%),
    radial-gradient(circle at 88% 16%, rgba(145, 91, 255, 0.1), transparent 32%),
    linear-gradient(180deg, rgba(12, 18, 31, 0.94), rgba(7, 10, 18, 0.96));
  border-color: rgba(93, 65, 134, 0.76);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.k-plan-page input,
.k-plan-page textarea,
.k-plan-page select,
.k-inline-maker-row textarea,
.k-inline-maker-row select,
.role-nsfw-modal textarea {
  border-color: rgba(103, 77, 142, 0.78);
  background:
    linear-gradient(180deg, rgba(7, 10, 18, 0.94), rgba(6, 7, 13, 0.96)),
    #070a12;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.k-plan-page input:focus,
.k-plan-page textarea:focus,
.k-plan-page select:focus,
.k-inline-maker-row textarea:focus,
.k-inline-maker-row select:focus,
.role-nsfw-modal textarea:focus {
  outline: none;
  border-color: rgba(255, 86, 126, 0.76);
  box-shadow:
    0 0 0 2px rgba(255, 64, 112, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.k-plan-page .k-ai-analysis,
.k-plan-page .k-full-outline,
.k-episode-assets-section,
.k-inline-frame-card,
.k-prompt-assets-main .k-inline-prompt,
.k-inline-assets,
.k-inline-maker-row .k-shot-video {
  border-radius: 13px;
  border-color: rgba(104, 76, 145, 0.72);
  background:
    linear-gradient(180deg, rgba(14, 17, 30, 0.92), rgba(8, 10, 18, 0.94)),
    var(--k-polish-panel);
}

.k-plan-page .k-ai-analysis {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 14px 28px rgba(0, 0, 0, 0.16);
}

.k-plan-page .k-source-modes button::before {
  box-shadow:
    0 0 0 4px rgba(155, 91, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.k-plan-page .k-source-modes button.active::before {
  box-shadow:
    inset 0 0 0 3px #080b14,
    0 0 0 4px rgba(255, 64, 112, 0.12);
}

.k-plan-page .k-full-outline {
  will-change: max-height, opacity, transform;
}

.k-episode-waterfall label,
.k-episode-param,
.k-episode-page .k-asset-thumb {
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(15, 19, 31, 0.9), rgba(8, 10, 18, 0.92)),
    rgba(11, 14, 24, 0.9);
  border-color: rgba(90, 66, 128, 0.64);
}

.k-inline-maker-row {
  border-radius: 15px;
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.k-inline-maker-row:hover {
  border-color: rgba(143, 91, 208, 0.78);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 64, 112, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.k-inline-assets .k-production-asset {
  min-height: 40px;
  max-height: 40px;
  padding: 5px 6px;
  border-radius: 9px;
  background:
    linear-gradient(90deg, rgba(18, 24, 38, 0.95), rgba(15, 10, 24, 0.95));
}

.k-inline-assets .k-production-asset strong {
  font-size: 11.5px;
}

.k-inline-assets .k-production-asset small {
  font-size: 10.5px;
}

.k-inline-panel-actions button,
.k-inline-panel-actions .k-generate-video-button {
  min-height: 32px;
  border-radius: 8px;
}

.modal-backdrop,
.role-nsfw-modal-backdrop,
.k-first-frame-backdrop,
.k-planning-result-backdrop,
.k-production-preview-backdrop {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 64, 112, 0.14), transparent 28%),
    radial-gradient(circle at 20% 80%, rgba(155, 91, 255, 0.12), transparent 34%),
    rgba(2, 4, 10, 0.82);
  backdrop-filter: blur(10px);
}

.image-modal,
.role-nsfw-modal,
.k-first-frame-modal,
.k-planning-result,
.k-production-preview {
  border-radius: 16px;
  border-color: rgba(162, 105, 225, 0.74);
  background:
    linear-gradient(180deg, rgba(18, 23, 38, 0.98), rgba(8, 10, 18, 0.98)),
    #0b101a;
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.68),
    0 0 0 1px rgba(255, 255, 255, 0.035),
    0 0 52px rgba(255, 64, 112, 0.11);
  animation: k-modal-pop 0.18s ease both;
}

.role-nsfw-modal {
  width: min(980px, calc(100vw - 96px));
  max-height: min(680px, calc(100vh - 84px));
  overflow: hidden;
}

.role-nsfw-modal header {
  min-height: 58px;
  padding: 11px 14px;
  border-bottom-color: rgba(122, 86, 172, 0.58);
}

.role-nsfw-tabs {
  position: relative;
  z-index: 4;
  margin: 10px 14px 8px;
  padding: 3px;
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(13, 20, 32, 0.98), rgba(7, 9, 16, 0.98)),
    #0b0f1a;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.role-nsfw-tabs button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.role-nsfw-panel {
  position: relative;
  z-index: 1;
  padding: 0 14px 14px;
}

.role-nsfw-create-layout {
  min-height: 0;
  height: min(440px, calc(100vh - 238px));
  grid-template-columns: minmax(320px, 0.9fr) minmax(300px, 1fr);
  gap: 14px;
}

.role-nsfw-create-left,
.role-nsfw-create-right {
  gap: 9px;
  padding: 11px;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  border-radius: 13px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 64, 112, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(16, 13, 28, 0.95), rgba(6, 8, 16, 0.96));
}

.role-nsfw-create-left {
  overflow-y: auto;
}

.role-nsfw-upload-drop.compact {
  padding: 10px;
}

.role-nsfw-upload-preview.small {
  min-height: 56px;
}

.role-nsfw-prompt-label textarea {
  min-height: 118px;
}

.role-nsfw-generated-preview {
  width: min(238px, 100%);
  border-radius: 13px;
}

/* K Plan package 21: align first-frame creation modal with role NSFW modal size. */
.k-first-frame-backdrop {
  place-items: center;
  padding: 24px;
}

.k-first-frame-modal {
  width: min(980px, calc(100vw - 96px));
  height: auto;
  max-height: min(680px, calc(100vh - 84px));
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.k-first-frame-modal-head {
  min-height: 58px;
  padding: 11px 14px;
}

.k-first-frame-modal-head strong {
  font-size: 18px;
}

.k-first-frame-modal-head span {
  font-size: 11px;
}

.k-first-frame-modal .k-modal-tabs {
  position: relative;
  z-index: 5;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(13, 20, 32, 0.98), rgba(7, 9, 16, 0.98));
}

.k-first-frame-modal .k-modal-tabs button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.k-first-frame-modal .k-modal-panel {
  min-height: 0;
  max-height: min(540px, calc(100vh - 224px));
  padding: 10px 14px 14px;
  overflow: auto;
}

.k-first-frame-modal [data-k-first-panel="create"].active {
  overflow: hidden;
}

.k-storyboard-create-layout {
  height: min(460px, calc(100vh - 236px));
  min-height: 0;
  grid-template-columns: minmax(320px, 0.96fr) minmax(300px, 1fr);
  gap: 12px;
}

.k-storyboard-create-left,
.k-storyboard-create-right {
  min-height: 0;
  padding: 11px;
  gap: 9px;
  overflow: hidden;
}

.k-storyboard-create-left {
  grid-template-rows: minmax(0, 1fr) minmax(76px, auto) auto;
  overflow-y: auto;
}

.k-storyboard-create-right {
  grid-template-rows: minmax(0, 1fr) auto;
}

.k-storyboard-prompt-label textarea {
  min-height: 150px;
  height: 100%;
  resize: none;
}

.k-modal-reference-block {
  min-height: 74px;
  max-height: 108px;
}

.k-modal-reference-assets {
  max-height: 58px;
}

.k-storyboard-preview-card {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
}

.k-storyboard-preview-card img {
  width: auto;
  max-width: min(240px, 100%);
  height: 100%;
  max-height: 392px;
  object-fit: contain;
}

.k-storyboard-preview-card > div {
  width: min(230px, 100%);
  aspect-ratio: 9 / 16;
}

.k-modal-left-actions .primary-button,
.k-modal-right-actions .primary-button {
  min-height: 32px;
  padding: 6px 14px;
}

@keyframes k-modal-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar-steps .step-chip,
  .primary-button,
  .secondary-button,
  .danger-outline-button,
  .create-project-button,
  .create-asset-button,
  .k-new-series-button,
  .k-generate-video-button,
  .image-modal,
  .role-nsfw-modal,
  .k-first-frame-modal,
  .k-planning-result,
  .k-production-preview {
    animation: none;
    transition: none;
  }
}
