/* 取色与层级对齐 YouTube Studio（Google 工作台）：白底 + 浅灰分隔 + 单一蓝色主色，
   不用描边阴影堆层次，靠 1px 线和字重区分主次，长时间盯数字不累眼。 */
:root {
  --bg: #f9f9f9;
  --panel: #ffffff;
  --primary: #065fd4;
  --primary-weak: #e8f0fe;
  --text: #0f0f0f;
  --muted: #606060;
  --border: #e5e5e5;
  --danger: #d93025;
  --danger-bg: #fce8e6;
  --ok: #0f9d58;
  --warn: #b26a00;
  --warn-bg: #fef1e0;
  --radius: 12px;
  --shadow: none;
  /* 语义分组色：内容产出 / 流量 / 变现 / 风险 */
  --tone-produce: #065fd4;
  --tone-traffic: #0f9d58;
  --tone-money: #7c3aed;
  --tone-risk: #d93025;
  --sidebar-bg: #ffffff;
}

* { box-sizing: border-box; }

/* 保证 hidden 属性优先于组件的 display（如 flex），避免隐藏元素仍显示 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); display: inline-block; }

/* ==================== 登录门禁 ==================== */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.gate-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 36px;
  width: 320px;
  text-align: center;
}
.gate-tip { color: var(--muted); margin: 12px 0 20px; }
.qr-box { display: flex; align-items: center; justify-content: center; min-height: 220px; }
.qr-box img { width: 220px; height: 220px; }
.qr-placeholder { color: var(--muted); }
.gate-status { color: var(--danger); min-height: 20px; margin: 12px 0 4px; }

/* ==================== 顶栏 ==================== */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: stretch;
  gap: 8px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 16px;
}
.topbar-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }

/* ==================== 终端连接状态条（「版本管理」页内） ==================== */
.term-strip {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 16px;
  padding: 6px 10px;
  margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #f6f8fa;
}
.term-lights { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* 一枚圆形指示灯：中间压人员姓名最后一个字（白字），绿=在线 / 红=离线 */
.term-light {
  position: relative; width: 34px; height: 34px; padding: 0;
  border: none; border-radius: 50%; cursor: default;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600; font-family: inherit;
  background: #9aa0a6;
}
.term-light.is-on { background: var(--ok); box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.18); }
.term-light.is-off { background: var(--danger); box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.16); }
.term-light-name { line-height: 1; }
.term-empty { font-size: 12px; color: var(--muted); }
.term-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.term-progress { font-size: 12px; color: var(--muted); }
.term-progress.is-error { color: var(--danger); }
.term-progress.is-warn { color: var(--warn); }
/* 「同步」的日期选择：默认前一天，跟按钮同排、同高 */
.term-date { font: inherit; font-size: 12px; height: 28px; padding: 0 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
/* 最近终端作业：逐台列出结果，每台下面按时间线展开「每一步」的执行明细 */
/* 「最近终端作业」卡头：标题/汇总/终止按钮同一行，按钮贴右 */
.job-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 8px; font-size: 13px; }
.job-panel-head #termJobCancel { margin-left: auto; }
.job-terminal { border-top: 1px solid var(--border); padding: 10px 0; }
.job-terminal:first-of-type { border-top: none; padding-top: 0; }
.job-terminal:last-child { padding-bottom: 0; }
.job-terminal-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.job-terminal-line { font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--bg); white-space: nowrap; }
.job-terminal-summary { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-terminal-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.job-badge.is-ok { background: #ecfdf5; color: var(--ok); }
.job-badge.is-failed { background: var(--danger-bg); color: var(--danger); }
.job-badge.is-partial { background: var(--warn-bg); color: var(--warn); }
.job-badge.is-empty { background: var(--warn-bg); color: var(--warn); }
.job-badge.is-running { background: var(--primary-weak); color: var(--primary); }
.job-badge.is-cancelled { background: var(--warn-bg); color: var(--warn); }
/* 采集完成情况：逐行 人 × 线路 × 日期，上方按人员筛选 + 「全部采集」 */
/* 「采集完成情况」卡头：标题与汇总一行，筛选控件自成一行，别用 float 挤歪文本 */
.collect-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin-bottom: 10px; }
.collect-title { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.collect-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
/* 七列（人员/线路/日期/采集状态/采集结果/日志/操作）：线路名要给足宽度，否则「30 · 邮箱11(人间纪实录) · 香港25」
   这种长名会被挤成三行，整表高度被拉长；容器不够宽时由 .table-scroll 横向滚动兜底 */
.collect-table { margin-top: 4px; }
.collect-table td { white-space: nowrap; }
.collect-table th:nth-child(1) { width: 90px; }
.collect-table th:nth-child(2) { width: 220px; }
.collect-table th:nth-child(3) { width: 106px; }
.collect-table th:nth-child(4), .collect-table th:nth-child(5) { width: 88px; }
.collect-table th:nth-child(6) { width: 90px; }
.collect-table th:nth-child(7) { width: 96px; }
.collect-table td:nth-child(2) { white-space: normal; }
/* 采集结果三态：成功绿 / 失败红 / 未采到（跑完但 0 条、跳过）橙 */
.collect-result { font-size: 12px; }
.collect-result.is-ok { color: var(--ok); }
.collect-result.is-failed { color: var(--danger); }
.collect-result.is-empty { color: var(--warn); }
/* 采集完成情况分页条：左侧「共 N 条 · 日期区间」，右侧翻页按钮 */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 13px; }
.pager-btns { display: inline-flex; align-items: center; gap: 8px; }
.pager-page { font-variant-numeric: tabular-nums; color: var(--muted); }
.job-steps { list-style: none; margin: 8px 0 0; padding: 0 0 0 4px; }
.job-step { position: relative; padding: 2px 0 2px 18px; font-size: 12px; color: var(--muted); line-height: 1.5; }
/* 竖线串起每一步，圆点颜色表示这一步的状态 */
.job-step::before {
  content: ''; position: absolute; left: 3px; top: 9px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--primary);
}
.job-step::after {
  content: ''; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 1px; background: var(--border);
}
.job-step:last-child::after { display: none; }
.job-step.is-done::before { background: var(--ok); }
.job-step.is-failed::before { background: var(--danger); }
.job-step.is-skipped::before { background: var(--border); }
.job-step-time { display: inline-block; min-width: 62px; font-variant-numeric: tabular-nums; color: var(--muted); }
.job-step-label {
  display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 4px;
  background: var(--primary-weak); color: var(--primary); font-size: 11px;
}
.job-step-msg { color: var(--text); }
.job-step.is-failed .job-step-msg { color: var(--danger); }
.topbar-crumb { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* 范围在上、时段在下：先决定「看谁」，再决定「看多久」，两排职责不混 */
.topbar-center {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex: 1 1 auto; justify-content: center;
}
.scope-row, .range-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scope-row .range-label, .range-row .range-label { width: 28px; }
.range-label { font-size: 12px; color: var(--muted); }
.snap-chip {
  font-size: 12px; color: var(--text); background: #f1f5f9;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
@media (max-width: 900px) {
  .topbar-center { order: 3; flex-basis: 100%; justify-content: flex-start; }
}

.badge {
  padding: 2px 10px; border-radius: 999px; font-size: 12px;
  background: var(--primary-weak); color: var(--primary);
}
.badge.admin { background: #fff7ed; color: #c2410c; }

.input, .select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--text); font-size: 13px; font-family: inherit;
}
.btn {
  padding: 6px 14px; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--primary); color: #fff; cursor: pointer; font-size: 13px; font-family: inherit;
}
.btn:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--border); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); }

/* ==================== 左侧菜单 ==================== */
#app { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
  width: 220px; flex: none;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: width .16s ease;
}
/* 品牌区与导航同底（Studio 的左侧栏是纯白），靠一条分隔线分区，不用深色块抢视线 */
.sidebar-head {
  display: flex; align-items: center; gap: 8px;
  padding: 16px; border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 700; font-size: 16px;
  white-space: nowrap; overflow: hidden;
}
.sidebar-head .brand-dot { background: #065fd4; }
.sidebar-sub { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; flex: 1; overflow: hidden; }
/* 导航分组标题 */
.nav-group {
  padding: 10px 12px 4px; font-size: 11px; color: var(--muted);
  letter-spacing: .04em; white-space: nowrap; overflow: hidden;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: none; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 14px; font-family: inherit; text-align: left;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: #f1f5f9; color: var(--text); }
.nav-item.is-active { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.nav-ico { width: 18px; flex: none; text-align: center; }
.side-collapse {
  margin: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--muted); cursor: pointer;
  font-size: 12px; font-family: inherit;
  display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden;
}
.side-collapse:hover { background: #f1f5f9; }
/* 收起态：只留图标 */
#app.is-collapsed .sidebar { width: 56px; }
#app.is-collapsed .nav-text,
#app.is-collapsed .sidebar-brand,
#app.is-collapsed .sidebar-sub,
#app.is-collapsed .nav-group { display: none; }
#app.is-collapsed .sidebar-head { justify-content: center; padding-left: 0; padding-right: 0; }
#app.is-collapsed .nav-item,
#app.is-collapsed .side-collapse { justify-content: center; padding-left: 0; padding-right: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar-title { font-weight: 600; font-size: 15px; }

.content { padding: 16px 24px 40px; max-width: 1440px; width: 100%; }
.loading { color: var(--muted); }

/* 总览内页签：下划线式，与顶栏时段控件（描边胶囊）拉开区分，避免两排控件看起来是一类 */
.view-tabs {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  margin-bottom: 14px; border-bottom: 1px solid var(--border);
}
.view-tab {
  padding: 8px 14px; border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 14px; font-family: inherit;
  margin-bottom: -1px;
}
.view-tab:hover { color: var(--text); }
.view-tab.is-active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

/* 切页签 / 切范围时轻微淡入：避免整页硬闪，观感更连贯 */
.view { animation: viewFade .18s ease; }
@keyframes viewFade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

/* 口径说明条：本系统与 YouTube Studio 的第一处差别要先讲清 —— 这里是多账号加总 */
.scope-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; margin-bottom: 12px; font-size: 12px;
  background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: 10px;
}
.scope-bar.is-single { border-left-color: var(--tone-traffic); }
.scope-bar-chip { font-size: 13px; font-weight: 600; }
.scope-bar-desc { color: var(--muted); }
.scope-bar-meta { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 分析主卡：一句话结论 + 指标行 + 趋势图，整块照搬 Studio 的概览卡结构。
   指标行是「选指标」的入口 —— 点谁，下面的图就换成谁。 */
.an-card { padding: 20px 24px 8px; margin-bottom: 16px; }
.an-headline {
  margin: 0 0 4px; font-size: 22px; font-weight: 400; line-height: 1.4;
  letter-spacing: -.01em;
}
.an-headline b { font-weight: 500; }
.an-subhead { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.metric-row {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 16px 0 4px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.metric-cell {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 12px 14px; border: none; border-right: 1px solid var(--border);
  background: var(--panel); font-family: inherit; text-align: left; cursor: pointer;
  transition: background .12s ease;
}
.metric-cell:last-child { border-right: none; }
.metric-cell:hover { background: #f7f7f7; }
/* 选中项灰底：与 Studio 一致，当前在看哪个指标一眼可辨 */
.metric-cell.is-active { background: #f2f2f2; }
.metric-cell.is-active .metric-label { color: var(--text); font-weight: 600; }
.metric-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.metric-value {
  font-size: 26px; font-weight: 400; line-height: 1.2; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.metric-delta { font-size: 11px; line-height: 1.4; }
.metric-delta .up { color: var(--ok); }
.metric-delta .down { color: var(--danger); }
@media (max-width: 1100px) { .metric-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 680px) { .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.an-chart-head {
  display: flex; align-items: baseline; gap: 12px; justify-content: space-between;
  padding: 16px 0 4px; font-size: 13px;
}
.an-chart-title { font-weight: 500; }
.an-chart-title b { font-weight: 600; }
#trendChart { padding-bottom: 4px; }

/* 逐账号贡献：把合计拆回各账号，条形长度=相对最大值，一眼看出谁在贡献 */
.contrib-row { cursor: pointer; }
.contrib-row:hover { background: #f8fafc; }
.contrib-name { font-weight: 600; }
.contrib-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.contrib-track {
  flex: 1 1 auto; max-width: 120px; height: 6px;
  background: #eef2f7; border-radius: 999px; overflow: hidden;
}
.contrib-track > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.contrib-num { min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.mini-badge {
  display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px;
  background: #ecfdf5; color: var(--ok);
}
.mini-badge.is-off { background: #f1f5f9; color: var(--muted); }

/* 内容榜缩略图：借 YouTube 官方缩略图接口，加载失败时留一块灰底不塌陷 */
.content-thumb { width: 92px; }
.content-thumb img {
  display: block; width: 76px; height: 43px; object-fit: cover;
  border-radius: 6px; background: #eef2f7;
}

/* ==================== 卡片 ==================== */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px;
}
.card + .card { margin-top: 12px; }

.section-title { font-size: 15px; font-weight: 600; margin: 18px 0 10px; }

/* 总览驾驶舱栅格 */
/* 逐账号贡献表整块铺满一行：与上下两张「指标 + 趋势」卡一样都是整宽卡片，不再分左右栏 */
.overview-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
.overview-main { display: grid; gap: 12px; align-content: start; }

/* 主趋势图 + 右侧「按人排行」：图占主区，排行固定在右，两者联动同一个指标 */
.an-chart-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 236px;
  gap: 16px; align-items: start;
}
.an-chart-rank { border-left: 1px solid var(--border); padding-left: 14px; }
.rank-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 13px; font-weight: 500; padding-bottom: 8px;
}
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; }
.rank-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-value { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.rank-track {
  grid-column: 1 / -1; height: 6px; border-radius: 999px;
  background: #eef2f7; overflow: hidden;
}
.rank-track > i { display: block; height: 100%; border-radius: 999px; }
@media (max-width: 1000px) {
  .an-chart-row { grid-template-columns: minmax(0, 1fr); }
  .an-chart-rank { border-left: none; border-top: 1px solid var(--border); padding: 12px 0 0; }
}

/* 「雷达处理」卡与上面那张 YouTube 数据卡保持完全一致的观感：
   指标格同样走 6 列栅格（3 个指标只占前 3 格），边框、字号、内边距、图表留白都不另做覆盖 */

/* ==================== 二级页：左筛选 + 右内容 ==================== */
.page-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; align-items: start; }
.page-side { padding: 10px; }
.page-side-title { font-size: 12px; color: var(--muted); padding: 4px 8px 8px; }
.filter-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 7px 10px; border: none; border-radius: 8px; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 13px; font-family: inherit; text-align: left;
}
.filter-item:hover { background: #f1f5f9; color: var(--text); }
.filter-item.is-active { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.filter-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.filter-item.is-active .filter-count { color: var(--primary); }
@media (max-width: 900px) { .page-grid { grid-template-columns: 1fr; } }

/* 页面级计数条（作业 / 重复异常） */
.mini-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mini-stat {
  display: flex; align-items: baseline; gap: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; box-shadow: var(--shadow);
}
.mini-stat-label { font-size: 12px; color: var(--muted); }
.mini-stat-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-stat.is-danger .mini-stat-value { color: var(--danger); }
.mini-stat.is-ok .mini-stat-value { color: var(--ok); }
.mini-stat.is-warn .mini-stat-value { color: #c2410c; }

/* 栅格/筛选条与后续卡片的间距（相邻 .card 的 margin-top 在跨元素时失效） */
.overview-grid + .card { margin-top: 12px; }
.up { color: var(--ok); }

/* ==================== 面板（趋势 / 排行） ==================== */
.panel { padding: 12px 14px 8px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 8px;
}
.panel-head-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-head-right { display: flex; align-items: center; gap: 8px; }
.panel-title { font-size: 14px; font-weight: 600; }

/* 分段控件 */
.seg-group { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg {
  border: none; background: var(--panel); color: var(--muted); cursor: pointer;
  padding: 4px 12px; font-size: 12px; font-family: inherit; border-left: 1px solid var(--border);
}
.seg:first-child { border-left: none; }
.seg.is-active { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.select-sm { padding: 4px 8px; font-size: 12px; }
.input-date { padding: 4px 8px; font-size: 12px; }

/* 成员直接点选（替代下拉框） */
.member-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.member-chip {
  padding: 3px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel); color: var(--muted); cursor: pointer;
  font-size: 12px; font-family: inherit;
}
.member-chip:hover { background: #f1f5f9; color: var(--text); }
.member-chip.is-active { background: var(--primary-weak); color: var(--primary); border-color: var(--primary); font-weight: 600; }

.danger-text { color: var(--danger); }
/* 「非人工介入异常」用琥珀色：是异常但不是红警报，与「需人工介入」拉开区分 */
.warn-text { color: #c2410c; }

/* ==================== 表格 ==================== */
/* 照 Studio 数据表：表头浅灰底 + 灰字，正文白底，hover 整行浅灰，合计行加粗 */
.table { width: 100%; border-collapse: collapse; background: var(--panel); }
.table th, .table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th {
  color: var(--muted); font-weight: 500; background: #f9f9f9;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody tr:hover { background: #f2f2f2; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* 合计行：与 Studio 一致，加粗 + 浅灰底，压住整表 */
.table tbody tr.total-row > td { font-weight: 600; background: #f2f2f2; color: var(--text); }
.table tbody tr.total-row:hover > td { background: #ececec; }

/* ==================== 视频任务流（作业页） ==================== */
/* 筛选条：状态分段 + 姓名 / 线路下拉，右侧给结果条数，一眼看出筛掉了多少 */
.filter-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 4px 0 10px;
}
.filter-field { display: inline-flex; align-items: center; gap: 6px; }
.filter-label { font-size: 12px; color: var(--muted); }
.filter-summary { font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; }
/* 九列信息密度高，标题列给足宽度可换行，其余列 nowrap，避免把行撑成两三行。
   固定布局下「没给宽度的列」会被挤到接近 0 宽（列看起来就重合了），所以给「异常分类」也钉死宽度，
   只留「标题 / 失败原因」两列参与分配；再给整表一个最小宽度、外面套横向滚动容器：
   容器不够宽时横向滚动，而不是把最后两列压扁 —— 媒体查询看的是视口宽度，判不出侧栏吃掉的那几百像素。 */
.table-scroll { overflow-x: auto; }
.task-flow-table { table-layout: fixed; min-width: 1080px; }
.task-flow-table th:nth-child(1) { width: 76px; }
.task-flow-table th:nth-child(2) { width: 30%; }
.task-flow-table th:nth-child(3) { width: 88px; }
.task-flow-table th:nth-child(4) { width: 130px; }
.task-flow-table th:nth-child(5) { width: 80px; }
.task-flow-table th:nth-child(6) { width: 92px; }
.task-flow-table th:nth-child(7) { width: 84px; }
.task-flow-table th:nth-child(8) { width: 104px; }
.task-flow-table td { vertical-align: top; }
.task-flow-table td:nth-child(3),
.task-flow-table td:nth-child(5),
.task-flow-table td:nth-child(6),
.task-flow-table td:nth-child(7) { white-space: nowrap; }
.task-title { font-weight: 500; word-break: break-word; }
.task-sub { font-size: 11px; margin-top: 2px; }
/* 外链：只给颜色和下划线，不做按钮，保持表格清爽 */
.ext-link { color: var(--primary); text-decoration: none; }
.ext-link:hover { text-decoration: underline; }
/* 状态标签：色值沿用 Studio 的蓝 / 绿 / 红 */
.task-status {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; background: #f1f3f4; color: var(--muted); white-space: nowrap;
}
.task-status.is-published { background: #e6f4ea; color: var(--ok); }
.task-status.is-failed { background: var(--danger-bg); color: var(--danger); }
.task-status.is-ready { background: var(--primary-weak); color: var(--primary); }
/* 可点单元格：状态格点开「任务详情」（含耗时分布）。已发布任务没有报错文本，靠这里进详情 */
button.cell-trigger {
  display: inline-block; background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer; text-align: left;
}
button.cell-trigger:hover .task-status { filter: brightness(.94); text-decoration: underline solid; }
/* 异常信息：表格里截断成一行，点开弹窗看完整内容 */
.err-cell {
  display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--danger); font-size: 12px;
}
button.err-cell {
  background: none; border: 0; padding: 0; font: inherit; font-size: 12px;
  color: var(--danger); text-align: left; width: 100%; cursor: pointer;
  /* 常驻虚线下划线：提示「这行被截断了，点得开」，而不是只有鼠标移上去才知道 */
  text-decoration: underline dotted; text-underline-offset: 3px;
}
button.err-cell:hover { text-decoration: underline solid; }
/* 耗时格：做成链接，点开任务详情看每一步耗时；等宽数字让同列耗时对齐好读 */
button.cell-link {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; font-size: 12px; color: var(--primary); cursor: pointer;
  text-align: left; font-variant-numeric: tabular-nums;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
button.cell-link:hover { text-decoration: underline solid; }
/* 异常详情弹窗：上半部分任务上下文，下半部分完整报错（保留换行、超高内部滚动） */
.detail-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px; padding: 10px 14px 4px;
}
.detail-row.is-wide { grid-column: 1 / -1; }
.detail-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.detail-value { font-size: 13px; word-break: break-word; }
.err-detail { margin: 10px 14px 6px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.err-detail-head { padding: 8px 12px; font-size: 12px; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--border); }
.err-detail-body {
  margin: 0; padding: 12px; max-height: 46vh; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
/* 耗时步骤日志：每步一行「步骤名 —— 耗时」，点「耗时」链接进来先看这里 */
.step-log { padding: 4px 12px 8px; }
.step-log-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 3px 0; font-size: 12px; border-bottom: 1px dashed var(--border);
}
.step-log-row:last-child { border-bottom: none; }
.step-log-row > span:first-child { color: var(--text); }
.step-log-row > span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 720px) { .detail-grid { grid-template-columns: 1fr; } }

/* 耗时瀑布：每阶段一行，横条表示相对最大阶段的占比，右侧给秒数与占比 */
.timing-list { padding: 4px 14px 10px; }
.timing-row {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) 132px;
  align-items: center; gap: 10px; padding: 3px 0;
}
.timing-row.is-child { opacity: .85; }
.timing-row.is-child .timing-label { padding-left: 14px; font-size: 12px; }
.timing-label { font-size: 12px; color: var(--muted); }
.timing-bar { display: block; height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.timing-bar > i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.timing-row.is-child .timing-bar > i { background: #9bb7f0; }
.timing-value { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.timing-total { padding: 8px 14px 2px; font-size: 12px; color: var(--muted); }
@media (max-width: 720px) { .timing-row { grid-template-columns: 90px minmax(0, 1fr) 108px; } }

/* ==================== 图表 / 其它 ==================== */
/* 高度交给 viewBox 比例（height:auto），否则固定高度会让宽面板里的图按高度缩放、两侧留白 */
.chart { width: 100%; height: auto; display: block; }
.chart-bars { width: 100%; height: auto; display: block; }
/* 趋势图数据点可点击下钻 */
#trendChart rect[data-day] { cursor: pointer; }
.table .is-focus { background: var(--primary-weak); }
.sev { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.sev-high { background: var(--danger-bg); color: var(--danger); }
.sev-medium { background: #fff7ed; color: #c2410c; }
.sev-low { background: #f1f5f9; color: var(--muted); }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 20;
}

/* ==================== 指标钻取弹窗 ==================== */
.modal { position: fixed; inset: 0; z-index: 30; display: flex; justify-content: center; align-items: flex-start; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .38); }
.modal-panel {
  position: relative; z-index: 1;
  margin: 48px 16px; width: min(940px, 100%); max-height: calc(100vh - 96px);
  display: flex; flex-direction: column;
  background: var(--panel); border-radius: 14px; box-shadow: 0 12px 40px rgba(15, 23, 42, .22);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.modal-head-left { display: flex; align-items: baseline; gap: 8px; }
.modal-head-right { display: flex; align-items: center; gap: 10px; }
.modal-title { font-weight: 600; font-size: 15px; }
.modal-body { padding: 4px 6px 14px; overflow: auto; }
.modal-body .table th, .modal-body .table td { border-bottom: 1px solid var(--border); }
.modal-panel-sm { width: min(620px, 100%); }
/* 账号表单：两列栅格，字段等宽，替代原来 9 个字段横排挤压 */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 6px 10px 10px; }
.form-grid .field-wide { grid-column: 1 / -1; }
.form-grid .field input, .form-grid .field select { width: 100%; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .sidebar { width: 56px; }
  .sidebar .nav-text, .sidebar .sidebar-brand { display: none; }
}

/* ==================== 一对多层级（成员 → 账号） ==================== */
.tree-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; font-size: 12px; flex-wrap: wrap;
}
.tree-toolbar .muted { font-size: 12px; }
/* 成员汇总行：可点击展开 */
.tree-member { cursor: pointer; }
.tree-member > td { font-weight: 600; background: #fafbfc; }
.tree-member:hover > td { background: var(--primary-weak); }
.tree-caret { display: inline-block; width: 16px; color: var(--muted); font-size: 11px; }
/* 账号子行：缩进 + 分支线，视觉上挂在成员下 */
.tree-account > td { background: var(--panel); color: var(--text); font-weight: 400; }
.tree-account:hover > td { background: #f8fafc; }
/* 当前顶栏范围命中的账号：左侧描边标出「你现在看的就是这一行」 */
.tree-account.is-scoped > td { background: var(--primary-weak); }
.tree-account.is-scoped > td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
/* 日维度表里的指标名：做成可点的下钻入口 */
.link-btn {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--primary, #2563eb); cursor: pointer; text-align: left;
}
.link-btn:hover { text-decoration: underline; }
/* 单指标明细里的占比条 */
.share-bar {
  display: inline-block; width: 48px; height: 6px; margin-left: 6px;
  background: #eef2f7; border-radius: 999px; overflow: hidden; vertical-align: middle;
}
.share-bar > i { display: block; height: 100%; background: var(--primary, #2563eb); }
.tree-child { padding-left: 30px !important; position: relative; }
.tree-child::before {
  content: ''; position: absolute; left: 16px; top: 0; bottom: 0;
  border-left: 1px solid var(--border);
}
/* 账号页成员分组行 */
.group-row > td {
  background: #f6f8fb; font-size: 13px; padding-top: 8px; padding-bottom: 8px;
}
.group-row strong { color: var(--text); }

/* 账号页：一行一条线路（比特窗口），组内缩进挂该线路监控的博主。
   线路是「关系」的中间层，视觉上必须比博主行重，否则一行行平铺会看不出归属。 */
.line-table { table-layout: fixed; }
.line-table th { white-space: nowrap; }
.line-table th:nth-child(1) { width: 15%; }
.line-table th:nth-child(2) { width: 172px; }
.line-table th:nth-child(3) { width: 62px; }
.line-table th:nth-child(4) { width: 92px; }
.line-table th:nth-child(5) { width: 62px; }
.line-table th:nth-child(6) { width: 76px; }
.line-table th:nth-child(7) { width: 124px; }
.line-table th:nth-child(8) { width: 78px; }
.line-table td { vertical-align: top; }
.line-table td:nth-child(2) .ext-link { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.line-table td:nth-child(7) { white-space: nowrap; }
.cell-nowrap { white-space: nowrap; }
.line-row > td { background: #f6f8fb; }
.line-row.is-scoped > td { background: var(--primary-weak); box-shadow: inset 3px 0 0 var(--primary); }
.line-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.line-label { font-weight: 600; }
.line-tag {
  font-size: 11px; padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  background: #eef2f7; color: var(--muted);
}
.line-tag.is-bound { background: var(--primary-weak); color: var(--primary); }
.line-tag.is-ok { background: #e6f4ea; color: var(--ok); }
.line-tag.is-money { background: #f3e8ff; color: var(--tone-money); }
.line-meta { font-size: 12px; }
.line-count { font-size: 12px; font-variant-numeric: tabular-nums; }
.line-actions { margin-left: auto; display: flex; gap: 6px; }

/* ==================== 重复异常：跨账号多对多 ==================== */
/* 页面按组纵向堆叠：组头一行到底（严重度 + 原因 + 操作），元信息单独一行对齐，明细用表格 */
.dup-list { display: flex; flex-direction: column; }
.dup-group { padding: 14px 0; }
.dup-group:first-child { padding-top: 4px; }
.dup-group + .dup-group { border-top: 1px solid var(--border); }
.dup-group-head { display: flex; align-items: center; gap: 10px; }
.dup-reason {
  flex: 1; min-width: 0; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dup-actions { flex: none; display: flex; gap: 8px; }
.dup-meta { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 6px 0 10px; font-size: 12px; }
.dup-meta-item { display: flex; align-items: baseline; gap: 6px; }
.dup-meta-item i { font-style: normal; color: var(--muted); }
/* 明细表格收在圆角框里，列头与数据左右对齐，和整页口径一致 */
.dup-items { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.dup-items th, .dup-items td { padding: 6px 10px; }
.dup-items tbody tr:last-child td { border-bottom: none; }

/* 弹窗内仍是紧凑卡片形态 */
.dup-card {
  border: 1px solid var(--border); border-radius: 10px;
  margin: 8px 10px; padding: 10px 12px; background: var(--panel);
}
.dup-card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px;
}
.dup-item {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 5px 0; border-top: 1px dashed var(--border); font-size: 13px;
}
.dup-item:first-of-type { border-top: none; }
.chip {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 12px; background: var(--primary-weak); color: var(--primary); white-space: nowrap;
}
.chip-ghost { background: #f1f5f9; color: var(--muted); }

/* 空态：给一句说明说清「为什么空、什么时候会有」，而不是丢一行灰字 */
.empty-state { padding: 56px 16px; text-align: center; }
.empty-title { font-size: 15px; font-weight: 600; }
.empty-sub { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ==================== 内容页：热门内容榜 ==================== */
/* 标题列限宽：长标题只在标题列内换行，不把整张表撑到横向滚动 */
.content-title { max-width: 420px; }
.link { color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }
.content-title .link { font-weight: 500; }

/* ==================== 观众页：五维度条形卡 ==================== */
/* 每维度一张卡，卡内一行一项：名称 / 占比条 / 占比 / 播放量，四列定宽对齐 */
.aud-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.aud-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px;
}
.aud-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 14px; font-weight: 600; margin-bottom: 10px;
}
.aud-card-head .muted { font-size: 12px; font-weight: 400; }
.aud-row {
  display: grid; grid-template-columns: 84px minmax(0, 1fr) 56px 88px;
  align-items: center; gap: 8px; padding: 3px 0; font-size: 12px;
}
.aud-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aud-track { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.aud-track > i { display: block; height: 100%; background: var(--tone-traffic); border-radius: 999px; }
.aud-value { text-align: right; font-variant-numeric: tabular-nums; }
.aud-sub { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.aud-more { margin-top: 6px; font-size: 11px; }
.aud-empty { color: var(--muted); font-size: 12px; padding: 12px 0; }
@media (max-width: 560px) {
  .aud-row { grid-template-columns: 72px minmax(0, 1fr) 52px; }
  .aud-sub { display: none; }
}

