:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e6eaf0;
  --line-soft: #f0f3f7;
  --text: #1a2233;
  --text-2: #5b6678;
  --text-3: #94a0b3;
  --brand: #2f5cff;
  --brand-soft: #eef2ff;
  --green: #12a150;
  --red: #e5484d;
  --amber: #f5a524;
  --violet: #7c5cff;
  --cyan: #06a4b8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}

.logo .mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, #2f5cff, #7c5cff);
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.topbar .spacer { flex: 1; }

/* ---------- 日期筛选 ---------- */
.range {
  display: flex; align-items: center; gap: 6px;
  background: var(--line-soft); padding: 4px; border-radius: 10px;
}
.range button {
  border: 0; background: transparent; color: var(--text-2);
  padding: 5px 11px; border-radius: 7px; cursor: pointer; font-size: 13px;
  font-family: inherit; white-space: nowrap;
}
.range button.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.range input[type=date] { border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-family: inherit; font-size: 13px; color: var(--text); background: #fff; }
.range .sep { color: var(--text-3); font-size: 12px; }

/* ---------- 日历：按日查看 ---------- */
.cal-wrap { position: relative; display: flex; align-items: center; }
.cal-btn {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  padding: 6px 10px; border-radius: 9px; font-size: 13px; font-family: inherit; cursor: pointer;
  white-space: nowrap; transition: border-color .15s ease, color .15s ease;
}
.cal-btn:hover { border-color: var(--brand); color: var(--brand); }
.cal-btn.on { background: var(--brand-soft); border-color: transparent; color: var(--brand); font-weight: 600; }
.cal-pop {
  position: absolute; top: calc(100% + 12px); left: 0; width: 290px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16,24,40,.16); padding: 12px; z-index: 90;
}
.cal-hd { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-hd .t { flex: 1; text-align: center; font-weight: 700; font-size: 13.5px; }
.cal-hd button {
  border: 1px solid var(--line); background: #fff; border-radius: 7px; width: 26px; height: 26px;
  cursor: pointer; color: var(--text-2); font-size: 14px; line-height: 1; font-family: inherit;
}
.cal-hd button:hover { color: var(--brand); border-color: var(--brand); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-w { text-align: center; color: var(--text-3); font-size: 11.5px; padding: 2px 0 4px; }
.cal-d {
  position: relative; height: 32px; border: 0; background: transparent; border-radius: 8px;
  font-size: 12.5px; color: var(--text); cursor: pointer; font-family: inherit; padding: 0;
}
.cal-d:hover { background: var(--line-soft); }
.cal-d.empty { visibility: hidden; }
.cal-d.has { font-weight: 600; color: var(--brand); }
.cal-d.has::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 4px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--brand);
}
.cal-d.sel { background: var(--brand); color: #fff; }
.cal-d.sel::after { background: #fff; }
.cal-d.today { box-shadow: inset 0 0 0 1px var(--brand); }
.cal-d.future { color: var(--text-3); }
.cal-ft { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.cal-ft button {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 0;
  font-size: 12px; cursor: pointer; color: var(--text-2); font-family: inherit;
}
.cal-ft button:hover { color: var(--brand); border-color: var(--brand); }
.cal-tip { margin-top: 8px; color: var(--text-3); font-size: 11.5px; text-align: center; }
.day-nav { display: flex; align-items: center; gap: 2px; background: var(--brand-soft); border-radius: 10px; padding: 3px 6px; }
.day-nav button { border: 0; background: transparent; color: var(--brand); font-size: 16px; cursor: pointer; padding: 0 6px; line-height: 1; }
.day-nav span { font-size: 13px; font-weight: 600; color: var(--brand); }

/* ---------- 数据范围切换（个人/全量） ---------- */
.scope-toggle { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-soft); border-radius: 10px; padding: 3px 8px; }
.scope-toggle .scope-label { font-size: 12px; color: var(--brand); margin-right: 2px; }
.scope-toggle button { border: 0; background: transparent; color: var(--brand); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 10px; border-radius: 8px; line-height: 1; }
.scope-toggle button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
@media (max-width: 720px) { .scope-toggle .scope-label { display: none; } }

/* ---------- API 接入 ---------- */
.api-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.api-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fff; }
.api-card-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.api-card-hd b { font-size: 15px; }
.api-note { font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.api-desc { font-size: 12.5px; color: var(--brand); background: var(--brand-soft); border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; }
.api-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.api-row label { width: 64px; flex: none; font-size: 13px; color: var(--text-2); }
.api-row select, .api-row input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.api-row input[readonly] { background: #f5f6f8; color: var(--text-2); }
.api-actions { text-align: right; margin-top: 4px; }
.api-actions .api-sync { margin-left: 8px; }
.api-miss { font-size: 12px; color: #b25e09; margin-left: 4px; }

/* ---------- 身份 ---------- */
.who { display: flex; align-items: center; gap: 8px; }
.who select, .who .pill {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 6px 10px; font-size: 13px; font-family: inherit; color: var(--text); cursor: pointer;
}
.who .pill { background: var(--brand-soft); border-color: transparent; color: var(--brand); font-weight: 600; }
.acct { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--line); }
.acct .pill {
  border: 1px solid transparent; background: #eef7f1; color: #0a6c37; border-radius: 9px;
  padding: 6px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; max-width: 200px;
  overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 布局 ---------- */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 178px; flex: 0 0 178px; background: #fff; border-right: 1px solid var(--line);
  min-height: calc(100vh - 58px); padding: 14px 10px; position: sticky; top: 58px;
}
.sidebar a {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 9px;
  color: var(--text-2); text-decoration: none; font-size: 13.5px; margin-bottom: 2px; cursor: pointer;
}
.sidebar a:hover { background: var(--line-soft); }
.sidebar a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidebar a .ico { width: 16px; text-align: center; opacity: .9; }
.main { flex: 1; padding: 18px 20px 60px; min-width: 0; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-hd { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.card-hd h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.card-hd .sub { color: var(--text-3); font-size: 12px; font-weight: 400; }
.card-hd .spacer { flex: 1; }
.card-bd { padding: 16px 18px; }
.card-bd.tight { padding: 10px 12px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); opacity: .75; }
.kpi.k2::after { background: var(--violet); }
.kpi.k3::after { background: var(--green); }
.kpi.k4::after { background: var(--amber); }
.kpi.k5::after { background: var(--cyan); }
.kpi .t { color: var(--text-2); font-size: 12.5px; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 5px; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.pos { color: var(--green); } .neg { color: var(--red); }

/* ---------- 网格 ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1180px) { .g2, .g3, .g-2-1 { grid-template-columns: 1fr; } }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); font-size: 13px; white-space: nowrap; }
th { color: var(--text-2); font-weight: 600; font-size: 12.5px; background: #fafbfd; position: sticky; top: 0; z-index: 2; }
tbody tr:hover { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow: auto; max-height: 620px; }
tfoot td {
  position: sticky; bottom: 0; z-index: 3;
  background: #f3f6fb; font-weight: 700; color: var(--text);
  border-top: 2px solid var(--line); border-bottom: 0;
}
tfoot td.lbl { color: var(--brand); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; background: var(--line-soft); color: var(--text-2); }
.tag.b { background: var(--brand-soft); color: var(--brand); }

/* ---------- 表单 ---------- */
input, select, textarea, button { font-family: inherit; font-size: 13px; color: var(--text); }
input[type=text], input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #fff; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 92, 255, .12); }
input.w-num { text-align: right; }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 14px;
  cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--line-soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #254eda; }
.btn.danger { color: var(--red); border-color: #f5c9ca; }
.btn.sm { padding: 3px 9px; font-size: 12px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: var(--line-soft); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--text-2); }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 120px; }

/* ---------- 纵向堆叠表单（产品库新增/修改） ---------- */
.stack-form { display: flex; flex-direction: column; gap: 10px; }
.sf-row { display: flex; align-items: center; gap: 12px; }
.sf-row > label {
  flex: none; width: 96px; text-align: right;
  font-size: 12.5px; color: var(--text-2); line-height: 1.3;
}
.sf-row > input, .sf-row > select {
  flex: 1 1 auto; max-width: 340px; height: 32px;
  padding: 5px 9px; box-sizing: border-box;
}
.sf-row > .sf-tip { flex: 1 1 auto; font-size: 12px; color: var(--text-2); }
.sf-actions { display: flex; gap: 10px; padding-left: 108px; margin-top: 2px; }
@media (max-width: 680px) {
  .sf-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .sf-row > label { width: auto; text-align: left; }
  .sf-row > input, .sf-row > select { max-width: none; }
  .sf-actions { padding-left: 0; }
}

/* ---------- 录入表 ---------- */
.entry-tbl input, .entry-tbl select { padding: 5px 7px; font-size: 12.5px; border-radius: 7px; }
.entry-tbl td, .entry-tbl th { padding: 5px 6px; }
.entry-tbl th { text-align: left; }
.entry-tbl input, .entry-tbl select { text-align: left; }
.entry-tbl input[readonly] { background: #fafbfd; color: var(--text-2); border-color: transparent; }
.col-w { width: 116px; } .col-n { width: 88px; }

.hint { color: var(--text-3); font-size: 12px; }
.banner { padding: 9px 14px; border-radius: 10px; font-size: 13px; background: var(--brand-soft); color: #2440b8; }
.banner.warn { background: #fff6e6; color: #8a5a00; }
.banner.ok { background: #e8f8ef; color: #0a6c37; }

/* ---------- 列表卡 ---------- */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.mini { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; background: #fff; }
.mini .hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mini .name { font-weight: 700; font-size: 14px; }
.mini .big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini .kv { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-top: 3px; }

.bar { height: 6px; background: var(--line-soft); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--brand); }

.chart-box { position: relative; height: 288px; }
.chart-box.tall { height: 330px; }
.chart-box.short { height: 230px; }

.empty { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 13px; }

.modal-mask { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
/* 弹窗采用「列向 flex + 内容区滚动」结构：
   .modal 自身不再滚动，改为 .bd 滚动、.hd/.ft 恒驻可见。
   修复：字段较多的弹窗（如「修改记录」10 个字段）在矮视口下
   底部「保存/确认删除」按钮会被挤出视口，用户点不到而误判为「功能无效」。 */
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 86vh; overflow: hidden; box-shadow: 0 20px 60px rgba(16,24,40,.25); display: flex; flex-direction: column; }
.modal .hd { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); font-weight: 700; flex: none; }
.modal .bd { padding: 18px 20px; flex: 1 1 auto; overflow: auto; }
.modal .ft { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; flex: none; }

.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 34px; z-index: 200;
  background: #1a2233; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.pill-date { font-size: 12px; color: var(--text-3); }

/* ---- 产品看板（iframe 嵌入） ---- */
#page-board { display: flex; flex-direction: column; }
.board-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.board-bar .spacer { flex: 1; }
#boardFrame {
  width: 100%;
  height: calc(100vh - 140px);
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

/* ---------- 录入不规范内容:浅黄标色 + 报错提示 ---------- */
.cell-warn { background: #fff8d1 !important; border-color: #eec95a !important; }
.cell-err { background: #fdecec !important; border-color: #e5484d !important; }

/* ============================================================
   视觉优化轮（2026-09-10）：整体观感升级 + 排行金银皇冠
   纯样式追加，不改任何结构与数据逻辑
   ============================================================ */

/* ---------- 全局质感 ---------- */
body { background: linear-gradient(180deg, #f6f8fc 0%, #f2f4f9 100%); }

::selection { background: rgba(47, 92, 255, .18); }

/* 细滚动条 */
.tbl-wrap::-webkit-scrollbar, .modal .bd::-webkit-scrollbar { width: 8px; height: 8px; }
.tbl-wrap::-webkit-scrollbar-thumb, .modal .bd::-webkit-scrollbar-thumb { background: #d5dce6; border-radius: 8px; }
.tbl-wrap::-webkit-scrollbar-thumb:hover { background: #bfc9d8; }
.tbl-wrap::-webkit-scrollbar-track, .modal::-webkit-scrollbar-track { background: transparent; }

/* ---------- 顶栏：微渐变 + 柔影 ---------- */
.topbar {
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
  box-shadow: 0 1px 8px rgba(16, 24, 40, .05);
}
.logo .mark { box-shadow: 0 3px 8px rgba(47, 92, 255, .35); }

/* ---------- 侧栏：过渡更顺滑 ---------- */
.sidebar a { transition: background .15s ease, color .15s ease; }
.sidebar a.on { box-shadow: inset 2px 0 0 var(--brand); }

/* ---------- 卡片：悬浮微浮起 ---------- */
.card { transition: box-shadow .2s ease; }
.card:hover { box-shadow: 0 2px 4px rgba(16,24,40,.05), 0 10px 28px rgba(16,24,40,.09); }
.card-hd h3 { letter-spacing: .2px; }

/* ---------- KPI：顶部渐变光带 + 悬浮浮起 ---------- */
.kpi { transition: transform .18s ease, box-shadow .18s ease; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(16,24,40,.06), 0 14px 32px rgba(16,24,40,.10); }
.kpi::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), rgba(47,92,255,.15));
}
.kpi.k2::before { background: linear-gradient(90deg, var(--violet), rgba(124,92,255,.15)); }
.kpi.k3::before { background: linear-gradient(90deg, var(--green), rgba(18,161,80,.15)); }
.kpi.k4::before { background: linear-gradient(90deg, var(--amber), rgba(245,165,36,.15)); }
.kpi.k5::before { background: linear-gradient(90deg, var(--cyan), rgba(6,164,184,.15)); }
.kpi::after { width: 0; } /* 左侧竖条改为顶部光带 */
.kpi .v { font-size: 25px; }

/* ---------- 表格：表头微渐变 + 行 hover 更柔 ---------- */
th { background: linear-gradient(180deg, #fafbfd, #f5f7fb); letter-spacing: .2px; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f6f8fc; }

/* ---------- 排行 TOP：第一名金冠、第二名银冠 + 字号按名次递减，最后一名保持默认字号 ---------- */
.crown { display: inline-block; margin-right: 3px; font-size: 14px; line-height: 1; vertical-align: -1px; transition: font-size .2s ease; }
.crown.silver { filter: grayscale(1) brightness(1.18) contrast(.92); }
tr.top1 > td { background: linear-gradient(90deg, #fffaf0, #fffdf8 60%, transparent); }
tr.top1 > td:first-child { box-shadow: inset 3px 0 0 #f5a524; }
tr.top2 > td { background: linear-gradient(90deg, #f6f8fb, #fafbfc 60%, transparent); }
tr.top2 > td:first-child { box-shadow: inset 3px 0 0 #aeb9c9; }
tr.top1:hover > td { background: #fff7e8; }
tr.top2:hover > td { background: #f2f5f9; }

/* 按名次递减:第 1 名略放大以突出,最后一名与当前表格默认字号一致;过渡平滑 */
#chGameTbl tr.rk-1 td.cell-game { font-size: 16.5px; font-weight: 600; }
#chGameTbl tr.rk-2 td.cell-game { font-size: 15.5px; font-weight: 500; }
#chGameTbl tr.rk-3 td.cell-game { font-size: 14.5px; }
#chGameTbl tr.rk-4 td.cell-game { font-size: 14px; }
#chGameTbl tr.rk-5 td.cell-game { font-size: 14px; }
#chGameTbl tr.rk-1 .crown { font-size: 16px; }
#chGameTbl tr.rk-2 .crown { font-size: 15px; }

/* ---------- 按钮：主按钮带柔影 ---------- */
.btn { transition: background .15s ease, box-shadow .15s ease, transform .1s ease; }
.btn:active { transform: translateY(1px); }
.btn.primary { box-shadow: 0 2px 8px rgba(47, 92, 255, .28); }
.btn.primary:hover { background: #2a54e8; box-shadow: 0 4px 12px rgba(47, 92, 255, .34); }

/* ---------- 迷你卡：悬浮浮起 + 进度条圆润 ---------- */
.mini { transition: transform .16s ease, box-shadow .16s ease; }
.mini:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,24,40,.08); }
.bar > i { background-image: linear-gradient(90deg, rgba(255,255,255,.25), transparent); }

/* ---------- 图表容器：浅色底衬托 ---------- */
.chart-box { background: linear-gradient(180deg, #fdfeff, #ffffff); border-radius: 10px; padding: 6px 4px 0; }

/* ---------- 弹窗：入场动画 ---------- */
.modal { animation: modalIn .18s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- toast：微弹入 ---------- */
.toast { animation: toastIn .2s ease; border-radius: 12px; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 标签：更精致 ---------- */
.tag { border: 1px solid rgba(16,24,40,.04); font-weight: 500; }

/* ============================================================
   布局轮（2026-09-10）：左右图表大小对齐 + 录入头部排版统一
   ============================================================ */

/* 左右并列的卡片保证等高、内容贴近 */
.grid > .card { display: flex; flex-direction: column; }
.grid > .card > .card-bd { flex: 1; display: flex; flex-direction: column; }
.grid > .card > .card-bd > .chart-box { flex: 1; }

/* 趋势图、排行图等大图统一最小高度,避免左右一高一低 */
.chart-box.tall { min-height: 330px; }
.chart-box { min-height: 280px; }

/* 优化师看板:两张排行图严格等高对齐 */
.rank-grid > .card > .card-bd { min-height: 380px; }
.rank-chart { min-height: 360px !important; height: 360px !important; }

/* 数据录入头部三块 field 排版统一(等宽 + 同字号) */
.entry-head .field { min-width: 200px; }
.entry-head .field label { font-size: 12.5px; color: var(--text-2); margin-bottom: 4px; display: block; font-weight: 500; }
.entry-head .field input,
.entry-head .field select { font-size: 13px; padding: 6px 10px; }

/* ===== 表头排序（点一下降序，点两下升序） ===== */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: #eef2f8; }
th.sortable::after {
  content: "\2195"; margin-left: 4px; font-size: 11px; opacity: .3;
}
th.sortable.sort-desc { color: #2f6bff; }
th.sortable.sort-desc::after { content: "\2193"; opacity: 1; font-weight: 700; }
th.sortable.sort-asc { color: #2f6bff; }
th.sortable.sort-asc::after { content: "\2191"; opacity: 1; font-weight: 700; }
.nowrap { white-space: nowrap; }

/* ===== Excel 上传录入弹窗 ===== */
.excel-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .46);
  display: flex; align-items: center; justify-content: center; z-index: 120; padding: 24px;
}
.excel-box {
  width: 880px; max-width: 100%; max-height: 90vh; background: #fff; border-radius: 16px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .28); display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn .18s ease;
}
.excel-box .hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 700;
}
.excel-box .hd .x {
  border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--text-3);
  cursor: pointer; padding: 0 4px;
}
.excel-box .hd .x:hover { color: var(--text); }
.excel-box .bd { padding: 18px; overflow: auto; }
.excel-box .ft {
  display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-soft);
  background: #fbfcfe;
}
.excel-ftinfo { color: var(--text-3); font-size: 12.5px; }
.excel-ftinfo.bad { color: var(--red); }
.excel-ftinfo.ok { color: var(--green); }

/* 拖拽区 */
.excel-drop { border: 2px dashed var(--line); border-radius: 12px; background: #fafbfe; transition: border-color .15s, background .15s; }
.excel-drop.over { border-color: var(--brand); background: var(--brand-soft); }
.excel-drop-in { padding: 38px 20px; text-align: center; cursor: pointer; }
.excel-drop-in .big { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.excel-drop-in .sub { font-size: 12.5px; color: var(--text-3); line-height: 1.6; max-width: 620px; margin: 0 auto; }

/* 预览区 */
.excel-meta { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.excel-meta b { color: var(--text); }
.excel-err {
  display: none; background: #fdecec; border: 1px solid #f8cfd0; color: #b42318;
  border-radius: 9px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 10px; max-height: 132px; overflow: auto;
}
.excel-err.show { display: block; }
.excel-err .eh { font-weight: 700; margin-bottom: 4px; }
.excel-err ul { margin: 4px 0 0; padding-left: 18px; }
.excel-err li { margin-bottom: 2px; }
.excel-table-wrap { max-height: 42vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.excel-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.excel-table th, .excel-table td { padding: 7px 9px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
.excel-table thead th {
  position: sticky; top: 0; background: #f6f8fc; z-index: 2; color: var(--text-2); font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.excel-table tbody tr:nth-child(even) { background: #fcfdff; }
.excel-table td.val { text-align: right; font-variant-numeric: tabular-nums; }
.excel-table .row-no { color: var(--text-3); text-align: center; }
.excel-table td.cell-err { background: #fdecec; color: #b42318; font-weight: 600; }
.excel-table td.cell-warn { background: #fff6e6; color: #9a6a00; }
.excel-table tr.row-err td.row-no { color: var(--red); font-weight: 700; }
.excel-table .flag { display: inline-block; min-width: 14px; }
.excel-table .flag.err { color: var(--red); }
.excel-table .flag.warn { color: var(--amber); }
.excel-table .flag.ok { color: var(--green); }

/* ===== 操作日志 ===== */
#logBody td { vertical-align: top; }
#logBody tr:hover { background: #f7f9fc; }
.tag[title] { cursor: help; }

/* ===== 批量勾选列 ===== */
.tbl-wrap table td input[type=checkbox], .tbl-wrap table th input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; }
.btn.danger:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; }

/* ===== 站内信 ===== */
.msg-badge {
  position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red, #e5484d); color: #fff; border-radius: 20px; font-size: 10.5px;
  line-height: 16px; text-align: center; font-weight: 700;
}
.usage-badge {
  margin-left: 4px; font-size: 11px; font-weight: 700; color: var(--primary, #2f5cff);
  font-variant-numeric: tabular-nums;
}
.msg-pop {
  position: fixed; top: 60px; right: 18px; width: 420px; max-width: calc(100vw - 36px);
  max-height: 70vh; display: flex; flex-direction: column; z-index: 200;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(16,24,40,.18);
}
.msg-hd {
  display: flex; align-items: center; gap: 6px; padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.msg-bd { overflow-y: auto; padding: 6px 8px 10px; }
.msg-item {
  padding: 10px 10px; border-radius: 9px; cursor: pointer; margin-bottom: 4px;
  border: 1px solid transparent; transition: background .15s ease;
}
.msg-item:hover { background: #f7f9fc; }
.msg-item.unread { background: #fff8ec; border-color: #ffe6bd; }
.msg-t { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.msg-t b { font-size: 13px; }
.msg-c { font-size: 12.5px; color: var(--text-2, #5b6678); line-height: 1.6; }
.msg-m { margin-top: 5px; font-size: 11.5px; }
.tag.warn { background: #fff4e5; color: #b25e09; }
.tag.danger { background: #ffecec; color: #c0392b; }
.tag.ok { background: #e8f9ee; color: #0f7a3a; }
.tag.muted { background: #eef0f3; color: #6b7280; }
.tag.info { background: #e9f0ff; color: #2f5cff; }
.usage-detail { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.ud-row { display: grid; grid-template-columns: 116px 1fr; align-items: baseline; gap: 10px; padding: 8px 10px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; }
.ud-row > span { font-size: 12.5px; color: var(--text-2); }
.ud-row > b { font-size: 14px; color: var(--brand); font-variant-numeric: tabular-nums; }
.ud-row > i { grid-column: 2; font-style: normal; font-size: 11.5px; color: var(--text-3); }
.msg-go { margin-top: 6px; font-size: 11.5px; color: var(--primary, #2f5cff); text-align: right; }
.danger { color: #c0392b; }
.pos { color: #0f7a3a; }
.neg { color: #c0392b; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== 项目维度渠道明细表 ===== */
#rkChannelTableWrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
#rkChannelTable { width: 100%; border-collapse: collapse; font-size: 13px; }
#rkChannelTable th,
#rkChannelTable td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
#rkChannelTable th { background: #f8fafc; font-weight: 600; color: var(--text-2); }
#rkChannelTable td:nth-child(2),
#rkChannelTable td:nth-child(3),
#rkChannelTable td:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; }
#rkChannelTable tbody tr:last-child td { border-bottom: none; }
#rkChannelTable tbody tr:hover { background: #fafbfd; }

/* ===== 站内信详情弹窗 ===== */
/* 注意：必须独立于 .modal-mask，避免同名类在层叠中把 openModal() 生成的通用弹窗
   覆盖成 display:none（曾导致「批量删除」「改」等弹窗不可见、真实点击无效） */
.msg-mask {
  position: fixed; inset: 0; z-index: 500; display: none;
  align-items: center; justify-content: center; background: rgba(16,24,40,.45);
}
.modal-card {
  width: 560px; max-width: calc(100vw - 32px); max-height: 84vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(16,24,40,.28); overflow: hidden;
}
.modal-hd {
  display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.modal-bd { padding: 16px; overflow-y: auto; }
.md-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.md-head b { font-size: 15px; }
.md-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-2, #5b6678); margin-bottom: 10px; }
.md-meta span { background: #f5f7fb; border-radius: 7px; padding: 4px 9px; }
.md-sum { font-size: 13px; color: #333; margin-bottom: 12px; }
.md-sum b.danger { font-size: 15px; }
.md-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.md-tbl th, .md-tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.md-tbl th { background: #f7f9fc; color: var(--text-2, #5b6678); font-weight: 600; }
.md-tbl td.num, .md-tbl th.num { text-align: right; }
.md-tbl tr:hover td { background: #fafbff; }
.md-tip {
  margin-top: 14px; padding: 10px 12px; border-left: 3px solid #f5a524; background: #fff9ef;
  border-radius: 8px; font-size: 12.5px; color: #8a5a06; line-height: 1.6;
}

/* ===== 产品看板（排行榜 / 饼图） ===== */
#page-board .chart-box { min-height: 300px; }
.board-tabs { display: flex; gap: 8px; }
.board-tabs button { border: 1px solid var(--line); background: #fff; color: var(--text-2); padding: 6px 16px; border-radius: 20px; cursor: pointer; font-size: 13px; transition: all .15s; }
.board-tabs button:hover { border-color: var(--brand); color: var(--brand); }
.board-tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 4px 12px rgba(47,92,255,.25); }
.board-tab-panel { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 优化师下钻（点击优化师卡片展开） ===== */
.mini.clickable { cursor: pointer; transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.mini.clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(47,92,255,.14); border-color: var(--brand); }
.drill-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 900px) { .drill-grid { grid-template-columns: 1fr; } }
.drill-grid .chart-box { height: 250px; position: relative; }
.drill-head-sums { display: flex; gap: 18px; align-items: baseline; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.drill-head-sums b { font-size: 15px; }
/* 下钻内部：小节标题 + 环比徽标 + 本期/上期双环对比 */
.od-sub-hd { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; flex-wrap: wrap; }
.od-sec-title { font-weight: 600; font-size: 13.5px; color: var(--text-1); margin: 16px 0 8px; padding-left: 9px; border-left: 3px solid var(--brand); }
.delta-tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px; line-height: 18px; white-space: nowrap; }
.delta-up { background: #fdecec; color: #b42318; }
.delta-down { background: #e8f8ef; color: #0a6c37; }
.delta-flat { background: #f1f3f7; color: var(--text-2); }
.pie-duo { display: flex; gap: 10px; align-items: stretch; }
.pie-cell { flex: 1; min-width: 0; }
.pie-cell .chart-box { height: 215px; position: relative; }
.pie-cap { text-align: center; font-size: 13px; font-weight: 600; color: var(--text-1); margin-top: 2px; }
/* 首页项目消耗/利润双排行表 */
.proj-rank-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .proj-rank-duo { grid-template-columns: 1fr; } }
.proj-rank-title { font-weight: 600; font-size: 13px; color: var(--text-2); margin-bottom: 6px; padding-left: 8px; border-left: 3px solid var(--brand); }
.proj-tbl { max-height: 330px; }
.proj-tbl tfoot td { border-top: 2px solid var(--line-soft); border-bottom: none; background: #f8fafc; }
/* 项目表格：主项目名 + 所属游戏小字 */
.pj-main { font-weight: 500; font-size: 12.5px; color: var(--text-1); line-height: 1.35; }
.pj-sub { font-size: 11px; color: var(--text-3); line-height: 1.3; margin-top: 1px; }

