/* ═══════════════════════════════════════════════
   SliceLens · 直播切片商品理解工作台 Demo 1.0
   设计 token 见 PROMPT.md §8
   ═══════════════════════════════════════════════ */

:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --line: #e6e8f0;
  --line-2: #eef0f6;
  --ink: #1c2333;
  --ink-2: #5a6478;
  --ink-3: #9aa3b5;
  --brand: #5b5bd6;
  --brand-2: #a855f7;
  --grad: linear-gradient(135deg, #5b5bd6, #a855f7);
  --sidebar: #131a2c;
  --ok: #16a34a;
  --ok-bg: #e8f7ee;
  --err: #e5484d;
  --err-bg: #fdebec;
  --warn: #f59e0b;
  --warn-bg: #fef4e2;
  --info: #0ea5e9;
  --info-bg: #e6f5fd;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 12px rgba(16,24,40,.08);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --font: -apple-system, "SF Pro SC", "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; font-size: 13px; color: var(--ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.app { display: flex; height: 100vh; overflow: hidden; }

/* ═══════════ 侧边栏 ═══════════ */
.sidebar {
  width: 232px; flex: none;
  background: var(--sidebar);
  color: #c6cddd;
  display: flex; flex-direction: column;
  padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  background: var(--grad); color: #fff;
  font-size: 17px; border-radius: 10px;
}
.brand-text b { display: block; color: #fff; font-size: 15px; letter-spacing: .3px; }
.brand-text i { display: block; font-style: normal; font-size: 11px; color: #7d87a3; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  font-size: 13.5px; color: #aeb6cc;
  transition: background .15s, color .15s;
  text-align: left; width: 100%;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #e7eaf3; }
.nav-item.active { background: linear-gradient(135deg, rgba(91,91,214,.28), rgba(168,85,247,.22)); color: #fff; }
.nav-ico { font-size: 15px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.12); color: #cdd4e4;
  font-size: 11px; border-radius: 9px; font-variant-numeric: tabular-nums;
}
.nav-badge.warn { background: rgba(229,72,77,.25); color: #ff9fa2; }

.sidebar-foot { margin-top: auto; }
.foot-card { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); border-radius: 10px; padding: 12px; }
.foot-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #dfe4f0; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.ok { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.18); animation: pulse 2s infinite; }
.foot-sub { margin-top: 8px; font-size: 11px; line-height: 1.6; color: #6f7a99; }

/* ═══════════ 主区 / 顶栏 ═══════════ */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; flex: none;
  background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.crumb { font-size: 13px; color: var(--ink-2); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.search {
  width: 220px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fafbfe;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,91,214,.12); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); color: var(--ink-2); font-size: 14px;
  background: var(--panel);
}
.icon-btn:hover { background: var(--line-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 13px;
}

.view { flex: 1; overflow-y: auto; padding: 22px 24px; animation: fadeUp .18s ease; }

/* ═══════════ 通用组件 ═══════════ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.page-head h1 { font-size: 20px; font-weight: 600; }
.page-head .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.page-actions { display: flex; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 9px;
  font-size: 13px; font-weight: 500;
  transition: transform .1s, box-shadow .15s, background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 2px 8px rgba(91,91,214,.35); }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(91,91,214,.45); filter: brightness(1.05); }
.btn-ghost { border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-soft { background: var(--info-bg); color: #0369a1; }
.btn-soft:hover { background: #d8eefb; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 7px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 16px 18px; display: flex; gap: 13px; align-items: flex-start; }
.stat-ico {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-size: 17px;
}
.stat-ico.i1 { background: var(--info-bg); } .stat-ico.i2 { background: #f3f0ff; }
.stat-ico.i3 { background: var(--ok-bg); }  .stat-ico.i4 { background: var(--warn-bg); }
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-value { font-size: 21px; font-weight: 650; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.stat-delta { font-size: 11.5px; color: var(--ok); margin-top: 3px; }
.stat-delta.down { color: var(--ok); }

.chip-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 13px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 12.5px; color: var(--ink-2);
  transition: all .15s;
}
.chip:hover { border-color: #c9cde0; color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { font-variant-numeric: tabular-nums; opacity: .7; margin-left: 3px; font-size: 11.5px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-queued { background: #eef0f6; color: #6b7490; }
.pill-queued::before { animation: pulse 1.6s infinite; }
.pill-processing { background: var(--info-bg); color: #0369a1; }
.pill-processing::before { animation: pulse 1.2s infinite; }
.pill-done { background: var(--ok-bg); color: #15803d; }
.pill-failed { background: var(--err-bg); color: #c53035; }

.progress { height: 5px; border-radius: 3px; background: #edeff6; overflow: hidden; min-width: 90px; }
.progress i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #38bdf8, #6366f1); position: relative; }
.progress i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: shimmer 1.3s infinite;
}

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 6px; font-size: 11px; background: #f1f2f8; color: var(--ink-2);
}
.tag.brand { background: #f3f0ff; color: #6d28d9; }
.tag.warn { background: var(--warn-bg); color: #b45309; }
.tag.err  { background: var(--err-bg); color: #c53035; }
.tag.ok   { background: var(--ok-bg); color: #15803d; }
.tag.info { background: var(--info-bg); color: #0369a1; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-3);
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafbfe;
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-size: 13px; vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafbff; }
.table tbody tr.clickable { cursor: pointer; }
.table .num { font-variant-numeric: tabular-nums; }
.ellipsis { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ellipsis b { font-weight: 550; }
.t-sub { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.row-acts { display: flex; gap: 6px; }

.empty { text-align: center; padding: 46px 20px; color: var(--ink-3); }
.empty .e-ico { font-size: 34px; margin-bottom: 10px; }
.empty .e-t { font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.empty .e-s { font-size: 12px; }

/* ═══════════ 工作台 ═══════════ */
.meta-bar { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.meta-bar h2 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.meta-info { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.meta-info b { color: var(--ink); font-weight: 550; font-variant-numeric: tabular-nums; }

.pipe-strip { display: flex; align-items: stretch; gap: 0; padding: 13px 18px; margin-bottom: 14px; flex-wrap: wrap; }
.pipe-stage { flex: 1; min-width: 128px; position: relative; padding: 4px 14px; }
.pipe-stage + .pipe-stage::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 1px; background: var(--line);
}
.pipe-stage .ps-top { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 550; }
.ps-dot { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; background: #eef0f6; color: #98a0b6; flex: none; }
.pipe-stage.done .ps-dot { background: var(--ok-bg); color: var(--ok); }
.pipe-stage.active .ps-dot { background: var(--info-bg); color: #0284c7; animation: pulse 1.2s infinite; }
.pipe-stage .ps-meta { font-size: 11px; color: var(--ink-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.pipe-total { padding: 4px 2px 4px 16px; min-width: 150px; }
.pipe-total .pt-num { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pipe-total .pt-lab { font-size: 11px; color: var(--ink-3); }
.frame-chain { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.frame-chain .fc { font-size: 10.5px; background: #f1f2f8; color: var(--ink-2); border-radius: 5px; padding: 2px 6px; font-variant-numeric: tabular-nums; }
.frame-chain .fc b { color: #6d28d9; }

.ws-grid { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 14px; align-items: start; }

/* 视频模拟区 */
.video-mock { position: relative; aspect-ratio: 16/8.2; border-radius: var(--radius); overflow: hidden; background: #10152a; }
.vm-poster {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 62% 75% at 68% 42%, rgba(168,85,247,.5), transparent 62%),
    radial-gradient(ellipse 55% 70% at 24% 68%, rgba(14,165,233,.36), transparent 60%),
    linear-gradient(160deg, #171d33, #0d1122 72%);
}
.vm-emoji { position: absolute; inset: 0; display: grid; place-items: center; padding-bottom: 150px; font-size: 74px; opacity: .85; filter: drop-shadow(0 10px 26px rgba(0,0,0,.5)); }
.vm-badge { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.5); color: #dfe4f0; font-size: 11px; padding: 4px 9px; border-radius: 7px; backdrop-filter: blur(4px); }
.vm-live { position: absolute; top: 12px; right: 12px; background: rgba(229,72,77,.9); color: #fff; font-size: 11px; padding: 4px 9px; border-radius: 7px; }
.vm-play {
  position: absolute; inset: 0; display: grid; place-items: center;
}
.vm-play span {
  width: 58px; height: 58px; border-radius: 50%;
  background: rgba(255,255,255,.14); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.3);
  display: grid; place-items: center; font-size: 20px; color: #fff;
  transition: transform .15s, background .15s;
}
.vm-play:hover span { transform: scale(1.08); background: rgba(255,255,255,.22); }
.vm-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px; background: linear-gradient(transparent, rgba(5,8,18,.78)); display: flex; align-items: center; gap: 10px; color: #cdd4e4; font-size: 11px; }
.vm-bar .progress { flex: 1; background: rgba(255,255,255,.18); }
.vm-bar .progress i { background: var(--grad); }
.vm-ctrl { cursor: pointer; user-select: none; }

/* 时间轴 */
.tl-panel { margin-top: 14px; padding: 14px 16px 16px; }
.tl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tl-head h3 { font-size: 13.5px; font-weight: 600; }
.tl-head .tl-tools { display: flex; gap: 6px; align-items: center; }
.tl-legend { display: flex; gap: 12px; font-size: 11px; color: var(--ink-3); margin-right: 8px; }
.tl-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 4px; }
.tl-wrap { overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
.tl-inner { position: relative; min-width: 100%; }
.tl-ruler { position: relative; height: 20px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.tick { position: absolute; bottom: 0; width: 1px; height: 5px; background: #c9cde0; }
.tick.major { height: 9px; background: #9aa3b5; }
.tick.major::after {
  content: attr(data-t); position: absolute; bottom: 11px; left: 0;
  font-size: 10px; color: var(--ink-3); transform: translateX(-50%);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tl-lane { position: relative; height: 34px; margin-bottom: 6px; background: #f7f8fc; border-radius: 8px; }
.lane-hl { height: 18px; background: #fbf7ef; }
.lane-risk { height: 22px; background: #fdf5f5; margin-bottom: 0; }
.lane-cap { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 10px; color: #b6bccd; pointer-events: none; z-index: 2; }

.tl-block {
  position: absolute; top: 3px; bottom: 3px;
  border-radius: 7px; border: 1px solid;
  font-size: 11.5px; font-weight: 550;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 6px;
  transition: filter .12s, box-shadow .12s;
  min-width: 0;
}
.tl-block:hover { filter: brightness(.96); z-index: 3; }
.tl-block.selected { box-shadow: 0 0 0 2px var(--ink); z-index: 3; }
.tl-block.playing { box-shadow: 0 0 0 2px var(--warn); z-index: 3; }
.tl-hl {
  position: absolute; top: 3px; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, #fbbf24, #f97316);
  display: grid; place-items: center; font-size: 8px; color: #fff;
}
.tl-risk {
  position: absolute; top: 50%; transform: translate(-50%, -50%) rotate(45deg);
  width: 11px; height: 11px; border-radius: 3px;
  border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  padding: 0; z-index: 2;
}
.tl-risk.high { background: var(--err); }
.tl-risk.mid { background: var(--warn); }
.tl-risk:hover { transform: translate(-50%, -50%) rotate(45deg) scale(1.25); }
.tl-playhead {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--warn); z-index: 4; pointer-events: none;
  border-radius: 2px;
}
.tl-playhead::before {
  content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--warn); border-bottom: none;
}
/* 提示层基准定位;时间轴色块/高光条本身是 absolute 锚点,不可被覆盖 */
[data-tip]:not(.tl-block):not(.tl-hl):not(.tl-risk) { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: #1c2333; color: #fff; font-size: 11px; line-height: 1.5;
  padding: 7px 10px; border-radius: 8px; white-space: nowrap;
  z-index: 30; pointer-events: none;
  box-shadow: 0 6px 18px rgba(16,24,40,.25);
  font-weight: 400; text-align: left;
}

/* 检查器 */
.inspector { position: sticky; top: 0; max-height: calc(100vh - 150px); overflow-y: auto; }
.ins-block { padding: 15px 16px; }
.ins-block + .ins-block { border-top: 1px solid var(--line-2); }
.ins-title { font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: .4px; margin-bottom: 10px; }
.prod-card { display: flex; gap: 12px; align-items: center; }
.prod-emoji {
  width: 48px; height: 48px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-size: 24px;
}
.prod-info { flex: 1; min-width: 0; }
.prod-info h4 { font-size: 15px; font-weight: 600; }
.prod-info .p-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.prod-price { margin-top: 5px; display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.pp-now { font-size: 17px; font-weight: 700; color: var(--err); font-variant-numeric: tabular-nums; }
.pp-orig { font-size: 12px; color: var(--ink-3); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.pp-deal { font-size: 11px; background: var(--err-bg); color: #c53035; padding: 1px 7px; border-radius: 5px; }
.ring { position: relative; width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center; }
.ring::before { content: ""; position: absolute; inset: 5px; background: #fff; border-radius: 50%; }
.ring b { position: relative; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ring-lab { display: block; text-align: center; font-size: 10px; color: var(--ink-3); margin-top: 3px; }

.slice-box { background: #fafbff; border: 1px dashed #d5d9ea; border-radius: 10px; padding: 11px 12px; margin-top: 11px; }
.slice-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slice-row .s-range { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.slice-row .s-dur { font-size: 11.5px; color: var(--ink-3); }
.slice-reason { font-size: 11.5px; color: var(--ink-2); margin-top: 5px; line-height: 1.55; }
.slice-acts { display: flex; gap: 8px; margin-top: 10px; }

.sp-chips { display: flex; flex-direction: column; gap: 7px; }
.sp-chip { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; line-height: 1.5; }
.sp-chip .tag { flex: none; margin-top: 1px; min-width: 34px; justify-content: center; }

.kf-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kf-thumb { position: relative; aspect-ratio: 16/10; border-radius: 8px; overflow: hidden; display: grid; place-items: center; font-size: 20px; }
.kf-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(5,8,18,.72));
  color: #e7eaf3; font-size: 9.5px; padding: 10px 6px 4px;
  display: flex; justify-content: space-between; gap: 4px;
  white-space: nowrap;
}
.kf-cap .t { font-variant-numeric: tabular-nums; }

.trans-lines { display: flex; flex-direction: column; gap: 8px; }
.tr-line { font-size: 12.5px; line-height: 1.6; color: var(--ink-2); display: flex; gap: 8px; }
.tr-t { flex: none; font-size: 11px; color: var(--brand); font-variant-numeric: tabular-nums; background: #f3f0ff; border-radius: 5px; padding: 1px 6px; height: fit-content; margin-top: 1px; }
.kw { color: #6d28d9; font-weight: 600; background: #f3f0ff; border-radius: 4px; padding: 0 3px; }

.risk-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.risk-item + .risk-item { margin-top: 8px; }
.risk-item.high { border-color: #f5c2c4; background: #fef7f7; }
.risk-head { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; flex-wrap: wrap; }
.risk-quote { font-size: 12.5px; font-weight: 550; color: var(--ink); }
.risk-quote::before { content: "「"; color: var(--ink-3); font-weight: 400; }
.risk-quote::after { content: "」"; color: var(--ink-3); font-weight: 400; }
.risk-law { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.risk-fix { font-size: 12px; margin-top: 6px; color: #15803d; line-height: 1.5; }
.risk-fix::before { content: "→ 改写建议 "; font-size: 11px; color: var(--ink-3); }
.chan-tag { font-size: 10px; padding: 1px 6px; border-radius: 5px; }
.chan-tag.rule { background: var(--info-bg); color: #0369a1; }
.chan-tag.llm { background: #f3f0ff; color: #6d28d9; }

/* 处理中 / 失败态 */
.run-panel { padding: 40px; text-align: center; }
.run-panel .big-ico { font-size: 44px; margin-bottom: 14px; }
.run-panel h3 { font-size: 17px; margin-bottom: 6px; }
.run-panel .r-sub { color: var(--ink-3); font-size: 12.5px; margin-bottom: 22px; }
.log-box { max-width: 520px; margin: 0 auto; text-align: left; background: #10152a; border-radius: 10px; padding: 14px 16px; color: #9fe8b9; font-size: 12px; line-height: 1.9; font-family: Consolas, Menlo, monospace; }
.log-box .dim { color: #5f6b8f; }
.log-box .warn-ln { color: #fbbf24; }

/* ═══════════ 素材库 ═══════════ */
.lib-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.lib-toolbar .search { width: 240px; }
.select {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--ink-2);
}
.select:focus { outline: none; border-color: var(--brand); }
.lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lib-card { padding: 15px 16px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, transform .15s; position: relative; }
.lib-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.lc-top { display: flex; align-items: center; gap: 8px; }
.lc-prod { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.lc-prod .ellipsis { max-width: 150px; }
.lc-score { margin-left: auto; }
.lc-text { font-size: 13px; line-height: 1.6; color: var(--ink); }
.lc-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.lc-time { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; cursor: pointer; }
.lc-time:hover { color: var(--brand); text-decoration: underline; }
.pushed-badge { position: absolute; top: 12px; right: 14px; }
.thumb { position: relative; aspect-ratio: 16/7.5; border-radius: 9px; overflow: hidden; display: grid; place-items: center; font-size: 30px; }
.thumb .th-range { position: absolute; left: 8px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px; padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }

/* ═══════════ 成本报表 ═══════════ */
.cost-grid { display: grid; grid-template-columns: 400px minmax(0,1fr); gap: 14px; margin-bottom: 14px; }
.donut-wrap { display: flex; gap: 22px; align-items: center; padding: 20px; }
.donut { position: relative; width: 172px; height: 172px; flex: none; border-radius: 50%; }
.donut::before { content: ""; position: absolute; inset: 30px; background: var(--panel); border-radius: 50%; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; z-index: 1; }
.donut-center b { font-size: 20px; font-variant-numeric: tabular-nums; display: block; }
.donut-center i { font-style: normal; font-size: 11px; color: var(--ink-3); }
.legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-row .l-name { color: var(--ink-2); width: 76px; flex: none; }
.legend-row .l-val { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-row .l-pct { color: var(--ink-3); font-size: 11.5px; width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.bar-panel { padding: 18px 20px; }
.bar-panel h3 { font-size: 13.5px; margin-bottom: 14px; }
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 46px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #8b5cf6, #5b5bd6); transition: filter .15s; position: relative; }
.bar:hover { filter: brightness(1.12); }
.bar b { position: absolute; top: -19px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 550; }
.bar-col .b-name { font-size: 10.5px; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.opt-card { padding: 16px 18px; }
.opt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.opt-head h4 { font-size: 13.5px; }
.opt-card p { font-size: 12.5px; line-height: 1.65; color: var(--ink-2); }
.opt-num { font-size: 22px; font-weight: 700; margin: 8px 0 2px; font-variant-numeric: tabular-nums; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.opt-num-lab { font-size: 11px; color: var(--ink-3); }
.switch { position: relative; width: 36px; height: 20px; border-radius: 10px; background: #d5d9ea; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--ok); }
.switch.on::after { transform: translateX(16px); }

/* ═══════════ 弹窗 ═══════════ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(13,17,32,.5);
  backdrop-filter: blur(3px); z-index: 100;
  display: grid; place-items: center; animation: fadeIn .15s ease;
}
.modal { width: 560px; max-width: calc(100vw - 40px); background: var(--panel); border-radius: 16px; box-shadow: 0 24px 60px rgba(13,17,32,.35); animation: popIn .18s ease; overflow: hidden; }
.m-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.m-head h3 { font-size: 16px; }
.m-close { width: 30px; height: 30px; border-radius: 8px; color: var(--ink-3); font-size: 15px; }
.m-close:hover { background: var(--line-2); color: var(--ink); }
.m-body { padding: 16px 22px 4px; max-height: 62vh; overflow-y: auto; }
.m-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px 18px; }
.m-hint { font-size: 11.5px; color: var(--ink-3); }
.m-hint b { color: var(--ink-2); }

.tabs { display: flex; gap: 4px; background: #f1f2f8; padding: 4px; border-radius: 9px; margin-bottom: 14px; }
.tab { flex: 1; height: 32px; border-radius: 7px; font-size: 13px; color: var(--ink-2); }
.tab.active { background: #fff; color: var(--ink); font-weight: 550; box-shadow: var(--shadow-sm); }

.dropzone {
  border: 1.5px dashed #cfd4e6; border-radius: 12px; padding: 26px 16px;
  text-align: center; color: var(--ink-3); font-size: 12.5px;
  transition: all .15s; margin-bottom: 14px; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: #f7f6ff; color: var(--brand); }
.dropzone .d-ico { font-size: 26px; display: block; margin-bottom: 8px; }
.dropzone.picked { border-style: solid; border-color: var(--ok); background: var(--ok-bg); color: #15803d; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.field .input, .field select {
  width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 11px;
  background: #fafbfe; transition: border-color .15s, box-shadow .15s;
}
.field .input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,91,214,.12); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ═══════════ Toast ═══════════ */
#toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: #1c2333; color: #fff; font-size: 13px;
  padding: 11px 16px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(13,17,32,.3);
  display: flex; align-items: center; gap: 8px;
  animation: toastIn .22s ease;
  max-width: 360px;
}
.toast.ok::before { content: "✅"; }
.toast.err::before { content: "⛔"; }
.toast.info::before { content: "💡"; }

/* ═══════════ 动画 ═══════════ */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ═══════════ 细节 ═══════════ */
.inspector::-webkit-scrollbar, .view::-webkit-scrollbar, .tl-wrap::-webkit-scrollbar, .m-body::-webkit-scrollbar { width: 8px; height: 8px; }
.inspector::-webkit-scrollbar-thumb, .view::-webkit-scrollbar-thumb, .tl-wrap::-webkit-scrollbar-thumb, .m-body::-webkit-scrollbar-thumb { background: #d3d7e4; border-radius: 4px; }
.inspector::-webkit-scrollbar-track, .view::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1240px) {
  .ws-grid { grid-template-columns: 1fr; }
  .inspector { position: static; max-height: none; }
  .lib-grid, .opt-grid { grid-template-columns: repeat(2, 1fr); }
  .cost-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════
   2.0 增量样式
   ═══════════════════════════════════════════════ */

/* 新状态 */
.pill-paused { background: var(--warn-bg); color: #b45309; }
.pill-cancelled { background: #eef0f6; color: #8b93a7; }
.danger-armed { background: var(--err-bg) !important; color: #c53035 !important; border-color: #f5c2c4 !important; }
.tl-wrap, .vm-bar .progress { cursor: crosshair; }
.tl-block { cursor: pointer; }

/* 合规中心双 Tab */
.tabbar { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tabbar-btn {
  padding: 10px 18px; font-size: 13.5px; color: var(--ink-2);
  border-radius: 9px 9px 0 0; position: relative; top: 2px;
  border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 7px;
  transition: color .15s, background .15s;
}
.tabbar-btn:hover { color: var(--ink); background: #fafbff; }
.tabbar-btn.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; background: #f7f6ff; }
.tabbar-btn .n { font-size: 11px; background: #eef0f6; border-radius: 8px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.tabbar-btn.active .n { background: #e6e5fb; }

/* 超时诊断卡 */
.diag-card {
  max-width: 520px; margin: 0 auto 6px; text-align: left;
  background: var(--warn-bg); border: 1px solid #f3ddb0; border-radius: 10px; padding: 12px 16px;
}
.dc-row { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.7; }
.dc-lab { flex: none; width: 62px; color: #b45309; font-weight: 600; }
.dc-row + .dc-row { border-top: 1px dashed #eedcb4; margin-top: 6px; padding-top: 6px; }

/* 素材库:按商品分组 */
.lib-group { margin-bottom: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.lg-head { display: flex; align-items: center; gap: 11px; padding: 13px 16px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 8%, #fff), #fff); border-left: 4px solid var(--c, var(--brand)); }
.lg-emoji { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; flex: none; }
.lg-info { min-width: 0; }
.lg-info b { font-size: 14.5px; display: block; }
.lg-info i { font-style: normal; font-size: 11.5px; color: var(--ink-3); display: block; margin-top: 2px; }
.lg-stats { margin-left: auto; display: flex; gap: 8px; }
.lg-stats span { font-size: 11.5px; color: var(--ink-2); background: #f1f2f8; border-radius: 7px; padding: 3px 9px; font-variant-numeric: tabular-nums; }
.lg-stats b { color: var(--ink); }
.lg-body { padding: 4px 16px 16px; }
.lg-sec + .lg-sec { margin-top: 12px; }
.lg-sec-t { font-size: 12px; font-weight: 600; color: var(--ink-3); margin: 10px 0 9px; letter-spacing: .3px; }
.lg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* 模型配置 */
.models-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.model-card { padding: 16px 18px; }
.mc-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 13px; }
.mc-head h4 { font-size: 14.5px; }
.mc-head i { font-style: normal; font-size: 11px; color: var(--ink-3); display: block; margin-top: 3px; }
.mc-fields .frow { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.mc-fields label { font-size: 11.5px; color: var(--ink-2); }
.mc-fields .input {
  height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px;
  background: #fafbfe; width: 100%; font-size: 12.5px;
  transition: border-color .15s, box-shadow .15s;
}
.mc-fields .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,91,214,.12); }
.mc-test { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--line); }
.mc-result { font-size: 11.5px; color: #15803d; }
.mc-result.off { color: var(--ink-3); }

/* 文案收件箱 */
.inbox-list { display: flex; flex-direction: column; gap: 10px; }
.inbox-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.inbox-item.ignored { opacity: .55; }
.ii-main { flex: 1; min-width: 0; }
.ii-text { font-size: 13px; }
.ii-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

/* 成本模拟器 */
.sim-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.sim-slots .frow { display: flex; flex-direction: column; gap: 5px; }
.sim-slots label { font-size: 11.5px; color: var(--ink-2); }
.sim-compare { display: flex; gap: 26px; align-items: stretch; padding: 14px 0; border-top: 1px dashed var(--line); }
.sim-nums { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 220px; }
.sim-nums > div { display: flex; align-items: baseline; gap: 8px; }
.sim-nums i { font-style: normal; font-size: 11.5px; color: var(--ink-3); width: 44px; }
.sim-nums b { font-size: 19px; font-variant-numeric: tabular-nums; }
.sim-arrow { color: var(--ink-3); font-size: 16px; }
.sim-save { font-size: 13px; font-weight: 650; color: var(--ok); background: var(--ok-bg); border-radius: 8px; padding: 4px 10px; }
.sim-save.up { color: #c53035; background: var(--err-bg); }
.sim-cmp { flex: 1; display: flex; flex-direction: column; gap: 9px; justify-content: center; min-width: 0; }
.sim-cmp-row { display: flex; align-items: center; gap: 10px; }
.sc-name { flex: none; width: 42px; font-size: 11.5px; color: var(--ink-2); }
.sc-bars { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.sc-bar { height: 13px; border-radius: 4px 6px 6px 4px; position: relative; min-width: 2px; transition: width .3s; }
.sc-bar span { position: absolute; left: calc(100% + 7px); top: 50%; transform: translateY(-50%); font-size: 10.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sc-bar.before { background: #d8dbe6; }
.sc-bar.after { background: linear-gradient(90deg, #5b5bd6, #a855f7); }
.sim-risk { border-radius: 10px; padding: 11px 14px; font-size: 12.5px; line-height: 1.65; display: flex; gap: 10px; align-items: baseline; }
.sim-risk b { flex: none; font-size: 13px; }
.sim-risk.none { background: #f1f2f8; color: var(--ink-2); }
.sim-risk.low { background: var(--ok-bg); color: #15803d; }
.sim-risk.mid { background: var(--warn-bg); color: #b45309; }
.sim-risk.high { background: var(--err-bg); color: #c53035; }

@media (max-width: 1240px) {
  .models-grid, .sim-slots { grid-template-columns: 1fr; }
  .lg-grid { grid-template-columns: 1fr; }
  .sim-compare { flex-direction: column; }
}

/* ═══════════ 2.0 合规规则库 Eval 自动校验 ═══════════ */
.rf-note { background: var(--warn-bg); border: 1px solid #f3ddb0; color: #b45309; font-size: 12px; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; line-height: 1.6; }
.eval-panel { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 4px; }
.eval-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.eval-title { font-size: 12.5px; font-weight: 650; }
.eval-hint { font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.eval-banner { border-radius: 8px; padding: 9px 12px; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.eval-banner.pass { background: var(--ok-bg); color: #15803d; }
.eval-banner.fail { background: var(--err-bg); color: #c53035; }
.eval-items { display: flex; flex-direction: column; gap: 6px; }
.eval-item { display: flex; gap: 8px; font-size: 12px; line-height: 1.6; align-items: baseline; }
.eval-item b { flex: none; font-size: 11.5px; width: 122px; }
.eval-item.ok b { color: var(--ok); }
.eval-item.warn b { color: #b45309; }
.eval-item.fail b { color: var(--err); }
.eval-item span { color: var(--ink-2); }
.eval-polished { margin-top: 8px; font-size: 11.5px; color: #6d28d9; background: #f3f0ff; border-radius: 8px; padding: 7px 10px; }

