:root {
  --bg: #0d0f11;
  --panel: #15181b;
  --panel-2: #191d21;
  --panel-3: #1e2328;
  --line: #2a3036;
  --line-soft: #21262b;
  --text: #e9e7e2;
  --muted: #9a9da0;
  --dim: #6c7277;
  --accent: #2fb8a6;
  --accent-2: #3d8f7f;
  --accent-soft: #133229;
  --warn: #d9a441;
  --danger: #d9645b;
  --ok: #57b98a;
  --info: #6f9dc4;
  --radius: 8px;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
  --topbar: 56px;
  --statusbar: 34px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent); }
svg { width: 16px; height: 16px; stroke-width: 1.8; flex: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b3237; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4349; }

/* ---------- 顶层导航 ---------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar);
  display: flex; align-items: center; gap: 20px;
  padding: 0 18px;
  background: #0f1214;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  color: inherit; text-decoration: none; flex: none;
}
.brand-mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: #06201b;
  font-weight: 700; font-size: 11px; letter-spacing: .4px;
}
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: 13.5px; letter-spacing: .2px; }
.brand-text .root {
  display: block;
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
  max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav-item {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap; flex: none;
}
.nav-item svg { width: 14px; height: 14px; }
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.active {
  color: var(--text);
  background: #1a2422;
  border-color: #2c4a44;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.topbar-right {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto; min-width: 0;
}

.project-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 32px; max-width: 230px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
}
.project-chip:hover { color: var(--text); border-color: #3a4348; }
.project-chip span { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar > .project-chip {
  max-width: 280px; color: var(--text);
  background: var(--panel); border-color: var(--line);
}
.topbar > .project-chip:hover { border-color: #3a4348; background: #1a1f23; }
.topbar > .ghost, .topbar > .primary { flex: none; }

.project-switch { position: relative; flex: none; }
.project-switch > summary { list-style: none; }
.project-switch > summary::-webkit-details-marker { display: none; }
.project-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  z-index: 70;
  width: min(320px, calc(100vw - 24px));
  max-height: 60vh; overflow-y: auto;
  padding: 6px;
  border: 1px solid #34413f;
  border-radius: 8px;
  background: #12171a;
  box-shadow: 0 18px 40px #000000cc;
}
.project-menu-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px 8px;
  font-size: 11px; color: var(--dim);
}
.project-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 9px;
  border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--muted);
  font-size: 12.5px; text-align: left; text-decoration: none;
}
.project-menu-item span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-menu-item:hover { background: var(--panel-2); color: var(--text); }
.project-menu-item.active { color: var(--accent); background: #142320; }
.project-menu-empty { padding: 10px; font-size: 12px; color: var(--dim); }

/* 步骤菜单下的项目工具条：四页共用同一顺序 */
.project-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 8px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}
.project-bar-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.project-bar-id strong { font-size: 13px; }
.project-bar-facts { display: flex; gap: 9px; flex-wrap: wrap; font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.project-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.project-chip svg { width: 13px; height: 13px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted); font-size: 11.5px;
  white-space: nowrap;
}
.pill svg { width: 12px; height: 12px; }
.pill.on { color: var(--ok); border-color: #2c4a3b; background: #16221c; }
.pill.off { color: var(--danger); border-color: #4a2c2a; background: #241817; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
}
.icon-btn:hover { color: var(--text); border-color: #3a4348; }

.primary {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid #2a8f81;
  border-radius: 6px;
  background: var(--accent);
  color: #06201b;
  font-weight: 600; font-size: 13px;
}
.primary:hover { background: #3cc7b4; }
.primary:disabled { opacity: .45; cursor: default; }

.ghost {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.ghost:hover { color: var(--text); border-color: #3a4348; }
.ghost.danger:hover { color: var(--danger); border-color: #5a302d; }
.ghost:disabled { opacity: .45; cursor: default; }

/* ---------- 主区域：六阶段 ---------- */

.viewport {
  min-height: calc(100vh - var(--topbar) - var(--statusbar));
  padding: 18px 20px 78px;
}

.stage-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
}
.stage-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: .2px; }
.stage-head .sub {
  margin-top: 2px;
  display: flex; gap: 10px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11.5px; color: var(--dim);
}
.stage-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.rail {
  display: flex; align-items: stretch;
  gap: 0;
  margin: 16px 0 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}
.stage-card {
  flex: 1 1 0;
  min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px 11px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  position: relative;
  transition: background .14s;
}
.stage-card:last-child { border-right: 0; }
.stage-card:hover { background: var(--panel-2); }
.stage-card.active { background: #17201f; }
.stage-card.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--accent);
}

.stage-card.linked .stage-title::after {
  content: "↗";
  margin-left: 3px;
  font-size: 10px;
  color: var(--dim);
}
.page-entry-body { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.page-entry .metric { flex: 1; }
.page-entry .metric-row { max-width: 520px; }
.stage-top { display: flex; align-items: center; gap: 8px; }
.stage-no {
  width: 20px; height: 20px; flex: none;
  display: grid; place-items: center;
  border-radius: 5px;
  border: 1px solid var(--line);
  font-family: var(--mono); font-size: 10.5px;
  color: var(--dim);
}
.stage-card.active .stage-no,
.stage-card.done .stage-no { color: var(--accent); border-color: #2f6b60; }
.stage-icon { color: var(--muted); }
.stage-card.active .stage-icon { color: var(--accent); }
.stage-title {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stage-state {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px; color: var(--dim);
  white-space: nowrap;
}
.stage-state.ok { color: var(--ok); }
.stage-state.warn { color: var(--warn); }
.stage-desc {
  font-size: 11.5px; color: var(--dim); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.stage-bar { height: 2px; background: #262d32; border-radius: 2px; margin-top: 5px; overflow: hidden; }
.stage-bar i { display: block; height: 100%; background: var(--accent-2); }

.stage-panel {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel);
  padding: 18px;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 {
  margin: 0;
  display: flex; align-items: center; gap: 8px;
  font-size: 15.5px; font-weight: 600;
}
.panel-head h2 .num {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 5px;
}
.panel-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--dim); }
.panel-head .tools { display: flex; gap: 6px; flex-wrap: wrap; }

.blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.block {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 12px 13px;
  min-width: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.block.span-2 { grid-column: span 2; }
.block-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500;
}
.block-head svg { width: 14px; height: 14px; color: var(--accent); }
.block-head .tag { margin-left: auto; }
.block p { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.55; }
.block .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.block .empty-line {
  border: 1px dashed #333b41;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px; color: var(--dim);
}

.tag {
  font-family: var(--mono); font-size: 10.5px;
  padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.tag.ok { color: var(--ok); border-color: #2c4a3b; }
.tag.warn { color: var(--warn); border-color: #4a4226; }
.tag.bad { color: var(--danger); border-color: #4a2c2a; }
.tag.plan { color: var(--info); border-color: #2c3f4f; border-style: dashed; }

.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(86px, 1fr)); gap: 8px; margin-top: 4px; }
.metric {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 7px 9px;
  background: #121518;
}
.metric .k { font-size: 10.5px; color: var(--dim); }
.metric .v { font-family: var(--mono); font-size: 13px; margin-top: 1px; }

/* ---------- 表格 / 分镜编辑器 ---------- */

.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: auto;
  max-height: 260px;
  background: #101315;
}
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td {
  padding: 7px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
th {
  color: var(--dim); font-weight: 500; font-size: 10.5px;
  letter-spacing: .3px; background: #13161a;
  position: sticky; top: 0; z-index: 1;
}
tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; min-width: 150px; max-width: 320px; }
td.mono, .mono { font-family: var(--mono); color: var(--muted); }

.shot-editor {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--panel-2);
}
.se-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: #13161a;
  border-bottom: 1px solid var(--line-soft);
}
.se-id { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.se-cam { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.se-body {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}
.se-body .field.wide { grid-column: 1 / -1; }
.se-body .field.adv { display: none; }
.se-body.advanced .field.adv { display: flex; }
.mini {
  height: 24px; padding: 0 7px;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.mini svg { width: 12px; height: 12px; }
.mini:hover { color: var(--text); border-color: #3a4348; }

/* ---------- 拖拽 / 文件 / 媒体 ---------- */

.drop {
  border: 1px dashed #394146;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--dim);
  background: #111416;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop.hover { border-color: var(--accent); background: #12201d; color: var(--text); }
.drop strong { display: block; color: var(--text); font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.file-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel-2);
}
.file-row svg { width: 13px; height: 13px; color: var(--dim); }
.file-row .spacer { flex: 1; }
.file-row audio { height: 26px; max-width: 190px; }

.shot-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.trim-grid { display: flex; flex-direction: column; gap: 6px; }
.trim-row {
  display: grid;
  grid-template-columns: 38px minmax(92px, 1fr) minmax(110px, 1.2fr);
  gap: 7px; align-items: end;
}
.trim-row > .mono {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  padding-bottom: 8px;
}
.trim-row .field > span { font-size: 10.5px; }
.trim-row input, .trim-row select { padding: 5px 7px; font-size: 12px; }
.strip-item {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
  background: #0c0f11;
  min-width: 0;
}
.strip-media {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background: #090b0c;
}
.strip-media img, .strip-media video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.strip-empty {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: #4f575b;
}
.strip-media .badge {
  position: absolute; left: 5px; bottom: 5px;
  font-family: var(--mono); font-size: 10px;
  padding: 1px 5px; border-radius: 4px;
  background: #0b0d0ecc; border: 1px solid #ffffff1a;
  color: #d8d6d0;
}
.strip-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px;
  font-size: 11px; color: var(--dim);
}

.timeline-strip {
  display: flex;
  gap: 2px;
  height: 42px;
  margin-top: 8px;
  border-radius: 6px;
  overflow: hidden;
  background: #0b0e10;
  border: 1px solid var(--line-soft);
}
.tl-block {
  position: relative;
  min-width: 4%;
  display: flex; flex-direction: column; justify-content: center;
  gap: 1px;
  padding: 0 6px;
  background: linear-gradient(180deg, #21423c, #172a26);
  border-right: 1px solid #0a0c0e;
  cursor: ew-resize;
  user-select: none;
  overflow: hidden;
}
.tl-block:nth-child(even) { background: linear-gradient(180deg, #1f3a35, #152622); }
.tl-block:hover { background: linear-gradient(180deg, #2c5a51, #1b332e); }
.tl-id { font-family: var(--mono); font-size: 10px; color: var(--accent); }
.tl-dur { font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; }
.tl-rows { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.tl-row {
  display: grid;
  grid-template-columns: 36px 76px 1fr 92px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.tl-field { display: flex; align-items: center; gap: 6px; }
.tl-field > span { font-size: 10.5px; color: var(--dim); }
.tl-field input {
  width: 74px;
  padding: 3px 6px;
  font-size: 11.5px;
  font-family: var(--mono);
}

.grade-row {
  display: grid;
  grid-template-columns: 52px 1fr 24px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.grade-row input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  height: 3px;
}
.grade-row output {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  text-align: right;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.preset-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel-2);
  cursor: pointer;
}
.preset-item:hover { border-color: #3a4348; }
.preset-item input { margin-top: 3px; accent-color: var(--accent); }
.preset-item span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.preset-item strong { font-size: 12.5px; font-weight: 500; }
.preset-item em { font-family: var(--mono); font-size: 10.5px; color: var(--muted); font-style: normal; }
.preset-item small { font-size: 11px; color: var(--dim); }

.media-frame {
  background: #08090b;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.media-frame video { width: 100%; max-height: 320px; display: block; background: #08090b; }
.ph-sub {
  margin-top: 8px;
  display: flex; gap: 10px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; color: var(--dim);
}
code {
  font-family: var(--mono); font-size: 11.5px;
  background: #0d1012; border: 1px solid var(--line-soft);
  padding: 0 4px; border-radius: 3px; color: #c9d6d2;
}

/* ---------- 项目列表 ---------- */

.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.proj-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  text-align: left;
}
.proj-card:hover { border-color: #3a4348; }
.proj-card .cover {
  aspect-ratio: 16 / 9;
  background: #090b0c;
  position: relative;
  display: grid; place-items: center;
  color: #596166;
  overflow: hidden;
}
.proj-card .cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.proj-card .cover .placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; }
.proj-card .cover .placeholder svg { width: 22px; height: 22px; }
.proj-card .cover .badge {
  position: absolute; top: 7px; left: 7px;
  font-family: var(--mono); font-size: 10px;
  padding: 2px 6px; border-radius: 4px;
  background: #0b0d0ecc; border: 1px solid #ffffff1a;
  color: #d8d6d0; backdrop-filter: blur(4px);
}
.proj-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; }
.proj-card .title { font-size: 13.5px; font-weight: 500; }
.proj-card .meta { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.proj-card .mini-rail { display: flex; gap: 3px; margin-top: 4px; }
.proj-card .mini-rail i {
  flex: 1; height: 3px; border-radius: 2px; background: #262d32;
}
.proj-card .mini-rail i.on { background: var(--accent-2); }

/* ---------- 模板 / 设置 ---------- */

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.template-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 15px;
  display: flex; flex-direction: column; gap: 8px;
}
.template-card h3 { margin: 0; display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; }
.template-card h3 svg { width: 15px; height: 15px; color: var(--accent); }
.template-card p { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.6; }
.template-card .shots { display: flex; gap: 5px; flex-wrap: wrap; }
.template-card .shots span {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line-soft); border-radius: 4px; padding: 1px 5px;
}
.template-card .foot { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.settings-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.settings-card h3 { margin: 0; display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; }
.settings-card h3 svg { width: 15px; height: 15px; color: var(--accent); }
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12px; }
.kv span:first-child { color: var(--dim); }
.kv span:last-child { font-family: var(--mono); font-size: 11.5px; color: var(--muted); word-break: break-all; text-align: right; }
.path-box {
  font-family: var(--mono); font-size: 11.5px; color: #b9c6c1;
  background: #0b0e10; border: 1px solid var(--line-soft); border-radius: 6px;
  padding: 8px 10px; word-break: break-all; line-height: 1.55;
}
.settings-card .links { display: flex; gap: 6px; flex-wrap: wrap; }
.settings-seg {
  display: inline-flex; align-self: flex-start; flex-wrap: wrap; gap: 2px;
  padding: 2px; border: 1px solid var(--line-soft); border-radius: 6px; background: #101416;
}
.settings-seg .seg {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 4px;
  background: transparent; color: var(--muted); font-size: 12px;
}
.settings-seg .seg svg { width: 13px; height: 13px; }
.settings-seg .seg:hover { color: var(--text); }
.settings-seg .seg.active { color: var(--text); border-color: #2c4a44; background: #1a2422; }
.ai-fields { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 底部状态栏 ---------- */

.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  height: var(--statusbar);
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: #0f1214;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.sb-left, .sb-right { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sb-project { font-size: 12px; color: var(--text); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { width: 128px; height: 4px; border-radius: 3px; background: #262d32; overflow: hidden; flex: none; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.sb-pct { font-family: var(--mono); font-size: 10.5px; color: var(--dim); min-width: 28px; }
.sb-mid {
  margin: 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11.5px;
  max-width: 46vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-mid:hover { color: var(--text); border-color: #3a4348; }
.sb-mid svg { width: 12px; height: 12px; }
.sb-mid.live { color: var(--warn); border-color: #4a4226; background: #1c1a13; }
.sb-export { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.sb-export svg { width: 12px; height: 12px; }
.sb-export.ok { color: var(--ok); }
.sb-sep { width: 1px; height: 12px; background: var(--line); }
.sb-hint { font-family: var(--mono); font-size: 10.5px; color: var(--dim); white-space: nowrap; }

/* ---------- 弹窗 / 提示 ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: #000000a6;
  display: grid; place-items: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(580px, 100%);
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: #15181b;
  border: 1px solid #333a3f;
  border-radius: 10px;
  box-shadow: 0 24px 64px #00000099;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #15181b;
}
.modal-foot[hidden] { display: none; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 11.5px; color: var(--dim); }
input:not([type]), input[type=text], input[type=number], input[type=search], select, textarea {
  background: #0f1214;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  min-width: 0;
  outline: none;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: #3f7d74; }
textarea { resize: vertical; line-height: 1.5; font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }

.toast-wrap { position: fixed; right: 16px; bottom: calc(var(--statusbar) + 12px); z-index: 60; display: flex; flex-direction: column; gap: 6px; }
.toast {
  background: #1c2226;
  border: 1px solid #39464b;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  max-width: 340px;
  box-shadow: 0 8px 24px #00000080;
}
.toast.error { border-left-color: var(--danger); color: #f0c9c5; }

.empty {
  height: 44vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--dim);
}
.empty svg { width: 30px; height: 30px; stroke-width: 1.2; }
.muted { color: var(--dim); }

@media (max-width: 1180px) {
  .stage-desc { display: none; }
  .stage-state { display: none; }
}

@media (max-width: 1000px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand-text .root { display: none; }
  .brand-text strong { display: none; }
  .nav-item { padding: 0 9px; font-size: 12.5px; }
  .topbar > .ghost .btn-label { display: none; }
  .rail { overflow-x: auto; }
  .stage-card { flex: 1 1 0; min-width: 150px; }
  .viewport { padding: 14px 12px 78px; }
}

@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .topbar > .primary .btn-label { display: none; }
  .topbar-right { order: 3; width: 100%; overflow-x: auto; }
  .topbar > .project-chip { max-width: 150px; }
  .project-chip span { max-width: 96px; }
  .project-bar { align-items: flex-start; }
  .project-bar-actions { width: 100%; }
  .pill span { display: none; }
  .rail { overflow-x: auto; }
  .stage-card { flex: 0 0 150px; border-right: 1px solid var(--line-soft); border-bottom: 0; min-width: 0; padding: 10px 11px; }
  .stage-icon { display: none; }
  .stage-title { font-size: 12px; }
  .stage-desc { display: none; }
  .stage-state { display: none; }
  .statusbar { gap: 8px; padding: 0 10px; }
  .sb-project { max-width: 92px; }
  .progress { width: 64px; }
  .sb-hint { display: none; }
  .block.span-2 { grid-column: span 1; }
  .story-chat { height: 62vh; min-height: 420px; }
  .story-versions { max-height: 70vh; }
  .script-story-body { min-height: 220px; max-height: 40vh; }
  .script-shot-list { min-height: 200px; max-height: none; }
  .script-inline-editor .se-body { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .script-story-foot .muted { display: none; }
  .story-editor { min-height: 200px; max-height: none; }
  .story-composer textarea { min-height: 56px; }
}
