/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #ff9d5c;
  --primary-2: #ffc08a;
  --primary-soft: #fff4e9;
  --primary-deep: #ff8a3d;
  --bg: #fbf7f2;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #8a93a6;
  --border: #f0e6db;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(120, 70, 20, .05), 0 8px 24px rgba(120, 70, 20, .06);
}

html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ============ 顶栏 ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: linear-gradient(120deg, #ffc08a, #ff9d5c);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 14px rgba(255, 157, 92, .35);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.brand h1 { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand p { font-size: 12px; opacity: .85; }
.topbar-actions button {
  background: rgba(255,255,255,.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
}
.topbar-actions button:hover { background: rgba(255,255,255,.28); }

/* ============ 标签页 ============ */
.tabs {
  display: flex;
  gap: 6px;
  padding: 14px 28px 0;
  max-width: 1200px;
  margin: 0 auto;
}
.tab {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-bottom: none;
  background: #eceef5;
  color: var(--muted);
  border-radius: 10px 10px 0 0;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.tab:hover { background: #e3e6f0; color: var(--text); }
.tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 -3px 10px rgba(255,157,92,.1);
}
.tab-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #d8dbe7;
  color: #5b6377;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.tab.active .tab-num { background: var(--primary); color: #fff; }

/* ============ 主区域 ============ */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 28px 60px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-head h2 { font-size: 17px; font-weight: 700; }
.muted { color: var(--muted); font-size: 12.5px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ 按钮 / 输入 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn:hover { border-color: #cfd3e0; background: #f8f9fc; }
.btn-primary {
  background: linear-gradient(120deg, var(--primary), var(--primary-2));
  border: none;
  color: #fff;
  box-shadow: 0 3px 10px rgba(255, 157, 92, .35);
}
.btn-primary:hover { filter: brightness(1.05); background: linear-gradient(120deg, var(--primary), var(--primary-2)); }
.btn-ghost { background: transparent; }
.btn-lg { padding: 10px 22px; font-size: 14.5px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }

.input, .textarea, select.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, select.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 157, 92, .16);
}
.textarea { resize: vertical; line-height: 1.7; font-family: "SF Mono", Consolas, "Courier New", monospace; font-size: 12.8px; }
.input-search { max-width: 320px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: #5b6377; }
.field-wide { flex: 2; }

/* ============ 筛选区 ============ */
.filters { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th {
  text-align: left;
  padding: 10px 14px;
  background: #f8f9fc;
  font-size: 12.5px; font-weight: 700; color: #5b6377;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f1f6;
  vertical-align: middle;
  font-size: 13px;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbff; }

.sku-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.sku-thumb {
  width: 52px; height: 52px; border-radius: 8px;
  object-fit: cover;
  background: #f0f1f6;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.sku-name { font-weight: 600; }
.sku-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.points-cell { max-width: 300px; }
.point-chip {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin: 1px 3px 1px 0;
}
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-mini {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  color: #4b5468;
  transition: all .15s;
}
.btn-mini:hover { border-color: var(--primary); color: var(--primary); }
.btn-mini.danger:hover { border-color: #dc2626; color: #dc2626; }
.btn-mini.primary { background: var(--primary-soft); border-color: #ffd9bd; color: var(--primary-deep); }
.btn-mini.primary:hover { background: #ffe9d5; }

.price-cell { font-weight: 700; color: var(--primary); white-space: nowrap; }
.empty-tip { text-align: center; color: var(--muted); padding: 30px 0; font-size: 13.5px; }

/* ============ 提示词工坊 ============ */
.prompt-form, .video-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 6px;
}
.prompt-form .btn-lg { align-self: end; }
.video-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.block-title {
  font-size: 14.5px; font-weight: 700;
  margin: 20px 0 10px;
  display: flex; align-items: center; gap: 10px;
}
.tag {
  background: #eef0f7;
  color: #5b6377;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.code-block { position: relative; }
.code-block .copy-btn { position: absolute; top: 10px; right: 10px; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.code-block .textarea { background: #fafbff; }

/* ============ 视频生成 ============ */
.progress-box { margin-top: 18px; }
.progress-track {
  height: 10px;
  background: #eef0f7;
  border-radius: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .3s ease;
}
.progress-text { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

#vr-video {
  width: 100%;
  max-height: 480px;
  border-radius: 10px;
  background: #000;
  border: 1px solid var(--border);
}

/* ============ 历史记录 ============ */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.history-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow .18s;
}
.history-card:hover { box-shadow: 0 6px 18px rgba(20,24,40,.1); }
.history-card video { width: 100%; height: 300px; object-fit: cover; background: #000; display: block; }
.history-info { padding: 10px 12px; }
.history-info h4 { font-size: 13.5px; margin-bottom: 4px; }
.history-info p { font-size: 12px; color: var(--muted); }
.history-actions { display: flex; gap: 6px; padding: 0 12px 12px; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 18, 30, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-mask[hidden] { display: none !important; }
.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  animation: popIn .2s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.modal-lg { max-width: 860px; }
.batch-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.batch-tools label.btn { cursor: pointer; }
.batch-tip {
  background: var(--primary-soft);
  border: 1px dashed #ffc9a3;
  color: #8a5a2e;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
}
.batch-tip code {
  background: rgba(255,255,255,.7);
  border: 1px solid #ffd9bd;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}
.bt-preview-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bt-preview-meta h3 { font-size: 14.5px; }
.bt-preview-meta .muted { flex: 1; }
.bt-preview-table { min-width: 520px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-head h2 { font-size: 16px; }
.btn-close {
  border: none; background: #f0f1f6; color: #5b6377;
  width: 30px; height: 30px; border-radius: 8px;
  font-size: 17px; cursor: pointer; line-height: 1;
}
.btn-close:hover { background: #e3e6f0; }
.modal-body { padding: 18px 22px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: #fff;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.form-grid .field { margin-bottom: 0; }
.modal-body .field { margin-bottom: 14px; }

.thumb-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumb-item { position: relative; }
.thumb-item img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border);
}
.thumb-item .thumb-del {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; background: #dc2626; color: #fff;
  font-size: 12px; cursor: pointer; line-height: 1;
}

.settings-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.settings-group h3 { font-size: 13.5px; color: #4b5468; }

/* ============ Toast ============ */
.toast-wrap {
  position: fixed; top: 70px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
}
.toast {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  min-width: 200px;
  animation: slideIn .25s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: #dc2626; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ============ 响应式 ============ */
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .tabs { padding: 12px 16px 0; }
  main { padding: 14px 16px 48px; }
  .form-grid { grid-template-columns: 1fr; }
  .brand p { display: none; }
}

/* ============ SKU 复选框列 ============ */
.col-check { width: 34px; text-align: center; }
.col-check input[type="checkbox"],
.row-check input[type="checkbox"] {
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--primary);
}
.row-check { width: 34px; text-align: center; vertical-align: middle; }

/* ============ 分页 ============ */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.pagination[hidden] { display: none !important; }
.page-info { font-size: 12px; color: var(--muted); }
.page-btns { display: flex; align-items: center; gap: 6px; }
.page-nums { display: flex; gap: 4px; }
.page-nums .btn-mini {
  min-width: 26px; text-align: center; padding: 4px 0;
}
.page-nums .btn-mini.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.page-nums .btn-mini:disabled { opacity: .4; cursor: not-allowed; }

/* ============ 批量生成任务队列 ============ */
.q-summary {
  font-size: 13px; color: #7c4a1d;
  background: var(--primary-soft);
  border: 1px solid #ffd9c2;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.q-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; }
.q-task {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; background: #fff;
}
.q-task .q-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.q-task .q-status { font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.q-task .q-status.waiting { color: var(--muted); }
.q-task .q-status.rendering { color: var(--primary); }
.q-task .q-status.done { color: var(--ok); }
.q-task .q-status.failed { color: #dc2626; }
.q-track { width: 90px; height: 6px; border-radius: 999px; background: #f0ece6; overflow: hidden; flex-shrink: 0; }
.q-track i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  border-radius: 999px; transition: width .3s;
}
