:root {
  --bg: #f4f6f9; --card: #ffffff; --text: #1e293b; --muted: #64748b;
  --border: #e2e8f0; --primary: #4f46e5; --radius: 12px;
  --danger: #f43f5e; --success: #10b981;
  --col-highlight: #f8fbff; --col-rank: #fffdf9;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: -apple-system, sans-serif; background: var(--bg); color: var(--text); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 15px; }

/* 头部布局 */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.header-left { display: flex; align-items: center; gap: 10px; }
.logo { width: 40px; height: 40px; background: #1e293b; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.h1 { font-size: 18px; font-weight: 800; margin: 0; white-space: nowrap; }
.sub { font-size: 11px; color: var(--muted); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.kpi { background: #fff; padding: 12px; border-radius: var(--radius); text-align: center; border: 1px solid var(--border); }
.kpiNum { font-size: 22px; font-weight: 900; color: var(--primary); }
.kpiLabel { font-size: 10px; color: var(--muted); }

/* 图表与筛选 */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; margin-bottom: 20px; }
.card { background: #fff; border-radius: var(--radius); padding: 15px; border: 1px solid var(--border); }
.chart-container { position: relative; height: 250px; width: 100%; }
.filterRow { display: flex; gap: 10px; flex-wrap: wrap; }
.filterItem { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 130px; }
select, input { padding: 9px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px; }

/* 表格 PC */
.tableWrap { width: 100%; overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.table { width: 100%; border-collapse: collapse; }
.table th { background: #f8fafc; padding: 12px; font-size: 12px; text-align: left; border-bottom: 2px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }

/* 列染色 */
.table td:nth-child(1), .table td:nth-child(2) { background-color: var(--col-highlight); }
.table td:nth-child(6), .table td:nth-child(7), .table td:nth-child(8) { background-color: var(--col-rank); }

.pill { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: #e2e8f0; display: inline-block; }
.pill.hot { background: #ffe4e6; color: var(--danger); }
.pill.good { background: #dcfce7; color: var(--success); }
.copy-btn { border: none; background: #f1f5f9; padding: 4px 7px; cursor: pointer; border-radius: 5px; }

/* 手机端响应式布局 - 修复关键 */
@media (max-width: 768px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { margin-bottom: 15px; border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: #fff !important; }

  .table td {
    display: flex !important; /* 强制 flex 布局 */
    justify-content: space-between !important;
    align-items: center;
    padding: 8px 5px !important;
    border-bottom: 1px dashed #f1f5f9 !important;
    background-color: transparent !important;
    min-height: 38px;
  }

  .table td:last-child { border-bottom: none !important; }

  /* 核心：确保 attr(data-label) 能够正确抓取到 HTML 属性 */
  .table td::before {
    content: attr(data-label);
    font-weight: 800;
    color: var(--muted);
    font-size: 11px;
    flex-shrink: 0;
    margin-right: 20px;
  }

  /* 确保表格内的实际内容不消失 */
  .table td span, .table td strong, .table td button {
    display: inline-block;
    position: relative;
    z-index: 1;
  }
}

.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 50px; display: none; z-index: 9999; }
.pagination { display: flex; justify-content: center; gap: 5px; padding: 20px 0; }
.page-btn { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.page-btn.active { background: var(--primary); color: #fff; }
.btn { padding: 9px 15px; border-radius: 8px; border: none; background: #1e293b; color: #fff; cursor: pointer; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }