/* ======================================================================
   抖音小游戏 ECPM 实时数据后台 · 全局样式
   ----------------------------------------------------------------------
   浅色精致主题（v2 视觉重构）
   原则：只调整视觉表现，不改动任何 HTML 结构 / 类名 / JS 逻辑
   ====================================================================== */

/* ---------------- 设计令牌 ---------------- */
:root {
  /* 底色与面板 */
  --bg: #f5f7fa;
  --bg-soft: #eef2f7;
  --panel: #ffffff;
  --panel-2: #f3f6fa;
  --panel-3: #e9eff6;
  --border: #e4eaf1;
  --border-soft: #edf1f6;
  --border-strong: #d3dce8;

  /* 文字 */
  --text: #1e293b;
  --text-2: #475569;
  --text-dim: #6b7c93;

  /* 主题色 */
  --accent: #0891b2;
  --accent-deep: #0e7490;
  --accent-line: rgba(8, 145, 178, 0.40);
  --accent-soft: rgba(8, 145, 178, 0.09);
  --accent-softer: rgba(8, 145, 178, 0.055);
  --accent-2: #059669;
  --accent-2-soft: rgba(5, 150, 105, 0.10);
  --warn: #d97706;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.09);
  --ok: #059669;
  --err: #dc2626;

  /* 形状 */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --ring: 0 0 0 3px rgba(8, 145, 178, 0.14);

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow: 0 6px 22px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 14px 34px rgba(15, 23, 42, 0.10), 0 3px 8px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 26px 64px rgba(15, 23, 42, 0.18);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --side-w: 214px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(900px 460px at 88% -12%, rgba(8, 145, 178, 0.10), transparent 62%),
    radial-gradient(760px 420px at 4% -6%, rgba(5, 150, 105, 0.07), transparent 58%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 42%, #f2f5f9 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; transition: color 0.16s var(--ease); }
a:hover { color: var(--accent-deep); }

::selection { background: rgba(8, 145, 178, 0.16); color: var(--accent-deep); }

/* ---------------- 侧边栏布局(综合业务管理平台) ---------------- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 46%, #f1f5fa 100%);
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.9), 8px 0 28px rgba(15, 23, 42, 0.035);
  display: flex; flex-direction: column; z-index: 60;
}
.side-brand {
  position: relative;
  padding: 20px 18px 16px 20px;
  font-size: 16px; font-weight: 700; line-height: 1.62; letter-spacing: 3px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.075), rgba(5, 150, 105, 0.02) 62%, transparent);
  overflow: hidden;
}
/* 品牌标识:纯 CSS 绘制的渐变方块 + 内嵌图形 */
.side-brand::before {
  content: "";
  display: block;
  width: 34px; height: 34px; margin-bottom: 12px;
  border-radius: 11px;
  background: linear-gradient(140deg, #22b8cf 0%, var(--accent) 52%, var(--accent-deep) 100%);
  box-shadow: 0 6px 16px rgba(8, 145, 178, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.side-brand::after {
  content: "";
  position: absolute; left: 31px; top: 30px;
  width: 16px; height: 16px;
  background:
    linear-gradient(#ffffff, #ffffff) 0 0 / 16px 3px no-repeat,
    linear-gradient(#ffffff, #ffffff) 0 6px / 9px 3px no-repeat,
    linear-gradient(#ffffff, #ffffff) 0 12px / 13px 3px no-repeat;
  opacity: 0.95;
  border-radius: 2px;
}
.side-nav { flex: 1; padding: 12px 10px 16px; overflow-y: auto; }
.nav-group {
  display: flex; align-items: center; gap: 8px;
  color: #93a4b8; font-size: 10.5px; letter-spacing: 2.4px;
  padding: 16px 12px 7px;
}
.nav-group::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.nav-item {
  position: relative;
  display: flex; align-items: center;
  padding: 9px 12px; margin-bottom: 3px;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; cursor: pointer;
  border-left: 3px solid transparent;
  letter-spacing: 0.2px;
}
/* 导航图标:用 SVG 蒙版渲染,颜色随文字 */
.nav-item::before {
  content: ""; flex: none;
  width: 15px; height: 15px; margin-right: 10px;
  background-color: currentColor;
  opacity: 0.55;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
  transition: opacity 0.16s var(--ease);
}
.nav-item[data-nav="home"] {
  --ico: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 2 11.6h3V21h5.2v-5.6h3.6V21H19v-9.4h3z'/%3E%3C/svg%3E");
}
.nav-item[data-nav="realtime"] {
  --ico: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6h18v2H3zM3 11h18v2H3zM3 16h18v2H3z'/%3E%3C/svg%3E");
}
.nav-item[data-nav="summary"] {
  --ico: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z'/%3E%3C/svg%3E");
}
.nav-item[data-nav="traffic"] {
  --ico: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5h3.4V20H4zM10.3 7.5h3.4V20h-3.4zM16.6 3.5H20V20h-3.4z'/%3E%3C/svg%3E");
}
.nav-item[data-nav="games"] {
  --ico: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.4 2.4 12 12 21.6 21.6 12zM11 7h2v8.4h-2zm0 9.8h2v2h-2z'/%3E%3C/svg%3E");
}
.nav-item[data-nav="users"] {
  --ico: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8zm0 10c4.4 0 8 2.1 8 4.6V21H4v-2.4C4 16.1 7.6 14 12 14z'/%3E%3C/svg%3E");
}
.nav-item:hover {
  color: var(--text);
  background: linear-gradient(90deg, var(--accent-softer), rgba(255, 255, 255, 0.4));
}
.nav-item:hover::before { opacity: 0.8; }
.nav-item.active {
  color: var(--accent-deep);
  background: linear-gradient(90deg, rgba(8, 145, 178, 0.13), rgba(8, 145, 178, 0.035));
  border-left-color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 3px rgba(8, 145, 178, 0.10);
}
.nav-item.active::before { opacity: 1; }
.side-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 16px; margin: 0 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-dim); font-size: 12px;
  box-shadow: var(--shadow-xs);
}
.side-foot a { color: var(--danger); font-weight: 500; }
.side-foot a:hover { color: #b91c1c; }

/* ---------------- 主内容区 ---------------- */
.main { margin-left: var(--side-w); padding: 20px 28px 64px; min-height: 100vh; }
.crumbs { color: var(--text-dim); font-size: 12.5px; margin-bottom: 12px; letter-spacing: 0.2px; }
.crumbs .sep { margin: 0 7px; color: #b8c4d4; }
.page-title-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title {
  position: relative;
  font-size: 21px; font-weight: 700; letter-spacing: 0.2px;
  padding-left: 15px; line-height: 1.3;
}
/* 标题左侧渐变竖条 */
.page-title::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 3px;
  background: linear-gradient(180deg, #22b8cf, var(--accent) 55%, var(--accent-2));
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.32);
}
.page-title-wrap .sub { color: var(--text-dim); font-size: 12.5px; }
.page-title-wrap .spacer { flex: 1; }

/* ---------------- 搜索过滤条 ---------------- */
.filter-bar {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 17px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  position: relative; z-index: 50;   /* 浮层(月历)不被下方卡片遮挡 */
}
.filter-bar .fld { margin: 0; min-width: 180px; flex: 1; max-width: 260px; }
.filter-bar .fld .lbl { display: block; color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.filter-bar .fld input { padding: 8px 11px; }
.filter-bar .btn { white-space: nowrap; }

/* ---------------- 顶部导航(旧,保留兼容) ---------------- */
nav.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px) saturate(140%);
}
nav.topbar .brand { font-size: 17px; font-weight: 700; letter-spacing: 0.5px; }
nav.topbar .brand .dot { color: var(--accent); }
nav.topbar .spacer { flex: 1; }
nav.topbar a.tab {
  color: var(--text-dim); padding: 7px 14px; border-radius: var(--radius-sm); font-weight: 500;
}
nav.topbar a.tab.active, nav.topbar a.tab:hover { color: var(--accent-deep); background: var(--accent-soft); }
nav.topbar .user { color: var(--text-dim); font-size: 13px; }
nav.topbar .logout { cursor: pointer; color: var(--danger); }

/* ---------------- 布局 ---------------- */
main.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 24px 60px; }
.page-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head h2 { font-weight: 700; letter-spacing: 0.2px; }
.page-head .sub { color: var(--text-dim); font-size: 13px; }
.page-head .spacer { flex: 1; }
.refresh-hint { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }

/* 数据刷新规则提示条(游戏数据汇总) */
.sum-tip {
  position: relative;
  background: linear-gradient(120deg, #fffaf1, #fff8ec 55%);
  border: 1px solid #f2ddba; border-left: 3px solid #e8a33d;
  border-radius: var(--radius);
  color: #8a4a09; font-size: 12.5px; line-height: 1.7;
  padding: 11px 16px 11px 15px; margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.06);
}
.sum-tip b { color: #b45309; }
.sum-tip.warn-mode {
  background: linear-gradient(120deg, #fff4e9, #ffeedd 60%);
  border-color: #f6c496; border-left-color: #ea7c1f;
  color: #a34b06;
  box-shadow: 0 2px 12px rgba(217, 119, 6, 0.12);
}
.sum-tip a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.sum-tip a:hover { color: #7c2d12; }

/* ---------------- 指标卡 ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px 17px;
  box-shadow: var(--shadow-sm);
}
/* 卡片右上角柔和光晕 */
.kpi::after {
  content: ""; position: absolute; right: -34px; top: -44px;
  width: 128px; height: 128px; border-radius: 50%;
  background: radial-gradient(circle at 34% 34%, rgba(8, 145, 178, 0.12), transparent 70%);
  pointer-events: none;
}
.kpi .label { color: var(--text-dim); font-size: 12px; letter-spacing: 1.1px; }
.kpi .value { font-size: 30px; font-weight: 700; margin-top: 7px; font-variant-numeric: tabular-nums; letter-spacing: -0.4px; }
.kpi .value.accent { color: var(--accent); }
.kpi .value.green { color: var(--accent-2); }
.kpi .value.warn { color: var(--warn); }
.kpi .foot { color: var(--text-dim); font-size: 11px; margin-top: 7px; }
.kpi.ecpm-big {
  background: linear-gradient(135deg, #ecf9fc 0%, #f5fbfe 52%, #ffffff 100%);
  border-color: #bfe6f0;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.kpi.ecpm-big::after {
  width: 170px; height: 170px; right: -40px; top: -60px;
  background: radial-gradient(circle at 36% 34%, rgba(8, 145, 178, 0.20), transparent 70%);
}
.kpi.ecpm-big .value {
  font-size: 40px; color: var(--accent-deep);
  background: linear-gradient(135deg, #0891b2, #0e7490 70%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 22px rgba(8, 145, 178, 0.16);
}
.kpi.ecpm-big .label { color: var(--accent-deep); font-weight: 600; }
.kpis-sm .kpi { padding: 14px 16px; }
.kpis-sm .kpi .value { font-size: 25px; }

/* ---------------- 卡片 ---------------- */
.card {
  position: relative;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 18px;
  background-image: linear-gradient(90deg, var(--accent-line), rgba(5, 150, 105, 0.22) 42%, rgba(8, 145, 178, 0) 78%);
  background-repeat: no-repeat;
  background-size: 100% 2px;
  background-position: left top;
}
.card h2 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; letter-spacing: 0.2px; }
.card h2 .hint { font-size: 11px; color: var(--text-dim); font-weight: 400; }

/* ---------------- 图表 ---------------- */
.chart-box { position: relative; width: 100%; height: 260px; }
canvas { width: 100%; height: 100%; display: block; }

/* ---------------- 游戏卡片网格 ---------------- */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.game-card {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.game-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), rgba(5, 150, 105, 0.85));
  opacity: 0; transition: opacity 0.2s var(--ease);
}
.game-card .g-top { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.game-card .g-name { font-weight: 600; font-size: 15px; letter-spacing: 0.2px; }
.game-card .g-appid { color: var(--text-dim); font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.2px; }
.game-card .badge {
  font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 600;
  background: var(--panel-2); color: var(--text-dim);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.game-card .badge.ok { background: rgba(5, 150, 105, 0.10); color: var(--ok); border-color: rgba(5, 150, 105, 0.22); }
.game-card .badge.err { background: rgba(220, 38, 38, 0.08); color: var(--err); border-color: rgba(220, 38, 38, 0.20); }
.game-card .badge.real { background: rgba(8, 145, 178, 0.10); color: var(--accent-deep); border-color: rgba(8, 145, 178, 0.22); }
.game-card .badge.warn { background: rgba(217, 119, 6, 0.10); color: var(--warn); border-color: rgba(217, 119, 6, 0.24); }
.game-card .g-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px;
  padding: 11px 10px 10px; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fafcfe, #f6f9fc);
  border: 1px solid var(--border-soft);
}
.game-card .g-metrics .m { min-width: 0; }
.game-card .g-metrics .m .m-v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; white-space: nowrap; }
.game-card .g-metrics .m .m-v.pending { font-size: 13px; color: var(--warn); letter-spacing: 0; }
.game-card .g-metrics .m .m-v.dash { color: #a8b6c8; font-weight: 600; }
.game-card .g-metrics .m .m-l { color: var(--text-dim); font-size: 11px; margin-top: 3px; letter-spacing: 0.2px; }
.game-card .ecpm-bar { height: 46px; display: flex; align-items: flex-end; gap: 2px; padding-bottom: 1px; border-bottom: 1px solid var(--border-soft); }
.game-card .ecpm-bar i {
  flex: 1; background: linear-gradient(180deg, #22b8cf, var(--accent) 45%, var(--accent-deep));
  border-radius: 2px 2px 0 0; min-height: 1px; opacity: 0.85;
}
.game-card .g-foot { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 11px; margin-top: 11px; }
.game-card .g-error {
  color: #b91c1c; font-size: 12px; margin-top: 8px; word-break: break-all;
  background: var(--danger-soft); border: 1px solid rgba(220, 38, 38, 0.16);
  border-radius: 8px; padding: 6px 9px; line-height: 1.5;
}

/* ---------------- 按钮/表单 ---------------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
  color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 16px; font-size: 13px; font-weight: 500; cursor: pointer; transition: 0.16s;
  box-shadow: var(--shadow-xs);
  /* 禁止按钮文字被鼠标选中:消除点击时"文字选中高亮"造成的视觉变大/变色 */
  user-select: none; -webkit-user-select: none;
}
.btn:hover { border-color: var(--accent-line); color: var(--accent-deep); }
.btn.primary {
  background: linear-gradient(135deg, #12a3c4 0%, #0891b2 46%, #0e7490 100%);
  border-color: rgba(14, 116, 144, 0.75); color: #fff;
  box-shadow: 0 3px 12px rgba(8, 145, 178, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}
.btn.primary:hover { filter: brightness(1.07); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: rgba(220, 38, 38, 0.45); color: #b91c1c; background: linear-gradient(180deg, #fff, #fef4f4); }
.btn.small { padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
/* 「查询」加载中:仅禁用重复点击,无任何视觉变化(避免任何浏览器渲染差异) */
.btn.loading { pointer-events: none; }

input, select, textarea {
  width: 100%; background: #fbfcfe; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13px; outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background-color 0.16s var(--ease);
  font-family: inherit;
}
input:hover, select:hover, textarea:hover { border-color: #c3cfdd; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: var(--ring);
}
input[readonly] { background: #f6f9fc; }
input::placeholder, textarea::placeholder { color: #a6b3c4; }
label.fld { display: block; margin-bottom: 12px; }
label.fld .lbl { display: block; color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.check-row input { width: auto; accent-color: var(--accent); }
.check-row span { color: var(--text-dim); font-size: 12px; }

/* ---------------- 表格 ---------------- */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
table.grid th, table.grid td {
  text-align: left; padding: 12px 15px; border-bottom: 1px solid var(--border-soft);
  font-size: 14px; vertical-align: middle;
}
table.grid th {
  color: var(--text-2); font-weight: 600; font-size: 12.5px; letter-spacing: 0.5px;
  background: linear-gradient(180deg, #f7fafc, #f1f5f9);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.grid th:first-child { border-top-left-radius: var(--radius-sm); }
table.grid th:last-child { border-top-right-radius: var(--radius-sm); }
table.grid tbody tr:last-child td { border-bottom: none; }
#rtTable td { font-size: 14px; }
#rtTable th { font-size: 12.5px; }
table.grid tr:hover td { background: var(--accent-softer); }
table.grid td:first-child { border-left: 2px solid transparent; }
table.grid tr:hover td:first-child { border-left-color: var(--accent-line); }
table.grid .ops { display: flex; gap: 6px; }
.report-key {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--accent-deep);
  cursor: pointer; border-bottom: 1px dashed var(--accent-line); padding-bottom: 1px;
}
.report-key:hover { color: #ffffff; background: var(--accent); border-bottom-color: transparent; border-radius: 4px; padding: 1px 5px; }

/* 日期下拉:当日选项标蓝 */
select option.today { color: var(--accent); font-weight: 600; }

/* ---------------- 弹出月历选择器 ---------------- */
.date-picker { position: relative; }
.date-picker input { cursor: pointer; padding-right: 30px; }
.cal-caret {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); font-size: 12px; pointer-events: none;
}
.cal {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 1000;
  width: 278px; background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 12px 13px;
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-size: 13px; font-weight: 600; letter-spacing: 0.3px; }
.cal-nav {
  background: none; border: none; color: var(--text-dim);
  font-size: 17px; cursor: pointer; padding: 2px 11px; line-height: 1; border-radius: 7px;
  transition: 0.16s var(--ease);
}
.cal-nav:hover { color: var(--accent-deep); background: var(--accent-soft); }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.cal-week span { font-size: 11px; color: #9aa9bd; padding: 3px 0; }
.cal-day {
  font-size: 12.5px; padding: 6px 0; border-radius: 8px; cursor: pointer;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.cal-dim { color: #b9c5d4; }
.cal-today { color: var(--accent); font-weight: 700; }        /* 今天:蓝色加粗 */
.cal-day.cal-selected {
  background: linear-gradient(135deg, #12a3c4, var(--accent-deep));
  color: #fff; font-weight: 700;
  box-shadow: 0 3px 10px rgba(8, 145, 178, 0.28);
}
.cal-day.cal-selected:hover { background: linear-gradient(135deg, #12a3c4, var(--accent-deep)); }
.cal-foot { text-align: center; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--border-soft); }
.cal-clear { background: none; border: none; color: var(--text-dim); font-size: 12px; cursor: pointer; }
.cal-clear:hover { color: var(--accent-deep); }

/* ---------------- 弹窗 ---------------- */
dialog {
  position: fixed; inset: 0; margin: auto; height: fit-content;
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; width: min(480px, 92vw);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(15, 23, 42, 0.34); backdrop-filter: blur(3px); }
dialog h3 { margin-bottom: 16px; font-size: 17px; letter-spacing: 0.3px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------------- 日志 ---------------- */
.log-line {
  display: flex; gap: 12px;
  padding: 9px 12px; border-bottom: 1px solid var(--border-soft); font-size: 12.5px;
  border-radius: 8px;
}
.log-line:last-child { border-bottom: none; }
.log-line .t { color: var(--text-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-line .status { font-weight: 700; width: 60px; flex: none; }
.log-line .status.success { color: var(--ok); }
.log-line .status.error { color: var(--err); }
.log-line .status.skipped { color: var(--warn); }
.log-line .msg { color: var(--text-dim); word-break: break-all; }

/* ---------------- 登录页 ---------------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
  position: relative; overflow: hidden;
  width: min(412px, 92vw); background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 36px 32px; box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
}
.login-box::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, #22b8cf, var(--accent) 45%, var(--accent-2));
}
.login-box h1 { font-size: 18.5px; margin-bottom: 8px; letter-spacing: 0.2px; line-height: 1.5; }
.login-box .tip { color: var(--text-dim); font-size: 12px; margin-bottom: 24px; }
.login-box .err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 12px; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 10px; padding: 11px; }

/* ---------------- 空态 ---------------- */
.empty { color: var(--text-dim); text-align: center; padding: 44px 0; font-size: 13px; }
.empty a { color: var(--accent); font-weight: 600; }

/* ---------------- 提示条 ---------------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(6px);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 20px; font-size: 13px; z-index: 99; box-shadow: var(--shadow-md);
  opacity: 0; transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none; backdrop-filter: blur(6px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-left-color: var(--danger); color: var(--danger); }
.toast.ok { border-left-color: var(--ok); color: #047857; }

.loading-box { color: var(--text-dim); padding: 34px; text-align: center; }

/* ================= 交互特效 ================= */
/* 全局平滑过渡 */
.btn, .nav-item, .game-card, .kpi, .cal-day, table.grid tbody tr,
.filter-bar .btn, .report-key, .log-line, .card, .badge, .side-foot {
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease),
              transform .16s var(--ease), box-shadow .18s var(--ease), opacity .2s var(--ease);
}
/* 按钮按压反馈(:active 在 :hover 之后,确保点击时缩放优先) */
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(15, 23, 42, 0.10); }
.btn.primary:hover { box-shadow: 0 6px 18px rgba(8, 145, 178, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.btn:active { transform: scale(0.96) translateY(0); }
.btn.primary:active { filter: brightness(0.94); }

/* 卡片 / 区块入场动画(过滤条不参与,避免层级干扰) */
.card, .game-card, .kpi {
  animation: fadeUp 0.42s var(--ease) both;
}
.kpi:nth-child(2) { animation-delay: .04s; }
.kpi:nth-child(3) { animation-delay: .08s; }
.kpi:nth-child(4) { animation-delay: .12s; }
.game-card:nth-child(2) { animation-delay: .05s; }
.game-card:nth-child(3) { animation-delay: .10s; }
.game-card:nth-child(4) { animation-delay: .15s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* 悬浮反馈:卡片抬升 */
.kpi:hover, .game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.game-card:hover::before { opacity: 1; }
.game-card:hover .g-name { color: var(--accent-deep); }

/* 导航 hover 微位移 */
.nav-item:hover { transform: translateX(3px); }

/* 表格行 hover 反馈 */
table.grid tbody tr:hover td { background: var(--accent-softer); }
table.grid tbody tr { cursor: default; }

/* 自定义滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd6e2; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #aebdcf; background-clip: padding-box; }

/* 弹窗弹出动画 */
dialog[open] { animation: dialogIn 0.22s var(--ease); }
@keyframes dialogIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* 月历格子点击反馈 */
.cal-day { transition: background-color .12s var(--ease), transform .12s var(--ease), color .12s var(--ease); }
.cal-day:hover { background: var(--accent-soft); }
.cal-day:active { transform: scale(0.9); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
  :root { --side-w: 186px; }
  .main { padding: 18px 20px 56px; }
  .filter-bar .fld { max-width: none; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; height: auto; }
  .side-nav { display: block; overflow: visible; padding: 8px 10px 12px; }
  .nav-item { margin-bottom: 2px; }
  .nav-group { padding: 12px 12px 5px; }
  .side-brand { padding: 16px; }
  .side-brand::after { top: 26px; }
  .side-foot { margin: 0 12px 12px; flex-wrap: wrap; gap: 6px; }
  .main { margin-left: 0; padding: 16px 14px 48px; }
  /* 覆盖模板内联的 repeat(4,1fr):窄屏两列,避免横向溢出 */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .filter-bar .fld { min-width: 145px; }
  .game-card .g-metrics { padding: 10px 8px; }
  .game-card .g-metrics .m .m-v { font-size: 16px; }
  .login-box { padding: 30px 22px; }
  .login-box h1 { font-size: 16px; }
}

/* 尊重系统"减少动态效果"设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
