:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: rgba(14, 25, 37, 0.92);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.1);
  --gold: #e4b85a;
  --gold-soft: rgba(228, 184, 90, 0.12);
  --text: #f4f0e8;
  --muted: #8fa0b2;
  --green: #62d6aa;
  --blue: #6fc4ff;
  --red: #ff7d7d;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 80% 0, #182537 0, var(--bg) 42%); color: var(--text); }
button, input, textarea, select { font: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px;
  background: rgba(5, 11, 18, 0.94); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), #9f6a1e); color: #15100a; font-weight: 900;
}
.brand strong { display: block; font-size: 14px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.sidebar-heading { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.plan-list { overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.plan-item {
  width: 100%; padding: 10px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--text); text-align: left; cursor: pointer;
}
.plan-item:hover, .plan-item.active { border-color: rgba(228,184,90,.35); background: var(--gold-soft); }
.plan-item strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.plan-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.sidebar-foot { margin-top: auto; color: var(--muted); font-size: 10px; }
.status-dot::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--green); }

.main { width: min(1260px, 100%); padding: 28px 34px 80px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: clamp(22px, 3vw, 34px); letter-spacing: -.03em; }
.topbar p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.panel {
  margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(180deg, rgba(18,31,44,.96), rgba(11,21,31,.96));
  box-shadow: 0 16px 50px rgba(0,0,0,.2);
}
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.section-title > div { display: flex; align-items: center; gap: 10px; }
.section-title h2 { margin: 0; font-size: 17px; }
.step { color: var(--gold); font: 700 11px ui-monospace, monospace; }
.hint, .muted { color: var(--muted); font-size: 11px; }
.pill { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
label { display: block; color: #c8d0d9; font-size: 11px; }
input, textarea, select {
  width: 100%; margin-top: 6px; padding: 10px 11px; border: 1px solid var(--line);
  border-radius: 9px; background: rgba(0,0,0,.2); color: var(--text); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: rgba(228,184,90,.6); box-shadow: 0 0 0 3px rgba(228,184,90,.08); }
textarea { resize: vertical; }
.input-group { display: grid; grid-template-columns: 1fr 90px; gap: 6px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 15px 0; }
.upload-card {
  padding: 16px; border: 1px dashed rgba(228,184,90,.28); border-radius: 12px;
  background: var(--gold-soft); cursor: pointer;
}
.upload-card input { display: none; }
.upload-card strong, .upload-card span, .upload-card small { display: block; }
.upload-card strong { color: #f6d999; font-size: 13px; }
.upload-card span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.upload-card small { margin-top: 9px; color: var(--blue); font-size: 10px; }
.image-catalog { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 16px; }
.image-asset-card { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.18); }
.image-asset-card img { display: block; width: 100%; height: 130px; object-fit: cover; background: #050a0f; }
.image-asset-card figcaption { display: grid; gap: 4px; padding: 8px; }
.image-asset-card strong { color: var(--gold); font-size: 10px; }
.image-asset-card span { color: var(--muted); font-size: 9px; line-height: 1.4; }
.asset-warning { grid-column: 1 / -1; padding: 9px 11px; border: 1px solid rgba(255,196,123,.24); border-radius: 8px; color: #ffc47b; font-size: 10px; line-height: 1.5; }
.asset-checklist { grid-column: 1 / -1; display: grid; gap: 7px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.03); }
.asset-check { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; }
.asset-check > span { display: grid; place-items: center; min-height: 25px; border-radius: 7px; background: rgba(255,190,72,.14); color: var(--gold); font-size: 9px; font-weight: 800; }
.asset-check.present > span { background: rgba(73,190,128,.16); color: #7ee2ac; }
.asset-check.missing > span { background: rgba(245,94,94,.16); color: #ff9292; }
.asset-check div, .asset-check small, .capability-shot span { display: block; }
.asset-check small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.promo-box { margin: 15px 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.promo-box summary { cursor: pointer; color: #e8d6b0; font-size: 12px; }
.promo-fields { margin-top: 13px; }
.confirm-line { display: flex; align-items: center; gap: 7px; margin-top: 10px; }
.confirm-line input { width: auto; margin: 0; }
.action-row { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 38px;
  padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: wait; }
.btn-primary { background: linear-gradient(135deg, #e4b85a, #b67a28); color: #160f07; font-weight: 750; }
.btn-secondary { border-color: var(--line); background: rgba(255,255,255,.04); color: var(--text); }
.btn-small { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.btn-block { width: 100%; }
.file-btn input { display: none; }

.evidence-preview, .learning-strip {
  margin-top: 14px; padding: 13px; border: 1px solid rgba(111,196,255,.18);
  border-radius: 11px; background: rgba(111,196,255,.055); color: #cde9fc; font-size: 12px;
}
.evidence-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.evidence-grid strong { display: block; color: #fff; margin-bottom: 4px; }
.factor-evidence-item + .factor-evidence-item { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.08); }
.factor-evidence-item span, .factor-evidence-item small { color: var(--muted); }
.variant-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.variant-card {
  position: relative; min-height: 300px; padding: 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel-soft); cursor: pointer; transition: transform .15s, border-color .15s;
}
.variant-card:hover { transform: translateY(-2px); border-color: rgba(111,196,255,.5); }
.variant-card.active {
  transform: translateY(-3px); border: 2px solid var(--gold);
  background: linear-gradient(180deg, rgba(228,184,90,.12), rgba(255,255,255,.035));
  box-shadow: 0 0 0 3px rgba(228,184,90,.08), 0 14px 34px rgba(0,0,0,.22);
}
.variant-card .angle { color: var(--muted); font-size: 11px; font-weight: 800; }
.variant-card.active .angle { color: var(--gold); }
.selection-state {
  position: absolute; top: 12px; right: 12px; padding: 4px 8px; border-radius: 999px;
  background: rgba(255,255,255,.06); color: var(--muted); font-size: 9px; font-weight: 700;
}
.variant-card.active .selection-state { background: var(--gold); color: #171108; }
.card-action { margin-top: 14px; color: var(--blue); font-size: 10px; font-weight: 700; }
.variant-card.active .card-action { color: var(--gold); }
.variant-card h3 { margin: 9px 0; font-size: 16px; }
.variant-card .hook { min-height: 52px; color: #fff; font-size: 14px; line-height: 1.55; }
.variant-card p { color: var(--muted); font-size: 11px; line-height: 1.55; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag { padding: 4px 7px; border-radius: 999px; background: rgba(255,255,255,.06); color: #bcc8d4; font-size: 9px; }
.tag.explore { background: rgba(111,196,255,.12); color: var(--blue); }
.tag.price { background: rgba(98,214,170,.1); color: var(--green); }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr); gap: 18px; }
.edit-stack { display: grid; gap: 12px; }
.split-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seedance-box { padding: 15px; border: 1px solid rgba(111,196,255,.18); border-radius: 12px; background: rgba(5,12,20,.55); }
.seedance-box h3 { margin-top: 0; color: var(--blue); font-size: 13px; }
.route-box { padding: 15px; border-radius: 12px; background: rgba(5,12,20,.55); }
.human-route { border: 1px solid rgba(98,214,170,.2); }
.route-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.route-heading h3 { margin: 3px 0 0; color: var(--green); font-size: 13px; }
.route-label { display: inline-block; color: var(--gold); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.shooting-list { display: grid; gap: 8px; margin: 10px 0; }
.shooting-shot { padding: 10px; border-left: 2px solid var(--green); background: rgba(98,214,170,.05); font-size: 10px; line-height: 1.55; }
.shooting-shot > div { margin-top: 3px; color: #c5ced8; }
.shooting-shot .shot-meta { color: var(--green); }
.advanced-editor { padding: 10px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; }
.advanced-editor summary { cursor: pointer; color: var(--muted); font-size: 11px; }
.advanced-editor label { margin-top: 10px; }
.timeline { display: grid; gap: 7px; margin: 10px 0; }
.timeline-row { padding: 8px; border-left: 2px solid var(--blue); background: rgba(111,196,255,.05); font-size: 10px; line-height: 1.5; }
.shot-reference-thumb { float: right; width: 72px; height: 72px; margin: 4px 0 6px 8px; border-radius: 7px; object-fit: cover; }
.shot-binding-label { display: block; margin: 7px 80px 4px 0; color: var(--muted); }
.shot-binding-label select { margin-top: 3px; padding: 6px; font-size: 10px; }
.binding-reason { display: inline-block; margin-bottom: 5px; color: var(--gold); }
.readiness-panel, .audio-plan { margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.03); font-size: 10px; line-height: 1.5; }
.readiness-score { display: flex; justify-content: space-between; gap: 10px; color: var(--gold); }
.readiness-warning { margin-top: 6px; color: #ffd18a; }
.readiness-warning.high { color: #ff9292; }
.capability-shot { margin-top: 7px; padding: 7px; border-left: 3px solid #d3a64d; background: rgba(255,255,255,.025); }
.capability-shot.suitable { border-left-color: #57c987; }
.capability-shot.unsuitable { border-left-color: #f55e5e; }
.capability-inline.suitable { color: #7ee2ac; }
.capability-inline.risky { color: #ffd18a; }
.capability-inline.unsuitable { color: #ff9292; }
.production-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cost-warning { color: #ffc47b; font-size: 10px; line-height: 1.5; }
.production-status { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.production-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.production-head strong, .production-head span { display: block; }
.production-head span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.production-error { color: var(--red); font-size: 10px; }
.production-shot-list { display: grid; gap: 8px; margin-top: 10px; }
.production-shot { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.production-shot.succeeded { border-color: rgba(98,214,170,.32); }
.production-shot.failed { border-color: rgba(255,125,125,.32); }
.production-shot strong, .production-shot small { display: block; font-size: 9px; }
.production-shot small { margin-top: 3px; color: var(--red); }
.production-shot video { width: 110px; max-height: 150px; border-radius: 6px; background: #000; }
.final-video { display: grid; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(98,214,170,.24); }
.final-video video { width: 100%; max-height: 520px; background: #000; border-radius: 9px; }
.code-box {
  max-height: 280px; overflow: auto; padding: 10px; border-radius: 8px;
  background: #03080d; color: #a7d8f7; font: 10px/1.5 ui-monospace, monospace; white-space: pre-wrap;
}
.metrics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-check { align-self: end; min-height: 42px; }
.version-actions { display: flex !important; gap: 8px !important; }
.section-help { margin: 5px 0 0; color: var(--muted); font-size: 11px; }

.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 420px;
  padding: 12px 15px; border: 1px solid rgba(228,184,90,.35); border-radius: 10px;
  background: #111d28; color: #f4ead4; box-shadow: 0 16px 50px rgba(0,0,0,.4); font-size: 12px;
}
.toast.error { border-color: rgba(255,125,125,.4); color: #ffd0d0; }
.hidden { display: none !important; }

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .plan-list { max-height: 180px; }
  .form-grid, .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .variant-grid { grid-template-columns: 1fr; }
  .editor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main { padding: 20px 12px 60px; }
  .topbar { flex-direction: column; }
  .form-grid, .metrics-grid, .upload-grid, .split-fields { grid-template-columns: 1fr; }
  .action-row { align-items: stretch; flex-direction: column; }
  .btn { width: 100%; }
}

.workspace-box { margin: 12px 0; padding: 10px 12px; border: 1px solid rgba(212,175,55,0.35); border-radius: 10px; background: rgba(212,175,55,0.06); }
.workspace-label { font-size: 11px; color: #8a93a6; letter-spacing: 0.08em; text-transform: uppercase; }
.workspace-code { font-size: 18px; font-weight: 700; letter-spacing: 0.12em; color: #d4af37; margin: 4px 0 8px; font-family: ui-monospace, monospace; }
.workspace-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.workspace-hint { font-size: 11px; color: #6b7488; margin: 8px 0 0; line-height: 1.4; }
.btn-sm { padding: 4px 8px; font-size: 11px; }


.autocomplete { position: relative; }
.autocomplete-list { position: absolute; z-index: 50; top: 100%; left: 0; right: 0; max-height: 280px; overflow-y: auto; background: #0e1925; border: 1px solid rgba(212,175,55,0.4); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.autocomplete-list.hidden { display: none; }
.autocomplete-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 8px 12px; background: transparent; border: 0; border-bottom: 1px solid rgba(255,255,255,0.05); color: #e6ecf3; text-align: left; cursor: pointer; font-size: 13px; }
.autocomplete-item:hover { background: rgba(212,175,55,0.12); }
.autocomplete-name { flex: 1; }
.autocomplete-score { font-size: 11px; color: #d4af37; margin-left: 12px; }
.autocomplete-score.muted { color: #6b7488; }
.autocomplete-empty { padding: 10px 12px; font-size: 12px; color: #8a93a6; }


.seedance-archived { margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(255,255,255,0.12); }
.seedance-archived > summary { cursor: pointer; font-size: 12px; color: #8a93a6; padding: 6px 0; }
.seedance-archived > summary:hover { color: #d4af37; }
.seedance-archived[open] > summary { color: #d4af37; margin-bottom: 8px; }

