:root {
  --bg: #171823;
  --top: #11121a;
  --panel: #303346;
  --panel-dark: #191c28;
  --panel-soft: #252736;
  --line: #464b61;
  --line-soft: #34384b;
  --text: #f3f5ff;
  --muted: #a7abbc;
  --faint: #73798d;
  --active: #ff3852;
  --blue: #3d8bd7;
  --green: #35c75a;
  --gold: #f6b900;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
  margin: 0;
  overflow-y: hidden;
  overflow-x: auto;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; white-space: nowrap; }

.app {
  --sidebar-w: 300px;
  width: 100%;
  height: 100vh;
  min-width: calc(var(--sidebar-w) + 400px);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 42px 43px 1fr;
  background: #191a25;
  transition: grid-template-columns 0.22s ease, min-width 0.22s ease;
}
.app.sidebar-collapsed {
  --sidebar-w: 0px !important;
  grid-template-columns: 0px 1fr;
  min-width: 400px;
}
.app.sidebar-collapsed .sidebar {
  border-right: none !important;
}
.app.resizing-sidebar {
  transition: none;
  user-select: none;
}

.sidebar {
  grid-row: 1 / -1;
  background: #161720;
  border-right: 1px solid #292b38;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.brand {
  height: 70px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  flex-shrink: 0;
}
.brand-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.22s ease;
}
.sidebar-body {
  transition: opacity 0.15s ease;
}
.sidebar-toggle {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #7e8393;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.22s ease;
  padding: 0;
}
.sidebar-toggle:hover { background: #252735; color: #f4f5fb; }

/* 折叠状态 */
.app.sidebar-collapsed .brand {
  padding: 0;
  justify-content: center;
  gap: 0;
}
.app.sidebar-collapsed .brand-mark {
  display: none;
}
.app.sidebar-collapsed .brand-text {
  width: 0;
  opacity: 0;
  pointer-events: none;
}
.app.sidebar-collapsed .sidebar-body {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  height: 0;
  padding: 0;
}
.app.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}
.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 12px 8px;
  flex-shrink: 0;
}
.sidebar-tab {
  height: 28px;
  border: 1px solid #2c3040;
  border-radius: 5px;
  background: #1c1e2a;
  color: #8f95a8;
  font-size: 12px;
  font-weight: 900;
}
.sidebar-tab:hover {
  background: #242737;
  color: #f3f5ff;
}
.sidebar-tab.active {
  background: var(--active);
  border-color: var(--active);
  color: #fff;
}
.app.sidebar-terminal-mode .sidebar-projects-content {
  display: none;
}
.app.sidebar-terminal-mode .sidebar {
  background: #101118;
}
.sidebar-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: ew-resize;
  z-index: 6;
  background: transparent;
}
.sidebar-resizer:hover,
.app.resizing-sidebar .sidebar-resizer {
  background: rgba(122, 162, 247, 0.22);
}
.app.sidebar-collapsed .sidebar-resizer {
  display: none;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #05060b;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px #252735;
  font-size: 11px;
  font-weight: 900;
  color: #f6b900;
}
.brand-name { font-size: 18px; font-weight: 900; letter-spacing: 0; }
.brand-sub { color: var(--faint); font-size: 12px; font-weight: 800; margin-top: 2px; }
.nav-section { padding: 8px 12px 2px; min-height: 0; }
.section-title {
  height: 26px;
  display: flex;
  align-items: center;
  color: #7e8393;
  font-size: 13px;
  font-weight: 800;
}
.project-list {
  max-height: 47vh;
  overflow: auto;
  padding-right: 4px;
}
.project-list::-webkit-scrollbar,
.workspace::-webkit-scrollbar { width: 8px; }
.project-list::-webkit-scrollbar-track,
.workspace::-webkit-scrollbar-track { background: #242737; }
.project-list::-webkit-scrollbar-thumb,
.workspace::-webkit-scrollbar-thumb { background: #656b83; border-radius: 999px; }
/* Thin custom scrollbar for all textareas */
textarea { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.16) transparent; }
textarea::-webkit-scrollbar { width: 4px; }
textarea::-webkit-scrollbar-track { background: transparent; }
textarea::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 2px; }
textarea::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }
.project-btn {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 7px 10px;
  color: #f4f5fb;
  font-weight: 900;
  margin-bottom: 3px;
  text-align: left;
}
.project-btn span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-btn small {
  color: #8990a4;
  font-weight: 800;
  font-size: 11px;
}
.project-btn.active { background: var(--active); }
.project-btn.active small { color: #ffe0e4; }
.sidebar-footer {
  margin-top: auto;
  min-height: 58px;
  border-top: 1px solid #2a2c37;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  color: #8b8f9f;
  font-size: 12px;
  line-height: 1.3;
  word-break: break-all;
}

.topbar {
  grid-column: 2;
  grid-row: 1;
  height: 42px;
  background: var(--top);
  border-bottom: 1px solid #282a35;
  display: flex;
  align-items: center;
  padding: 0 12px 0 18px;
  gap: 12px;
}
.switch { display: flex; align-items: center; gap: 8px; font-weight: 900; }
.toggle {
  width: 40px;
  height: 20px;
  border-radius: 999px;
  background: #464b57;
  padding: 2px;
}
.toggle::before {
  content: "";
  width: 16px;
  height: 16px;
  display: block;
  border-radius: 50%;
  background: #fff;
}
.search-wrap { position: relative; display: flex; align-items: center; }
.search {
  width: 200px;
  height: 34px;
  border: 1px solid #454859;
  background: #11121a;
  border-radius: 8px;
  color: #dce1f2;
  padding: 0 30px 0 13px;
  font-weight: 800;
  outline: none;
}
.search-clear {
  position: absolute; right: 8px;
  width: 18px; height: 18px;
  border: none; background: #454859; border-radius: 50%;
  color: #dce1f2; font-size: 13px; line-height: 1;
  display: none; align-items: center; justify-content: center;
  padding: 0; cursor: pointer; opacity: 0.8;
}
.search-clear:hover { opacity: 1; background: #656b83; }
.search-clear.visible { display: flex; }
.auth-username-decoy {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.tab {
  height: 30px;
  min-width: 190px;
  max-width: 360px;
  border-radius: 5px 5px 0 0;
  background: #2a2b38;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f7f1c8;
  font-weight: 900;
  border-bottom: 2px solid #f45a62;
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-spacer { flex: 1; }

.filterbar {
  grid-column: 2;
  grid-row: 2;
  border-bottom: 1px solid #36384a;
  background: #252632;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
}
.small-btn,
.pill,
.status-chip {
  height: 28px;
  border-radius: 4px;
  border: 1px solid #4b5064;
  background: #303344;
  color: #f1f3fb;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 900;
  padding: 0 9px;
  white-space: nowrap;
}
.small-btn:hover { border-color: #6f7690; }
.small-btn.active,
.small-btn.active-filter {
  background: var(--active);
  border-color: var(--active);
}
.sub-spacer { flex: 1; }
.pill { color: var(--gold); background: #3a3540; border-color: #575160; }
.pill-board-type { color: #a8d4ff; background: #1a2a3a; border-color: #3a6080; }
.pill-muted { color: #8892aa; background: #252830; border-color: #404555; font-weight: 500; }
.status-chip { color: #dce1f2; }
.status-chip.ok { color: var(--green); }

.workspace {
  grid-column: 2;
  grid-row: 3;
  overflow: auto;
  padding: 8px 18px 24px 12px;
  background: #303346;
}
.module {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #303346;
  overflow: hidden;
  margin-bottom: 10px;
}
.module-spacer { flex: 1; }
.module-body { padding: 10px; }
.panel-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 6px 10px 0;
}

.workflow-tabs {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.workflow-tabs::-webkit-scrollbar {
  display: none;
}
.workflow-tab {
  height: 30px;
  border: 1px solid #4b5064;
  border-radius: 4px;
  background: #303344;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  text-align: left;
  font-weight: 900;
}
.workflow-tab span { font-size: 14px; }
.count-total { opacity: 0.55; font-weight: normal; }
.workflow-tab b {
  min-width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #191c28;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 12px;
  padding: 0 5px;
}
.workflow-tab.active {
  background: var(--active);
  border-color: #ff6677;
}
.workflow-tab.active b {
  background: #801d2a;
  color: #fff;
}

.sub-tabs {
  min-height: 0;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 7px;
  margin: 0 0 8px;
}
.sub-tabs::-webkit-scrollbar {
  display: none;
}
.sub-tab {
  height: 28px;
  border-radius: 4px;
  border: 1px solid #4b5064;
  background: #303344;
  color: #f1f3fb;
  font-weight: 900;
  padding: 0 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.sub-tab.active {
  background: #6b58c9;
  border-color: #8374dc;
}
.sub-tab-select-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #252836;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #3c4055;
  width: 100%;
}
.sub-tab-label {
  font-size: 13px;
  color: #a0a5ba;
  font-weight: bold;
}
.sub-tab-select {
  height: 28px;
  border-radius: 4px;
  border: 1px solid #4b5064;
  background: #303344;
  color: #f1f3fb;
  font-weight: bold;
  padding: 0 10px;
  outline: none;
  font-size: 13px;
  cursor: pointer;
  min-width: 250px;
  transition: border-color 0.2s;
}
.sub-tab-select:hover,
.sub-tab:hover {
  border-color: #6f7690;
}
.filterbar .sub-tabs {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}
.filterbar .sub-tab-select-wrap {
  background: transparent;
  border: none;
  padding: 0;
  width: auto;
  gap: 7px;
}
.sub-tab-select:focus {
  border-color: #8374dc;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }
#globalStudio.active { display: flex; flex-direction: column; }

.doc-card {
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #272a3a;
  padding: 12px;
  margin-bottom: 9px;
}
.doc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.doc-head > div { min-width: 0; flex: 1; }
.doc-title {
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-file {
  color: var(--muted);
  font-weight: 800;
  margin-top: 3px;
}
.doc-excerpt {
  min-height: 160px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid #e1e6f2;
  border-radius: 4px;
  background: #171a25;
  padding: 12px;
  color: #e6eaf7;
  font-weight: 700;
  line-height: 1.6;
  white-space: pre-wrap;
}
.markdown-view {
  max-height: 62vh;
  overflow: auto;
  border: 1px solid #e1e6f2;
  border-radius: 4px;
  background: #171a25;
  padding: 14px;
  color: #e6eaf7;
  font-weight: 700;
  line-height: 1.65;
}
.markdown-view h1,
.markdown-view h2,
.markdown-view h3 {
  margin: 12px 0 8px;
  color: #fff;
  letter-spacing: 0;
}
.markdown-view h1 { font-size: 20px; }
.markdown-view h2 { font-size: 17px; }
.markdown-view h3 { font-size: 15px; color: #f7f1c8; }
.markdown-view p {
  margin: 0 0 8px;
  word-break: break-word;
}
.markdown-view .raw-list {
  padding-left: 14px;
  position: relative;
}
.markdown-view .raw-list::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  position: absolute;
  left: 0;
  top: 12px;
}
.markdown-view pre {
  margin: 10px 0;
  border: 1px solid #454b61;
  border-radius: 4px;
  background: #0f111a;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
}
.markdown-view code {
  color: #f5f7ff;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}
.raw-table table {
  min-width: 720px;
}
.storyboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.storyboard-panel {
  min-height: 116px;
  border: 1px solid #444b61;
  border-radius: 5px;
  background: #191c28;
  padding: 10px;
}
.storyboard-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  border-radius: 4px;
  background: #f2c94c;
  color: #171a25;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 8px;
}
.storyboard-panel p {
  margin: 0;
  color: #f0f2fb;
  font-weight: 750;
  line-height: 1.45;
  word-break: break-word;
}
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}
.gallery-item {
  background: #191c28;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.gallery-file {
  height: 180px;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.asset-card,
.video-card {
  min-height: 350px;
  display: grid;
  grid-template-columns: minmax(330px, 1fr) 220px minmax(330px, 1fr);
  align-items: start;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #272a3a;
  padding: 10px;
  margin-bottom: 9px;
}
.media-panel {
  background: #191c28;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.asset-card > .media-panel,
.video-card > .media-panel {
  height: clamp(240px, 30vw, 380px);
  max-height: 380px;
}
.media-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  color: #aab0c3;
  text-align: center;
  padding: 18px;
  background: #191c28;
  overflow: hidden;
}
.media-stage.has-media { padding: 0; background: #0f111a; }
.media-stage img,
.media-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.media-panel img,
.media-panel video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.media-caption { display: none; }
.control-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.generate {
  height: 39px;
  border: 1px solid #5ea0e4;
  border-radius: 7px;
  background: linear-gradient(#418bd7, #347fc5);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.generate:disabled {
  cursor: wait;
  border-color: #6b7186;
  background: linear-gradient(#656b7f, #555b70);
}

/* Upload drop zone */
.upload-droppable { transition: box-shadow 0.15s, border-color 0.15s; }
.upload-droppable.drag-over {
  box-shadow: inset 0 0 0 3px #5b8cff;
  border-color: #5b8cff;
}

/* Upload progress panel */
.upload-progress-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #141622;
}
.upload-progress-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 220px;
}
.upload-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #3a3f56;
  border-top-color: #5b8cff;
  border-radius: 50%;
  animation: img-spin 0.8s linear infinite;
}
.upload-progress-msg {
  color: #c8cfe8;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.upload-progress-sub {
  color: #73798d;
  font-size: 11px;
  font-weight: 600;
}
.upload-bar-wrap {
  width: 100%;
  height: 5px;
  background: #2a2f42;
  border-radius: 3px;
  overflow: hidden;
}
.upload-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3d66cc, #5b8cff);
  border-radius: 3px;
  transition: width 0.2s ease;
}
.meta-box {
  flex: 1;
  border: 1px solid #171a25;
  border-radius: 4px;
  background: #191c28;
  padding: 12px;
  overflow: hidden;
}
.meta-title {
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 8px;
  word-break: break-word;
}
.meta-row {
  min-height: 26px;
  border-bottom: 1px solid #2b2f40;
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 8px;
  color: #dfe3f3;
  font-weight: 700;
}
.meta-row span:first-child { color: #81879a; }
.meta-row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-message {
  margin-top: 10px;
  border: 1px solid #3b435a;
  border-radius: 4px;
  background: #202331;
  padding: 9px;
  color: #dfe3f3;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}
.prompt-panel {
  border-left: 1px solid #11131b;
  padding-left: 10px;
  min-width: 0;
}
.prompt-top {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.prompt-label {
  flex: 1;
  height: 32px;
  border: 1px solid #e1e6f2;
  border-radius: 4px;
  background: #171a25;
  padding: 7px 10px;
  color: #e7ebf7;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.textarea {
  min-height: 244px;
  max-height: 380px;
  overflow: auto;
  border: 1px solid #e1e6f2;
  border-radius: 4px;
  background: #171a25;
  padding: 12px;
  color: #e6eaf7;
  font-weight: 700;
  line-height: 1.55;
  white-space: pre-wrap;
}
.tool-row {
  display: flex;
  gap: 7px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.file-heading {
  color: #f7f1c8;
  font-weight: 900;
  margin: 4px 0 8px;
}
.table-wrap {
  border: 1px solid var(--line-soft);
  background: #191c28;
  border-radius: 5px;
  overflow: auto;
  margin-bottom: 12px;
}
table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  table-layout: fixed;
}
th {
  height: 36px;
  background: #202331;
  color: #cbd1e4;
  font-weight: 900;
  border-bottom: 1px solid #394054;
  text-align: left;
  padding: 0 10px;
}
td {
  vertical-align: top;
  border-bottom: 1px solid #303548;
  padding: 10px;
  color: #f0f2fb;
  line-height: 1.45;
  font-weight: 700;
}
tr:last-child td { border-bottom: 0; }
.col-id { width: 74px; }
.col-time { width: 86px; }
.col-shot { width: 96px; }
.col-move { width: 100px; }
.col-dialog { width: 18%; }
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  border-radius: 4px;
  background: #3a3f53;
  border: 1px solid #51576b;
  color: #dce1f2;
  padding: 0 7px;
  margin: 0 4px 5px 0;
  font-size: 12px;
  font-weight: 900;
}
.segment-overview {
  margin: 0 0 14px;
  border: 1px solid #3a4054;
  border-radius: 6px;
  background: #181b27;
  overflow: hidden;
}
.segment-overview-title {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 1000;
  border-bottom: 1px solid #303548;
}
.compact-table table {
  min-width: 900px;
}
.shot-group {
  margin: 0 0 14px;
  border: 1px solid #383e52;
  border-radius: 6px;
  overflow: hidden;
  background: #171a25;
}
.shot-group-head {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #303548;
  background: #202331;
}
.shot-group-title {
  flex: 0 0 auto;
  color: var(--gold);
  font-weight: 1000;
}
.shot-group-summary {
  color: #cbd1e4;
  font-size: 13px;
  font-weight: 800;
}

.audit-hero {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.audit-score {
  min-height: 112px;
  border: 1px solid #171a25;
  border-radius: 5px;
  background: #191c28;
  display: grid;
  place-items: center;
  align-content: center;
}
.audit-score span {
  color: var(--gold);
  font-size: 42px;
  line-height: 1;
  font-weight: 900;
}
.audit-score small {
  color: var(--muted);
  font-weight: 900;
  margin-top: 7px;
}
.audit-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.audit-metrics div {
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #272a3a;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 112px;
}
.audit-metrics b {
  color: #fff;
  font-size: 28px;
  font-weight: 900;
}
.audit-metrics span {
  color: var(--muted);
  font-weight: 900;
  margin-top: 5px;
}
.audit-section {
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #272a3a;
  padding: 10px;
  margin-bottom: 10px;
}
.audit-title {
  color: #f7f1c8;
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 10px;
}
.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}
.stage-chip {
  min-height: 36px;
  border-radius: 4px;
  border: 1px solid #51576b;
  background: #303344;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-weight: 900;
}
.stage-chip.ok { border-color: #307d48; color: var(--green); }
.stage-chip.warn { border-color: #8a7429; color: var(--gold); }
.stage-chip.missing { border-color: #86404c; color: #ff9aa5; }
.audit-list {
  display: grid;
  gap: 8px;
}
.audit-item {
  border: 1px solid #43495d;
  border-radius: 5px;
  background: #191c28;
  padding: 10px;
}
.audit-item.error { border-color: #a34655; }
.audit-item.warn { border-color: #8a7429; }
.audit-item.info { border-color: #4b5872; }
.audit-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 900;
}
.severity {
  height: 22px;
  border-radius: 4px;
  background: #303344;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  font-size: 12px;
}
.audit-file,
.audit-detail,
.audit-suggestion {
  margin-top: 7px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
  word-break: break-word;
}
.audit-suggestion {
  color: #dfe3f3;
}
.audit-table table {
  min-width: 900px;
}

.empty,
.loading,
.error {
  border: 1px dashed #555b70;
  background: #191c28;
  color: var(--muted);
  border-radius: 5px;
  padding: 18px;
  font-weight: 800;
}
.error { color: #ff9aa5; border-color: #b9424f; }

@media (max-width: 1380px) {
  .asset-card,
  .video-card {
    grid-template-columns: minmax(300px, 1fr) 190px minmax(300px, 1fr);
  }
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal-content {
  width: 420px;
  background: #1e202e;
  border: 1px solid #464b61;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  height: 50px;
  padding: 0 16px;
  background: #11121a;
  border-bottom: 1px solid #282a35;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--gold);
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  line-height: 1;
  padding: 0;
}
.modal-body {
  padding: 16px;
  overflow: auto;
}
.modal-footer {
  padding: 12px 16px;
  background: #11121a;
  border-top: 1px solid #282a35;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px;
}
.form-group select,
.form-group input {
  width: 100%;
  height: 36px;
  background: #0f111a;
  border: 1px solid #454859;
  border-radius: 6px;
  color: #fff;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
}
.form-group select:focus,
.form-group input:focus {
  border-color: var(--active);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.input-with-unit {
  position: relative;
}
.input-with-unit input {
  padding-right: 32px;
}
.input-with-unit span {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
}

/* Duration number pad */
.form-group--duration {
  grid-column: 1 / -1;
}
.duration-pad {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}
.duration-btn {
  height: 32px;
  background: #0f111a;
  border: 1px solid #454859;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.duration-btn:hover { border-color: var(--active); color: #fff; }
.duration-btn.active {
  background: var(--active);
  border-color: var(--active);
  color: #fff;
}
.form-toggles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  background: #171a25;
  padding: 12px;
  border-radius: 6px;
}
.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  color: #dce1f2;
}
.toggle-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.param-btn {
  height: 32px;
  margin-top: 4px;
  font-size: 13px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.mode-item {
  cursor: pointer;
}
.mode-item input {
  display: none;
}
.mode-box {
  padding: 10px;
  background: #171a25;
  border: 1px solid #454859;
  border-radius: 6px;
  text-align: center;
  transition: all 0.2s;
}
.mode-item input:checked + .mode-box {
  background: #2a2d3d;
  border-color: var(--active);
  box-shadow: inset 0 0 0 1px var(--active);
}
.mode-name {
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 2px;
}
.mode-desc {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

/* ==========================================================================
   Image Picker Modal
   ========================================================================== */
.img-picker-modal {
  width: 600px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.img-picker-tabs {
  display: flex;
  background: #11121a;
  border-bottom: 1px solid #282a35;
  flex-shrink: 0;
}
.img-picker-tab {
  flex: 1;
  height: 40px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.img-picker-tab:hover { color: #dce1f2; }
.img-picker-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.img-picker-body {
  flex: 1;
  overflow-y: auto;
  min-height: 180px;
}
.img-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}
.img-picker-item {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #11121a;
  position: relative;
  transition: border-color 0.15s;
}
.img-picker-item:hover { border-color: #5ea0e4; }
.img-picker-item.selected { border-color: var(--gold); }
.img-picker-item img,
.img-picker-item video {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.img-picker-item-label {
  font-size: 10px;
  color: var(--muted);
  padding: 3px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.img-picker-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  background: var(--gold);
  border-radius: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: #000;
}
.img-picker-item.selected .img-picker-badge { display: flex; }
.img-picker-count {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  text-align: center;
}
.img-picker-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  grid-column: 1 / -1;
}

/* Selected images strip in video card */
.section-images-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0;
}
.section-img-thumb {
  width: 44px;
  height: 33px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #464b61;
  cursor: pointer;
  transition: border-color 0.15s;
}
.section-img-thumb:hover { border-color: #e05252; }
.section-vid-thumb {
  width: 66px;
  height: 37px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #5ea0e4;
  cursor: pointer;
  transition: border-color 0.15s;
  background: #11121a;
}
.section-vid-thumb:hover { border-color: #e05252; }

/* ==========================================================================
   🔑 Antigravity Premium Auth System Styles
   ========================================================================== */

/* Topbar Indicator */
.key-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 12px;
  font-weight: 800;
}
.key-status-indicator:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.key-status-indicator .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3852;
  box-shadow: 0 0 8px #ff3852;
  transition: all 0.3s;
}
.key-status-indicator.is-logged-in .status-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
.key-status-indicator .status-text {
  color: var(--muted);
  transition: all 0.3s;
}
.key-status-indicator.is-logged-in .status-text {
  color: #f3f5ff;
}

/* Auth Modal Backdrop */
.auth-modal {
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  background: rgba(13, 14, 21, 0.85);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Auth Card Glassmorphism */
.auth-content {
  background: rgba(28, 30, 45, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  padding: 40px;
  width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: scaleUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Auth Card Ambient Glow */
.auth-content::before {
  content: "";
  position: absolute;
  top: -150px;
  left: -150px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 56, 82, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

/* Brand Section */
.auth-brand {
  margin-bottom: 30px;
}
.auth-brand .brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: linear-gradient(135deg, #111 0%, #222 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 20px;
  font-weight: 900;
  color: #f6b900;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.auth-brand h2 {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}
.auth-brand p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  padding: 0 10px;
}

/* Form Styles */
.auth-body {
  text-align: left;
}
.auth-body .form-group {
  margin-bottom: 24px;
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.auth-body label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.auth-body .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-body .input-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  color: var(--faint);
  pointer-events: none;
}
.auth-body input[type="password"] {
  width: 100%;
  height: 48px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #fff;
  padding: 0 16px 0 44px;
  font-size: 15px;
  font-weight: 800;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-body input[type="password"]:focus {
  border-color: var(--active);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 56, 82, 0.15), 
              inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Error Message */
.auth-error-msg {
  color: #ff3852;
  font-size: 12px;
  font-weight: 800;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: shake 0.4s;
}

/* Premium Submit Button */
.auth-submit-btn {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--active) 0%, #ff5268 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 56, 82, 0.3), 
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 56, 82, 0.4), 
              inset 0 1px 0 rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, #ff4c63 0%, #ff687c 100%);
}
.auth-submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(255, 56, 82, 0.2);
}

/* Footer style */
.auth-footer {
  margin-top: 36px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 16px;
  font-size: 11px;
  color: var(--faint);
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Collapsible Web Terminal */
.web-terminal-container {
  position: fixed;
  width: min(860px, calc(100vw - 32px));
  height: 32px;
  min-width: 320px;
  min-height: 32px;
  background: rgba(13, 15, 23, 0.94);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(122, 162, 247, 0.28);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.42);
  z-index: 5000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, width 0.22s cubic-bezier(0.4, 0, 0.2, 1), left 0.22s cubic-bezier(0.4, 0, 0.2, 1), height 0.22s cubic-bezier(0.4, 0, 0.2, 1), top 0.22s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.22s ease;
}
.web-terminal-container.expanded {
  height: 320px;
}
.web-terminal-container.dragging,
.web-terminal-container.resizing {
  transition: none !important;
  user-select: none;
  border-color: rgba(122, 162, 247, 0.75);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(122, 162, 247, 0.22);
}
.web-terminal-container.dock-bottom {
  left: var(--sidebar-w, 230px);
  right: 12px;
  bottom: 10px;
  width: auto;
  border-radius: 8px 8px 0 0;
}
.web-terminal-container.dock-left {
  left: 0;
  top: 106px;
  bottom: 0;
  width: var(--sidebar-w, 230px);
  min-width: 0;
  height: auto;
  border-radius: 0;
  border-left: 0;
  border-right: 1px solid rgba(122, 162, 247, 0.28);
  border-bottom: 0;
  box-shadow: none;
}
.web-terminal-container.dock-left .terminal-resize-n,
.web-terminal-container.dock-left .terminal-resize-s,
.web-terminal-container.dock-left .terminal-resize-w,
.web-terminal-container.dock-left .terminal-resize-nw,
.web-terminal-container.dock-left .terminal-resize-sw {
  display: none;
}
.web-terminal-container.dock-left .terminal-resize-e,
.web-terminal-container.dock-left .terminal-resize-ne,
.web-terminal-container.dock-left .terminal-resize-se {
  cursor: ew-resize;
}
.web-terminal-container.dock-right {
  right: 12px;
  top: 74px;
  bottom: 12px;
  width: min(620px, calc(100vw - var(--sidebar-w, 230px) - 28px));
  height: auto;
}
.web-terminal-container.floating {
  left: max(var(--sidebar-w, 230px), 260px);
  top: 96px;
}
.web-terminal-container:not(.expanded) {
  height: 32px !important;
  width: 125px !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.web-terminal-container:not(.expanded).dock-bottom {
  left: auto !important;
  right: 12px !important;
  bottom: 10px !important;
}
.web-terminal-container:not(.expanded).dock-left {
  left: calc(var(--sidebar-w, 230px) - 125px) !important;
  top: 106px !important;
  bottom: auto !important;
  border-radius: 8px 0 0 8px !important;
  border-left: 1px solid rgba(122, 162, 247, 0.28) !important;
}
.web-terminal-container:not(.expanded).dock-right {
  left: auto !important;
  right: 12px !important;
  top: 74px !important;
  bottom: auto !important;
}
.web-terminal-container:not(.expanded) #terminalDockLeftBtn,
.web-terminal-container:not(.expanded) #terminalFloatBtn,
.web-terminal-container:not(.expanded) #terminalClearBtn,
.web-terminal-container:not(.expanded) #terminalReconnectBtn {
  display: none !important;
}
.web-terminal-container:not(.expanded) .terminal-header {
  cursor: default !important;
}
.terminal-label {
  font-size: 11px;
  font-weight: 600;
  color: #a9b1d6;
  white-space: nowrap;
  letter-spacing: 0.5px;
}
.app.sidebar-collapsed .web-terminal-container.dock-left {
  display: none !important;
}
.terminal-resize {
  position: absolute;
  z-index: 2;
  background: transparent;
}
.terminal-resize-n,
.terminal-resize-s {
  left: 14px;
  right: 14px;
  height: 8px;
  cursor: ns-resize;
}
.terminal-resize-n { top: 0; }
.terminal-resize-s { bottom: 0; }
.terminal-resize-e,
.terminal-resize-w {
  top: 14px;
  bottom: 14px;
  width: 8px;
  cursor: ew-resize;
}
.terminal-resize-e { right: 0; }
.terminal-resize-w { left: 0; }
.terminal-resize-ne,
.terminal-resize-nw,
.terminal-resize-se,
.terminal-resize-sw {
  width: 16px;
  height: 16px;
}
.terminal-resize-ne { top: 0; right: 0; cursor: ne-resize; }
.terminal-resize-nw { top: 0; left: 0; cursor: nw-resize; }
.terminal-resize-se { bottom: 0; right: 0; cursor: se-resize; }
.terminal-resize-sw { bottom: 0; left: 0; cursor: sw-resize; }
.terminal-resize:hover,
.terminal-resize.dragging {
  background: rgba(122, 162, 247, 0.2);
}
.terminal-header {
  height: 32px;
  min-height: 32px;
  padding: 0 8px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(14, 15, 22, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  user-select: none;
  cursor: move;
  position: relative;
  z-index: 3;
}
.web-terminal-container.dock-left .terminal-header {
  cursor: default;
  padding: 0 4px 0 6px;
}
.terminal-header:hover {
  background: rgba(14, 15, 22, 0.9);
}
.terminal-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  font-size: 11px;
  color: #a9b1d6;
  min-width: 0;
}
.terminal-text { display: none; }
.terminal-icon {
  font-size: 13px;
  color: #7aa2f7;
  line-height: 1;
}
.terminal-status {
  font-size: 10px;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 99px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.terminal-status.connected {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.terminal-status.disconnected {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.terminal-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.terminal-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  color: #a9b1d6;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}
.terminal-icon-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 12px;
}
.web-terminal-container.dock-left .terminal-icon {
  display: none;
}
.web-terminal-container.dock-left .terminal-status {
  width: 14px;
  height: 14px;
  font-size: 8px;
}
.web-terminal-container.dock-left .terminal-actions {
  gap: 2px;
}
.web-terminal-container.dock-left .terminal-icon-btn {
  width: 19px;
  height: 20px;
  font-size: 11px;
}
.terminal-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}
.terminal-body {
  flex: 1;
  background: #0f1015;
  padding: 8px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.xterm-container {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.terminal-pin-modal {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: rgba(5, 7, 12, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.terminal-pin-card {
  width: min(320px, calc(100vw - 32px));
  padding: 18px;
  border-radius: 10px;
  background: rgba(15, 16, 24, 0.96);
  border: 1px solid rgba(122, 162, 247, 0.28);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}
.terminal-pin-title {
  color: #c0caf5;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px;
}
.terminal-pin-display {
  height: 42px;
  border-radius: 8px;
  background: #090b10;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #9ece6a;
  font: 700 22px/42px Menlo, Consolas, monospace;
  text-align: center;
  letter-spacing: 4px;
  margin-bottom: 8px;
}
.terminal-pin-error {
  min-height: 18px;
  color: #f7768e;
  font-size: 12px;
  margin-bottom: 8px;
}
.terminal-pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.terminal-pin-pad button {
  height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: #c0caf5;
  font-weight: 700;
  cursor: pointer;
}
.terminal-pin-pad button:hover {
  background: rgba(122, 162, 247, 0.18);
  border-color: rgba(122, 162, 247, 0.38);
}
.xterm-viewport::-webkit-scrollbar {
  width: 8px;
}
.xterm-viewport::-webkit-scrollbar-track {
  background: #0f1015;
}
.xterm-viewport::-webkit-scrollbar-thumb {
  background: #2b2d3c;
  border-radius: 4px;
}

/* AIGC Generation Logs — masonry grid */
.logs-masonry {
  columns: 3;
  column-gap: 12px;
}
@media (max-width: 1400px) { .logs-masonry { columns: 2; } }
@media (max-width: 900px)  { .logs-masonry { columns: 1; } }

.log-card {
  break-inside: avoid;
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.log-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  border-color: var(--line);
}
.log-card-media-wrap {
  width: 100%;
  background: #0d0f18;
  overflow: hidden;
  max-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.log-card-media {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
  display: block;
}
.log-card-body {
  padding: 10px 12px 12px;
}
.log-card-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.log-kind {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}
.log-kind.kind-img { background: rgba(122, 162, 247, 0.18); color: #7aa2f7; }
.log-kind.kind-vid { background: rgba(187, 154, 247, 0.18); color: #bb9af7; }
.log-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-card-meta {
  font-size: 11px;
  color: var(--faint);
  margin-bottom: 4px;
}
.log-card-error {
  font-size: 11px;
  color: #f7768e;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-card-ptid {
  font-size: 10px;
  color: var(--faint);
  font-family: monospace;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Log Detail Modal */
.log-detail-modal-content {
  max-width: 820px;
  width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.log-detail-body {
  overflow-y: auto;
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.log-detail-media-wrap {
  background: #0d0f18;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 340px;
}
.log-detail-media {
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
  display: block;
}
.log-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.log-detail-section {
  background: #171a25;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 12px;
}
.log-detail-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--faint);
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line-soft);
}
.log-kv {
  display: flex;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 5px;
  align-items: flex-start;
}
.log-kv span { color: var(--faint); flex-shrink: 0; width: 100px; }
.log-kv code { color: var(--muted); font-family: monospace; word-break: break-all; flex: 1; }
.log-kv-error code { color: #f7768e; }
.log-link { color: #7aa2f7; font-size: 12px; word-break: break-all; }
.log-event-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.log-event-type { color: var(--muted); font-weight: 700; }
.log-event-time { color: var(--faint); font-family: monospace; }
.log-event-empty { font-size: 12px; color: var(--faint); }
.log-detail-prompt {
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
  background: #0d0f18;
  padding: 10px 12px;
  border-radius: 5px;
  line-height: 1.6;
  max-height: 260px;
  overflow-y: auto;
}
.log-detail-params {
  font-size: 12px;
  color: var(--muted);
  background: #0d0f18;
  padding: 10px 12px;
  border-radius: 5px;
  overflow-x: auto;
  margin: 0;
  line-height: 1.5;
}

/* Keyboard shortcuts modal */
.shortcuts-modal-content {
  max-width: 560px;
  width: 96vw;
}
.shortcuts-body {
  padding: 4px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 65vh;
  overflow-y: auto;
}
.shortcuts-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--faint);
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line-soft);
}
.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.shortcut-row span { flex: 1; }
kbd {
  display: inline-block;
  min-width: 28px;
  padding: 2px 7px;
  background: #1e2030;
  border: 1px solid #464b61;
  border-bottom-width: 2px;
  border-radius: 5px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 12px;
  font-weight: 700;
  color: #c0caf5;
  text-align: center;
  white-space: nowrap;
  line-height: 1.5;
}
.shortcuts-footer {
  padding: 10px 20px 14px;
  font-size: 11px;
  color: var(--faint);
  border-top: 1px solid var(--line-soft);
  line-height: 1.5;
}

/* Prompt editing */
.prompt-panel.is-editing .textarea { display: none; }
.prompt-textarea {
  flex: 1;
  min-height: 120px;
  resize: vertical;
  background: #11131e;
  border: 1.5px solid var(--active);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  line-height: 1.55;
  padding: 8px 10px;
  outline: none;
  width: 100%;
}
.prompt-textarea:focus {
  border-color: #ff6070;
  box-shadow: 0 0 0 2px rgba(255, 56, 82, 0.18);
}
.prompt-edit-btn {
  font-size: 12px;
  padding: 0 8px;
  height: 26px;
  background: rgba(122, 162, 247, 0.1);
  border: 1px solid rgba(122, 162, 247, 0.3);
  color: #7aa2f7;
  border-radius: 5px;
}
.prompt-edit-btn:hover { background: rgba(122, 162, 247, 0.2); }
.prompt-save-btn {
  font-size: 12px;
  padding: 0 8px;
  height: 26px;
  background: rgba(53, 199, 90, 0.12);
  border: 1px solid rgba(53, 199, 90, 0.35);
  color: #35c75a;
  border-radius: 5px;
}
.prompt-save-btn:hover { background: rgba(53, 199, 90, 0.22); }
.prompt-cancel-btn {
  font-size: 12px;
  padding: 0 8px;
  height: 26px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  border-radius: 5px;
}
.prompt-cancel-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.prompt-top { gap: 6px; flex-wrap: nowrap !important; }

/* Conflict diff modal */
.conflict-modal-content {
  max-width: 900px;
  width: 96vw;
}
.conflict-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
  max-height: 55vh;
  overflow: hidden;
}
.conflict-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.conflict-col-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.conflict-col:first-child .conflict-col-title { color: #f6b900; }
.conflict-col:last-child .conflict-col-title { color: #35c75a; }
.conflict-text {
  flex: 1;
  overflow-y: auto;
  background: #0d0f18;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}
.conflict-line-changed { background: rgba(246, 185, 0, 0.15); border-left: 2px solid #f6b900; padding-left: 4px; display: block; }
.conflict-col:last-child .conflict-line-changed { background: rgba(53, 199, 90, 0.1); border-left-color: #35c75a; }
.conflict-line-same { display: block; color: var(--muted); }

/* Image generation loading state */
.image-loading-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(122, 162, 247, 0.06);
  border: 1px dashed rgba(122, 162, 247, 0.3);
}
.image-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(122, 162, 247, 0.2);
  border-top-color: #7aa2f7;
  border-radius: 50%;
  animation: img-spin 0.9s linear infinite;
}
@keyframes img-spin {
  to { transform: rotate(360deg); }
}
.image-loading-msg {
  font-size: 12px;
  color: #7aa2f7;
  text-align: center;
  max-width: 120px;
  line-height: 1.4;
}

/* ─── 角色/场景 Tab 分组分隔符 ──────────────────────────────── */
.asset-group-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 6px;
  margin-top: 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.asset-group-sep:first-child { margin-top: 0; }
.asset-group-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── 标准剧本 (04_scripts) 显示 ───────────────────────────── */
.script-card {
  background: var(--panel);
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
}
.script-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-dark);
}
.script-head .doc-title { font-size: 15px; font-weight: 600; color: var(--text); }
.script-head .doc-file  { font-size: 11px; color: var(--faint); margin-top: 2px; }
.screenplay {
  padding: 20px 24px 28px;
  font-size: 15.5px;
  line-height: 1.55;
  max-width: 850px;
}
.sp-episode {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: var(--active);
  margin: 8px 0 16px;
  letter-spacing: 0.05em;
}
.sp-gap { height: 10px; }
.sp-scene-head {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-soft);
  border-left: 3px solid var(--active);
  border-radius: 0 4px 4px 0;
  padding: 5px 12px;
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 600;
}
.sp-scene-no {
  color: var(--active);
  font-family: monospace;
  font-size: 12px;
  min-width: 32px;
  flex-shrink: 0;
}
.sp-scene-desc { color: var(--text); }
.sp-cast {
  font-size: 12px;
  color: var(--faint);
  font-style: italic;
  padding: 2px 4px 6px 16px;
}
.sp-action {
  margin: 3px 0;
  color: var(--muted);
  font-style: italic;
  padding-left: 20px;
  position: relative;
}
.sp-action::before {
  content: "▲";
  position: absolute;
  left: 4px;
  color: var(--faint);
  font-style: normal;
  font-size: 10px;
  top: 2px;
}
.sp-dialogue {
  display: flex;
  gap: 10px;
  margin: 2px 0;
  align-items: baseline;
}
.sp-char {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--gold);
  white-space: nowrap;
  min-width: 95px;
  text-align: right;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.sp-speech {
  color: var(--text);
  flex: 1;
}
.sp-text {
  margin: 3px 0;
  color: var(--muted);
  padding-left: 4px;
}

/* ─── 窄屏/窄窗口响应式优化 ─────────────────────────────────── */
@media (max-width: 1200px) {
}

@media (max-width: 1100px) {
  .asset-card,
  .video-card {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .asset-card > .media-panel,
  .video-card > .media-panel {
    height: 300px !important;
    max-height: none !important;
  }
  .prompt-panel {
    border-left: none !important;
    border-top: 1px solid var(--line-soft) !important;
    padding-left: 0 !important;
    padding-top: 12px !important;
  }
}

/* ─── 悬浮大图预览浮窗 ───────────────────────────────────── */
.image-hover-preview {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10000;
  background: transparent;
  border: 1.5px solid rgba(255, 56, 82, 0.35);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 56, 82, 0.15);
  pointer-events: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.22s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
  visibility: hidden;
  line-height: 0;
}
.image-hover-preview.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  visibility: visible;
}
.image-hover-preview img {
  display: block;
  max-width: 88vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ─── 解说漫 Commentary Tab ──────────────────────────────────────── */
.cm-episode-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-bottom: 24px;
  overflow: hidden;
}
.cm-episode-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-dark);
}
.cm-episode-head .doc-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.cm-episode-head .doc-file  { font-size: 10px; color: var(--faint); margin-top: 1px; }

.cm-ep-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Voice color legend */
.cm-legend { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.cm-legend-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--vc, #555);
  color: var(--vc, #aaa);
  white-space: nowrap;
}

/* Voice line display (used in all views) */
.cm-voice-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  border-left: none;
  padding-left: 0;
  margin: 2px 0;
}
.cm-voice-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--vc, var(--muted));
  white-space: nowrap;
  min-width: auto;
  text-align: left;
  flex-shrink: 0;
  opacity: 0.9;
  cursor: default;
}
.cm-voice-text {
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  flex: 1;
  min-width: 0;
  word-break: break-all;
}

/* ── v2 Per-line Shot Table ─────────────────────────────────────── */
.cm-shot-table { width: 100%; overflow-x: auto; }
.cm-shot-table table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.cm-col-video    { width: 302px; }
.cm-col-vidprompt{ width: 128px; }
.cm-col-img    { width: 316px; }
.cm-col-prompt { width: 228px; }
.cm-col-voice  { width: 156px; }

.cm-shot-table th {
  background: var(--panel-dark);
  font-size: 11px;
  color: var(--faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  text-align: left;
  border-bottom: 2px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 2;
}
.cm-th-shot { text-align: center; }

.cm-td-shot,
.cm-td-img,
.cm-td-prompt,
.cm-td-voice,
.cm-td-video,
.cm-td-vidprompt {
  vertical-align: top;
  padding: 16px 12px; /* Moderately increased row height and cell breathing room */
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cm-td-shot {
  text-align: center;
  vertical-align: middle;
  border-right: 1px solid var(--line-soft);
  background: var(--panel-dark);
}
.cm-td-img {
  border-right: 1px solid var(--line-soft);
  background: var(--panel-dark);
  padding: 0;
  vertical-align: top;
}
.cm-td-prompt {
  border-right: 1px solid var(--line-soft);
  background: var(--panel-dark);
  padding: 0;
  vertical-align: top;
  height: 1px; /* allows children to use height: 100% relative to rendered cell height */
}
.cm-prompt-fill {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 8px;
  box-sizing: border-box;
}
.cm-prompt-fill .cm-prompt-edit {
  flex: 1;
  min-height: 50px;
  resize: none;
}
.cm-td-voice {
  vertical-align: top;
  padding: 0;
}
/* Voice cell hover-reveal wrapper */
.cm-voice-cell-wrap {
  position: relative;
  padding: 8px 10px;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}
/* Top-right button group: edit + TTS, positioned absolute, appear on hover */
.cm-voice-top-btns {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s 0s;
}
.cm-voice-cell-wrap:hover .cm-voice-top-btns {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.15s 0.3s;
}
[data-mode="edit"] .cm-voice-top-btns {
  opacity: 1 !important;
  pointer-events: auto !important;
}
[data-mode="read"] .cm-voice-save-btn,
[data-mode="read"] .cm-voice-cancel-btn {
  display: none !important;
}
[data-mode="edit"] .cm-voice-edit-btn,
[data-mode="edit"] .cm-tts-line-btn {
  display: none !important;
}
[data-mode="edit"] .cm-voice-save-btn,
[data-mode="edit"] .cm-voice-cancel-btn {
  display: inline-block !important;
}
.cm-voice-top-btns .cm-tts-line-btn {
  display: inline-block;
  width: auto;
  margin: 0;
}
/* Audio player: hidden by default, appear on hover, overlaid at bottom */
.cm-voice-cell-wrap .custom-audio-player {
  position: absolute;
  bottom: 4px;
  left: 10px;
  right: 10px;
  width: auto;
  margin-top: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.cm-voice-cell-wrap:hover .custom-audio-player {
  opacity: 1;
  pointer-events: auto;
}
.cm-td-video {
  border-right: 1px solid var(--line-soft);
  background: var(--panel-dark);
  padding: 0;
  vertical-align: middle;
  text-align: center;
}
.cm-td-vidprompt {
  border-right: 1px solid var(--line-soft);
  background: var(--panel-dark);
  padding: 0;
  vertical-align: top;
  height: 1px;
}
.cm-vidprompt-fill {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 8px;
  box-sizing: border-box;
}
.cm-vidprompt-edit {
  flex: 1;
  min-height: 50px;
  resize: none;
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px; /* Increased for better legibility */
  padding: 5px 7px;
  line-height: 1.55;
}
.cm-vidprompt-edit:focus {
  outline: none;
  border-color: var(--active);
}
.cm-vidprompt-edit::placeholder {
  color: var(--faint);
  opacity: 0.5;
}
.cm-vid-actions {
  display: flex;
  gap: 5px;
  margin-top: 5px;
  flex-wrap: wrap;
}
.cm-shot-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  background: #000;
  display: block;
}
.cm-vid-placeholder {
  font-size: 10px;
  color: var(--faint);
  opacity: 0.6;
  display: block;
  padding: 4px;
}
.cm-shot-first-row > td {
  border-top: 2px solid var(--line-soft);
}

/* Shot ID badge — overlaid on keyframe image top-left */
.cm-img-cell-wrap {
  position: relative;
  width: 100%;
}
.cm-shot-id-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 3;
  pointer-events: none;
  display: inline-block;
  font-family: monospace;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* Frame cell */
.cm-frame-img-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 0;
}
.cm-shot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}
.cm-img-placeholder {
  font-size: 10px;
  color: var(--faint);
  opacity: 0.6;
  text-align: center;
  padding: 4px;
}

/* Portrait Layout Mode for Commentary Table */
.portrait-layout .cm-col-video     { width: 149px; }
.portrait-layout .cm-col-vidprompt { width: 189px; }
.portrait-layout .cm-col-img       { width: 149px; }
.portrait-layout .cm-col-prompt    { width: 319px; }
.portrait-layout .cm-col-voice     { width: 324px; }

.portrait-layout .cm-shot-video,
.portrait-layout .lazy-video.cm-shot-video {
  aspect-ratio: 9 / 16;
}
.portrait-layout .cm-frame-img-wrap {
  aspect-ratio: 9 / 16;
}

/* Prompt textarea in frame cell */
.cm-prompt-edit {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px; /* Increased for better legibility */
  padding: 5px 7px;
  resize: none;
  line-height: 1.55;
  margin-bottom: 5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cm-prompt-edit:focus {
  border-color: var(--active);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
  outline: none;
}

/* Prompt Read-only Text View & Hover Scrollbar Delay */
.cm-prompt-text-view,
.cm-vidprompt-text-view {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  max-height: 120px;
  overflow-y: hidden;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 15px; /* Increased for better legibility */
  line-height: 1.55;
  color: var(--text-muted, #8b949e);
  cursor: pointer;
  background: rgba(0, 0, 0, 0.08);
  margin-bottom: 5px;
  transition: border-color 0.2s, background 0.2s;
}

.cm-prompt-text-view:hover,
.cm-vidprompt-text-view:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  /* Triggers scrollbar showing after a 0.3s delay */
  overflow-y: auto;
  transition: overflow-y 0s 0.3s, border-color 0.2s, background 0.2s;
}

/* Toggle Views & Buttons based on Mode */
[data-mode="read"] .cm-prompt-text-view,
[data-mode="read"] .cm-vidprompt-text-view {
  display: block !important;
}
[data-mode="read"] .cm-prompt-edit,
[data-mode="read"] .cm-vidprompt-edit {
  display: none !important;
}

[data-mode="edit"] .cm-prompt-text-view,
[data-mode="edit"] .cm-vidprompt-text-view {
  display: none !important;
}
[data-mode="edit"] .cm-prompt-edit,
[data-mode="edit"] .cm-vidprompt-edit {
  display: block !important;
}

/* Hover Actions Reveal Delay */
.cm-img-actions,
.cm-vid-actions {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease 0s;
}

.cm-prompt-fill:hover .cm-img-actions,
.cm-vidprompt-fill:hover .cm-vid-actions {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.15s ease 0.3s; /* Delay hover display by 0.3 seconds */
}

/* In edit mode, save and cancel buttons are always visible without hover delay! */
[data-mode="edit"] .cm-img-actions,
[data-mode="edit"] .cm-vid-actions {
  opacity: 1 !important;
  pointer-events: auto !important;
  transition: none !important;
}

/* Align buttons nicely */
[data-mode="read"] .cm-img-gen-btn,
[data-mode="read"] .cm-img-pick-btn,
[data-mode="read"] .cm-vid-gen-btn,
[data-mode="read"] .cm-edit-btn {
  display: inline-block !important;
}
[data-mode="read"] .cm-save-btn,
[data-mode="read"] .cm-vidprompt-save-btn,
[data-mode="read"] .cm-cancel-btn {
  display: none !important;
}

[data-mode="edit"] .cm-img-gen-btn,
[data-mode="edit"] .cm-img-pick-btn,
[data-mode="edit"] .cm-vid-gen-btn,
[data-mode="edit"] .cm-edit-btn {
  display: none !important;
}
[data-mode="edit"] .cm-save-btn,
[data-mode="edit"] .cm-vidprompt-save-btn,
[data-mode="edit"] .cm-cancel-btn {
  display: inline-block !important;
}

.cm-img-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.cm-img-gen-btn, .cm-img-pick-btn { font-size: 11px; }
.cm-img-gen-btn { background: transparent; border: 1px solid var(--line-soft); color: var(--faint); border-radius: 4px; padding: 3px 7px; cursor: pointer; white-space: nowrap; }
.cm-img-gen-btn:hover { border-color: var(--active); color: var(--active); }

.cm-save-btn {
  background: #1a3554 !important;
  border: 1px solid #388bfd !important;
  color: #58a6ff !important;
}
.cm-save-btn:hover { background: #1f426e !important; }
.cm-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Reference thumbs */
.cm-selected-thumbs { display: flex; flex-wrap: wrap; gap: 3px; margin: 5px 0; }
.cm-selected-thumb { position: relative; width: 44px; height: 33px; cursor: pointer; border-radius: 3px; overflow: hidden; }
.cm-selected-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cm-thumb-remove {
  position: absolute; top: -3px; right: -3px;
  background: #c0392b; color: #fff; border-radius: 50%;
  width: 13px; height: 13px; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* TTS per-line button + audio */
.cm-tts-line-btn {
  display: block;
  width: 100%;
  background: #1a3a2a;
  border: 1px solid #2a6a4a;
  color: #6ee7b7;
  font-size: 11px;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  margin-top: 5px;
  margin-bottom: 3px;
  text-align: center;
}
.cm-tts-line-btn:hover { background: #2a5a3a; }
.cm-tts-line-btn.busy { opacity: 0.6; cursor: not-allowed; }
.cm-tts-line-btn.has-audio {
  background: #122a1e;
  border-color: #1e5238;
  color: #86efac;
}
/* ─── Lazy Video Placeholder ───────────────────────────────── */
.lazy-video {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
.lazy-video.cm-shot-video {
  height: auto;
  aspect-ratio: 16 / 9;
  background: transparent;
}
.lazy-video.gallery-lazy-vid {
  height: 160px;
}
.lazy-video-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: brightness(0.72);
  transition: filter 0.2s;
}
.lazy-video:hover .lazy-video-poster { filter: brightness(0.88); }
.lazy-video-play {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 0 0 3px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
  pointer-events: none;
}
.lazy-video:hover .lazy-video-play {
  background: rgba(255, 56, 82, 0.75);
  border-color: rgba(255, 56, 82, 0.9);
  transform: scale(1.1);
}

/* ─── Custom Audio Player ──────────────────────────────────── */
.custom-audio-player {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 14px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  width: 100%;
  box-sizing: border-box;
  margin-top: 3px;
  user-select: none;
}
.custom-audio-player .cap-audio { display: none; }
.cap-play-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--active);
  color: #fff;
  font-size: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0 0 0 1px;
  line-height: 1;
  transition: background 0.15s;
}
.cap-play-btn:hover { background: #ff5a6a; }
.cap-progress-wrap {
  flex: 1;
  height: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.cap-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  position: relative;
}
.cap-filled {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--active);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
  transition: width 0.1s linear;
}
.cap-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.custom-audio-player:hover .cap-thumb { opacity: 1; }
.cap-time {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 68px;
  text-align: right;
  font-family: "JetBrains Mono", "Consolas", monospace;
  letter-spacing: -0.3px;
}
.cap-download-btn {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
  margin-left: 4px;
}
.cap-download-btn:hover {
  color: var(--active);
  transform: scale(1.15);
}

/* Character card voice enhancements */
.voice-meta-row b.voice-id-badge {
  color: var(--vc, var(--gold));
  font-weight: 700;
  font-size: 12px;
}
.voice-trait-line {
  font-size: 10.5px;
  color: var(--faint);
  font-style: italic;
  padding: 2px 0 4px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  cursor: default;
}

.cm-selected-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.cm-selected-thumb {
  position: relative;
  width: 52px;
  height: 39px;
  border-radius: 4px;
  border: 1px solid var(--line-soft);
  overflow: hidden;
  cursor: pointer;
}
.cm-selected-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cm-selected-thumb:hover {
  border-color: #e05252;
}
.cm-thumb-remove {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(224, 82, 82, 0.9);
  color: white;
  width: 14px;
  height: 14px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom-left-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.cm-selected-thumb:hover .cm-thumb-remove {
  opacity: 1;
}

.cm-img-actions {
  display: flex;
  gap: 6px;
}

/* ── Voice Configuration Modal & Audio Player ─────────────────── */
.voice-config-modal-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text);
  table-layout: fixed;
}
.voice-config-modal-table th,
.voice-config-modal-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.voice-config-modal-table th {
  background: var(--panel-dark);
  font-weight: 600;
  color: var(--faint);
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.voice-config-modal-table td select {
  width: 100%;
  padding: 5px 8px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}
.voice-config-modal-table td select:focus {
  border-color: var(--active);
}

.cm-audio-player {
  width: 100%;
  margin-top: 8px;
}
.cm-audio-player audio {
  width: 100%;
  height: 32px;
  border-radius: 4px;
  outline: none;
  background: #1a1a1a;
  border: 1px solid var(--line-soft);
}

/* Custom indicator states for generating audio */
.cm-tts-btn.busy {
  color: var(--active);
  background: rgba(88, 166, 255, 0.1);
  border-color: rgba(88, 166, 255, 0.2);
  cursor: wait;
}

/* ─── Global Video Player Modal ────────────────────────────── */
.vid-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vid-modal-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vid-modal-inner video {
  display: block;
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  background: #000;
}
.vid-modal-close {
  position: absolute;
  top: -38px;
  right: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.15s;
}
.vid-modal-close:hover { color: #fff; }

/* ─── Compact Header & Hover Overlay Improvements ────────────── */
.cm-prompt-fill,
.cm-vidprompt-fill {
  position: relative !important;
  height: 100%;
  box-sizing: border-box;
  padding: 0 !important;
}

.cm-prompt-text-view,
.cm-vidprompt-text-view,
.cm-prompt-edit,
.cm-vidprompt-edit {
  margin-bottom: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  flex: 1 1 0% !important;
  height: auto !important;
  min-height: 32px !important;
  max-height: none !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  padding-bottom: 38px !important;
}

.cm-prompt-fill .cm-selected-thumbs {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  padding: 6px 8px 4px !important;
  margin: 0 !important;
  overflow-x: auto !important;
  flex-shrink: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.cm-prompt-fill .cm-selected-thumbs::-webkit-scrollbar {
  height: 3px !important;
}
.cm-prompt-fill .cm-selected-thumbs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15) !important;
  border-radius: 2px !important;
}
.cm-prompt-fill .cm-selected-thumbs::-webkit-scrollbar-thumb:hover {
  background: rgba(122, 162, 247, 0.4) !important;
}

.cm-img-actions,
.cm-vid-actions {
  position: absolute !important;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(14, 16, 26, 0.88);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 5px 8px;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  z-index: 10;
}

.icon-only-btn {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 15px !important;
  border-radius: 6px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.icon-only-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(122, 162, 247, 0.5) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cm-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-global-toggle {
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 13px !important;
  border-radius: 4px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  transition: all 0.2s ease;
  color: #7e8393 !important;
  cursor: pointer;
}
.sidebar-global-toggle:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(122, 162, 247, 0.5) !important;
  color: #f4f5fb !important;
}

.app.sidebar-collapsed #sidebarToggleGlobalBtn {
  background: rgba(122, 162, 247, 0.1) !important;
  border-color: rgba(122, 162, 247, 0.4) !important;
  color: #7aa2f7 !important;
}

.app.sidebar-collapsed #sidebarToggleGlobalBtn:hover {
  background: rgba(122, 162, 247, 0.2) !important;
  border-color: rgba(122, 162, 247, 0.6) !important;
  color: #f4f5fb !important;
}

/* ── Global Studio ─────────────────────────────────────────────────────────── */

.project-btn.studio-entry {
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  padding-bottom: 10px;
  background: transparent;
}
.project-btn.studio-entry span { font-weight: 700; letter-spacing: 0.02em; }
.project-btn.studio-entry.active {
  background: rgba(100,116,255,0.12);
  border-left: 3px solid #7aa2f7;
  padding-left: calc(var(--spacing-sm) - 3px);
}

.global-studio-body {
  display: flex;
  flex-direction: row;
  height: 100%;
  overflow: hidden;
  padding: 0;
}

/* ─ Generation Panel (left column) ─ */
.global-gen-panel {
  width: 400px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
}

.global-prompt-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.global-prompt-input {
  width: 100%;
  min-height: 100px;
  max-height: 200px;
  resize: vertical;
  background: #191c28;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.global-prompt-input:focus { outline: none; border-color: var(--active); }

.global-params-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.global-param-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}
.global-param-group label {
  font-size: 12px;
  color: #81879a;
  font-weight: 700;
  white-space: nowrap;
  width: 64px;
  flex-shrink: 0;
  text-align: right;
}
.global-param-group select,
.global-param-group input[type="number"] {
  height: 30px;
  background: #191c28;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 0 9px;
  font-size: 13px;
  min-width: 0;
  flex: 1;
}
.global-param-group select { cursor: pointer; }
.global-param-group input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

.global-mode-inline {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.global-mode-inline label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0;
}
.global-mode-inline input[type="radio"] { display: none; }
.global-mode-pill {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  color: var(--faint);
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
}
.global-mode-inline input:checked + .global-mode-pill {
  border-color: var(--active);
  color: var(--active);
  background: rgba(122,162,247,0.1);
}

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

.global-gen-btn {
  height: 39px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 900;
  border-radius: 7px;
  background: linear-gradient(#418bd7, #347fc5);
  color: #fff;
  border: 1px solid #5ea0e4;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.global-gen-btn:hover { opacity: 0.88; }
.global-gen-btn:disabled { opacity: 0.45; cursor: not-allowed; border-color: #6b7186; background: linear-gradient(#656b7f, #555b70); }

/* ─ Active pill (button-based, no radio) ─ */
.global-mode-pill.active {
  border-color: var(--active);
  color: var(--active);
  background: rgba(122,162,247,0.1);
}
.global-mode-pill { background: transparent; }

/* ─ Records section (right column) ─ */
.global-records-section {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
  padding: 14px 16px;
}

/* ─ Studio toggle topbar button ─ */
.studio-toggle-topbar {
  margin-left: 6px;
}
.studio-toggle-topbar.active {
  background: rgba(122,162,247,0.18) !important;
  border-color: var(--active) !important;
  color: #7aa2f7 !important;
}

/* ─ Records filter bar ─ */
.global-records-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}
.global-records-filter label { font-size: 11px; color: var(--faint); font-weight: 700; }

/* ─ Record row (params left, preview right) ─ */
.global-record-row {
  display: grid;
  grid-template-columns: 1fr 280px;
  border-bottom: 1px solid var(--border);
  background: #272a3a;
  margin-bottom: 8px;
  border-radius: 5px;
  border: 1px solid var(--line-soft);
  overflow: hidden;
  transition: background 0.12s;
}
.global-record-row:hover { background: #2f3245; }
.global-record-params {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  overflow: hidden;
}
.global-record-preview {
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: #191c28;
  overflow: hidden;
}
.global-record-img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 5px;
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.global-record-img:hover { opacity: 0.88; }

/* ─ Record param table ─ */
.rec-meta {
  font-size: 12px;
  color: #81879a;
  margin-bottom: 10px;
  font-weight: 700;
}
.rec-param-table { border-collapse: collapse; width: 100%; }
.rec-param-table tr { border-bottom: 1px solid #2b2f40; }
.rec-param-table tr:last-child { border-bottom: none; }
.rec-param-table td { padding: 5px 8px 5px 0; vertical-align: top; font-size: 13px; color: #dfe3f3; font-weight: 700; }
.rec-param-key { color: #81879a; white-space: nowrap; font-weight: 700; width: 80px; flex-shrink: 0; }
.rec-prompt { font-size: 13px; color: var(--text); opacity: 0.9; white-space: pre-wrap; word-break: break-all; margin: 0; max-height: 80px; overflow: hidden; line-height: 1.5; }
.rec-ref-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); margin-right: 4px; vertical-align: middle; }

/* ─ Ref strip in gen panel ─ */
.global-ref-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.global-ref-empty { font-size: 12px; color: var(--faint); font-style: italic; }
.global-ref-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e53e3e;
  color: #fff;
  border: none;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
}
.global-ref-thumb:hover .global-ref-remove { display: flex; }
.global-ref-thumb { position: relative; display: inline-block; }
.global-ref-thumb img { width: 52px; height: 52px; object-fit: cover; border-radius: 5px; border: 1px solid var(--border); display: block; }

/* ─ Gen status text ─ */
.global-gen-status { font-size: 12px; color: var(--faint); font-style: italic; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─ Fake video player ─ */
.global-vid-thumb {
  position: relative;
  width: 100%;
  max-width: 260px;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
}
.global-vid-thumb img { width: 100%; max-height: 160px; object-fit: cover; display: block; border-radius: 6px; }
.global-vid-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.28);
  border-radius: 6px;
  transition: background 0.15s;
}
.global-vid-thumb:hover .global-vid-overlay { background: rgba(0,0,0,0.5); }
.global-vid-play {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #111;
  padding-left: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.15s;
}
.global-vid-thumb:hover .global-vid-play { transform: scale(1.1); }
.global-vid-placeholder { background: rgba(255,255,255,0.05); border-radius: 6px; padding: 24px 10px; text-align: center; color: var(--faint); font-size: 12px; width: 100%; }

/* ─ Records empty/loading ─ */
.global-records-section .empty, .global-records-section .loading {
  padding: 32px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

/* Global Picker Tab Bar */
#globalPickerTabBar { gap: 0; }
#globalPickerTabBar .img-picker-tab { flex-shrink: 0; }

/* ── Global Generator Card Layout ── */
.global-studio-body.is-vertical {
  flex-direction: column;
  overflow-y: auto !important;
  padding: 10px 18px 24px 12px !important;
  gap: 16px;
}

.global-studio-body.is-vertical .global-records-section {
  overflow-y: visible !important;
  padding: 0 !important;
}

.global-generator-card {
  min-height: 350px;
  display: grid;
  grid-template-columns: minmax(330px, 1fr) 220px minmax(330px, 1fr);
  align-items: start;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #272a3a;
  padding: 10px;
  margin-bottom: 9px;
  width: 100%;
  box-sizing: border-box;
}

.global-generator-card > .prompt-panel {
  border-left: none !important;
  border-right: 1px solid #11131b;
  padding-left: 0 !important;
  padding-right: 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

.global-generator-card > .media-panel {
  border-left: 1px solid #11131b;
  padding-left: 12px;
  height: clamp(240px, 30vw, 380px);
  max-height: 380px;
  background: #191c28;
  border-radius: 4px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.global-generator-card .prompt-textarea {
  flex: 1;
  min-height: 244px;
  max-height: 380px;
  background: #171a25;
  border: 1px solid #e1e6f2;
  border-radius: 4px;
  color: #e6eaf7;
  padding: 12px;
  line-height: 1.55;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.global-generator-card .prompt-textarea:focus {
  border-color: var(--active);
}

.global-generator-card .control-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  box-sizing: border-box;
}

.global-generator-card .meta-box {
  margin-top: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.global-generator-card .meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.global-generator-card .meta-row select {
  cursor: pointer;
}

/* Commentary Voice Editor Mode Styling */
[data-mode="read"] .cm-voice-text-view {
  display: inline !important;
}
[data-mode="read"] .cm-voice-text-edit {
  display: none !important;
}
[data-mode="edit"] .cm-voice-text-view {
  display: none !important;
}
[data-mode="edit"] .cm-voice-text-edit {
  display: block !important;
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  background: #0f111a;
  border: 1px solid #454859;
  border-radius: 4px;
  color: #fff;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 13px;
  margin-top: 4px;
  resize: vertical;
}

/* ── Responsive Commentary Storyboard Table (V2) ── */

@media (min-width: 1025px) {
  /* Fluid proportional columns above minimum width */
  .cm-col-video    { width: 26.7% !important; }
  .cm-col-vidprompt{ width: 11.3% !important; }
  .cm-col-img    { width: 27.9% !important; }
  .cm-col-prompt { width: 20.2% !important; }
  .cm-col-voice  { width: 13.8% !important; }
}

@media (max-width: 1024px) {
  /* Responsive stacked card layout below 1024px */
  .cm-shot-table thead {
    display: none !important;
  }
  
  .cm-shot-table table,
  .cm-shot-table tbody,
  .cm-shot-table tr,
  .cm-shot-table td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .cm-shot-table tr {
    border-bottom: none !important;
  }
  
  /* Stacked card grouping per shot */
  .cm-shot-table tr.cm-shot-first-row {
    margin-top: 32px !important;
    border: 1px solid var(--line-soft) !important;
    border-radius: 8px 8px 0 0 !important;
    background: var(--panel-dark) !important;
    padding: 20px 16px 12px 16px !important;
  }
  
  .cm-shot-table tr:not(.cm-shot-first-row) {
    border-left: 1px solid var(--line-soft) !important;
    border-right: 1px solid var(--line-soft) !important;
    border-bottom: 1px solid var(--line-soft) !important;
    background: var(--bg-dark) !important;
    padding: 12px 16px !important;
  }
  
  .cm-shot-table tr:not(.cm-shot-first-row):last-child {
    border-radius: 0 0 8px 8px !important;
  }
  
  /* Single-row shots (1 voice line) */
  .cm-shot-table tr.cm-shot-first-row:last-child {
    border-radius: 8px !important;
    border-bottom: 1px solid var(--line-soft) !important;
  }
  
  .cm-shot-table td {
    padding: 10px 0 !important;
    border: none !important;
    background: transparent !important;
    height: auto !important;
  }
  
  /* Media elements responsive sizing */
  .cm-td-video {
    margin-bottom: 8px !important;
  }
  .cm-td-video::before {
    content: "🎬 视频 (Video Preview)";
    display: block;
    font-size: 11px;
    color: var(--active);
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
  }
  
  .cm-td-vidprompt {
    margin-bottom: 16px !important;
  }
  .cm-td-vidprompt::before {
    content: "📝 视频提示词 (Video Prompt)";
    display: block;
    font-size: 11px;
    color: var(--active);
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
  }
  .cm-vidprompt-edit, .cm-vidprompt-text-view {
    max-height: 140px !important;
  }
  
  .cm-td-img {
    margin-bottom: 8px !important;
  }
  .cm-td-img::before {
    content: "🖼️ 关键帧图片 (Keyframe)";
    display: block;
    font-size: 11px;
    color: #a78bfa;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
  }
  
  .cm-td-prompt {
    margin-bottom: 16px !important;
  }
  .cm-td-prompt::before {
    content: "🎨 图片提示词 (Image Prompt)";
    display: block;
    font-size: 11px;
    color: #a78bfa;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
  }
  .cm-prompt-edit, .cm-prompt-text-view {
    max-height: 140px !important;
  }
  
  .cm-td-voice {
    border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
    padding-top: 14px !important;
    margin-top: 4px !important;
  }
  .cm-td-voice::before {
    content: "🎙️ 解说词 · 音频 (Narrative & Audio)";
    display: block;
    font-size: 11px;
    color: #34d399;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
  }
}



/* ─── Batch TTS ─────────────────────────────────────────────────────────────── */
.batch-tts-modal-box {
  width: 480px;
}
.batch-tts-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}
.batch-ep-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 14px;
}
.batch-ep-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: #11121a;
  border: 1px solid #2e3040;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.batch-ep-row:hover { border-color: #4a5070; }
.batch-ep-row input[type="checkbox"] { flex-shrink: 0; accent-color: var(--gold); }
.batch-ep-name { flex: 1; color: var(--text); }
.batch-ep-stat { font-size: 11px; color: var(--muted); white-space: nowrap; }
.batch-tts-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.batch-opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.batch-opt-row input[type="checkbox"] { accent-color: var(--gold); }

/* Per-line batch status badge */
.batch-tts-badge {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}
.batch-tts-badge[data-status="generating"] { color: #fbbf24; background: rgba(251,191,36,0.12); animation: batch-pulse 1s ease-in-out infinite; }
.batch-tts-badge[data-status="done"]       { color: #34d399; background: rgba(52,211,153,0.12); }
.batch-tts-badge[data-status="playing"]    { color: #60a5fa; background: rgba(96,165,250,0.15); animation: batch-pulse 0.8s ease-in-out infinite; }
.batch-tts-badge[data-status="error"]      { color: #f87171; background: rgba(248,113,113,0.12); }
.batch-tts-badge[data-status="pending"]    { color: #94a3b8; }

@keyframes batch-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* Toast notification */
.batch-tts-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e202e;
  border: 1px solid #4a5070;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 2000;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
