:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e6e9ee;
  --line-soft: #f0f2f5;
  --text: #1a2233;
  --text-2: #5b6472;
  --text-3: #8b95a5;
  --brand: #2f6fed;
  --brand-soft: #eaf1ff;
  --ok: #0ca678;
  --warn: #e8590c;
  --bad: #e03131;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  max-width: 100%;
  overflow-x: hidden;   /* 兜底：万一某个元素超宽，也不能让整页跟着横移 */
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 布局 */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px; flex: 0 0 216px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #2f6fed, #1c4fd0);
  color: #fff; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 30px;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: -1px; }

nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  padding: 9px 12px; border-radius: 8px;
  color: var(--text-2); font-size: 13.5px;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--line-soft); text-decoration: none; color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.sidebar-foot {
  margin-top: auto; padding: 12px 8px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--text-3);
  display: flex; flex-direction: column; gap: 3px;
}
.who { color: var(--text-2); font-weight: 500; }
.link-quiet { color: var(--text-3); font-size: 12px; }
.link-quiet:hover { color: var(--bad); text-decoration: none; }

.main { flex: 1; min-width: 0; padding: 22px 28px 48px; max-width: 1320px; }
.main.wide { max-width: none; }

.topbar { margin-bottom: 18px; }
.topbar h1 { font-size: 20px; font-weight: 650; margin: 0; letter-spacing: -.2px; }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft); gap: 12px;
}
.card-head h2 { font-size: 14.5px; font-weight: 620; margin: 0; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.card-actions { display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 14px; align-items: start; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }

/* ---------------------------------------------------------------- 指标卡 */
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow);
}
.stat-accent { border-left: 3px solid var(--brand); }
.stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.stat-value { font-size: 25px; font-weight: 680; letter-spacing: -.5px; line-height: 1.15; }
.stat-sub { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px; font-weight: 560; font-size: 12px;
  color: var(--text-3); background: #fbfcfd;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfcfe; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.title-cell { max-width: 340px; }
.title-cell a { color: var(--text); font-weight: 500; }
.title-cell a:hover { color: var(--brand); text-decoration: none; }
.sub { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }

/* 分平台业绩表：标出本平台最佳 + 平台均值基准行 */
table.t-perf td, table.t-perf th { white-space: nowrap; }
table.t-perf td.n { text-align: right; }
tbody tr.row-best td { background: #f4faf6; }
tbody tr.row-best td:first-child { box-shadow: inset 3px 0 0 #34a853; }
tbody tr.row-bench td {
  background: #fbfcfd; color: var(--text-3);
  font-size: 12px; border-top: 1px dashed var(--line);
}
tbody tr.row-bench:hover td { background: #fbfcfd; }
.tag-best {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  font-size: 10.5px; line-height: 1.5; border-radius: 4px;
  background: #e7f6ec; color: #1e7a3c; font-weight: 500;
}
.sec-title {
  margin: 26px 0 12px; font-size: 15px; font-weight: 600;
  color: var(--text); letter-spacing: .3px;
}
.sec-title::before {
  content: ""; display: inline-block; width: 3px; height: 14px;
  background: var(--brand); border-radius: 2px;
  margin-right: 8px; vertical-align: -2px;
}

/* ---------------------------------------------------------------- 徽章 */
.badge {
  display: inline-block; padding: 1.5px 7px; border-radius: 5px;
  font-size: 11.5px; font-weight: 520; white-space: nowrap;
  background: #f1f3f6; color: var(--text-2);
}
.b-ok    { background: #e7f7f1; color: #0b7a58; }
.b-warn  { background: #fff1e6; color: #b44a06; }
.b-bad   { background: #ffecec; color: #b42318; }
.b-blue  { background: #eaf1ff; color: #1c4fd0; }
.b-cyan  { background: #e3f7fb; color: #0b7285; }
.b-orange{ background: #fff4e6; color: #b44a06; }
.b-green { background: #e7f7f1; color: #0b7a58; }
.b-gray  { background: #f1f3f6; color: #6b7280; }
.b-p-bilibili { background: #e7f5ff; color: #1971c2; }
.b-p-toutiao  { background: #e7f0ff; color: #2f6fed; }
.b-p-wechat_mp { background: #ffecec; color: #e03131; }
.b-p-xiaohongshu { background: #fff0e3; color: #e8590c; }
.b-p-douyin { background: #f1f3f5; color: #343a40; }
.b-p-wechat_channels { background: #e7f7f1; color: #0b7a58; }
.b-p-unknown { background: #f1f3f6; color: #6b7280; }

/* ---------------------------------------------------------------- 表单 */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date],
select, textarea {
  width: 100%; padding: 8px 11px; font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text);
  font-family: inherit; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* 自绘下拉框：替代原生 select 弹层（原生弹层在内嵌浏览器里会飘到窗口左上角） */
.csel { position: relative; display: inline-block; vertical-align: middle; }
.csel-fill { display: block; width: 100%; }
.csel-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 11px; font-family: inherit; font-size: 13.5px; line-height: 1.4;
  color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; text-align: left; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.csel-btn:hover { border-color: #d3d9e3; }
.csel-btn:focus-visible, .csel-open .csel-btn {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}
.csel-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel-car { flex: 0 0 auto; color: var(--text-3); font-size: 10px; line-height: 1; transition: transform .12s; }
.csel-open .csel-car { transform: rotate(180deg); }

/* 弹层挂在 body 上、position:fixed —— 不会被 .card 的 overflow:hidden 裁掉，也不会随父级滚动跑位 */
.csel-menu {
  position: fixed; z-index: 900; display: none;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .14);
  padding: 4px; max-height: 280px; overflow-y: auto;
  max-width: calc(100vw - 16px);
}
.csel-opt {
  padding: 7px 10px; border-radius: 6px;
  font-size: 13px; color: var(--text); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.csel-opt:hover, .csel-opt.hot { background: var(--line-soft); }
.csel-opt[aria-selected="true"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.csel-opt[aria-disabled="true"] { color: var(--text-3); cursor: default; background: transparent; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 13px; font-weight: 520;
  cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #fbfcfd; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #2258c9; }
.btn-danger { color: var(--bad); border-color: #ffd5d5; }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 150px; margin-bottom: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 筛选栏：独立一行，不要挤进卡片标题，否则窄屏会被压成两行 */
.filter-bar {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 14px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.filter-bar form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { width: auto; min-width: 130px; }

/* ---------------------------------------------------------------- 提示 */
.flash {
  padding: 10px 14px; border-radius: 9px; margin-bottom: 14px;
  font-size: 13px; border: 1px solid transparent;
}
.flash-ok    { background: #e7f7f1; color: #0b7a58; border-color: #c3ecdd; }
.flash-error { background: #ffecec; color: #b42318; border-color: #ffd5d5; }
.flash-warn  { background: #fff6e8; color: #b44a06; border-color: #ffe3bd; }
.flash-info  { background: #eef4ff; color: #1c4fd0; border-color: #d6e2ff; }

.note {
  font-size: 12.5px; color: var(--text-2); background: #fbfcfd;
  border: 1px solid var(--line-soft); border-left: 3px solid var(--line);
  padding: 10px 13px; border-radius: 8px; margin: 12px 0;
}
.note strong { color: var(--text); }

.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty.compact { padding: 22px 20px; }
.empty p { margin: 0 0 6px; font-size: 14px; }
.empty-hint { font-size: 12.5px; color: var(--text-3); }

.hint { font-size: 12px; color: var(--text-3); margin: 10px 0 0; line-height: 1.6; }
.hint code { background: #f1f3f6; padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }

/* ---------------------------------------------------------------- 登录 */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #f2f4f7;
}
.login-card {
  width: 340px; background: #fff; padding: 28px 26px 22px;
  border-radius: 14px; border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(16, 24, 40, .07);
}
.brand-login { padding: 0 0 20px; }

/* ---------------------------------------------------------------- 图表 */
.chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 12.5px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------------------------------------------------------------- 详情 */
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 10px; font-size: 13px; }
.kv dt { color: var(--text-3); font-size: 12.5px; }
.kv dd { margin: 0; color: var(--text); word-break: break-all; }

.comment-row { padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.comment-row:last-child { border-bottom: none; }
.comment-row.lv2 { padding-left: 26px; background: #fcfdfe; }
.comment-meta { font-size: 11.5px; color: var(--text-3); margin-bottom: 2px; }
.comment-text { color: var(--text); line-height: 1.55; }
.flag-suspicious { color: var(--bad); font-weight: 600; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 14px; font-size: 13px; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 560; }
.tab:hover { text-decoration: none; color: var(--text); }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3, .g-2, .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  /* 关键：横向导航那 5 个链接的总宽会把 .sidebar 撑开，进而把 .shell 撑到
     比屏幕还宽，导致右侧卡片被裁。必须给这条链路每层都设宽度上限。 */
  .shell { flex-direction: column; width: 100%; max-width: 100%; }
  .sidebar {
    width: 100%; max-width: 100%; flex: none; height: auto; position: static;
    padding: 12px 14px; border-right: none; border-bottom: 1px solid var(--line);
    overflow: hidden;
  }
  .main { width: 100%; max-width: 100%; overflow: hidden; }
  .brand { padding-bottom: 10px; }
  nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 2px; max-width: 100%; }
  .nav-item { white-space: nowrap; padding: 7px 11px; }
  .sidebar-foot { flex-direction: row; justify-content: space-between; padding-top: 10px; }
  .main { padding: 16px 14px 40px; }
  .g-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 21px; }
  .topbar h1 { font-size: 18px; }
  .title-cell { max-width: 200px; white-space: normal; }

  /* 图表按容器等比缩放。手机上略小，但趋势形状和量级还能看清，
     具体数值看上面的指标卡和下面的快照明细表，不指望在图上读精确值 */
  .chart-scroll-inner { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 表格单元格不换行，靠横向滚动看，否则"2026-11-19 18:49:57"会竖排成三行 */
  table td, table th { white-space: nowrap; }
  table td .title-cell { white-space: normal; }
  .kv { grid-template-columns: 74px 1fr; font-size: 12.5px; }
}

/* 密码框的「显示」开关：改密码最容易栽在看不见的字符上
   （多打空格、输入法全角、浏览器自动填了旧密码）。
   用绝对定位挂在框内右侧，不参与 .field 的布局，宽度不受影响。 */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 46px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--text-2);
  font-size: 12px; line-height: 1; padding: 4px 5px;
  cursor: pointer; font-family: inherit; border-radius: 6px;
}
.pw-eye:hover { color: var(--brand); background: rgba(47, 111, 237, .08); }

/* 数据异常预警：互动>曝光这类逻辑矛盾，单独隔离、红框提示，等人工复核 */
.card-anomaly { border-color: #ffc9c9; box-shadow: 0 0 0 1px rgba(224, 49, 49, .05), var(--shadow); }
.card-anomaly .card-head { background: #fff5f5; border-bottom-color: #ffe3e3; }
.card-anomaly .card-head h2 { color: #b42318; }

.anomaly-banner {
  margin-bottom: 14px; padding: 12px 14px;
  background: #fff5f5; border: 1px solid #ffd5d5;
  border-left: 3px solid var(--bad); border-radius: 8px;
}
.anomaly-banner-title { font-size: 13.5px; font-weight: 650; color: #b42318; margin-bottom: 4px; }
.anomaly-banner-text { font-size: 12.5px; color: #7a271a; line-height: 1.65; }
.anomaly-banner-text b { color: #b42318; font-weight: 650; }

.anomaly-table td { vertical-align: top; }
.anomaly-num { font-size: 12px; color: var(--text-2); }
.anomaly-num b { color: var(--text); font-weight: 650; }
.anomaly-reason { font-size: 12px; color: #b42318; line-height: 1.6; }
.anomaly-note { font-size: 11.5px; color: var(--text-3); margin-top: 4px; line-height: 1.5; }
.anomaly-cta { margin-top: 6px; font-size: 12px; }
.anomaly-cta a { color: #b42318; font-weight: 550; }
.anomaly-cta a:hover { text-decoration: underline; }

.anomaly-ok { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.anomaly-ok-icon {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  background: #e7f7f1; color: #0b7a58;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.anomaly-ok .sub { display: block; margin-top: 2px; }

/* 平台内互动画像：经复核定案的分析方法视图 */
.profile-section { margin-bottom: 18px; }
.profile-section .tabs { margin-bottom: 0; }
.profile-card { border-top-left-radius: 0; border-top-right-radius: 0; }
.profile-card .sec-title { margin-top: 2px; }
.t-profile td { white-space: nowrap; }
.t-profile td:last-child { white-space: normal; min-width: 200px; font-size: 11px; }
.profile-verdict {
  margin-top: 14px; padding: 12px 15px; background: #f8faff;
  border: 1px solid #dbe6ff; border-left: 3px solid var(--brand); border-radius: 8px;
}
.pv-line { font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.pv-line + .pv-line { margin-top: 6px; }
.pv-line .badge { margin-right: 4px; }
.pv-line.sub { color: var(--text-3); font-size: 11.5px; }
.locked-box {
  background: #fafbfc; border: 1px dashed var(--line); border-radius: 10px;
  padding: 18px 20px;
}
.lock-title { font-size: 14px; font-weight: 620; color: var(--text-2); margin-bottom: 8px; }
.lock-text { font-size: 12.5px; color: var(--text-3); line-height: 1.7; }
.lock-list { margin: 10px 0 0; padding-left: 20px; font-size: 12.5px; color: var(--text-2); line-height: 1.9; }
.lock-list strong { color: var(--text); }

/* 算法校准：阈值漂移监控（自动执行，页面只展示状态） */
.calib-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin-bottom: 4px;
}
.calib-item {
  background: #fafbfc; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px;
}
.calib-val { font-size: 17px; font-weight: 640; margin-top: 3px; letter-spacing: -.2px; }
.calib-val.sm { font-size: 12.5px; font-weight: 520; color: var(--text-2); }
.calib-block {
  margin-top: 10px; padding: 9px 12px; border-radius: 8px;
  background: #fafbfc; border: 1px solid var(--line); border-left: 3px solid var(--line);
}
.calib-block.ok { background: #f4faf6; border-left-color: #2f9e44; }
.calib-block.warn { background: #fffaf0; border-left-color: #f08c00; }
.calib-block-title { font-size: 12px; font-weight: 620; color: var(--text-2); margin-bottom: 4px; }
.calib-line { font-size: 12.5px; line-height: 1.75; color: var(--text-2); }
@media (max-width: 760px) {
  .calib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
