:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --accent2: #34d399;
  --danger: #f87171;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px; border-bottom: 1px solid var(--border);
}
.brand h1 { margin: 0; font-size: 20px; }
.subtitle { color: var(--muted); font-size: 13px; }
.health { font-size: 13px; color: var(--accent2); }

.tabs {
  display: flex; gap: 6px; padding: 14px 28px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tab {
  background: none; border: none; color: var(--muted);
  padding: 10px 16px; cursor: pointer; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

main { padding: 24px 28px; max-width: 1080px; }
.panel { display: none; }
.panel.active { display: block; }

.form-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.form-row input[type=text] {
  flex: 1; min-width: 260px; padding: 11px 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px;
}
.form-row input[type=file] { color: var(--muted); font-size: 13px; }
.options { gap: 18px; font-size: 13px; color: var(--muted); }
.options select {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px;
}
.check input { margin-right: 6px; }
.or { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin-top: -4px; }

.btn {
  padding: 11px 20px; border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 14px; font-weight: 600;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 6px 12px; font-size: 12px; }

.progress { margin: 10px 0; display: none; }
.progress.show { display: block; }
.progress .bar {
  height: 8px; background: var(--panel2); border-radius: 6px; overflow: hidden;
}
.progress .bar > div {
  height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .3s;
}
.progress .msg { font-size: 12px; color: var(--muted); margin-top: 6px; white-space: pre-wrap; }

.result { margin-top: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; }
video, img { max-width: 100%; border-radius: 8px; }
video { max-height: 420px; background: #000; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.grid img { width: 100%; height: 90px; object-fit: cover; border: 1px solid var(--border); }
.grid .cap { font-size: 11px; color: var(--muted); text-align: center; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.kv .item { background: var(--panel2); border-radius: 8px; padding: 10px 12px; }
.kv .k { font-size: 11px; color: var(--muted); }
.kv .v { font-size: 15px; font-weight: 600; margin-top: 3px; }

textarea.output {
  width: 100%; min-height: 220px; background: var(--panel2);
  color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-size: 14px; line-height: 1.6;
}
.chip { display: inline-block; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px; font-size: 12px; margin: 3px; color: var(--text); }
.muted { color: var(--muted); }
.error { color: var(--danger); }
canvas.wave { width: 100%; height: 90px; background: var(--panel2); border-radius: 8px; }

/* ---------- 侧边导航布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 58px); }
.sidebar {
  width: 200px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 16px 10px; display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  background: none; border: none; text-align: left; color: var(--muted);
  padding: 11px 14px; cursor: pointer; font-size: 14px; border-radius: 8px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel2); color: var(--text); border-left-color: var(--accent); }
.sidebar .sep { height: 1px; background: var(--border); margin: 10px 8px; }

main { flex: 1; padding: 24px 28px; min-width: 0; max-width: none; }

.top-actions { display: flex; align-items: center; gap: 14px; }
.quota { font-size: 13px; color: var(--accent2); }
.quota.low { color: var(--danger); }

.form-col { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.form-col textarea {
  width: 100%; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px;
  padding: 11px 14px; resize: vertical; line-height: 1.6; font-family: inherit;
}
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---------- 任务中心 ---------- */
.task-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px;
}
.task-row .kind { font-weight: 600; min-width: 90px; }
.task-row .status { font-size: 12px; padding: 2px 10px; border-radius: 12px; white-space: nowrap; }
.status.queued { background: #3a4150; color: #cbd5e1; }
.status.running { background: #1e3a5f; color: #7cb8ff; }
.status.done { background: #12382a; color: #34d399; }
.status.error { background: #4a1d1d; color: #f87171; }
.task-row .progress-mini { flex: 1; height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.task-row .progress-mini > div { height: 100%; background: var(--accent); }
.task-row .time { font-size: 12px; color: var(--muted); white-space: nowrap; }
