:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1b1f27;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --green: #12805c;
  --red: #b42318;
  --amber: #b45309;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 16px 0; }
.right { text-align: right; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 28px; height: 60px;
  background: #0f172a; color: #e2e8f0;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.logo {
  font-weight: 700; font-size: 19px; letter-spacing: 0.08em;
  background: linear-gradient(120deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 12px; color: #94a3b8; letter-spacing: 0.04em; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  color: #cbd5e1; padding: 7px 12px; border-radius: 8px; font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.nav a.active { background: rgba(96,165,250,0.18); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.user-name { color: #e2e8f0; }
.btn-link { background: none; border: 0; color: #94a3b8; cursor: pointer; font-size: 13px; padding: 0; }
.btn-link:hover { color: #fff; }
.chip {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.12);
  padding: 4px 10px; border-radius: 999px; font-size: 12px; color: #e2e8f0;
}
.chip-mock { background: rgba(251,191,36,0.18); border-color: rgba(251,191,36,0.4); color: #fbbf24; }

/* container */
.container { max-width: 1180px; margin: 0 auto; padding: 26px 24px 60px; }
.footer {
  display: flex; gap: 16px; justify-content: center;
  padding: 24px; color: var(--muted); font-size: 12px;
}

/* hero */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: linear-gradient(120deg, #0f172a 0%, #1e293b 60%, #1e3a8a 100%);
  color: #fff; border-radius: 16px; padding: 28px 30px; margin-bottom: 20px;
}
.hero h1 { color: #fff; font-size: 28px; }
.hero p { color: #cbd5e1; margin: 0; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 18px;
}
.page-head h1 { display: flex; align-items: center; gap: 10px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-num { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: 13px; }

/* cards */
.section-title { margin: 8px 0 12px; font-size: 16px; }
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.preset-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; color: var(--ink); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.preset-card:hover { border-color: #bfdbfe; text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15,23,42,0.06); }
.preset-kind { font-size: 11px; color: var(--accent); background: #eff6ff; display: inline-block; padding: 2px 8px; border-radius: 999px; margin-bottom: 8px; }
.preset-name { font-weight: 650; font-size: 16px; margin-bottom: 4px; }
.preset-desc { color: var(--muted); font-size: 13px; min-height: 40px; }
.preset-meta { font-size: 12px; color: #9ca3af; margin-top: 10px; }

.cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.cols-form { grid-template-columns: 1.5fr 1fr; align-items: start; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }

/* table */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.table td { padding: 10px; border-bottom: 1px solid #f1f3f5; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.card-table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

/* badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-queued { background: #f1f5f9; color: #475569; }
.badge-running { background: #eff6ff; color: #1d4ed8; }
.badge-done { background: #ecfdf5; color: var(--green); }
.badge-failed { background: #fef2f2; color: var(--red); }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { font-size: 13px; font-weight: 550; }
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 9px;
  font: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: #93c5fd; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; padding: 5px 8px; font-size: 13px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  font: inherit; font-weight: 550; cursor: pointer; background: #eef2f7; color: var(--ink);
}
.btn:hover { text-decoration: none; filter: brightness(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: #fff; border-color: #d1d5db; }
.btn-danger-ghost { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* alerts */
.alert { padding: 11px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--red); }

/* login */
.login-wrap { min-height: calc(100vh - 160px); display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px; box-shadow: 0 20px 50px rgba(15,23,42,0.08);
}
.login-brand { margin-bottom: 14px; }
.login-card h1 { font-size: 22px; }
.login-card .form { margin-top: 18px; }

/* thumbs */
.thumb-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.thumb-grid.small { grid-template-columns: repeat(6, 1fr); margin-top: 8px; }
.thumb {
  position: relative; display: block; aspect-ratio: 1; border-radius: 10px;
  overflow: hidden; background: #eef1f5; border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { text-decoration: none; }
.thumb .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; background: rgba(15,23,42,0.28);
}
.thumb-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 8px;
  background: linear-gradient(transparent, rgba(15,23,42,0.65));
  color: #fff; font-size: 11px;
}

/* progress */
.progress-panel { padding: 18px 20px; }
.progress-head { display: flex; align-items: center; gap: 14px; }
.bar { flex: 1; height: 8px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #6366f1); transition: width .4s; border-radius: 999px; }
.bar.big { height: 12px; }
.progress-cell { width: 170px; }
.progress-cell .bar { margin-bottom: 3px; }

/* steps */
.step-list { list-style: none; margin: 0; padding: 0; }
.step-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #eef1f5; font-size: 14px; }
.step-list li:last-child { border-bottom: 0; }
.step-dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; flex: none; }
.step-running { background: #3b82f6; box-shadow: 0 0 0 3px #dbeafe; }
.step-done { background: var(--green); }
.step-failed { background: var(--red); }
.step-status { margin-left: auto; font-size: 12px; }

/* kv */
.kv { display: grid; grid-template-columns: 76px 1fr; gap: 6px 10px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs a { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-size: 14px; }
.tabs a.active { background: #0f172a; color: #fff; }
.tabs a:hover { text-decoration: none; background: #eef1f5; }
.tabs a.active:hover { background: #0f172a; }

/* empty */
.empty { text-align: center; padding: 60px 20px; background: var(--panel); border: 1px dashed #d1d5db; border-radius: var(--radius); }

/* steps preview */
.steps-preview { margin: 0 0 18px; padding-left: 18px; color: #374151; font-size: 14px; }
.steps-preview li { margin-bottom: 4px; }
.side h2 { margin-top: 6px; }

@media (max-width: 900px) {
  .stats, .preset-grid { grid-template-columns: repeat(2, 1fr); }
  .cols, .cols-form { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; gap: 10px; }
  .nav { overflow-x: auto; }
  .brand-sub, .user-name { display: none; }
  .thumb-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 账号页 / 管理页补充 */
.narrow { max-width: 520px; }
.stat-num.warn { color: #f08a24; }
.alert-ok { background: rgba(46,160,67,.12); border: 1px solid rgba(46,160,67,.4); color: #7ee2a8; }
.thumb-video { width: 100%; display: block; border-radius: 10px; background: #000; }

.thumb-dl { display: block; padding-top: 4px; }

.step-retry { margin-left: auto; }
.btn-sm { padding: 2px 10px; font-size: 12px; }

.checks { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); }

/* 商品档案 */
.product-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:14px; }
.product-card { display:block; background:var(--panel); border:1px solid var(--line); border-radius:14px; overflow:hidden; color:inherit; }
.product-card:hover { border-color:var(--accent); }
.product-thumb { aspect-ratio:1/1; background:#111; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.product-thumb img { width:100%; height:100%; object-fit:cover; }
.product-thumb .ph { color:var(--muted); font-size:13px; }
.product-body { padding:10px 12px 12px; display:grid; gap:4px; }
.product-name { font-weight:600; }
.attached { margin-top:10px; display:grid; gap:6px; }
.attached .thumb-grid img { width:64px; height:64px; }
.empty { text-align:center; padding:60px 20px; display:grid; gap:10px; place-items:center; }

/* 素材库筛选与批量下载 */
.filters { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:14px; }
.filters select { padding:8px 10px; border-radius:9px; border:1px solid var(--line); background:var(--panel); color:var(--text); font-size:14px; }
.clear-filter { font-size:13px; }
.lib-bar { display:flex; flex-wrap:wrap; gap:12px; align-items:center; margin-bottom:12px; }
.check-all { display:inline-flex; align-items:center; gap:6px; font-size:14px; }
.thumb.selectable { position:relative; }
.thumb .lib-check { position:absolute; top:8px; left:8px; width:18px; height:18px; z-index:2; accent-color:var(--accent); }
.thumb-open { display:block; padding:2px 8px; font-size:12px; color:var(--muted); }
.pager { display:flex; gap:12px; align-items:center; justify-content:center; margin-top:18px; }

/* 生成图加入商品参考图 */
.promote { display:flex; gap:6px; margin-top:6px; }
.promote select { flex:1; min-width:0; padding:3px 6px; font-size:12px; border-radius:7px; border:1px solid var(--line); background:var(--panel); color:var(--text); }

/* 帮助中心 */
.help-steps { margin: 8px 0 4px 20px; line-height: 1.9; font-size: 14px; }
.faq { border-top: 1px solid var(--line); padding: 10px 0; }
.faq:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.faq p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }

/* 任务列表批量操作 */
.bulk-bar { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom:12px; }
.job-check { width:16px; height:16px; accent-color: var(--accent); }

/* 素材库加入参考图 */
.thumb .promote { margin-top: 6px; }
.thumb .promote select { width: 100%; padding: 3px 6px; font-size: 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }

/* 复制提示词 */
.step-copy { margin-left: auto; font-size: 12px; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0; }
.step-copy:hover { color: var(--accent); }
.step-copy ~ .step-retry { margin-left: 8px; }

/* 只读分享页 */
.share-body { background: var(--bg); }
.share-main { max-width: 1040px; margin: 0 auto; padding: 24px 18px 60px; }
.share-note { margin-top: 18px; }
.share-box { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:12px; }
.share-box input { flex:1 1 320px; padding:7px 10px; border-radius:8px; border:1px solid var(--line); background:var(--panel); color:var(--text); font-size:12px; }

/* 管理端筛选与分页 */
.filter-bar { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:14px; }
.filter-bar select { padding:6px 10px; border-radius:8px; border:1px solid var(--line); background:var(--panel); color:var(--text); }
.pager { display:flex; gap:10px; align-items:center; margin-top:14px; }
.code-box { white-space:pre-wrap; word-break:break-word; font-size:12px; color:var(--muted); background:var(--panel-2); padding:12px; border-radius:10px; }
.seg-list { margin: 8px 0 4px; display: grid; gap: 6px; max-width: 420px; }
.seg-row { display: grid; grid-template-columns: 44px 110px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.seg-label { color: var(--muted); }
.seg-count { font-variant-numeric: tabular-nums; }
.seg-bar { margin: 0; height: 6px; }
