/* ==================== Reset & Base ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f6f3ee;
  --surface: #fffcf7;
  --surface2: #f0ece4;
  --primary: #c25a3c;
  --primary-hover: #a84a2e;
  --primary-light: rgba(194, 90, 60, 0.08);
  --amber: #d4a06a;
  --amber-light: rgba(212, 160, 106, 0.15);
  --text: #3d3229;
  --text-secondary: #7a6b5d;
  --text-muted: #b0a294;
  --border: #e0d8ce;
  --border-light: #ede8e0;
  --danger: #c0392b;
  --success: #27ae60;
  --sage: #8a9a7a;
  --slate: #8a9bb5;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 1px 4px rgba(61, 50, 41, 0.08);
  --shadow-hover: 0 3px 10px rgba(61, 50, 41, 0.12);
  --font: -apple-system, "Segoe UI", "Noto Sans SC", "PingFang SC", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Consolas", monospace;
  --nav-w: 200px;
  --preview-w: 340px;
}
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
input, select, textarea, button { font-family: inherit; font-size: inherit; }
[v-cloak] { display: none !important; }

/* ==================== Layout ==================== */
.section-divider { border: none; border-top: 1px solid var(--border-light); margin: 16px 0; }
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==================== Left Nav ==================== */
.nav-sidebar {
  width: var(--nav-w);
  min-width: var(--nav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.nav-header {
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-settings {
  border-left: none !important;
  padding: 4px 6px !important;
  font-size: 16px;
}
.nav-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
.nav-menu {
  flex: 1;
  padding: 6px 0;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  gap: 8px;
  font-size: 15px;
}
.nav-item:hover { background: var(--primary-light); color: var(--text); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-icon { font-size: 18px; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
  background: var(--border-light);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}
.nav-item.active .nav-badge {
  background: var(--primary);
  color: #fff;
}
.nav-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-light);
}
.nav-footer .btn-full { margin-bottom: 8px; }
.nav-io-row { display: flex; gap: 6px; }
.nav-io-row .btn { flex: 1; }

/* ==================== Center Canvas ==================== */
.canvas-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.view-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.pane-header h2 { font-size: 17px; font-weight: 700; }
.pane-body {
  flex: 1;
  padding: 14px 18px;
  overflow-y: auto;
  min-height: 0;
}
.pane-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 6px;
  font-size: 15px;
}

/* ==================== Entity Tabs ==================== */
.entity-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}
.entity-tab {
  padding: 6px 16px;
  border-radius: 18px;
  background: var(--surface2);
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.entity-tab:hover { background: var(--amber-light); }
.entity-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.tab-del {
  cursor: pointer;
  opacity: 0.4;
  font-size: 13px;
  line-height: 1;
}
.tab-del:hover { opacity: 1; color: var(--danger); }
.entity-tab.active .tab-del { opacity: 0.7; color: #fff; }
.entity-tab.active .tab-del:hover { opacity: 1; }

/* ==================== Form Controls ==================== */
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.label-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 13px;
}
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.form-row .form-group { margin-bottom: 0; }
.half { flex: 0 0 calc(50% - 6px); min-width: 0; }
.third { flex: 0 0 calc(33.33% - 8px); min-width: 0; }
.two-thirds { flex: 0 0 calc(66.66% - 8px); min-width: 0; }
.fourth { flex: 0 0 calc(25% - 9px); min-width: 0; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  font-size: 15px;
}
input[type="text"]:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
textarea { resize: vertical; min-height: 48px; }
.input-sm { margin-top: 6px; }
select { cursor: pointer; appearance: auto; }
.empty-hint { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ==================== Chip Group ==================== */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-group.wrap { gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 18px;
  font-size: 14px;
  background: var(--surface2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  color: var(--text-secondary);
}
.chip:hover {
  background: var(--amber-light);
  border-color: var(--amber);
}
.chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==================== Editable Select ==================== */
.editable-select {
  position: relative;
  display: inline-block;
  width: 100%;
}
.editable-select input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-size: 15px;
  cursor: text;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.editable-select input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.editable-select::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}
.editable-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-hover);
}
.editable-select-option {
  padding: 7px 12px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.08s;
}
.editable-select-option:hover { background: var(--primary-light); }
.editable-select-option.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* ==================== Utility Classes ==================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap { gap: 12px; }
.gap-lg { gap: 16px; }
.p-sm { padding: 8px; }
.p { padding: 12px; }
.p-lg { padding: 16px; }
.mb-sm { margin-bottom: 8px; }
.mb { margin-bottom: 12px; }
.mb-lg { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.15s;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover { background: var(--surface2); border-color: var(--text-muted); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 自身居中（用于行内按钮） */
.btn-self-center { align-self: center; }

.meta-label { display:flex; align-items:center; gap:4px; font-size:13px; color:var(--text-secondary); white-space:nowrap; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-outline { background: transparent; border-color: var(--text-muted); color: var(--text-secondary); }
.btn-outline:hover { background: var(--surface); border-color: var(--primary); color: var(--primary); }
.btn-xs { padding: 4px 10px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.btn-icon:hover { background: var(--danger); color: #fff; }

/* ==================== Slider ==================== */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  margin-top: 8px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
}

/* ==================== Dialogue ==================== */
.dlg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.dlg-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dlg-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}
.dlg-char {
  width: 110px;
  flex-shrink: 0;
}
.dlg-text {
  flex: 1;
  min-width: 0;
}
.dlg-tone {
  width: 120px;
  flex-shrink: 0;
}
.dlg-voice {
  width: 80px;
  flex-shrink: 0;
}
.dlg-intensity {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  align-items: center;
}
.intensity-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.12s;
}
.intensity-dot.active {
  background: var(--primary);
}
.intensity-dot:hover {
  background: var(--amber);
}
.dlg-row select, .dlg-row input[type="text"] {
  padding: 4px 8px;
  font-size: 13px;
}
.dlg-row .editable-select input {
  padding: 4px 8px;
  font-size: 13px;
}
.dlg-row .editable-select::after {
  font-size: 12px;
  right: 6px;
}

/* ==================== Advanced Section ==================== */
.advanced-section {
  margin-top: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.advanced-section summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
}
.advanced-section summary:hover { color: var(--primary); }
.advanced-section > .form-group { margin-top: 10px; }

/* ==================== Editor Groups ==================== */
.editor-group {
  margin-bottom: 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.editor-group summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  user-select: none;
}
.editor-group summary:hover { color: var(--primary); background: var(--primary-light); }
.editor-group[open] summary { border-bottom-color: var(--border); color: var(--text); }
.editor-group > .form-row,
.editor-group > .form-group {
  padding: 0 12px;
  margin-top: 10px;
}
.editor-group > .form-row:last-child,
.editor-group > .form-group:last-child {
  margin-bottom: 10px;
}
.editor-group .chip-group {
  margin-top: 3px;
}

/* ==================== Production Layout ==================== */
.production-layout {
  display: flex;
  gap: 0;
  height: 100%;
  min-height: 0;
}
.sequence-sidebar {
  width: 140px;
  flex-shrink: 0;
  padding: 8px;
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  background: var(--surface2);
}
.seq-list-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.seq-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.1s;
  margin-bottom: 2px;
}
.seq-item:hover { background: var(--bg); }
.seq-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.seq-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seq-count {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 18px;
  text-align: right;
}
.seq-item.active .seq-count { color: var(--primary); }
.seq-del {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  opacity: 0;
}
.seq-item:hover .seq-del { opacity: 0.5; }
.seq-del:hover { opacity: 1; color: var(--danger); }
.production-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 0 0 0 10px;
}

/* ==================== Filmstrip ==================== */
.filmstrip-status {
  display: flex;
  gap: 12px;
  padding: 6px 0 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  margin: 0 0 10px;
}
.filmstrip-stat {
  white-space: nowrap;
}
.filmstrip {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}
.filmstrip-track {
  display: flex;
  gap: 8px;
  min-width: min-content;
}
.shot-frame {
  flex-shrink: 0;
  width: 220px;
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px 8px;
  cursor: grab;
  transition: all 0.15s;
  position: relative;
  user-select: none;
  display: flex;
  flex-direction: column;
}
.shot-frame:active { cursor: grabbing; }
.shot-frame:hover { border-color: var(--amber); box-shadow: var(--shadow); }
.shot-frame.active {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 2px var(--primary-light);
}
.shot-frame.textmode {
  border-color: #c5cae9;
  background: #f5f6ff;
}
.shot-frame.textmode.active {
  border-color: #3f51b5;
  box-shadow: 0 0 0 2px rgba(63,81,181,0.15);
}
.shot-frame.dragging { opacity: 0.3; }
.sf-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.sf-num {
  font-weight: 800;
  font-size: 20px;
  color: var(--primary);
  line-height: 1;
  min-width: 30px;
  text-shadow: 0 1px 2px rgba(194,90,60,0.15);
}
.shot-frame.textmode .sf-num { color: #3f51b5; text-shadow: 0 1px 2px rgba(63,81,181,0.15); }
.sf-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface2);
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}
.sf-desc {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  max-height: 4.5em;
  overflow: hidden;
  flex: 2;
  padding: 6px 0;
  border-top: 1px dashed var(--border-light);
  border-bottom: 1px dashed var(--border-light);
  margin: 0 0 8px;
}
.sf-desc-empty { color: var(--text-muted); font-style: italic; font-size: 12px; border-color: transparent; flex: 2; }
.sf-row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sf-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.sf-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.sf-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
}
.sf-del {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 0 6px;
  line-height: 1;
  border-radius: 4px;
  opacity: 0.6;
  margin-left: auto;
  transition: all 0.12s;
}
.sf-del:hover { background: var(--danger); color: #fff; opacity: 1; }
.shot-action { color: var(--text); }
.shot-dialogue { color: var(--primary); font-style: italic; }
.shot-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 12px; margin-top: 4px; }
.shot-frames {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.frame-placeholder {
  width: 64px;
  height: 40px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
}
.frame-box {
  width: 64px;
  height: 40px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  background: var(--surface2);
  transition: all 0.12s;
}
.frame-box:hover { border-color: var(--primary); background: var(--primary-light); }
.frame-box.has { border-style: solid; border-color: var(--amber); }
.frame-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.frame-thumb { width: 100%; height: 100%; object-fit: cover; }
.frame-arrow { color: var(--text-muted); font-size: 14px; }

.frame-upload {
  width: 100%;
  min-height: 100px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  background: var(--surface2);
  transition: all 0.12s;
  margin-top: 4px;
}
.frame-upload:hover { border-color: var(--primary); background: var(--primary-light); }
.frame-upload-placeholder { font-size: 14px; color: var(--text-muted); padding: 20px; }
.frame-preview { width: 100%; max-height: 180px; object-fit: contain; }
.frame-upload-wrap { position: relative; }
.frame-del-btn {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px;
  border-radius: 50%; border: none; background: rgba(0,0,0,0.55);
  color: #fff; font-size: 15px; line-height: 1; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  transition: background 0.12s; z-index: 2;
}
.frame-del-btn.is-visible { display: flex; }
.frame-del-btn:hover { background: rgba(220,50,50,0.85); }
.frame-info { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--text-secondary); }

/* ==================== Shot Editor ==================== */
.shot-editor {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.editor-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--primary);
}
.form-actions {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

/* ==================== Right Preview Panel ==================== */
.preview-panel {
  width: var(--preview-w);
  min-width: var(--preview-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.preview-header h3 { font-size: 16px; font-weight: 700; }
.preview-actions { display: flex; gap: 6px; }
.preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  min-height: 0;
}
.preview-section {
  margin-bottom: 8px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
}
.preview-seg-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}
.preview-seg-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.preview-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-light);
}
.preview-stat {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: right;
}

/* ==================== Color Segments ==================== */
.seg-color-0 { border-left-color: #c25a3c !important; }
.seg-color-1 { border-left-color: #d4a06a !important; }
.seg-color-2 { border-left-color: #8a9a7a !important; }
.seg-color-3 { border-left-color: #8a9bb5 !important; }
.seg-color-4 { border-left-color: #c25a3c !important; }
.seg-color-5 { border-left-color: #d4a06a !important; }
.seg-color-6 { border-left-color: #8a9a7a !important; }
.seg-color-7 { border-left-color: #8a9bb5 !important; }

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.btn-half { width: 50%; justify-content: center; }

/* ==================== Task List ==================== */
.task-stats { display: flex; gap: 16px; padding: 8px 0 12px; font-size: 14px; flex-wrap: wrap; }
.task-stat { color: var(--text-secondary); cursor: pointer; user-select: none; padding: 2px 6px; border-radius: 4px; transition: background .15s; }
.task-stat:hover { background: var(--primary-light); }
.task-stat.active { background: var(--primary-light); color: var(--primary); }
.task-stat strong { color: var(--text); font-size: 16px; }
.task-stat.active strong { color: var(--primary); }
.task-table-wrap { overflow-x: auto; }
.task-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.task-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.task-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); }
.task-table tr:hover td { background: var(--surface2); }
.time-cell { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.status-badge.pending { background: #fff3cd; color: #856404; }
.status-badge.running { background: #cce5ff; color: #004085; }
.status-badge.completed { background: #d4edda; color: #155724; }
.status-badge.failed { background: #f8d7da; color: #721c24; }
.badge-audio, .badge-image { display:inline-block; padding:2px 8px; border-radius:8px; font-size:11px; font-weight:600; white-space:nowrap; }
.badge-audio { background:#e8f4fd; color:#0468a4; }
.badge-image { background:#f0e6ff; color:#6b21a8; }

/* ==================== Video Modal ==================== */
.video-modal { max-width: 800px !important; }
.video-body { padding: 0; background: #000; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.video-player { width: 100%; max-height: 70vh; display: block; object-fit: contain; }

/* ==================== Frame Capture Modal ==================== */
.capture-modal { max-width: 700px !important; }
.capture-source-tabs { display: flex; gap: 0; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.cap-tab { padding: 6px 16px; cursor: pointer; font-size: 14px; color: var(--text-muted); border-bottom: 2px solid transparent; transition: all 0.12s; }
.cap-tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
.cap-tab:hover { color: var(--text); }
.capture-source-panel { margin-bottom: 8px; }
.capture-source-row { display: flex; align-items: center; gap: 8px; }
.capture-source-row label { white-space: nowrap; font-size: 14px; color: var(--text-secondary); }
.capture-source-row select { flex: 1; }
.capture-player-area { margin-top: 8px; }
.capture-canvas-wrap { position: relative; background: #000; border-radius: 6px; overflow: hidden; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.capture-canvas { max-width: 100%; max-height: 50vh; display: block; }
.capture-time { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,0.65); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 13px; font-family: monospace; }
.capture-controls { display: flex; align-items: center; gap: 8px; margin-top: 10px; justify-content: center; }
.capture-seekbar { flex: 1; max-width: 400px; height: 10px; cursor: pointer; accent-color: var(--primary); }
.capture-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.capture-info-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; justify-content: center; }
.capture-time-input { width: 110px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; font-family: monospace; text-align: center; }
.cap-label { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.cap-play { min-width: 32px; text-align: center; font-size: 14px; }

/* ==================== Preview Modal with Shot Selection ==================== */
.preview-modal { max-width: 800px !important; }
.shot-select-area { margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.shot-select-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.shot-select-all { cursor: pointer; font-size: 14px; user-select: none; }
.shot-select-all .cb { margin-right: 4px; }
.shot-select-count { font-size: 13px; color: var(--text-muted); }
.shot-select-list { max-height: 200px; overflow-y: auto; }
.shot-select-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px; transition: background 0.08s; }
.shot-select-item:hover { background: var(--surface2); }
.shot-select-item.selected { background: var(--primary-light); }
.shot-select-item .cb { font-size: 16px; flex-shrink: 0; }
.shot-sel-num { color: var(--text-muted); font-weight: 600; min-width: 28px; }
.shot-sel-desc { color: var(--text-secondary); min-width: 50px; }
.shot-sel-action { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.shot-sel-dur { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.modal-footer-actions { display: flex; gap: 8px; }

.preview-footer-actions {
  display: flex;
  gap: 6px;
}

/* ==================== Modal ==================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  width: 80vw;
  max-width: 900px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fmt-opt {
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface2);
  color: var(--text-secondary);
  transition: all 0.12s;
}
.fmt-opt.active {
  background: var(--primary);
  color: #fff;
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  min-height: 0;
}
.modal-body pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  margin: 0;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* ==================== Toast ==================== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 20px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-hover);
  animation: toastIn 0.2s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info  { background: var(--text); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==================== 提示词审阅 ==================== */
.chip-sm { padding: 2px 10px; font-size: 12px; }
.manual-target { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.shot-submit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border-light);
}

.prompt-review-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}
.prompt-shot-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.prompt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.prompt-card-header .shot-num {
  font-weight: 600;
  font-size: 14px;
}
.prompt-card-status .status-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.status-idle { background: var(--bg); color: var(--text-muted); }
.status-pending { background: #fff8e1; color: #f57f17; }
.status-running { background: #e3f2fd; color: #1565c0; }
.status-completed { background: #e8f5e9; color: #2e7d32; }
.status-failed { background: #fbe9e7; color: #c62828; }

.prompt-card-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prompt-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.prompt-field .label-hint {
  font-weight: 400;
  color: var(--text-light);
}
.prompt-field.locked .locked-text {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  min-height: 20px;
}
.prompt-field .locked-text.small {
  font-size: 12px;
  color: var(--text-muted);
  max-height: 60px;
  overflow-y: auto;
}
.prompt-field.editable textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.15s;
}
.prompt-field.editable textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.prompt-field.editable input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  transition: border-color 0.15s;
}
.prompt-field.editable input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.prompt-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.prompt-gen-waiting {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.prompt-gen-waiting p {
  margin: 8px 0;
  font-size: 15px;
}

/* 提示词生成结果（任务列表中的 pre 展示） */
.prompt-text-card {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
}
.prompt-text-card:last-child {
  border-bottom: none;
}
.prompt-text-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.prompt-text-content {
  margin: 4px 0 0;
  padding: 8px 10px;
  background: #f8f9fa;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  color: var(--text);
}

/* 资产形象图列表 */
.asset-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.asset-image-item {
  position: relative;
  display: inline-flex;
}
.asset-image-thumb {
  width: 60px;
  height: 45px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.1s;
}
.asset-image-thumb:hover,
.asset-image-thumb.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.asset-image-item .btn-icon {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  font-size: 10px;
  line-height: 18px;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s;
}
.asset-image-item:hover .btn-icon {
  opacity: 1;
}

/* ==================== Responsive ==================== */
@media (max-width: 1100px) {
  :root { --nav-w: 160px; --preview-w: 280px; }
}
@media (max-width: 900px) {
  #app { flex-direction: column; }
  .nav-sidebar { width: 100%; min-width: 0; flex-direction: row; height: 52px; }
  .nav-header { display: none; }
  .nav-menu { display: flex; padding: 0; overflow-x: auto; }
  .nav-item { border-left: none; border-bottom: 3px solid transparent; padding: 14px 12px; white-space: nowrap; }
  .nav-item.active { border-left: none; border-bottom-color: var(--primary); }
  .nav-footer { display: none; }
  .preview-panel { width: 100%; min-width: 0; border-left: none; border-top: 1px solid var(--border); height: 220px; }
}

/* ==================== Login Page ==================== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
}
.login-card {
  width: 380px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px 32px;
  box-shadow: var(--shadow-hover);
  text-align: center;
}
.login-logo {
  font-size: 48px;
  margin-bottom: 8px;
}
.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.login-page .form-group {
  text-align: left;
  margin-bottom: 16px;
}
.login-page .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.login-page .form-group input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}
.login-page .form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 4px;
  padding: 8px 12px;
  background: rgba(192, 57, 43, 0.06);
  border-radius: var(--radius-sm);
}
.login-card .btn-full {
  width: 100%;
  padding: 10px;
  font-size: 15px;
  font-weight: 600;
}

/* ==================== User Management ==================== */
.user-form-card input,
.user-form-card select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

/* ==================== Form Inputs (通用表单控件) ==================== */
input.form-input,
select.form-input,
textarea.form-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}
.task-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.task-table th.sortable:hover {
  background: var(--hover-bg, rgba(128,128,128,0.08));
}
input.form-input:focus,
select.form-input:focus,
textarea.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
/* 模态框内的表单控件也保持一致 */
.modal-body input,
.modal-body select,
.modal-body textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
/* modal overlay / box 基础样式补全 */
.modal-footer .btn + .btn {
  margin-left: 8px;
}

/* 参考图标记者列表 */
.ref-list .ref-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  cursor: grab;
  transition: box-shadow .15s;
}
.ref-list .ref-item:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
