:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --ink: #15171a;
  --muted: #68717d;
  --line: #dfe3e8;
  --accent: #1f7a5f;
  --accent-2: #375a9e;
  --warn: #9b5c20;
  --bad: #9b3030;
  --shadow: 0 16px 42px rgba(25, 32, 44, 0.08);
}

body.theme-dark {
  --bg: #0e1116;
  --panel: #171b22;
  --panel-soft: #1f252e;
  --ink: #eef3f7;
  --muted: #9aa6b2;
  --line: #2c3440;
  --accent: #25a37e;
  --accent-2: #8fb2ff;
  --warn: #e2a358;
  --bad: #ef7777;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 1px solid #1b5f4b;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  padding: 8px 12px;
  cursor: pointer;
}

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

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

button.ghost,
button.seg {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #1b5f4b;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.button-link:hover {
  filter: brightness(0.96);
}

.button-link.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.button-link.disabled,
.button-link[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
  filter: none;
}

button.seg.active,
.side-nav button.active,
.settings-shortcut.active {
  background: #e8f2ee;
  border-color: #9dc9ba;
  color: #114b39;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 0%, rgba(37, 163, 126, 0.12), transparent 34%), var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card .mark {
  margin-bottom: 18px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.auth-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.auth-login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  width: 100%;
  border: 1px solid #1b5f4b;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 160ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  background: #20242a;
  color: #f8fafc;
  transition: padding 160ms ease;
}

.sidebar-toggle {
  position: absolute;
  top: 20px;
  right: -15px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border-color: var(--line);
  background: #11161d;
  color: #d9e5ee;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.sidebar-toggle span {
  display: block;
  font-size: 21px;
  line-height: 1;
  transform: translateY(-1px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f0f4f1;
  color: #173f33;
  font-weight: 750;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.board-head h3,
.board-head p {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
}

.brand-copy {
  min-width: 0;
  overflow: hidden;
}

.brand p,
.side-section label,
.status-box small {
  color: #b9c0c9;
}

.side-section {
  display: grid;
  gap: 6px;
}

.compact-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.compact-form button {
  padding-inline: 10px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav button {
  width: 100%;
  min-height: 38px;
  text-align: left;
  background: transparent;
  color: #eef2f5;
  border-color: #3a414b;
}

.side-nav button span {
  display: inline-block;
}

.status-box {
  margin-top: auto;
  display: block;
  width: 100%;
  padding: 14px;
  background: #2b3037;
  border: 1px solid #3a414b;
  border-radius: 8px;
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
}

.status-box:hover,
.status-box:focus-visible,
.status-box.active {
  border-color: #3ca987;
  background: #173127;
  filter: none;
}

.status-box span {
  display: block;
  font-size: 28px;
  font-weight: 750;
}

.settings-shortcut {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  background: transparent;
  color: #eef2f5;
  border-color: #3a414b;
  text-align: left;
}

.settings-shortcut:hover,
.settings-shortcut:focus-visible,
.settings-shortcut.active {
  border-color: #3ca987;
  background: #173127;
  filter: none;
}

.settings-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(60, 169, 135, 0.13);
}

.settings-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.settings-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

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

.settings-copy small {
  color: #b9c0c9;
}

.app-shell.sidebar-collapsed .sidebar {
  gap: 16px;
  padding: 20px 12px;
}

.app-shell.sidebar-collapsed .sidebar-toggle span {
  transform: translateY(-1px) rotate(180deg);
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .side-section,
.app-shell.sidebar-collapsed .compact-form,
.app-shell.sidebar-collapsed .status-box small,
.app-shell.sidebar-collapsed .settings-copy {
  display: none;
}

.app-shell.sidebar-collapsed .side-nav {
  gap: 10px;
}

.app-shell.sidebar-collapsed .side-nav button {
  display: grid;
  place-items: center;
  height: 42px;
  padding: 0;
  text-align: center;
  font-weight: 760;
}

.app-shell.sidebar-collapsed .side-nav button span {
  display: none;
}

.app-shell.sidebar-collapsed .side-nav button::before {
  content: attr(data-short);
}

.app-shell.sidebar-collapsed .status-box {
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 0;
  text-align: center;
}

.app-shell.sidebar-collapsed .status-box span {
  font-size: 18px;
}

.app-shell.sidebar-collapsed .settings-shortcut {
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 0;
}

.app-shell.sidebar-collapsed .sidebar .current-user {
  display: none;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

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

.topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.current-user {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 340px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
}

.current-user img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
}

.current-user span {
  display: grid;
  min-width: 0;
}

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

.current-user strong {
  font-size: 12px;
}

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

.current-user button {
  padding: 6px 8px;
  font-size: 12px;
}

.sidebar .current-user {
  width: 100%;
  max-width: none;
  padding: 10px 12px;
  border-color: #3a414b;
  background: #14191f;
  color: #f8fafc;
}

.sidebar .current-user span {
  flex: 1 1 0;
}

.sidebar .current-user strong {
  color: #f8fafc;
  font-size: 13px;
}

.sidebar .current-user small {
  color: #b9c0c9;
}

.sidebar .current-user button.ghost {
  flex: 0 0 auto;
  background: #11161d;
  color: #eef2f5;
  border-color: #3a414b;
}

.sidebar .current-user button.ghost:hover,
.sidebar .current-user button.ghost:focus-visible {
  border-color: #3ca987;
  filter: none;
}

.episode-switcher {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 280px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.episode-switcher.hidden {
  display: none;
}

.episode-switcher select {
  min-width: 280px;
  padding: 8px 10px;
}

.topbar h2 {
  font-size: 24px;
}

.topbar p {
  color: var(--muted);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  gap: 16px;
}

.project-stack {
  display: grid;
  gap: 16px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.project-section {
  display: grid;
  gap: 12px;
}

.project-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.project-section-toggle:hover {
  filter: none;
}

.project-section-toggle > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.project-section-toggle strong {
  font-size: 18px;
  line-height: 1.2;
}

.project-section-toggle small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.project-section-preview {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.project-section-preview:empty {
  display: none;
}

.project-section-preview img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.project-section-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.project-section-body {
  display: grid;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.project-section.is-collapsed {
  gap: 0;
}

.project-section.is-collapsed .project-section-body {
  display: none;
}

.project-section-actions {
  display: flex;
  justify-content: flex-start;
}

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

.board-head > div:first-child {
  min-width: 0;
}

.inspector-head h3 {
  min-width: 0;
}

.inspector-head > span {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  min-width: max-content;
}

.inspector-head .badge {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

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

.final-actions button {
  min-height: 34px;
  padding: 6px 11px;
  white-space: nowrap;
}

.final-download-action {
  flex: 0 0 34px;
}

.episode-picker-head {
  align-items: flex-start;
}

.episode-picker-head select {
  max-width: 360px;
}

.helper-text {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.helper-text.compact {
  margin: 4px 0 0;
}

.hidden {
  display: none !important;
}

.section-subtitle {
  margin: 16px 0 10px;
  font-size: 15px;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
}

.users-form {
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 1.25fr) 180px 120px;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.users-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.users-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.users-form input,
.users-form select,
.users-form button {
  width: 100%;
  min-height: 48px;
}

.users-list {
  display: grid;
  gap: 8px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.8fr) 130px 130px auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
}

.user-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

.user-main span,
.user-main small {
  color: var(--muted);
  font-size: 12px;
}

.user-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.user-actions button {
  min-height: 34px;
  padding: 6px 9px;
}

.stack-form,
.upload-form {
  display: grid;
  gap: 10px;
}

.source-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.summary-row span {
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 750;
}

.summary-row p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.episode-plan-summary {
  display: grid;
  gap: 4px;
  min-height: 52px;
  padding: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.episode-plan-summary strong {
  font-size: 13px;
}

.episode-plan-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.full {
  width: 100%;
  margin-top: 12px;
}

.list,
.job-list {
  display: grid;
  gap: 8px;
}

.jobs-toolbar {
  display: flex;
  align-items: end;
  gap: 8px;
  max-width: 560px;
  margin: 8px 0 14px;
}

.jobs-user-filter {
  position: relative;
  display: grid;
  gap: 6px;
  width: min(360px, 100%);
}

.jobs-user-filter > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filter-dropdown {
  position: relative;
}

.filter-dropdown summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11161d;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-dropdown summary::-webkit-details-marker {
  display: none;
}

.filter-dropdown summary::after {
  content: "⌄";
  flex: 0 0 auto;
  color: var(--muted);
}

.filter-dropdown[open] summary::after {
  transform: rotate(180deg);
}

.filter-dropdown.is-disabled summary {
  cursor: default;
  opacity: 0.55;
}

.filter-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: min(360px, 86vw);
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11161d;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
}

.filter-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.filter-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.filter-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.jobs-toolbar button {
  min-height: 40px;
  padding-inline: 14px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.list-row small {
  color: var(--muted);
}

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

.asset-grid.characters {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.asset-grid.locations {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

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

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

.asset-image-frame {
  position: relative;
  overflow: hidden;
  background: #eceff3;
}

.asset-preview-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  line-height: 0;
}

.asset-preview-button img {
  display: block;
}

.asset-preview-button:hover {
  filter: none;
}

.asset-preview-button:focus-visible {
  outline: 2px solid #27a77f;
  outline-offset: -2px;
}

.asset-reference-action {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 34px;
  height: 34px;
  min-height: 0;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(12, 20, 28, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: #16232e;
  box-shadow: 0 6px 18px rgba(8, 12, 18, 0.2);
}

.asset-reference-action:hover {
  filter: none;
  background: #fff;
}

.asset-reference-action svg {
  width: 18px;
  height: 18px;
}

.empty-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(135deg, #edf1f3 0%, #edf1f3 48%, #dfe6ea 48%, #dfe6ea 52%, #edf1f3 52%, #edf1f3 100%);
}

.empty-thumb span {
  color: #65717e;
  font-size: 12px;
  font-weight: 650;
}

.asset-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.asset-body h4 {
  margin: 0;
  font-size: 14px;
}

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

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

.mention-count {
  color: var(--muted);
  font-size: 11px;
}

.asset-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.bilingual-description {
  display: grid;
  gap: 5px;
  min-height: 72px;
}

.bilingual-description strong {
  color: var(--ink);
  font-size: 11px;
}

.character-facts {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.character-facts.empty {
  color: var(--muted);
  font-size: 12px;
}

.character-facts div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.character-facts span {
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.character-facts p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.voice-reference-block {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.voice-reference-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.voice-reference-head strong {
  font-size: 12px;
}

.voice-reference-block p {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.voice-reference-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.voice-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.voice-audio-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 34px;
  padding: 4px 9px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(60, 169, 135, 0.1);
  color: var(--ink);
}

.voice-play-button {
  width: 26px;
  height: 26px;
  min-height: 0;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  border-color: #2f8d70;
  background: #27a77f;
  color: #fff;
}

.voice-play-button:hover {
  filter: brightness(0.96);
}

.voice-play-button svg {
  width: 14px;
  height: 14px;
}

.voice-chip-label,
.voice-duration {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.voice-duration {
  color: var(--muted);
}

.voice-upload-action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.voice-upload-action svg {
  width: 16px;
  height: 16px;
}

.voice-icon-action {
  width: 30px;
  height: 30px;
  min-height: 0;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.voice-icon-action:hover {
  filter: none;
  color: var(--ink);
  border-color: #3ca987;
}

.voice-icon-action.danger {
  color: #ffb3b3;
  border-color: rgba(255, 120, 120, 0.32);
}

.voice-icon-action svg {
  width: 15px;
  height: 15px;
}

.asset-upload-row {
  display: grid;
  gap: 5px;
}

.asset-upload-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.asset-upload-row input {
  width: 100%;
  min-width: 0;
}

.asset-body small {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.alias-line {
  padding-top: 2px;
}

.missing-reference {
  border-style: dashed;
}

.character-card {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.character-card:hover,
.character-card:focus-visible {
  border-color: #3ca987;
}

.character-card:focus-visible {
  outline: 2px solid #3ca987;
  outline-offset: 2px;
}

.character-card img {
  aspect-ratio: 16 / 11;
}

.character-card-body {
  gap: 7px;
}

.character-card-summary {
  min-height: 0;
}

.character-card-summary p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.character-modal {
  width: min(1100px, 100%);
}

.character-detail {
  display: grid;
  gap: 16px;
}

.character-detail-hero {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.character-detail-preview img,
.character-detail-empty {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
}

.character-detail-image-frame {
  border-radius: 8px;
}

.character-detail-preview img {
  object-fit: cover;
  border: 1px solid var(--line);
}

.character-detail-summary {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.character-detail-description {
  min-height: 0;
}

.character-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.character-detail-tags span {
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.character-detail section {
  display: grid;
  gap: 8px;
}

.character-detail section h4 {
  margin: 0;
  font-size: 14px;
}

.reference-replace-modal {
  width: min(760px, 100%);
}

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

.reference-compare figure {
  display: grid;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

.reference-compare figcaption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reference-compare img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.reference-compare audio,
.voice-delete-preview audio {
  width: 100%;
}

.reference-compare small,
.voice-delete-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.voice-delete-preview {
  display: grid;
  gap: 10px;
}

.episode-layout {
  display: grid;
  grid-template-columns: minmax(320px, 640px);
  gap: 16px;
}

.episode-create-panel {
  max-width: 640px;
}

.episode-plan-summary {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

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

.scene-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.scene-item {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.scene-review-item,
.scene-with-thumb {
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.scene-final-pick {
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 0;
  padding: 0;
  overflow: visible;
}

.scene-pick-main {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 8px 0 0 8px;
  padding: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.scene-pick-main:disabled {
  cursor: default;
}

.scene-final-pick.is-disabled .scene-pick-main {
  opacity: 0.72;
}

.scene-edit-action {
  position: relative;
  display: grid;
  place-items: center;
  align-self: stretch;
  min-height: 100%;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--muted);
}

.scene-edit-action:hover,
.scene-edit-action:focus-visible {
  color: #27a77f;
  background: rgba(39, 167, 127, 0.08);
}

.scene-edit-action svg {
  width: 17px;
  height: 17px;
}

.scene-thumb {
  width: 46px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10161d;
}

.scene-thumb-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.scene-review-item .scene-thumb-empty span,
.scene-with-thumb .scene-thumb-empty span {
  color: inherit;
  font-size: 13px;
}

.scene-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.scene-title-line {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  color: var(--ink);
}

.scene-number {
  flex: 0 0 auto;
}

.scene-dot {
  flex: 0 0 auto;
  color: var(--muted);
}

.scene-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-meta {
  line-height: 1.35;
}

.scene-item.active {
  border-color: #779e91;
  background: #eef6f2;
}

.scene-item.is-current-final {
  border-color: #27a77f;
  box-shadow: 0 0 0 1px #27a77f;
  background: #eef8f4;
}

.scene-item strong {
  font-size: 13px;
}

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

.scene-review-item .scene-title-line span,
.scene-with-thumb .scene-title-line span {
  color: inherit;
  font-size: inherit;
}

.scene-review-item .scene-dot,
.scene-with-thumb .scene-dot {
  color: var(--muted);
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  gap: 16px;
  align-items: start;
}

.review-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.history-shot-grid {
  --shot-card-min: 150px;
}

.history-inspector {
  min-width: 0;
}

.scene-rail,
.inspector,
.shot-board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.inspector {
  position: sticky;
  top: 18px;
}

.rail-title {
  font-weight: 750;
  margin-bottom: 10px;
}

.review-layout .rail-title {
  margin-bottom: 12px;
}

.review-layout .scene-review-item {
  min-height: 78px;
}

.board-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.board-actions button {
  white-space: nowrap;
}

.scale-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.scale-control select {
  width: 110px;
  padding: 7px 8px;
}

.scale-control input {
  width: 86px;
  padding: 7px 8px;
}

.scene-generate-box {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.scene-generate-fields {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.scene-generate-fields button {
  padding: 7px 10px;
}

.scene-generate-box textarea {
  min-height: 56px;
}

.generate-modal {
  width: min(860px, 100%);
}

.generate-modal-body {
  gap: 14px;
}

.generate-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.generation-mode-panel {
  display: grid;
  gap: 7px;
}

.generation-mode-panel textarea {
  min-height: 124px;
}

.generation-option-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
}

.generation-option-row input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.generation-option-row span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.generation-option-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.generation-option-row.is-disabled {
  opacity: 0.58;
}

.generation-assets-head h4,
.generation-asset-summary h5,
.generation-asset-picker-panel h5 {
  margin: 0;
}

.generation-selected-assets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.generation-selected-asset {
  display: inline-flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  gap: 6px;
  padding: 5px 8px 5px 5px;
  border: 1px solid rgba(39, 167, 127, 0.45);
  border-radius: 7px;
  background: rgba(39, 167, 127, 0.08);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
  box-sizing: border-box;
}

.generation-selected-asset img {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
}

.generation-selected-asset video {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--bg);
}

.generation-selected-asset.is-source-prompt {
  border-color: rgba(255, 188, 100, 0.42);
  background: rgba(255, 188, 100, 0.08);
}

.generation-asset-kind {
  flex: 0 0 auto !important;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.generation-selected-asset span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-selected-asset small {
  flex: 0 0 auto;
  color: #9ff0d0;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.generation-selected-asset.is-custom {
  border-color: rgba(125, 190, 255, 0.45);
  background: rgba(125, 190, 255, 0.08);
}

.generation-asset-remove {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.generation-asset-remove:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.28);
}

.generation-asset-grid {
  display: grid;
  gap: 12px;
}

.generation-asset-summary {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.generation-asset-summary-head,
.generation-asset-picker-head,
.generation-asset-picker-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.generation-asset-summary-head > div,
.generation-asset-picker-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.generation-asset-summary-head span,
.generation-asset-picker-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.generation-asset-summary-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  max-width: 100%;
}

.generation-asset-add {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border-color: rgba(39, 167, 127, 0.55);
  color: #9ff0d0;
  font-size: 22px;
  line-height: 1;
}

.generation-asset-upload {
  min-height: 32px;
  padding: 6px 9px;
  border-color: rgba(125, 190, 255, 0.45);
  background: rgba(125, 190, 255, 0.08);
  color: #c7e4ff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.generation-asset-summary-chips {
  min-height: 34px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.generation-asset-summary-chips .generation-selected-asset {
  flex: 1 1 100%;
}

.generation-asset-placeholder {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.generation-asset-picker-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(39, 167, 127, 0.45);
  border-radius: 8px;
  background: rgba(17, 24, 32, 0.98);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.generation-asset-picker-actions {
  justify-content: flex-end;
}

.generation-asset-picker-actions button {
  padding: 7px 10px;
}

.generation-asset-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 8px;
}

.generation-asset-picker-list {
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.generation-asset-option {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
}

.generation-asset-option:hover,
.generation-asset-option.is-selected {
  filter: none;
  border-color: #27a77f;
  box-shadow: 0 0 0 1px rgba(39, 167, 127, 0.65);
}

.generation-asset-option img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #10161d;
}

.generation-asset-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

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

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--shot-card-min, 230px)), 1fr));
  gap: 12px;
  align-items: start;
}

.shot-sections {
  display: grid;
  gap: 24px;
}

.shot-sections.scale-large,
.shot-grid.scale-large {
  --shot-card-min: 270px;
}

.shot-sections.scale-medium,
.shot-grid.scale-medium {
  --shot-card-min: 220px;
}

.shot-sections.scale-small,
.shot-grid.scale-small {
  --shot-card-min: 170px;
}

.shot-sections.scale-small .shot-grid,
.shot-grid.scale-small {
  gap: 10px;
}

.shot-sections.scale-tiny,
.shot-grid.scale-tiny {
  --shot-card-min: 130px;
}

.shot-sections.scale-tiny .shot-grid,
.shot-grid.scale-tiny {
  gap: 8px;
}

.shot-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.shot-section-archive {
  background: #eceff3;
  border-color: #c9ced6;
  color: #2e343b;
}

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

.shot-section-head h4 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.shot-section-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

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

.shot-section-head .shot-section-title {
  color: var(--ink);
  font-size: 14px;
}

.shot-section-toggle {
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.shot-section-toggle:hover {
  filter: none;
}

.shot-section-toggle .shot-section-head {
  align-items: center;
}

.shot-section-toggle .shot-section-head::after {
  content: "Expand";
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid #b7bdc6;
  border-radius: 999px;
  color: #424952;
  background: #f6f7f9;
  font-size: 11px;
  font-weight: 750;
}

.shot-section-toggle[aria-expanded="true"] .shot-section-head::after {
  content: "Collapse";
}

.shot-section.is-collapsed {
  gap: 0;
}

.shot-section.is-empty .shot-grid {
  grid-template-columns: 1fr;
}

.shot-card {
  display: grid;
  grid-template-rows: auto 1fr;
  align-self: start;
  min-width: 0;
  cursor: pointer;
}

.shot-card.is-selected {
  border-color: #27a77f;
  box-shadow: 0 0 0 1px #27a77f;
}

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

.processing-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 9 / 16;
  padding: 14px;
  background:
    linear-gradient(135deg, #eef5f2 0%, #eef5f2 48%, #d8e7e1 48%, #d8e7e1 52%, #eef5f2 52%, #eef5f2 100%);
  color: #1f7a5f;
  text-align: center;
  font-size: 12px;
  font-weight: 750;
}

.processing-preview span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.inspector-processing {
  border-radius: 8px;
}

.scrub-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #17191d;
  cursor: ew-resize;
  user-select: none;
}

.scrub-poster,
.scrub-preview video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scrub-poster {
  display: block;
  background: #17191d;
  transition: opacity 0.12s ease;
}

.scrub-preview video {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.scrub-preview.video-ready video {
  opacity: 1;
}

.scrub-preview.video-ready .scrub-poster {
  opacity: 0;
}

.scrub-cursor {
  position: absolute;
  top: 0;
  bottom: 4px;
  left: 0;
  z-index: 3;
  width: 2px;
  border-radius: 999px;
  background: #27a77f;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.32),
    0 0 14px rgba(39, 167, 127, 0.55);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
}

.shot-duration-overlay {
  position: absolute;
  right: 8px;
  bottom: 10px;
  z-index: 4;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(10, 14, 18, 0.52);
  color: rgba(235, 241, 246, 0.78);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  pointer-events: none;
}

.scale-small .shot-duration-overlay,
.scale-tiny .shot-duration-overlay {
  right: 6px;
  bottom: 8px;
  padding: 3px 5px;
  font-size: 10px;
}

.scrub-preview:hover .scrub-cursor,
.scrub-preview.scrubbing .scrub-cursor {
  opacity: 1;
}

.scrub-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
}

.scrub-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: #27a77f;
}

.shot-info {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
}

.scale-small .shot-info,
.scale-tiny .shot-info {
  gap: 6px;
  padding: 8px;
}

.scale-tiny .shot-title {
  align-items: center;
}

.scale-small .shot-title,
.scale-tiny .shot-title {
  gap: 6px;
}

.scale-tiny .shot-title strong,
.scale-small .shot-title strong {
  font-size: 12px;
}

.scale-small .shot-title .badge,
.scale-tiny .shot-title .badge {
  max-width: 42%;
}

.scale-tiny .badge,
.scale-small .badge {
  padding: 2px 6px;
  font-size: 10px;
}

.scale-tiny .archive-reason {
  max-height: 58px;
  overflow: auto;
}

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

.shot-title strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shot-context {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
}

.badge.has-tooltip {
  position: relative;
  overflow: visible;
  cursor: help;
}

.badge.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #10161d;
  color: #f5f7f9;
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.badge.has-tooltip:hover::after,
.badge.has-tooltip:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.badge.approved {
  color: #244a8f;
  background: #e8efff;
  border-color: #a7bce8;
}

.badge.leader {
  color: #0d5c42;
  background: #dff6ec;
  border-color: #86cdb2;
}

.badge.rejected {
  color: var(--bad);
  background: #f8eeee;
  border-color: #e0b8b8;
}

.badge.raw,
.badge.post,
.badge.processing,
.badge.waiting,
.badge.ready_for_codex,
.badge.starting,
.badge.running {
  color: var(--warn);
  background: #fff4e8;
  border-color: #e7c394;
}

.badge.done,
.badge.completed {
  color: #0d5c42;
  background: #dff6ec;
  border-color: #86cdb2;
}

.badge.failed {
  color: var(--bad);
  background: #f8eeee;
  border-color: #e0b8b8;
}

.badge.priority-high {
  color: #114b39;
  background: #dff4ec;
  border-color: #8fcdb8;
}

.badge.priority-medium {
  color: #244a8f;
  background: #e8efff;
  border-color: #a7bce8;
}

.badge.priority-low,
.badge.manual {
  color: var(--muted);
  background: #f5f7f9;
  border-color: var(--line);
}

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

.archive-reason {
  margin: 0;
  padding: 8px;
  border: 1px solid #e6c4a6;
  border-radius: 7px;
  background: #fff7ef;
  color: #6d3d12;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.shot-card.is-archived .archive-reason {
  max-height: 112px;
  overflow: auto;
}

.scale-small .shot-card.is-archived .archive-reason {
  max-height: 88px;
}

.scale-tiny .shot-card.is-archived .archive-reason {
  max-height: 58px;
}

.inspector-reason {
  margin-top: 10px;
}

.shot-actions button:not(.shot-icon-action) {
  min-height: 0;
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  line-height: 1.2;
  font-size: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.shot-actions .review-status-action:not(.shot-icon-action) {
  flex: 1 1 100%;
}

.shot-icon-action {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  overflow: visible;
  background: #f7fbf9;
  border-color: #9fcfbd;
  color: #1e8f6f;
  text-decoration: none;
}

.shot-icon-action svg {
  width: 18px;
  height: 18px;
  display: block;
}

.shot-icon-action.leader-action.is-active {
  background: #e4f6ef;
  border-color: #2aa77f;
  color: #16815f;
}

.shot-icon-action.leader-action.is-active:disabled {
  opacity: 1;
}

.shot-icon-action.danger {
  background: #fff4f4;
  border-color: #8f3131;
  color: #b8333f;
}

.shot-icon-action.download-action {
  background: #f4f7ff;
  border-color: #8ca4df;
  color: #305cae;
}

.shot-icon-action::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 10;
  transform: translateX(-50%) translateY(2px);
  pointer-events: none;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10161d;
  color: #f5f7f9;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease;
}

.shot-icon-action:hover::after,
.shot-icon-action:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.shot-icon-action.danger::after {
  left: auto;
  right: 0;
  transform: translateY(2px);
}

.shot-icon-action.danger:hover::after,
.shot-icon-action.danger:focus-visible::after {
  transform: translateY(0);
}

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

.empty-state.compact {
  padding: 8px 10px;
  font-size: 12px;
}

.inspector video {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #15171a;
  border-radius: 8px;
}

.inspector-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

.inspector-actions button {
  padding: 6px 10px;
}

.inspector-shot-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.comment-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.comment-row {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.comment-row time {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 650;
}

.regen-box {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  margin-top: 12px;
}

.lineage {
  max-height: 190px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  color: #3c4652;
  font-size: 11px;
}

.prompt-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.prompt-panel h4 {
  margin: 4px 0 0;
}

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

.modal-panel {
  width: min(980px, 100%);
  max-height: min(860px, calc(100vh - 44px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.prompt-assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
}

.prompt-asset {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
}

.prompt-asset img,
.prompt-asset video {
  width: 100%;
  aspect-ratio: 9 / 12;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg);
}

.prompt-asset-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.prompt-asset-preview:hover {
  filter: none;
}

.prompt-asset-preview img {
  display: block;
}

.prompt-asset audio {
  width: 100%;
}

.prompt-asset-audio {
  align-content: start;
}

.prompt-audio-reference {
  min-height: 58px;
  display: flex;
  align-items: center;
  min-width: 0;
}

.prompt-audio-chip {
  width: 100%;
  min-height: 38px;
  padding: 5px 10px 5px 5px;
  border-color: rgba(60, 169, 135, 0.42);
  background: rgba(60, 169, 135, 0.12);
}

.prompt-audio-chip .voice-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-asset small {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.prompt-asset-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 9 / 12;
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.asset-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}

.asset-lightbox.hidden {
  display: none;
}

.asset-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  min-height: 34px;
  padding: 6px 10px;
}

.asset-lightbox-figure {
  display: grid;
  gap: 10px;
  max-width: min(92vw, 1180px);
  max-height: calc(100vh - 80px);
  margin: 0;
}

.asset-lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 128px);
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d11;
}

.asset-lightbox-figure figcaption {
  max-width: min(92vw, 1180px);
  color: #e7edf4;
  font-size: 12px;
  text-align: center;
  overflow-wrap: anywhere;
}

.codex-chat-panel {
  gap: 10px;
}

.codex-chat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.codex-chat-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.codex-chat-entry {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
}

.codex-chat-entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.codex-chat-entry-head span {
  color: var(--muted);
  font-size: 11px;
}

.codex-chat-body {
  margin: 0;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  font-size: 11px;
}

.provider-prompt-block {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
}

.prompt-note {
  margin: 0;
  color: var(--muted);
}

.prompt-text {
  max-height: 310px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  color: #3c4652;
  font-size: 11px;
  white-space: pre-wrap;
}

.final-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(360px, 1fr);
  gap: 16px;
  align-items: start;
}

.leader-player {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #15171a;
  border-radius: 8px;
}

.leader-now {
  margin-top: 10px;
  color: var(--muted);
}

.job-row {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 7px;
  padding: 10px;
}

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

.job-row small {
  color: var(--muted);
}

.job-inline-error {
  color: #ff9b9b !important;
}

.job-direction {
  margin: 0;
  color: var(--ink);
}

.job-health {
  display: grid;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.job-health.ok {
  border-color: rgba(39, 167, 127, 0.42);
  background: rgba(39, 167, 127, 0.07);
}

.job-health.info {
  border-color: rgba(112, 159, 255, 0.35);
  background: rgba(112, 159, 255, 0.06);
}

.job-health.warning {
  border-color: rgba(255, 176, 76, 0.45);
  background: rgba(255, 176, 76, 0.08);
}

.job-health.error {
  border-color: rgba(255, 120, 120, 0.45);
  background: rgba(255, 120, 120, 0.08);
}

.job-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.job-health-grid div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.job-health-grid span {
  color: var(--muted);
  font-size: 11px;
}

.job-health-grid strong {
  color: var(--ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.job-health p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.job-row code {
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

.job-actions button {
  padding: 6px 10px;
}

.job-results {
  display: grid;
  gap: 8px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.job-results-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.job-results-toggle:hover {
  border-color: rgba(39, 167, 127, 0.55);
}

.job-results-toggle[aria-expanded="true"] {
  border-color: rgba(39, 167, 127, 0.65);
  background: rgba(39, 167, 127, 0.08);
}

.job-results-toggle small {
  color: var(--muted);
  white-space: nowrap;
}

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

.job-result-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.job-shot-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
}

.job-shot-preview {
  width: 74px;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.job-shot-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.job-shot-info {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.job-shot-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.job-shot-title strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.job-shot-info p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.job-shot-info button {
  justify-self: start;
  padding: 5px 9px;
}

.job-provider-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.job-provider-links a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(39, 167, 127, 0.55);
  border-radius: 6px;
  color: #9df0d2;
  background: rgba(39, 167, 127, 0.1);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.job-provider-links a:hover {
  border-color: #27a77f;
  background: rgba(39, 167, 127, 0.18);
}

.job-provider-links.compact a {
  min-height: 24px;
  padding: 4px 7px;
  font-size: 11px;
}

.job-output-note {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.job-output-note.warning {
  color: #ffd08a;
  border-color: rgba(255, 176, 76, 0.45);
  background: rgba(255, 176, 76, 0.09);
}

.job-output-note.error {
  color: #ffb4b4;
  border-color: rgba(255, 120, 120, 0.45);
  background: rgba(255, 120, 120, 0.08);
}

.job-output-paths {
  display: grid;
  gap: 4px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  padding: 12px 14px;
  background: #20242a;
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: 0.18s ease;
}

.toast.active {
  opacity: 1;
  transform: translateY(0);
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: #11161d;
  color: var(--ink);
  border-color: var(--line);
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
  color: #727d89;
}

body.theme-dark button.ghost,
body.theme-dark button.seg {
  background: #11161d;
  color: var(--ink);
  border-color: var(--line);
}

body.theme-dark button.seg.active,
body.theme-dark .side-nav button.active,
body.theme-dark .settings-shortcut.active {
  background: #142820;
  border-color: #3ca987;
  color: #9af0cf;
}

body.theme-dark .sidebar {
  background: #0b0d11;
  border-right: 1px solid var(--line);
}

body.theme-dark .mark {
  background: #173127;
  color: #9af0cf;
}

body.theme-dark .status-box {
  background: #14191f;
  border-color: var(--line);
}

body.theme-dark .asset-card,
body.theme-dark .shot-card,
body.theme-dark .scene-item {
  background: #141920;
}

body.theme-dark .shot-section {
  background: #141920;
  border-color: var(--line);
}

body.theme-dark .shot-section-archive {
  background: #20242b;
  border-color: #3a414b;
  color: var(--ink);
}

body.theme-dark .shot-section-toggle .shot-section-head::after {
  color: #d8dee6;
  background: #161b22;
  border-color: #46505d;
}

body.theme-dark .shot-card.is-selected {
  border-color: #3ca987;
  box-shadow: 0 0 0 1px #3ca987;
}

body.theme-dark .shot-icon-action {
  background: #12221d;
  border-color: #285d4d;
  color: #8ce5c5;
}

body.theme-dark .button-link.secondary,
body.theme-dark .shot-icon-action.download-action {
  background: #17243b;
  border-color: #39568a;
  color: #a9c5ff;
}

body.theme-dark .shot-icon-action.leader-action.is-active {
  background: #123127;
  border-color: #3ca987;
  color: #8ce5c5;
}

body.theme-dark .empty-thumb {
  background:
    linear-gradient(135deg, #202832 0%, #202832 48%, #2b3440 48%, #2b3440 52%, #202832 52%, #202832 100%);
}

body.theme-dark .processing-preview {
  background:
    linear-gradient(135deg, #17231f 0%, #17231f 48%, #20352e 48%, #20352e 52%, #17231f 52%, #17231f 100%);
  color: #9af0cf;
}

body.theme-dark .empty-thumb span {
  color: #9aa6b2;
}

body.theme-dark .scene-item.active {
  border-color: #3ca987;
  background: #142820;
}

body.theme-dark .scene-item.is-current-final {
  border-color: #3ca987;
  box-shadow: 0 0 0 1px #3ca987;
  background: #142820;
}

body.theme-dark .scene-pick-main {
  color: #edf3f7;
}

body.theme-dark .scene-edit-action {
  border-left-color: #2f3c4d;
  color: #9aa6b2;
}

body.theme-dark .scene-edit-action:hover,
body.theme-dark .scene-edit-action:focus-visible {
  color: #9af0cf;
  background: rgba(60, 169, 135, 0.12);
}

body.theme-dark .badge {
  background: #11161d;
}

body.theme-dark .badge.approved {
  color: #9cbaff;
  background: #17263f;
  border-color: #334f82;
}

body.theme-dark .badge.leader {
  color: #7ee0bd;
  background: #123027;
  border-color: #25664f;
}

body.theme-dark .badge.rejected {
  background: #3a1d22;
  border-color: #753641;
}

body.theme-dark .shot-actions button.danger {
  border-color: #753641;
  background: #3a1d22;
  color: #ffb1b1;
}

body.theme-dark .badge.raw,
body.theme-dark .badge.post,
body.theme-dark .badge.processing,
body.theme-dark .badge.waiting,
body.theme-dark .badge.ready_for_codex,
body.theme-dark .badge.starting,
body.theme-dark .badge.running {
  background: #332617;
  border-color: #6d4a20;
}

body.theme-dark .badge.done,
body.theme-dark .badge.completed {
  color: #7ee0bd;
  background: #123027;
  border-color: #25664f;
}

body.theme-dark .badge.failed {
  background: #3a1d22;
  border-color: #753641;
}

body.theme-dark .badge.priority-high {
  color: #8ce8c7;
  background: #123126;
  border-color: #2a765b;
}

body.theme-dark .badge.priority-medium {
  color: #9cbaff;
  background: #17263f;
  border-color: #334f82;
}

body.theme-dark .badge.priority-low,
body.theme-dark .badge.manual {
  background: #151b23;
}

body.theme-dark .archive-reason {
  background: #2e2116;
  color: #f0bd80;
  border-color: #67441f;
}

body.theme-dark .lineage {
  background: #11161d;
  color: #b9c4d0;
}

body.theme-dark .prompt-text {
  background: #11161d;
  color: #b9c4d0;
}

body.theme-dark .toast {
  background: #11161d;
  border: 1px solid var(--line);
}

.agent-layout {
  max-width: 1180px;
  margin: 0 auto;
  height: 100%;
  min-height: 0;
}

#tabAgent.active {
  height: calc(100vh - 118px);
  min-height: 560px;
  overflow: hidden;
}

.agent-chat-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto auto;
  background: #101419;
}

.agent-message-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 0;
  overflow: auto;
  padding: 28px 42px 30px;
  scrollbar-width: thin;
  scrollbar-color: #283442 #101419;
  scrollbar-gutter: stable;
}

.agent-message-list::-webkit-scrollbar {
  width: 10px;
}

.agent-message-list::-webkit-scrollbar-track {
  background: #101419;
}

.agent-message-list::-webkit-scrollbar-thumb {
  min-height: 48px;
  border: 2px solid #101419;
  border-radius: 999px;
  background: #283442;
}

.agent-message-list::-webkit-scrollbar-thumb:hover {
  background: #344353;
}

.agent-message {
  max-width: 820px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.agent-message.user {
  align-self: flex-end;
  max-width: min(760px, 76%);
  border-radius: 22px;
  padding: 14px 18px;
  background: #24262a;
  color: #f2f5f7;
}

.agent-message.assistant {
  align-self: flex-start;
  width: min(920px, 100%);
  color: #f2f5f7;
}

.agent-message.is-pending .agent-message-body {
  color: var(--muted);
}

.agent-message.is-pending .agent-message-body::after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 4px;
  margin-left: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(185, 196, 208, 0.2), rgba(185, 196, 208, 0.75), rgba(185, 196, 208, 0.2));
  animation: agentThinking 1.1s ease-in-out infinite;
  vertical-align: middle;
}

@keyframes agentThinking {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

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

.agent-message-body {
  line-height: 1.55;
  font-size: 15.5px;
  font-weight: 450;
  white-space: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.agent-message-body p {
  margin: 0 0 10px;
}

.agent-message-body p:last-child {
  margin-bottom: 0;
}

.agent-message-body ul {
  margin: 8px 0 12px;
  padding-left: 24px;
}

.agent-message-body code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: #cde6ff;
}

.agent-message-body a {
  color: var(--accent-2);
}

.agent-inline-media {
  display: block;
  width: min(360px, 100%);
  max-height: 360px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a0f14;
  object-fit: contain;
}

.agent-message.user .agent-message-body {
  font-size: 15px;
  line-height: 1.45;
}

.agent-message-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.agent-generation-panel {
  display: grid;
  gap: 12px;
  margin: 8px 0 14px;
}

.agent-generation-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #e3e9ef;
  font-size: 13px;
}

.agent-generation-head span {
  color: var(--muted);
  font-weight: 650;
}

.agent-generation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-width: 720px;
}

.agent-generation-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151b22;
}

.agent-generation-card.is-ready {
  border-color: rgba(43, 179, 138, 0.38);
}

.agent-generation-preview {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 9 / 16;
  min-height: 220px;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #0c1116;
  color: var(--muted);
}

.agent-generation-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-generation-poster {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  background: #05080b;
  transition: opacity 160ms ease;
}

.agent-generation-preview.is-playing .agent-generation-poster,
.agent-generation-preview.is-playing .agent-generation-play {
  opacity: 0;
  pointer-events: none;
}

.agent-generation-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(8, 13, 18, 0.72);
  color: #f3f7fb;
  font-size: 22px;
  line-height: 1;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(8px);
}

.agent-generation-play:hover {
  background: rgba(36, 47, 58, 0.84);
  filter: none;
}

.agent-generation-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #05080b;
}

.agent-generation-preview.is-placeholder {
  gap: 8px;
  padding: 18px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(43, 179, 138, 0.12), transparent 55%),
    #10171d;
}

.agent-generation-preview.is-placeholder strong {
  color: #dce5ed;
  font-size: 14px;
}

.agent-generation-preview.is-placeholder small {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-generation-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(185, 196, 208, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.agent-generation-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 750;
}

.agent-generation-copy {
  display: grid;
  gap: 6px;
  padding: 9px 10px 10px;
}

.agent-generation-copy strong,
.agent-generation-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-generation-copy strong {
  color: #f2f5f7;
  font-size: 13px;
}

.agent-generation-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.agent-generation-copy button {
  justify-self: start;
}

.agent-generation-summary {
  margin-top: 4px;
  color: #dbe4ec;
}

.agent-generation-technical {
  max-width: 760px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(92, 112, 134, 0.34);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 12px;
}

.agent-generation-technical summary {
  cursor: pointer;
  color: #aebcca;
  font-weight: 700;
}

.agent-generation-technical div {
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.agent-progress {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(92, 112, 134, 0.45);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 13px;
}

.agent-progress summary {
  cursor: pointer;
  color: #d8e1ea;
  font-weight: 650;
}

.agent-progress ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.agent-progress li {
  margin: 4px 0;
}

.agent-plan-chip,
.agent-pending-box {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #2c765d;
  border-radius: 12px;
  background: rgba(16, 37, 31, 0.9);
  color: #b7f4dc;
}

.agent-plan-chip.is-decided {
  border-color: rgba(92, 112, 134, 0.65);
  background: rgba(37, 44, 52, 0.75);
  color: #b9c4d0;
}

.agent-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.agent-plan-destination {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(185, 244, 220, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: #d7efe6;
  font-size: 13px;
}

.agent-plan-chip.is-decided .agent-plan-destination {
  border-color: rgba(185, 196, 208, 0.22);
  color: #b9c4d0;
}

.agent-plan-destination strong {
  color: inherit;
  font-size: 12px;
}

.agent-plan-destination span {
  color: inherit;
  overflow-wrap: anywhere;
}

.agent-plan-actions button {
  min-height: 36px;
}

.agent-plan-actions button:disabled {
  cursor: default;
  border-color: rgba(92, 112, 134, 0.55);
  background: rgba(255, 255, 255, 0.04);
  color: #83909e;
  opacity: 1;
}

.agent-plan-actions button.is-selected:disabled {
  border-color: rgba(185, 196, 208, 0.55);
  background: rgba(185, 196, 208, 0.13);
  color: #d0d8e0;
}

.agent-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.agent-job-button {
  min-height: 34px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-context-chip {
  min-height: 24px;
  margin: 0 42px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.agent-context-chip span {
  display: inline-flex;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.03);
}

.agent-selected-assets {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  min-height: 0;
  margin: -4px 0 0;
}

.agent-selected-assets:empty {
  display: none;
}

.agent-selected-assets-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.agent-selected-assets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.agent-selected-asset {
  display: inline-grid;
  grid-template-columns: 34px minmax(0, auto) auto auto;
  align-items: center;
  gap: 8px;
  max-width: min(100%, 340px);
  padding: 5px 8px 5px 5px;
  border: 1px solid rgba(43, 179, 138, 0.5);
  border-radius: 12px;
  background: rgba(26, 73, 62, 0.55);
  color: #eef8f4;
  font-size: 13px;
  font-weight: 700;
}

.agent-selected-asset img,
.agent-asset-option img,
.agent-mention-option img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  background: #0b1015;
}

.agent-asset-audio-mini,
.agent-asset-file-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #111923;
}

.agent-asset-audio-mini button {
  display: grid;
  width: 26px;
  height: 26px;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(43, 179, 138, 0.45);
  border-radius: 50%;
  background: rgba(43, 179, 138, 0.14);
  color: #b9f6df;
}

.agent-asset-audio-mini svg,
.agent-asset-file-icon svg {
  width: 16px;
  height: 16px;
}

.agent-asset-file-icon.document {
  color: #a8c7ff;
}

.agent-selected-asset span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-selected-asset small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: lowercase;
}

.agent-selected-asset button {
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.agent-selected-asset .agent-asset-audio-mini button {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(43, 179, 138, 0.45);
  background: rgba(43, 179, 138, 0.14);
  color: #b9f6df;
}

.agent-asset-initial {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #111923;
  font-size: 12px;
  font-weight: 800;
}

.agent-asset-picker {
  margin: 0 42px 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #141a21;
}

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

.agent-asset-picker-grid {
  display: grid;
  gap: 14px;
}

.agent-asset-picker-grid h5 {
  margin: 0 0 8px;
}

.agent-asset-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-asset-option,
.agent-mention-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  max-width: 260px;
  min-height: 44px;
  padding: 5px 8px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #10161d;
  color: var(--text);
  text-align: left;
  content-visibility: auto;
  contain-intrinsic-size: 44px 220px;
}

.agent-asset-option.is-selected {
  border-color: var(--accent);
  background: rgba(43, 179, 138, 0.16);
}

.agent-asset-option span,
.agent-mention-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-asset-empty {
  color: var(--muted);
  font-size: 13px;
}

.agent-mention-panel {
  z-index: 8;
  display: grid;
  gap: 4px;
  width: min(420px, calc(100% - 84px));
  max-height: 270px;
  margin: 0 42px 10px;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #151b22;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

.agent-mention-option {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  width: 100%;
  max-width: none;
}

.agent-mention-option small {
  color: var(--muted);
  font-size: 11px;
}

.agent-chat-tools {
  display: flex;
  grid-column: 1 / 2;
  align-items: center;
  align-self: end;
  gap: 7px;
  min-width: 0;
}

.agent-format-hint {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  margin: 0 42px 22px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #11161d;
}

.agent-composer-actions {
  display: flex;
  grid-column: 2 / 3;
  align-items: center;
  align-self: end;
  justify-self: end;
  gap: 8px;
}

.agent-chat-form textarea {
  --agent-input-max-height: 168px;
  appearance: none;
  grid-column: 1 / -1;
  min-height: 48px;
  max-height: var(--agent-input-max-height);
  resize: none;
  overflow-y: hidden;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 8px 6px;
  font-size: 16px;
  scrollbar-width: thin;
  scrollbar-color: #283442 #101419;
}

.agent-chat-form textarea:focus,
.agent-chat-form textarea:focus-visible {
  border-color: transparent;
  outline: 0;
  box-shadow: none;
}

.agent-chat-form textarea::-webkit-scrollbar {
  width: 10px;
}

.agent-chat-form textarea::-webkit-scrollbar-track {
  background: #101419;
  border-radius: 999px;
}

.agent-chat-form textarea::-webkit-scrollbar-thumb {
  min-height: 34px;
  border: 2px solid #101419;
  border-radius: 999px;
  background: #283442;
}

.agent-chat-form textarea::-webkit-scrollbar-thumb:hover {
  background: #344353;
}

.agent-voice-button,
.agent-send-button {
  width: 44px;
  height: 44px;
  min-height: 0;
  border: 1px solid #354250;
  border-radius: 50%;
  background: #27313c;
  color: #dce5ed;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.agent-voice-button {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  color: #b7c4cf;
  font-size: 0;
}

.agent-voice-button svg {
  width: 19px;
  height: 19px;
}

.agent-voice-button:hover,
.agent-send-button:hover {
  background: #303b48;
  filter: none;
}

.agent-voice-button.is-recording {
  border-color: rgba(48, 211, 153, 0.45);
  background: #17382f;
  color: #a8f5d6;
}

.agent-voice-button.is-transcribing {
  border-color: rgba(148, 163, 184, 0.52);
  background: #2d3540;
  color: #d7e0e8;
}

.agent-voice-button.is-recording .agent-voice-mic-icon,
.agent-voice-button.is-transcribing .agent-voice-mic-icon {
  display: none;
}

.agent-voice-stop-icon {
  display: none;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: currentColor;
  z-index: 2;
}

.agent-voice-button.is-recording .agent-voice-stop-icon,
.agent-voice-button.is-transcribing .agent-voice-stop-icon {
  display: block;
}

.agent-voice-meter {
  position: absolute;
  inset: 7px 8px;
  display: none;
  align-items: center;
  justify-content: space-between;
  opacity: 0.75;
}

.agent-voice-button.is-recording .agent-voice-meter {
  display: flex;
}

.agent-voice-meter i {
  width: 3px;
  height: 14px;
  border-radius: 999px;
  background: rgba(168, 245, 214, 0.72);
  transform: scaleY(0.35);
  transform-origin: center;
  transition: transform 80ms linear;
}

.agent-voice-button.is-transcribing::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(215, 224, 232, 0.26);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: agentVoiceSpin 0.9s linear infinite;
}

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

.agent-send-button.is-stop {
  border-color: rgba(255, 185, 185, 0.42);
  background: #3a3035;
  color: #ffcdcd;
  font-size: 16px;
}

.agent-send-button.is-stop:hover {
  background: #46343a;
}

.agent-empty-state {
  max-width: 620px;
  margin: auto;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.agent-context-panel {
  display: none;
}

.agent-context-summary {
  display: grid;
  gap: 10px;
}

.agent-context-summary p {
  margin: 0;
  color: var(--muted);
}

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

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

  .review-layout,
  .history-layout,
  .agent-layout,
  .final-layout,
  .split-grid,
  .episode-layout,
  .jobs-toolbar,
  .character-detail-hero,
  .reference-compare {
    grid-template-columns: 1fr;
  }

  .scene-rail,
  .inspector {
    position: static;
  }

  .jobs-toolbar {
    flex-direction: column;
    align-items: stretch;
    max-width: none;
  }

  .jobs-user-filter,
  .filter-menu {
    width: 100%;
  }

  .users-form,
  .user-row {
    grid-template-columns: 1fr;
  }

  .user-actions {
    justify-content: flex-start;
  }

  #tabAgent.active {
    height: calc(100vh - 92px);
  }
}
