:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #16182b;
  --ink-2: #4b5168;
  --ink-3: #868ca3;
  --line: #e8e9f2;
  --line-strong: #d8dae8;
  --brand: #6750f5;
  --brand-2: #9d5cf5;
  --brand-soft: #f0edff;
  --ok: #12a06a;
  --ok-soft: #e8f8f1;
  --warn: #c47b12;
  --warn-soft: #fdf4e5;
  --err: #d43b3b;
  --err-soft: #fdecec;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(22, 24, 43, .04), 0 4px 14px rgba(22, 24, 43, .04);
  --shadow-md: 0 12px 40px rgba(46, 39, 110, .10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }

.wrap {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

/* ---------- 背景装饰 ---------- */
.bg-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(90px);
  opacity: .5;
}
.blob-1 {
  width: 520px; height: 520px;
  top: -180px; left: -120px;
  background: radial-gradient(circle, #d9d2ff 0%, rgba(217, 210, 255, 0) 70%);
}
.blob-2 {
  width: 480px; height: 480px;
  top: 60px; right: -160px;
  background: radial-gradient(circle, #d6ecff 0%, rgba(214, 236, 255, 0) 70%);
}

/* ---------- 导航 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: saturate(160%) blur(14px);
  background: rgba(255, 255, 255, .78);
  border-bottom: 1px solid rgba(232, 233, 242, .9);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 66px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.2px;
}
.brand-mark {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 6px 16px rgba(103, 80, 245, .28);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--brand);
  background: var(--brand-soft);
}
.nav-links {
  display: flex;
  gap: 22px;
  margin-left: auto;
  font-size: 14px;
  color: var(--ink-2);
}
.nav-links a:hover { color: var(--brand); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: #f2f3f8;
  font-size: 13px;
  color: var(--ink-2);
  max-width: 180px;
}
.user-chip .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c6bff, #b06bff);
}
.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
  transition: all .16s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 8px 20px rgba(103, 80, 245, .24);
}
.btn-primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(103, 80, 245, .3); }
.btn-ghost {
  color: var(--ink-2);
  background: #fff;
  border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-soft {
  color: var(--brand);
  background: var(--brand-soft);
}
.btn-soft:hover { background: #e5e0ff; }
.btn-danger-soft {
  color: var(--err);
  background: var(--err-soft);
}
.btn-danger-soft:hover { background: #fbdcdc; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 30px; height: 30px;
  border: none;
  border-radius: 8px;
  background: #f3f4f9;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.icon-btn:hover { background: #e9eaf3; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  padding: 56px 0 34px;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand);
  background: #fff;
  border: 1px solid #e6e2ff;
  padding: 5px 13px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.hero-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22c07a;
  box-shadow: 0 0 0 3px rgba(34, 192, 122, .16);
}
.hero h1 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.2;
  letter-spacing: -1px;
  margin: 18px 0 14px;
  font-weight: 800;
}
.hero h1 .grad {
  background: linear-gradient(100deg, var(--brand) 10%, var(--brand-2) 55%, #38b6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  color: var(--ink-2);
  font-size: 15.5px;
  max-width: 660px;
  margin: 0 auto;
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}
.hero-chips li {
  font-size: 12.5px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 999px;
}

/* ---------- 布局 ---------- */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
  padding-bottom: 40px;
}
.layout-main {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}
.layout-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 84px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.panel-head h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.2px;
}
.panel-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 4px;
}
.head-actions { display: flex; gap: 8px; flex-shrink: 0; }

.pill-soft {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: #f3f4f9;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-soft.is-active { color: var(--brand); background: var(--brand-soft); }

/* ---------- 上传区 ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 38px 24px;
  border: 1.5px dashed #d9d5f5;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfaff 0%, #f8f8fe 100%);
  cursor: pointer;
  transition: all .18s ease;
  text-align: center;
}
.dropzone:hover, .dropzone.is-drag {
  border-color: var(--brand);
  background: #f6f4ff;
  transform: translateY(-1px);
}
.dz-icon {
  width: 50px; height: 50px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: #fff;
  box-shadow: 0 8px 20px rgba(103, 80, 245, .12);
  margin-bottom: 4px;
}
.dz-icon svg { width: 24px; height: 24px; }
.dz-title { font-size: 15px; font-weight: 650; }
.dz-sub { font-size: 12.5px; color: var(--ink-3); }
.dropzone .btn-soft { margin-top: 10px; pointer-events: none; }

/* ---------- 文件列表 ---------- */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.file-list:empty { display: none; }

.file-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color .16s ease;
}
.file-item:hover { border-color: var(--line-strong); }
.file-thumb {
  width: 96px; height: 58px;
  border-radius: 9px;
  background: #111322 center/cover no-repeat;
  overflow: hidden;
  position: relative;
}
.file-thumb video, .file-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.file-thumb .duration {
  position: absolute;
  right: 4px; bottom: 4px;
  font-size: 10.5px;
  color: #fff;
  background: rgba(0, 0, 0, .62);
  padding: 1px 5px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.file-meta { min-width: 0; }
.file-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.file-sub .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: #cfd2e0; }
.file-progress {
  margin-top: 8px;
  height: 5px;
  border-radius: 99px;
  background: #f0f1f7;
  overflow: hidden;
}
.file-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .3s ease;
}
.file-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.file-state {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}
.file-state.is-error { color: var(--err); }
.file-state.is-ok { color: var(--ok); }

.seg {
  display: inline-flex;
  padding: 2px;
  background: #f2f3f8;
  border-radius: 9px;
  gap: 2px;
}
.seg button {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.seg button.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(22, 24, 43, .1);
}

.remove-file {
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.remove-file:hover { color: var(--err); }

.submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.submit-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.submit-hint svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------- 记录表 ---------- */
.table-wrap { overflow-x: auto; }
.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.task-table th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-3);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.task-table td {
  padding: 13px 12px;
  border-bottom: 1px solid #f2f3f8;
  vertical-align: middle;
}
.task-table tr:last-child td { border-bottom: none; }
.ta-right { text-align: right; }
.task-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.task-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: #f4f3ff;
  color: var(--brand);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.task-icon svg { width: 17px; height: 17px; }
.task-title {
  font-weight: 600;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.mode-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: #f3f4f9;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.mode-tag.is-region { color: var(--brand); background: var(--brand-soft); }

.status-cell { min-width: 132px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-uploading, .status-queued { color: var(--ink-2); background: #f0f1f7; }
.status-processing { color: var(--brand); background: var(--brand-soft); }
.status-done { color: var(--ok); background: var(--ok-soft); }
.status-failed { color: var(--err); background: var(--err-soft); }
.status-expired { color: var(--warn); background: var(--warn-soft); }
.mini-progress {
  height: 4px;
  border-radius: 99px;
  background: #eef0f7;
  margin-top: 6px;
  overflow: hidden;
  width: 118px;
}
.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .3s ease;
}
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.row-actions .btn { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.expire-text { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

.empty {
  padding: 40px 10px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}
.empty-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #f4f5fa;
  color: #b9bdd0;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
}
.empty-icon svg { width: 22px; height: 22px; }
.empty-row td { border-bottom: none !important; }

/* ---------- 侧栏 ---------- */
.side-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}
.steps { display: flex; flex-direction: column; gap: 11px; }
.steps li {
  display: flex;
  gap: 10px;
  font-size: 12.8px;
  color: var(--ink-2);
  line-height: 1.5;
}
.steps li span {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
}
.tips { display: flex; flex-direction: column; gap: 9px; }
.tips li {
  font-size: 12.5px;
  color: var(--ink-2);
  padding-left: 15px;
  position: relative;
  line-height: 1.55;
}
.tips li::before {
  content: "";
  position: absolute;
  left: 2px; top: 7px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #cfc8ff;
}
.cost-card {
  background: linear-gradient(160deg, #fbf9ff 0%, #f4f1ff 100%);
  border-color: #e9e4ff;
}
.cost-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  padding: 6px 0;
}
.cost-line strong { color: var(--ink); font-weight: 650; }
.cost-note {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed #ddd6ff;
  line-height: 1.55;
}

/* ---------- 页脚 ---------- */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .6);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 22, 40, .45);
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(16, 18, 40, .28);
  animation: pop .18s ease-out;
}
.modal-wide { width: min(760px, 100%); }
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-sub {
  font-size: 12.8px;
  color: var(--ink-3);
  margin-top: 6px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.modal-foot {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 12px;
  text-align: center;
  line-height: 1.5;
}

.tabs {
  display: flex;
  gap: 4px;
  background: #f3f4f9;
  padding: 4px;
  border-radius: 11px;
  margin: 16px 0;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-3);
  border-radius: 8px;
  cursor: pointer;
}
.tab.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(22, 24, 43, .1); }

.auth-form { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fcfcff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(103, 80, 245, .12);
}
.form-error {
  font-size: 12.5px;
  color: var(--err);
  background: var(--err-soft);
  padding: 8px 10px;
  border-radius: 8px;
}

/* ---------- 区域框选 ---------- */
.region-stage {
  position: relative;
  margin-top: 14px;
  background: #0e1020;
  border-radius: 12px;
  overflow: hidden;
  user-select: none;
  cursor: crosshair;
}
.region-stage video {
  display: block;
  width: 100%;
  max-height: 56vh;
  object-fit: contain;
  background: #0e1020;
}
.region-box {
  position: absolute;
  border: 1.5px solid #8b7bff;
  background: rgba(139, 123, 255, .18);
  box-shadow: 0 0 0 9999px rgba(10, 12, 26, .28);
  pointer-events: none;
}
.region-box::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px dashed rgba(255, 255, 255, .55);
  border-radius: 2px;
}
.region-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
  min-height: 30px;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #171a2e;
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(10, 12, 26, .3);
  animation: toast-in .2s ease-out;
  max-width: 90vw;
}
.toast.is-error { background: #b62f2f; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout-side { position: static; }
  .nav-links { display: none; }
  .hero { padding-top: 40px; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 28px); }
  .panel { padding: 18px; }
  .file-item { grid-template-columns: 72px minmax(0, 1fr); }
  .file-thumb { width: 72px; height: 46px; }
  .file-actions { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .submit-bar { flex-direction: column; align-items: stretch; }
  .submit-bar .btn { width: 100%; }
  .task-title { max-width: 140px; }
  .user-name { display: none; }
}
