* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #f4f6f9; color: #2c3e50; font-size: 14px;
}

/* 顶部导航 */
.topnav {
    display: flex; align-items: center; gap: 24px;
    background: #1f2d3d; color: #fff; padding: 0 24px; height: 52px;
}
.topnav .brand { font-weight: 700; font-size: 16px; }
.topnav .menu a { color: #cfd8e3; text-decoration: none; margin-right: 12px; }
.topnav .menu a:hover { color: #fff; }
.topnav .user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.role-admin { background: #e74c3c; color: #fff; font-style: normal;
    font-size: 12px; padding: 1px 6px; border-radius: 3px; margin-left: 4px; }
.btn-logout { color: #cfd8e3; text-decoration: none; border: 1px solid #55606d; padding: 3px 10px; border-radius: 4px; }
.btn-logout:hover { color: #fff; border-color: #fff; }

/* 容器 */
.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* 提示 */
.flash { padding: 10px 16px; border-radius: 4px; margin-bottom: 14px; }
.flash.success { background: #e8f7ee; color: #1e7e3e; border: 1px solid #b7e4c7; }
.flash.error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6c2; }

/* 登录/注册卡片 */
.auth-card { max-width: 380px; margin: 60px auto; background: #fff; padding: 28px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.auth-card h2 { margin-bottom: 6px; }
.auth-tip { color: #888; font-size: 12px; margin-bottom: 16px; }
.auth-card label { display: block; margin: 12px 0 4px; font-weight: 600; }
.auth-card input { width: 100%; padding: 9px 12px; border: 1px solid #d5dbe3; border-radius: 5px; }
.auth-link { margin-top: 14px; text-align: center; color: #666; }
.auth-link a { color: #2d7de0; }

/* 按钮 */
.btn-primary { background: #2d7de0; color: #fff; border: none; padding: 9px 22px; border-radius: 5px; cursor: pointer; font-size: 14px; }
.btn-primary:hover { background: #2266bd; }

/* 看板头部 */
.dash-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.period-bar { display: flex; align-items: center; gap: 8px; }
.period-bar select, .period-bar input {
    padding: 7px 10px; border: 1px solid #d5dbe3; border-radius: 5px; font-size: 14px;
}
.period-range { color: #888; font-size: 13px; margin-left: 4px; }

/* KPI 卡片 */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi-card { background: #fff; padding: 16px 18px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.kpi-label { color: #8899a8; font-size: 13px; margin-bottom: 6px; }
.kpi-value { font-size: 22px; font-weight: 700; color: #1f2d3d; }

/* 图表 */
.chart-wrap { background: #fff; border-radius: 8px; padding: 12px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.chart { height: 360px; }

/* 表格 */
.table-wrap { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06); overflow-x: auto; }
.data-table { width: 100%; min-width: 2200px; border-collapse: collapse; white-space: nowrap; }
.data-table th, .data-table td { border: 1px solid #e3e8ee; padding: 7px 10px; text-align: right; }
.data-table th { background: #f0f3f7; font-weight: 600; }
/* 表头两行纵向固定(页面上下滚动时表头不消失) */
.data-table thead th { position: sticky; top: 0; z-index: 3; }
/* 店铺列横向固定: 仅第一行表头第一个单元格 + 数据行第一列(避免误固定品类标签行) */
.data-table thead tr:first-child th:first-child { text-align: left; position: sticky; left: 0; top: 0; z-index: 5; background: #f0f3f7; }
.data-table tbody td:first-child { text-align: left; position: sticky; left: 0; z-index: 2; background: #f0f3f7; }
.data-table td.num { font-variant-numeric: tabular-nums; }
.data-table td.na { color: #c4ccd6; }
.data-table tr.row-na td { background: #fafbfc; }
.data-table tr.row-na td:first-child { background: #e9edf2; }
.data-table .empty { text-align: center; color: #999; }
.col-group { text-align: center; background: #e3ecf5 !important; }
.cat-row th { font-size: 12px; font-weight: 600; background: #f7fafc; }

  .footnote { color: #999; font-size: 12px; margin-top: 10px; }

  /* 提成统计表 */
  #commissionTables .panel { margin-top: 16px; }
  #commissionTables .subtitle { color: #888; font-size: 13px; margin-bottom: 10px; }
  #commissionTables .data-table { min-width: 720px; }
  #commissionTables td.left { text-align: left; }

  /* 财务报表(仿 Excel 模板) */
  .report-tabs { display: flex; gap: 8px; }
  .report-tabs button {
      padding: 7px 18px; border: 1px solid #d5dbe3; border-radius: 5px;
      background: #fff; cursor: pointer; font-size: 14px;
  }
  .report-tabs button.active { background: #2d7de0; color: #fff; border-color: #2d7de0; }
  .report-wrap {
      background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
      overflow: auto; max-height: 76vh;
  }
  .report-table { border-collapse: collapse; white-space: nowrap; font-size: 13px; min-width: 1600px; }
  .report-table th, .report-table td { border: 1px solid #d0d5dd; padding: 5px 10px; text-align: right; }
  .report-table th { background: #f0f3f7; font-weight: 600; }
  /* 表头 + 店铺列固定 */
  .report-table thead th { position: sticky; top: 0; z-index: 3; }
  .report-table thead th:first-child { position: sticky; left: 0; top: 0; z-index: 5; text-align: left; }
  .report-table tbody td:first-child { position: sticky; left: 0; z-index: 2; text-align: left; background: #fff; }
  .report-table tbody tr:hover td:first-child { background: #f2f6fb; }

/* 面板 / 表单 / 标签 */
.panel { background: #fff; border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.panel-title { font-size: 15px; margin-bottom: 12px; color: #1f2d3d; }
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form input[type=password], .inline-form select {
    padding: 7px 10px; border: 1px solid #d5dbe3; border-radius: 5px; font-size: 14px;
}
.inline-form .chk { display: flex; align-items: center; gap: 4px; font-size: 13px; }
form.inline { display: inline; }
.btn-mini { padding: 3px 12px; border-radius: 4px; border: none; cursor: pointer; font-size: 13px; }
.btn-off { background: #fdecea; color: #c0392b; }
.btn-on { background: #e8f7ee; color: #1e7e3e; }
.badge-off { color: #c0392b; font-weight: 600; }
.tag-ok { background: #e8f7ee; color: #1e7e3e; padding: 1px 8px; border-radius: 3px; font-size: 12px; }
.tag-fail { background: #fdecea; color: #c0392b; padding: 1px 8px; border-radius: 3px; font-size: 12px; }
.muted { color: #999; }
.link-muted { color: #2d7de0; font-size: 13px; }
.td-param { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
