:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2433;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --ok: #059669;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
}
.brand { font-size: 17px; }
.brand b { letter-spacing: .3px; }
.brand-suffix { color: var(--muted); font-size: 12px; margin-left: 2px; }
#nav { display: flex; gap: 4px; flex: 1; }
#nav a {
  padding: 7px 14px; border-radius: 8px; color: var(--muted);
  text-decoration: none; font-weight: 500;
}
#nav a:hover { background: var(--bg); color: var(--text); }
#nav a.active { background: var(--primary-light); color: var(--primary); }

main { max-width: 1180px; margin: 24px auto 80px; padding: 0 24px; }

/* cards */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }

/* inputs */
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
textarea { resize: vertical; min-height: 56px; }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: inherit; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fef2f2; border-color: #fecaca; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* badges / chips */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; background: var(--primary-light); color: var(--primary); font-weight: 500;
}
.badge.gray { background: #f3f4f6; color: var(--muted); }
.badge.green { background: #ecfdf5; color: var(--ok); }
.badge.red { background: #fef2f2; color: var(--danger); }
.chip {
  display: inline-flex; align-items: center; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border); cursor: pointer; user-select: none; font-size: 13px;
}
.chip.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* product images */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; border: 0;
  font-size: 11px; line-height: 18px; text-align: center; cursor: pointer; padding: 0;
}

/* shots table */
.shots { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.shots th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.shots td { padding: 6px 8px; border-bottom: 1px solid #f1f2f5; vertical-align: top; }
.shots textarea { min-height: 38px; font-size: 13px; padding: 6px 8px; }

/* progress */
.progress { height: 8px; background: #eef0f4; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s; }

/* job list */
.job { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid #f1f2f5; }
.job:last-child { border-bottom: 0; }
.job .info { flex: 1; min-width: 0; }
.job .msg { font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* video grid */
.vcard video { width: 100%; aspect-ratio: 9/16; max-height: 420px; border-radius: 8px; background: #000; }

/* login */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 360px; background: #fff; border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 10px 40px rgba(16,24,40,.08);
  padding: 38px 34px; text-align: center;
}
.login-logo { font-size: 40px; }
.login-card h2 { margin: 6px 0 4px; }
.login-card p { margin: 0 0 22px; }
.login-card input { margin-bottom: 12px; text-align: center; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px !important; }

/* toasts */
#toasts { position: fixed; top: 70px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1f2433; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: 380px;
  animation: slidein .25s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* misc */
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.section-title h2 { margin: 0; font-size: 17px; }
.empty { text-align: center; color: var(--muted); padding: 46px 0; }
.kv { font-size: 13px; color: var(--muted); margin: 2px 0; }
.script-head { display: flex; align-items: flex-start; gap: 10px; }
.script-head input[type=checkbox] { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--primary); }
.selectbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--border);
  padding: 12px 24px; display: flex; justify-content: center; gap: 14px; align-items: center;
  box-shadow: 0 -4px 16px rgba(16,24,40,.06);
}
@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 0 12px; overflow-x: auto; }
  main { padding: 0 12px; }
}

/* ============ V2 升级 ============ */
/* 图标 */
.ic { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -3px; }
.ic.lg { width: 20px; height: 20px; }
#nav a { display: inline-flex; align-items: center; gap: 7px; }

/* 时长规划条 */
.plan-bar { display: flex; gap: 18px; flex-wrap: wrap; background: var(--primary-light); border-radius: 10px; padding: 12px 16px; margin: 4px 0 14px; font-size: 13px; }
.plan-bar b { color: var(--primary); font-size: 16px; }
.plan-bar .pi { display: flex; flex-direction: column; gap: 2px; }
.plan-bar .pi span { color: var(--muted); font-size: 11.5px; }

/* 分镜卡片网格 */
.shotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 12px; }
.shotcard { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.shotcard .thumb-wrap { position: relative; aspect-ratio: 9/16; background: #11131a; max-height: 300px; }
.shotcard .thumb-wrap img, .shotcard .thumb-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.shotcard .ov { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #fff; background: rgba(15,17,23,.55); font-size: 12.5px; }
.shotcard .seq { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.shotcard .mode-tag { position: absolute; top: 8px; right: 8px; background: rgba(79,70,229,.92); color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 11px; }
.shotcard .body { padding: 10px 11px; display: flex; flex-direction: column; gap: 7px; }
.shotcard .meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.shotcard textarea { min-height: 34px; font-size: 12.5px; padding: 5px 7px; }
.shotcard .acts { display: flex; gap: 6px; }
.shotcard .acts .btn { flex: 1; padding: 5px 6px; font-size: 12px; }

/* 骨架/spinner */
.skel { background: linear-gradient(100deg, #1b1e27 30%, #262a36 50%, #1b1e27 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spin { width: 22px; height: 22px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* 选项 chip 行 */
.chips-label { font-size: 12.5px; color: var(--muted); margin: 10px 0 6px; font-weight: 500; }

/* 试听播放按钮 */
.play-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--primary); }
.play-btn:hover { background: var(--primary-light); }
.play-btn.playing { background: var(--primary); color: #fff; }

/* 音色库列表项 */
.voice-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 7px; }
.voice-row .vn { flex: 1; }
.voice-row .va { font-size: 11px; color: var(--muted); }

/* 合规警告 */
.compliance-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; margin-top: 8px; }

/* focus 可见（可访问性） */
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
