/* 画布运营速览 —— Nexus 风格设计系统（浅色 / 卡片质感 / 动效对齐参考片）
   品牌色与字体严格取自 Mini Brand Guide：
   主色 #5347CE · 浅紫 #887CFD · 蓝 #4896FE · 青 #16C8C7 · 字体 SF Pro Display */
:root {
  --bg: #f0f1f5;
  --panel: #ffffff;
  --border: #e8eaf0;
  --border-strong: #dcdfe7;
  --text: #171c26;
  --text-2: #3f4654;
  --muted: #8a91a0;
  --muted-2: #a7adba;
  --accent: #5347ce;
  --accent-deep: #463bb8;
  --violet: #887cfb;
  --teal: #16c8c7;
  --blue: #4896fe;
  --purple: #887cfb;
  --teal-light: #7ce9e6;
  --green: #0e9f6e;
  --green-bg: #e2f5ec;
  --red: #e5484d;
  --red-bg: #fdebec;
  --amber: #d97706;
  --radius: 14px;
  --shadow-card: 0 1px 2px rgba(19, 25, 40, .04);
  --shadow-lift: 0 12px 30px rgba(19, 25, 40, .10), 0 2px 6px rgba(19, 25, 40, .05);
  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* 兜底：任何元素再溢出也不产生横向滚动，左右外壳保持固定 */
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
.muted { color: var(--muted); }
.muted.small, .small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.dash { color: var(--muted-2); }

/* ————————————— 外壳：视频同款“镜头推近”开场 ————————————— */
.app-shell {
  display: flex;
  min-height: 100vh;
  transform-origin: 50% 42%;
  animation: shellIn 1.1s cubic-bezier(.19, 1, .22, 1) both;
}
@keyframes shellIn {
  from { opacity: .45; transform: scale(.955); }
  to   { opacity: 1;    transform: scale(1); }
}
body.boot .card,
body.boot .src-card,
body.boot .stat-card,
body.boot .src-total {
  animation: cardIn .6s cubic-bezier(.22, .61, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(.992); }
  to   { opacity: 1; transform: none; }
}
.panel-enter { animation: panelIn .45s cubic-bezier(.22, .61, .36, 1) both; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
/* 页签切换时卡片错峰重放入场（boot 类只负责开场，之后由 panel-anim 驱动） */
.panel-anim .card,
.panel-anim .stat-card,
.panel-anim .src-card,
.panel-anim .src-total {
  animation: cardIn .6s cubic-bezier(.22, .61, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

/* ————————————— 侧栏 ————————————— */
.sidebar {
  width: 264px; flex: none;
  background: #f7f8fb;
  border-right: 1px solid rgba(23, 28, 38, .05);
  padding: 18px 14px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px 16px; }
.logo { display: inline-flex; }
.logo-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.side-collapse {
  margin-left: auto; width: 30px; height: 30px; flex: none;
  border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.side-collapse:hover { color: var(--text-2); border-color: var(--border-strong); background: #fff; }
.side-nav { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.side-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: var(--muted-2);
  padding: 14px 10px 6px;
}
.side-group:first-child .side-group-label { padding-top: 2px; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px;
  border-radius: 10px; border: 0; background: transparent; width: 100%;
  color: #565e6d; font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left;
  transition: background .15s ease, color .15s ease;
}
.side-item svg { flex: none; opacity: .85; }
.side-item:hover { background: #eef0f6; color: var(--text); text-decoration: none; }
.side-item.active { background: #e9ebf4; color: var(--text); font-weight: 600; }
.side-item.active svg { color: var(--accent); opacity: 1; }
.side-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--red-bg); color: var(--red); font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.side-beta {
  margin-left: auto; padding: 1px 7px; border-radius: 999px;
  background: #efeefc; color: #7a6cf0; font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.side-foot { margin-top: 14px; }
.team-card {
  display: flex; align-items: center; gap: 10px;
  background: #f1f2f7; border-radius: 12px; padding: 10px 12px;
  text-decoration: none; transition: background .15s ease, box-shadow .15s ease;
}
.team-card:hover { background: #e9ebf2; box-shadow: var(--shadow-card); }
.team-ic {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: linear-gradient(140deg, #38dbd9, #16c8c7);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(22, 200, 199, .28);
}
.team-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.team-txt em { font-style: normal; font-size: 11px; color: var(--muted); }
.team-txt b { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-caret { margin-left: auto; color: var(--muted-2); flex: none; }
.side-copy { margin-top: 10px; text-align: center; font-size: 10.5px; color: var(--muted-2); }

/* 折叠态 */
.app-shell.collapsed .sidebar { width: 76px; padding: 18px 10px 14px; }
.app-shell.collapsed .logo-name,
.app-shell.collapsed .side-group-label,
.app-shell.collapsed .side-item .txt,
.app-shell.collapsed .side-beta,
.app-shell.collapsed .team-txt,
.app-shell.collapsed .team-caret,
.app-shell.collapsed .side-copy { display: none; }
.app-shell.collapsed .side-item { justify-content: center; padding: 10px 0; }
.app-shell.collapsed .side-count { position: absolute; margin: 0; transform: translate(14px, -14px); }
.app-shell.collapsed .team-card { justify-content: center; padding: 8px; }
.app-shell.collapsed .side-brand { justify-content: center; padding-bottom: 12px; }
.app-shell.collapsed .side-collapse { position: absolute; right: 10px; }
.app-shell.collapsed .side-collapse svg { transform: rotate(180deg); }

/* ————————————— 顶栏 ————————————— */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 12px 22px;
}
.search {
  flex: 1; max-width: 560px;
  display: flex; align-items: center; gap: 9px;
  background: #f2f3f7; border: 1px solid transparent; border-radius: 10px;
  padding: 7px 12px; color: var(--muted);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.search:focus-within { background: #fff; border-color: var(--border-strong); box-shadow: 0 0 0 3px rgba(83, 71, 206, .08); color: var(--text-2); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font: 13.5px var(--font); color: var(--text); }
.search input::placeholder { color: var(--muted); }
.search kbd {
  font: 11px var(--font); color: var(--muted-2);
  border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 1px 6px;
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-ic {
  width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; cursor: pointer;
  color: #6a7280; display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.top-ic:hover { background: #f2f3f7; color: var(--text); text-decoration: none; }
.top-div { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.clock { font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, #887cfb, #5347ce);
  color: #fff; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.user-txt { display: flex; flex-direction: column; line-height: 1.25; }
.user-txt b { font-size: 13px; }
.user-txt em { font-style: normal; font-size: 11px; color: var(--muted); }

/* ————————————— 内容区 ————————————— */
main { padding: 20px 22px 56px; width: 100%; max-width: 1760px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.head-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 胶囊：日期范围 / 分段 / 按钮 / 下拉 */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px 12px; color: var(--muted); font-size: 13px;
}
.range-input {
  border: 0; background: transparent; outline: none;
  font: 13px var(--font); color: var(--text-2); width: 128px; color-scheme: light;
}
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; cursor: pointer; padding: 5px 12px; font-size: 13px; font-weight: 500;
  color: var(--muted); border-radius: 8px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.seg button:hover { color: var(--text); background: #f4f5f9; }
.seg button.active { background: #ecedf5; color: var(--text); font-weight: 600; }
.date-input, .input, .select {
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
  padding: 6px 11px; font-size: 13px; color: var(--text);
}
.input { width: 230px; }
.input:focus, .select:focus, .range-input:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 3px rgba(83, 71, 206, .08); }
.select.small { padding: 4px 26px 4px 10px; font-size: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--panel); border-radius: 10px;
  padding: 6px 13px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-2); white-space: nowrap;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { border-color: var(--border-strong); background: #fafbfd; box-shadow: var(--shadow-card); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.expand-btn { font-size: 11px; padding: 3px 9px; }

/* ————————————— 卡片 ————————————— */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-card);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.card:hover { box-shadow: 0 6px 20px rgba(19, 25, 40, .06), 0 1px 2px rgba(19, 25, 40, .04); border-color: var(--border-strong); }
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
  font-size: 14px;
}
.card-head b { font-weight: 650; }
.chip {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.chip-indigo { background: #e9e7fa; color: var(--accent); }
.chip-violet { background: #efeefc; color: #7a6cf0; }
.chip-blue   { background: #e8f2fe; color: var(--blue); }
.chip-teal   { background: #e0f7f7; color: var(--teal); }
.chip-amber  { background: #fdf1e2; color: var(--amber); }
.chip-gray   { background: #f1f2f6; color: #64748b; }
.head-btns { margin-left: auto; display: inline-flex; gap: 6px; }
.mini-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border); background: var(--panel); border-radius: 8px;
  padding: 5px 11px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.mini-btn:hover { color: var(--text); border-color: var(--border-strong); background: #fafbfd; }
.mini-btn.on { color: var(--accent); border-color: #d5d1f5; background: #f2f0fc; }
.mini-btn.square { width: 30px; padding: 0; justify-content: center; }
.chart-wrap { position: relative; height: 236px; }
.chart-wrap.tall { height: 296px; }
.chart-wrap.donut { height: 196px; }
.chart-wrap.rate { height: 460px; }
/* 画布必须锁定容器尺寸：JS 写 canvas.width = clientWidth × dpr 设置物理分辨率，
   若无 CSS 宽度，画布 CSS 宽度 = 属性宽度，下次绘制读回的 clientWidth 已被放大，
   每画一次 ×dpr 一次 → 指数增长 → 文档横向溢出（滑动错乱的根因）。
   锁成 100% 后 clientWidth 恒等于容器宽，属性宽度 = 容器宽 × dpr，稳定无溢出。 */
.chart-wrap canvas { display: block; width: 100%; height: 100%; }

/* ————————————— 统计卡（Page Views / Total Revenue 同款） ————————————— */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-card, .src-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-card);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.stat-card:hover, .src-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); border-color: var(--border-strong); }
.stat-top { display: flex; align-items: center; gap: 10px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-info { margin-left: auto; color: #c6cbd4; display: inline-flex; }
.stat-value-row { display: flex; align-items: baseline; gap: 10px; margin-top: 9px; flex-wrap: wrap; }
.stat-value {
  font-size: 27px; font-weight: 750; letter-spacing: -.02em; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; font-weight: 700; padding: 2.5px 9px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.delta svg { width: 11px; height: 11px; }
.delta.up   { background: var(--green-bg); color: var(--green); }
.delta.down { background: var(--red-bg); color: var(--red); }
.stat-sub { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.stat-sub b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 来源汇总卡（Token 页） */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 14px; }
.src-total {
  grid-column: 1 / -1; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 14px 18px;
  display: flex; flex-wrap: wrap; gap: 26px; font-size: 12px; color: var(--muted);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.src-total:hover { box-shadow: var(--shadow-lift); border-color: var(--border-strong); }
.src-total b { font-size: 19px; color: var(--text); font-variant-numeric: tabular-nums; display: block; letter-spacing: -.01em; }

/* ————————————— 网格 ————————————— */
.grid-2-1 { display: grid; grid-template-columns: 1.9fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-2-1 > .card { margin-bottom: 0; display: flex; flex-direction: column; height: 440px; }
/* 左卡：图表填满剩余高度，下方不留白边 */
.grid-2-1 > .card .chart-wrap.tall { flex: 1 1 auto; height: auto; min-height: 236px; }
.grid-2-1 > .card .flow-legend { flex: none; }
/* 右卡：固定框，列表在框内上下滚动 */
.grid-2-1 > .card .int-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding-right: 4px; }
.grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-1-1 > .card { margin-bottom: 0; }

/* 分布 KPI（Sales Distribution 同款三值：细竖条色标 + 标签 + 数值） */
.dist-kpis { display: flex; gap: 26px; flex-wrap: wrap; margin: 2px 2px 10px; }
.dist-kpi { display: flex; align-items: center; gap: 8px; }
.dist-kpi .k-dot { width: 3px; height: 15px; border-radius: 2px; flex: none; }
.dist-kpi em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.dist-kpi b { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* 流程图图例（按天调用分布） */
.flow-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.flow-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.flow-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.flow-legend b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; margin-left: 1px; }

/* ————————————— Partner 工具统计（List of Integration 同款） ————————————— */
.int-list { font-size: 13px; }
.int-row {
  display: grid; grid-template-columns: 18px minmax(0, 1.15fr) minmax(0, .9fr) minmax(0, 1.3fr) 84px;
  gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid #f1f2f6;
}
.int-row:last-child { border-bottom: 0; }
.int-row.int-head {
  color: var(--muted-2); font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  border-bottom: 1px solid var(--border); padding-bottom: 7px;
}
.int-check { width: 15px; height: 15px; accent-color: var(--accent); cursor: default; }
.int-app { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; color: var(--text); min-width: 0; }
.int-app span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.int-avatar {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.rate-cell { display: flex; align-items: center; gap: 8px; }
.rate-bar { width: 58px; height: 4px; border-radius: 2px; background: #edeff4; overflow: hidden; flex: none; }
.rate-bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); transform-origin: left; animation: barGrow .9s cubic-bezier(.22, .61, .36, 1) both; }
@keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ————————————— 表格 ————————————— */
.table-scroll { overflow-x: auto; border-radius: 8px; }
/* 网格子项禁止 min-content 撑列（大数字 / 长文本不会把统计卡、来源卡顶出轨道） */
.stat-card, .src-card { min-width: 0; }
/* 勾选列（导出 CSV 用） */
.th-select { width: 40px; }
.td-select { width: 40px; text-align: center; }
.row-check, .select-all { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.tbl { border-collapse: collapse; width: 100%; font-size: 13px; min-width: 1500px; }
.tbl.small { min-width: 900px; }
.tbl th {
  text-align: left; font-size: 10.5px; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--border); padding: 8px 10px; white-space: nowrap; background: #fafbfd; position: sticky; top: 0;
}
.tbl td { border-bottom: 1px solid #f2f3f7; padding: 9px 10px; vertical-align: top; }
.tbl tbody tr { transition: background .12s ease; }
.tbl tbody tr:hover { background: #f7f8fc; }
.tbl.small td { padding: 6px 10px; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 6px; padding: 2px 8px; vertical-align: middle; min-height: 22px;
  border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--muted);
  cursor: pointer; line-height: 1; font-size: 11px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); background: #f2f0fc; }
.filter-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fb-icon { width: 12px; height: 12px; display: block; flex: none; }
.fb-badge {
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px;
  background: rgba(255, 255, 255, .28); color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.th-expand { width: 46px; }

/* 状态标签（Nexus 圆角胶囊） */
.tag {
  display: inline-block; padding: 1.5px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); background: #f3f4f8; color: var(--text-2); margin: 1px 3px 1px 0; white-space: nowrap;
}
.tag.green  { background: var(--green-bg); border-color: #bde8d4; color: var(--green); }
.tag.red    { background: var(--red-bg); border-color: #f6c8ca; color: var(--red); }
.tag.orange { background: #fdf1e2; border-color: #f4d9ae; color: var(--amber); }
.tag.blue   { background: #e8f2fe; border-color: #c6e0fe; color: #2f72d8; }
.tag.violet { background: #efeefc; border-color: #d6d2f8; color: #6a5be0; }
.tag.gray   { background: #f1f2f6; border-color: #dfe2ea; color: #5b6472; }

.cell-user .name { font-weight: 600; }
.cell-user .handle { font-size: 11px; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; word-break: break-all; }
.clip { max-height: 45px; overflow: hidden; position: relative; }
.clip.expanded { max-height: none; }
.clip::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 14px; background: linear-gradient(transparent, #fff); pointer-events: none; }
.clip.expanded::after { display: none; }
.cell-media img, .cell-media video { max-width: 90px; max-height: 64px; border-radius: 6px; object-fit: cover; margin-right: 4px; vertical-align: middle; background: #000; }
.cell-media .no-media { color: var(--muted); font-size: 12px; }
.copy-btn { border: 0; background: none; cursor: pointer; color: #b6bcc6; font-size: 11px; padding: 0 2px; }
.copy-btn:hover { color: var(--accent); }

/* 展开详情行 */
tr.detail-row td { background: #fafbfd; padding: 16px 18px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 24px; }
.detail-grid .d-section { margin-bottom: 14px; }
.detail-grid .d-title { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
.pre-block {
  background: #f3f4f8; border-radius: 8px; padding: 10px 12px; font-size: 12px; white-space: pre-wrap; word-break: break-word;
  max-height: 260px; overflow: auto; margin: 0;
}
.media-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.media-item { width: 170px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.media-item .thumb { height: 150px; display: flex; align-items: center; justify-content: center; background: #f3f4f8; }
.media-item .thumb img, .media-item .thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-item .meta { padding: 6px 8px; font-size: 11px; color: var(--muted); }
.timing-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; font-size: 12px; margin: 0; }
.timing-dl dt { color: var(--muted); }
.timing-dl dd { margin: 0; font-variant-numeric: tabular-nums; }

/* 评价输入 */
.review-select { width: 100%; max-width: 120px; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; font-size: 12px; color: var(--text-2); background: #fff; }
.review-note { width: 100%; min-width: 180px; }
textarea.review-note { border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 12px; resize: vertical; min-height: 30px; max-height: 90px; font-family: inherit; }
textarea.review-note:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 3px rgba(83, 71, 206, .08); }
textarea.review-note.bad { border-color: var(--red); }
.save-review { font-size: 12px; padding: 4px 10px; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding-top: 12px; font-size: 13px; color: var(--muted); }
.pager button {
  border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: 13px; color: var(--text-2);
  transition: border-color .15s ease, background .15s ease;
}
.pager button:hover:not(:disabled) { border-color: var(--border-strong); background: #fafbfd; }
.pager button:disabled { opacity: .45; cursor: default; }

/* 筛选弹层 */
.filter-pop {
  position: fixed; z-index: 60; width: 280px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lift); padding: 10px;
  animation: popIn .18s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
.filter-pop-list { max-height: 300px; overflow: auto; margin: 8px 0; }
.filter-pop-list label { display: flex; gap: 8px; align-items: center; padding: 4px 2px; font-size: 13px; cursor: pointer; border-radius: 6px; }
.filter-pop-list label:hover { background: #f4f5f9; }
.filter-pop-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* 令牌门 */
[hidden] { display: none !important; }
.gate { position: fixed; inset: 0; z-index: 100; background: rgba(238, 240, 244, .92); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; animation: gateIn .25s ease both; }
@keyframes gateIn { from { opacity: 0; } to { opacity: 1; } }
.gate-box { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 28px 32px; width: 380px; box-shadow: var(--shadow-lift); }
.gate-box h2 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.01em; }
.gate-box .input { width: 100%; margin: 12px 0; }
.gate-box .btn { width: 100%; padding: 9px; }
.error { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 8px; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 90;
  background: #1c2130; color: #fff; font-size: 13px; padding: 9px 18px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(19, 25, 40, .28);
  animation: toastIn .3s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 速率图 */
.rate-strip { font-size: 12px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.rate-strip b { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ————————————— 轨迹回放页（请求轨迹 / 审计重建，直读画布生产库，浅色对齐设计系统） ————————————— */
/* 账号列的搜索框 */
.traj-search { padding: 0 2px 10px; }
.traj-search .input { width: 100%; font-size: 12.5px; padding: 7px 10px; }
.traj-status { margin: 0 2px; font-size: 12.5px; min-height: 18px; padding-top: 8px; }
.traj-status.error { color: var(--red); }
.traj-status.ok { color: var(--green); }

/* 选中账号的信息条（中列顶部） */
.traj-account-info { padding: 0 4px 10px; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.traj-account-info:empty { display: none; }
.traj-account-info .si-title { color: var(--text); font-weight: 600; font-size: 12.5px; }
.traj-account-info code { font-family: "SFMono-Regular", ui-monospace, monospace; font-size: 11px; background: #f1f2f7; border-radius: 5px; padding: 0 5px; }

.traj-grid { display: grid; grid-template-columns: minmax(210px, 1fr) minmax(210px, 1.05fr) minmax(0, 1.9fr); gap: 14px; align-items: start; }
.traj-col { display: flex; flex-direction: column; margin-bottom: 0; height: 660px; }
.traj-col .card-head { margin-bottom: 8px; }
.traj-list { list-style: none; margin: 0; padding: 0 2px; flex: 1 1 auto; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.traj-item { display: block; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 9px 10px; margin-bottom: 5px; cursor: pointer; transition: background .14s ease, border-color .14s ease; }
.traj-item:hover { background: #f6f7fb; border-color: var(--border); }
.traj-item[aria-pressed="true"] { background: #f2f0fc; border-color: #d5d1f5; box-shadow: var(--shadow-card); }
.traj-item .t-title { display: block; font-weight: 600; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.traj-item .t-meta { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.5; }
.traj-empty { color: var(--muted); font-size: 12.5px; padding: 22px 8px; }
.traj-col-foot { flex: none; padding-top: 10px; }
.mini-btn.wide { width: 100%; justify-content: center; }
.traj-path-title { font-family: "SFMono-Regular", ui-monospace, monospace; font-size: 11px; color: var(--accent); overflow-wrap: anywhere; padding: 0 4px 12px; min-height: 14px; }
.traj-timeline { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding-right: 6px; overscroll-behavior: contain; }

.traj-event { position: relative; margin: 0 0 16px 4px; padding: 0 0 2px 20px; border-left: 1px solid var(--border-strong); overflow-wrap: anywhere; }
.traj-event::before { content: ""; position: absolute; left: -4.5px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: #b7bcc9; border: 2px solid var(--panel); }
.traj-event.user::before { background: var(--blue); }
.traj-event.assistant::before { background: var(--accent); }
.traj-event.tool_call::before, .traj-event.tool_result::before { background: var(--amber); }
.traj-event.error::before { background: var(--red); }
.traj-event.error { border-left-color: #f0b6b8; }
.traj-event.annotation::before { background: var(--teal); }
.traj-event-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.traj-event-head .t-role { font-size: 13px; font-weight: 650; color: var(--text); }
.traj-badge { font-size: 10.5px; font-weight: 500; color: var(--muted); background: #f4f5f9; border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; }
.traj-event.error .traj-badge { color: var(--red); background: var(--red-bg); border-color: #f3c9cb; }
.traj-event-id { font-family: "SFMono-Regular", ui-monospace, monospace; font-size: 10.5px; color: var(--muted); margin: 5px 0; }
.traj-event-times { font-family: "SFMono-Regular", ui-monospace, monospace; font-size: 10.5px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0 10px; }
.traj-body { font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; color: var(--text-2); }
.traj-event pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: "SFMono-Regular", ui-monospace, monospace; font-size: 11px; line-height: 1.65; background: #f7f8fb; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; max-height: 400px; overflow: auto; margin: 8px 0; }
.traj-event details { margin-top: 8px; }
.traj-event summary { color: var(--muted); font-size: 11.5px; cursor: pointer; width: fit-content; padding: 2px 0; }


::-webkit-scrollbar-thumb { background: #cfd3de; border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* 响应式 */
@media (max-width: 1280px) {
  .grid-2-1, .grid-1-1 { grid-template-columns: 1fr; }
  .head-tools { margin-left: 0; }
  .grid-2-1 > .card { height: auto; }
  .grid-2-1 > .card .chart-wrap.tall { flex: none; height: 296px; }
  .grid-2-1 > .card .int-list { flex: none; overflow-y: visible; padding-right: 0; }
  .traj-grid { grid-template-columns: 1fr; }
  .traj-col { height: auto; }
  .traj-list, .traj-timeline { max-height: 320px; }
}
@media (max-width: 980px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .side-nav { display: flex; flex-wrap: wrap; }
  .side-group { display: contents; }
  .side-group-label, .side-foot { display: none; }
  .app-shell.collapsed .side-item .txt { display: inline; }
  main { padding: 16px 14px 48px; }
  .detail-grid { grid-template-columns: 1fr; }
  .chart-wrap.rate { height: 320px; }
}
