:root {
  color-scheme: dark;
  --page: #111311;
  --surface: #181b18;
  --surface-2: #20241f;
  --line: #333a32;
  --line-strong: #536052;
  --text: #f0f3eb;
  --text-2: #b8c0b5;
  --text-3: #7e887b;
  --amber: #e9ae45;
  --amber-soft: #2e2617;
  --green: #65b886;
  --green-soft: #15291d;
  --red: #f17777;
  --red-soft: #301a1a;
  --shadow: 0 18px 55px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body { min-height: 100vh; margin: 0; color: var(--text); background: var(--page); font-family: Inter, "Microsoft YaHei", "PingFang SC", sans-serif; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }
a { color: inherit; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 12px max(22px, calc((100vw - 1440px) / 2)); border-bottom: 1px solid var(--line); background: rgba(17, 19, 17, .94); backdrop-filter: blur(16px); }
.brand, .top-actions, .section-heading, .panel-title, .row, .task-title { display: flex; align-items: center; }
.brand { gap: 12px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #82642e; border-radius: 8px; color: #171207; background: var(--amber); font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: var(--text-3); font-size: 10px; }
.top-actions { gap: 10px; }
.service-state { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-2); font-size: 10px; }
.service-state.ready { color: #a7dfbb; border-color: #315b40; background: var(--green-soft); }
.service-state.warning { color: #ffd28a; border-color: #76592c; background: var(--amber-soft); }
.shell { width: min(1440px, calc(100% - 36px)); margin: 0 auto; padding: 24px 0 64px; }
.stage-rail { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; margin-bottom: 18px; }
.stage-item { position: relative; min-height: 56px; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--text-3); background: var(--surface); }
.stage-item b { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 9px; }
.stage-item strong, .stage-item small { display: block; }
.stage-item strong { color: inherit; font-size: 11px; }
.stage-item small { margin-top: 2px; font-size: 8px; }
.stage-item.active { color: #ffd483; border-color: #8b692e; background: var(--amber-soft); }
.stage-item.done { color: #91d4aa; border-color: #315b40; background: var(--green-soft); }
.notice { margin-bottom: 16px; padding: 12px 14px; border: 1px solid #6f3535; border-radius: 6px; color: #ffc0c0; background: var(--red-soft); font-size: 12px; line-height: 1.6; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.main-panel, .side-card, .history-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.main-panel { min-height: 620px; padding: 26px; }
.side-panel { position: sticky; top: 96px; display: grid; gap: 12px; }
.side-card { padding: 18px; box-shadow: none; }
.panel-title { justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.panel-title small, .section-heading small { color: var(--amber); font-size: 9px; font-weight: 800; }
.panel-title h1, .section-heading h2 { margin: 4px 0 0; letter-spacing: 0; }
.panel-title h1 { font-size: 24px; }
.panel-title p { max-width: 580px; margin: 5px 0 0; color: var(--text-2); font-size: 11px; line-height: 1.6; }
.section-heading { justify-content: space-between; gap: 16px; }
.section-heading h2 { font-size: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: grid; gap: 7px; }
.field.wide { grid-column: 1 / -1; }
.field > span { color: var(--text-2); font-size: 11px; font-weight: 700; }
.field > span i { color: var(--amber); font-style: normal; }
.input, .textarea, .select { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 5px; outline: 0; color: var(--text); background: #111411; transition: border-color .15s ease, box-shadow .15s ease; }
.textarea { min-height: 98px; resize: vertical; line-height: 1.6; }
.textarea.prompt { min-height: 150px; font-family: Consolas, monospace; font-size: 11px; }
.input:focus, .textarea:focus, .select:focus { border-color: #96743b; box-shadow: 0 0 0 3px rgba(233, 174, 69, .09); }
.duration-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.duration-option { min-height: 82px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 6px; color: var(--text-2); background: var(--surface-2); cursor: pointer; }
.duration-option input { accent-color: var(--amber); }
.duration-option strong, .duration-option small { display: block; }
.duration-option strong { color: var(--text); font-size: 14px; }
.duration-option small { margin-top: 4px; color: var(--text-3); font-size: 9px; }
.material-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.material-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.material-head strong, .material-head small { display: block; }
.material-head strong { font-size: 12px; }
.material-head small { margin-top: 3px; color: var(--text-3); font-size: 9px; }
.material-count { color: var(--amber); font-size: 10px; }
.upload-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.upload-tile, .image-tile { min-height: 112px; border-radius: 5px; overflow: hidden; }
.upload-tile { display: grid; place-items: center; border: 1px dashed #5b6758; color: var(--text-2); background: #141814; cursor: pointer; text-align: center; font-size: 10px; }
.upload-tile.busy { pointer-events: none; opacity: .55; }
.upload-tile input { display: none; }
.image-tile { position: relative; border: 1px solid var(--line); background: #0a0c0a; }
.image-tile img { width: 100%; height: 112px; display: block; object-fit: cover; }
.remove-image { position: absolute; right: 5px; top: 5px; width: 26px; height: 26px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; color: white; background: rgba(0,0,0,.7); cursor: pointer; }
.authorization { display: flex; align-items: start; gap: 10px; margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--text-2); background: var(--surface-2); font-size: 11px; line-height: 1.6; }
.authorization input { margin-top: 3px; accent-color: var(--amber); }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.actions.start { justify-content: flex-start; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid #9b7431; border-radius: 5px; color: #191307; background: var(--amber); font-weight: 800; font-size: 11px; cursor: pointer; }
.button:hover { filter: brightness(1.08); }
.button:disabled { cursor: not-allowed; filter: none; opacity: .45; }
.button.secondary { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.button.ghost { color: var(--text-2); border-color: var(--line); background: transparent; }
.button.danger { color: #ffc0c0; border-color: #723838; background: var(--red-soft); }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 9px; }
.processing { min-height: 480px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.spinner { width: 54px; height: 54px; margin-bottom: 20px; border: 3px solid var(--line); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.processing h2 { margin: 0; font-size: 23px; }
.processing p { max-width: 520px; margin: 8px auto 0; color: var(--text-2); font-size: 11px; line-height: 1.7; }
.progress { width: min(540px, 100%); height: 7px; margin-top: 22px; overflow: hidden; border-radius: 999px; background: #0d100d; }
.progress span { display: block; height: 100%; background: var(--amber); transition: width .3s ease; }
.progress-label { width: min(540px, 100%); display: flex; justify-content: space-between; margin-top: 7px; color: var(--text-3); font-size: 9px; }
.shot-list { display: grid; gap: 12px; }
.shot-card { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.shot-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.shot-number { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: #1a1306; background: var(--amber); font-size: 10px; font-weight: 900; }
.shot-head strong, .shot-head small { display: block; }
.shot-head strong { font-size: 12px; }
.shot-head small { margin-top: 2px; color: var(--text-3); font-size: 9px; }
.shot-body { padding: 15px; }
.shot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.media-card { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.media { position: relative; aspect-ratio: 9 / 13; background: #090b09; }
.media.image { aspect-ratio: 3 / 4; }
.media img, .media video { width: 100%; height: 100%; display: block; object-fit: cover; }
.media-placeholder { height: 100%; display: grid; place-items: center; padding: 20px; color: var(--text-3); text-align: center; font-size: 10px; }
.media-body { padding: 13px; }
.media-body strong, .media-body small { display: block; }
.media-body small { margin-top: 4px; color: var(--text-3); font-size: 9px; }
.media-body .actions { margin-top: 12px; }
.status-tag { padding: 5px 8px; border-radius: 999px; color: var(--text-2); background: #2b302a; font-size: 8px; }
.status-tag.completed { color: #a4dbb8; background: var(--green-soft); }
.status-tag.failed { color: #ffaaaa; background: var(--red-soft); }
.status-tag.processing { color: #ffe0a3; background: #493817; }
.status-tag.warning { color: #ffe0a3; background: #493817; }
.segment-running-notice { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 9px; margin-bottom: 14px; padding: 11px 13px; border: 1px solid #5f4821; border-radius: 6px; background: #211b10; }
.segment-running-notice strong { font-size: 10px; }
.segment-running-notice small { color: var(--text-3); font-size: 9px; }
.segment-running-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.segment-progress-preview { position: relative; width: 100%; height: 100%; overflow: hidden; }
.segment-progress-preview > img { opacity: .42; }
.segment-progress-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; background: rgba(5, 7, 5, .58); }
.segment-progress-overlay strong { color: #fff1cf; font-size: 28px; line-height: 1; }
.segment-progress-overlay span { margin-top: 7px; color: var(--text-2); font-size: 9px; }
.segment-progress-track { width: min(220px, 78%); height: 6px; margin-top: 14px; overflow: hidden; border: 1px solid #4c4d44; border-radius: 999px; background: #10120f; }
.segment-progress-track i { display: block; height: 100%; background: var(--amber); transition: width .35s ease; }
.segment-card-progress { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; gap: 9px; margin-top: 12px; }
.segment-card-progress > div { height: 4px; overflow: hidden; border-radius: 999px; background: #2a2d27; }
.segment-card-progress i { display: block; height: 100%; border-radius: inherit; background: var(--amber); transition: width .35s ease; }
.segment-card-progress span { color: var(--text-3); font-size: 9px; text-align: right; }
.segment-card-progress.failed i { background: #cb5d5d; }
.host-layout { display: grid; grid-template-columns: minmax(240px, 330px) 1fr; gap: 20px; }
.host-preview { min-height: 430px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #0b0d0b; }
.host-preview img { width: 100%; height: 100%; min-height: 430px; display: block; object-fit: cover; }
.host-placeholder { min-height: 430px; display: grid; place-items: center; padding: 30px; color: var(--text-3); text-align: center; font-size: 11px; line-height: 1.7; }
.side-card h3 { margin: 0 0 14px; font-size: 13px; }
.side-card dl { display: grid; grid-template-columns: 78px 1fr; gap: 10px; margin: 0; font-size: 10px; }
.side-card dt { color: var(--text-3); }
.side-card dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.task-title { justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.task-title strong { font-size: 15px; }
.task-title small { display: block; margin-top: 3px; color: var(--text-3); font-size: 9px; }
.history-panel { margin-top: 18px; padding: 20px; }
.task-history { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.history-card { min-width: 0; display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 6px; color: inherit; background: var(--surface-2); text-align: left; cursor: pointer; }
.history-card:hover, .history-card.selected { border-color: #8f6f38; }
.history-index { width: 36px; height: 42px; display: grid; place-items: center; border-radius: 5px; color: var(--amber); background: var(--amber-soft); font-size: 10px; font-weight: 900; }
.history-card strong, .history-card small, .history-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-card strong { font-size: 11px; }
.history-card small { margin-top: 3px; color: var(--text-3); font-size: 8px; }
.history-card span { grid-column: 2; color: var(--amber); font-size: 8px; }
.empty { min-height: 170px; display: grid; place-items: center; color: var(--text-3); text-align: center; font-size: 11px; }
.final-video { width: min(100%, 620px); max-height: 680px; display: block; margin: 20px auto 0; border: 1px solid var(--line); border-radius: 7px; background: #000; }
.quality-report { max-width: 620px; margin: 18px auto 0; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); text-align: left; }
.quality-report .task-title { display: flex; align-items: center; }
.quality-report .task-title strong { font-size: 12px; }
.quality-report dl { display: grid; grid-template-columns: 74px 1fr; gap: 8px 12px; margin: 14px 0 0; font-size: 10px; }
.quality-report dt { color: var(--text-3); }
.quality-report dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.quality-detail { margin: 13px 0 0; color: var(--text-3); font-size: 9px; line-height: 1.6; }
.quality-warnings { margin: 13px 0 0; padding: 10px 10px 10px 24px; border: 1px solid #5f4821; border-radius: 5px; color: #ffe0a3; background: #211b10; font-size: 9px; line-height: 1.7; }
.quality-pass { margin: 13px 0 0; color: #a4dbb8; font-size: 9px; }
.complete { min-height: 480px; text-align: center; }
.complete h2 { margin: 10px 0 0; }
.complete p { color: var(--text-2); font-size: 11px; }
.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: min(420px, calc(100% - 44px)); padding: 12px 15px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text); background: #242824; box-shadow: var(--shadow); font-size: 11px; line-height: 1.5; opacity: 0; pointer-events: none; transform: translateY(10px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { color: #ffc1c1; border-color: #743b3b; background: #2d1919; }
.hidden { display: none !important; }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 1fr; }
  .side-panel { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-history { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { min-height: 64px; padding: 10px 14px; }
  .service-state { display: none; }
  .shell { width: min(100% - 22px, 1440px); padding-top: 14px; }
  .main-panel { min-height: 520px; padding: 18px 14px; }
  .form-grid, .shot-grid, .host-layout { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .upload-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .media-grid { grid-template-columns: 1fr; }
  .stage-item small { display: none; }
  .side-panel, .task-history { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .brand small { display: none; }
  .stage-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .duration-options { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-title { align-items: start; flex-direction: column; }
  .actions .button { flex: 1; }
}
