/* 带货视频工作台 —— 工作台风格：冷静深色面、单一琥珀强调色、细分割线 */
:root {
  --bg: #0d0e10;
  --surface: #14161a;
  --surface-2: #1a1d22;
  --line: #262a30;
  --line-soft: #1e2227;
  --text: #e9ebee;
  --muted: #8b929c;
  --dim: #6a7079;
  --accent: #ffb43a;
  --accent-ink: #1a1204;
  --ok: #3ecf8e;
  --err: #ff6b6b;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(13, 14, 16, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: .02em;
}
.tag {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
}

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 28px;
  align-items: start;
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 20px 80px;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
.col-form { display: flex; flex-direction: column; gap: 2px; }
.col-run { position: sticky; top: 78px; }

/* ---------- 步骤 ---------- */
.step {
  padding: 26px 0;
  border-top: 1px solid var(--line-soft);
}
.col-form .step:first-child { border-top: 0; padding-top: 4px; }

.step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.idx {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  letter-spacing: .08em;
  padding-top: 2px;
}
.step-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 620;
  letter-spacing: .01em;
}
.badge {
  font-size: 10.5px;
  font-family: var(--mono);
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.req { color: var(--accent); border-color: rgba(255, 180, 58, .35); }

.lede {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13.5px;
}
.hint {
  margin: -4px 0 0;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ---------- 分段控件 ---------- */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-bottom: 16px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.seg-btn.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg-btn:not(.is-active):hover { color: var(--text); }

.seg-panel { display: none; }
.seg-panel.is-active { display: block; animation: fade .22s ease both; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 拖放区 ---------- */
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 30px 16px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--surface-2); }
.drop-title { font-size: 14px; font-weight: 560; }
.drop-sub { font-size: 12px; color: var(--dim); font-family: var(--mono); }

.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.chip .meta { color: var(--dim); font-size: 12px; font-family: var(--mono); }

/* ---------- 商品图缩略图 ---------- */
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute;
  top: 5px; right: 5px;
  width: 20px; height: 20px;
  border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .68);
  color: #fff; font-size: 12px; line-height: 1;
  cursor: pointer;
}
.thumb .name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 6px 4px;
  font-size: 10px; color: #d7dae0;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row { display: flex; gap: 8px; margin-top: 8px; }

input[type="text"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .18s ease;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
textarea { resize: vertical; line-height: 1.6; }
input[type="text"]:focus, select:focus, textarea:focus { border-color: var(--accent); }
::placeholder { color: var(--dim); }

.stepper { display: flex; align-items: center; gap: 12px; }
.stepper output {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}
input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 0;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border: 0;
  border-radius: 50%; background: var(--accent); cursor: pointer;
}

/* ---------- 开关 ---------- */
.switch {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text) !important;
  font-size: 14px !important;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative;
  width: 38px; height: 22px;
  border-radius: 999px;
  background: var(--line);
  transition: background .2s ease;
  flex: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s cubic-bezier(.4, 1.3, .5, 1);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ---------- 说明块 ---------- */
.note {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 2px solid var(--accent);
  background: linear-gradient(90deg, rgba(255, 180, 58, .07), transparent 70%);
  border-radius: 0 8px 8px 0;
}
.note strong {
  display: block;
  font-size: 12.5px;
  color: var(--accent);
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.note p { margin: 0 0 8px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.note p:last-child { margin-bottom: 0; }
.note em { color: var(--text); font-style: normal; }

/* ---------- 按钮 ---------- */
.btn {
  font: inherit;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, opacity .18s ease;
}
.btn:hover { border-color: var(--dim); }
.btn.ghost { flex: none; padding: 10px 14px; font-size: 13px; }
.btn.primary {
  width: 100%;
  padding: 13px 18px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  letter-spacing: .02em;
}
.btn.primary:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary.is-running { opacity: .6; cursor: progress; }

/* ---------- 执行台 ---------- */
.step.run { border-top: 0; padding-top: 4px; }

.summary {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.summary li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 13px;
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.summary li:last-child { border-bottom: 0; }
.summary .k { color: var(--muted); flex: none; }
.summary .v { color: var(--text); text-align: right; word-break: break-all; }
.summary .v.miss { color: var(--err); }

.progress { margin-top: 18px; }
.bar {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9d2e, var(--accent));
  transition: width .5s cubic-bezier(.4, 0, .2, 1);
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
}

.log {
  margin-top: 16px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  background: #0a0b0d;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  scrollbar-width: thin;
}
.log-line { display: flex; gap: 8px; animation: slide .25s ease both; }
.log-line .t { color: var(--dim); flex: none; }
.log-line .s { color: var(--accent); flex: none; }
.log-line.info .m { color: #c8ccd2; }
.log-line.warn .m { color: var(--accent); }
.log-line.error .m { color: var(--err); }
.log-line.ok .m { color: var(--ok); }
@keyframes slide { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }

.gallery { margin-top: 20px; }
.gallery h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.gallery-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  animation: fade .3s ease both;
}
.gallery-grid img { width: 100%; display: block; aspect-ratio: 9 / 16; object-fit: cover; }
.gallery-grid figcaption {
  padding: 5px 7px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}

.result { margin-top: 20px; animation: fade .35s ease both; }
.result video {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #000;
  display: block;
}
.result .meta {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  font-family: var(--mono);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.result .acts { margin-top: 12px; display: flex; gap: 8px; }
.result .acts a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  transition: border-color .18s ease;
}
.result .acts a:hover { border-color: var(--accent); color: var(--accent); }
.result details { margin-top: 12px; }
.result summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
  padding: 8px 0;
}
.result pre {
  margin: 0;
  padding: 12px;
  background: #0a0b0d;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c8ccd2;
}

/* ---------- 顶栏补充 ---------- */
.brand { text-decoration: none; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.btn.primary.sm {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}
.btn.ghost.danger { color: var(--err); }
.btn.ghost.danger:hover { border-color: var(--err); }

/* ---------- 视图容器 ---------- */
.view { animation: fade .2s ease both; }
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 20px 80px;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
.wrap.head-wrap { padding-bottom: 0; }

/* ---------- 任务列表 ---------- */
.view-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.view-head h1 { margin: 0; font-size: 19px; font-weight: 650; }
.counts { display: flex; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; }
.cnt { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.cnt.run { color: var(--accent); border-color: rgba(255, 180, 58, .3); }
.cnt.ok { color: var(--ok); border-color: rgba(62, 207, 142, .3); }
.cnt.err { color: var(--err); border-color: rgba(255, 107, 107, .3); }

.job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 16px;
}

.job-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease;
}
.job-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.jc-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  overflow: hidden;
}
.jc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jc-thumb .ph {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--dim); font-size: 12px;
}
.jc-thumb .play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff;
  background: rgba(0, 0, 0, .28);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
}
.jc-thumb .status-badge { position: absolute; left: 9px; bottom: 9px; }
.jc-del {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px;
  border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff; font-size: 14px; line-height: 1;
  cursor: pointer; opacity: 0;
  transition: opacity .18s ease, background .18s ease;
}
.job-card:hover .jc-del { opacity: 1; }
.jc-del:hover { background: var(--err); }

.jc-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 7px; }
.jc-title {
  margin: 0;
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.jc-sub {
  margin: 0;
  font-size: 12px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.9em;
}
.jc-meta {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; color: var(--dim);
}
.jc-meta span { opacity: .6; }

.mini-bar { height: 3px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.mini-bar i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #ff9d2e, var(--accent));
  transition: width .5s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 状态徽章 ---------- */
.status-badge {
  display: inline-block;
  font-size: 11px; font-family: var(--mono);
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.status-badge.queued { color: var(--muted); }
.status-badge.running {
  color: var(--accent);
  border-color: rgba(255, 180, 58, .35);
  background: rgba(255, 180, 58, .08);
}
.status-badge.running::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.status-badge.ok { color: var(--ok); border-color: rgba(62, 207, 142, .35); background: rgba(62, 207, 142, .08); }
.status-badge.err { color: var(--err); border-color: rgba(255, 107, 107, .35); background: rgba(255, 107, 107, .08); }
.status-badge.dim { color: var(--dim); }

/* ---------- 空态 ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty p { margin: 0 0 16px; font-size: 14px; }

/* ---------- 任务详情 ---------- */
.job-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 4px;
  flex-wrap: wrap;
}
.job-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.job-head .spacer { flex: 1; }

/* ---------- 移动端 ---------- */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 18px 16px 60px;
  }
  .col-run { position: static; }
  .step.run {
    border-top: 1px solid var(--line);
    padding-top: 24px;
  }
  .log { max-height: 240px; }
  .grid2 { grid-template-columns: 1fr; gap: 20px; }
  .topbar { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .topbar .tag { display: none; }
  .wrap { padding: 18px 16px 60px; }
  .wrap.head-wrap { padding-bottom: 0; }
  .job-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .jc-del { opacity: 1; }
}
