:root {
  --bg: #f5f7fb;
  --panel: #fff;
  --soft: #f6f7f9;
  --line: #ebedf0;
  --txt: #1a1d21;
  --muted: #98a0aa;
  --sub: #5a626d;
  --accent: #2f3742;
  --up: #0f8a43; /* 涨：红（A股/国内习惯） */
  --up-bg: #fdecec;
  --down: #d64545; /* 跌：绿 */
  --down-bg: #eafaf0;
  --warn: #e08a00;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 18px 60px; }
header.top { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
h1 { font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
.meta { color: var(--muted); font-size: 12.5px; }

/* KPI */
.kpis { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 16px; background: var(--panel); }
.kpi { flex: 1; min-width: 140px; padding: 14px 16px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: none; }
.kpi .label { color: var(--muted); font-size: 11.5px; margin-bottom: 6px; }
.kpi .val { font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.kpi .val.warn { color: var(--warn); }
.kpi .sub { color: var(--muted); font-size: 11px; margin-top: 3px; }

/* 峰值时段框 */
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.box h3 { font-size: 13px; color: var(--sub); font-weight: 600; margin-bottom: 10px; display:flex; align-items:center; gap:8px;}
.chartbox { position: relative; height: 220px; }

/* 工具条 */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type="search"] { min-width: 140px; max-width: 200px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; outline: none; }
.toolbar input[type="search"]:focus { border-color: var(--accent); }
.toolbar .hint { color: var(--muted); font-size: 12px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line2, #f2f3f5); vertical-align: middle; }
.table thead th { background: var(--soft); color: var(--sub); font-weight: 600; font-size: 12.5px; cursor: pointer; user-select: none; white-space: nowrap; }
.table thead th:hover { color: var(--txt); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr.expanded { background: #f3f6fb; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.totalcell { font-weight: 600; }
.rank { text-align: center; color: var(--muted); width: 48px; }
.shopcell { min-width: 150px; }
.shopname { font-weight: 550; color: var(--accent); text-decoration: none; cursor: pointer; }
.shopname:hover { text-decoration: underline; }
.badflag { color: var(--warn); margin-left: 4px; cursor: help; }

/* 增量 badges */
.delta { font-weight: 600; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.zero { color: var(--muted); }
.delta.flat { color: var(--muted); }

/* 异常记录 */
.anoms { list-style: none; font-size: 12px; line-height: 1.5; padding: 0; }
.anoms li { padding: 1px 0; }
.anoms .growth { color: var(--up); font-weight: 600; }
.anoms .drop { color: var(--down); font-weight: 600; }
.anoms .none { color: var(--muted); }
.anom-warn { color: var(--warn); font-weight: 600; font-size: 12px; }

/* 展开详情行 */
.detail-row td { background: #f7f9fc; padding: 0 !important; }
.detail-inner { padding: 14px 16px; display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.detail-chart { flex: 1; min-width: 280px; height: 200px; }
.detail-meta { font-size: 12.5px; color: var(--sub); min-width: 180px; }
.detail-meta div { margin-bottom: 4px; }

.empty { color: var(--muted); padding: 30px; text-align: center; }

/* 总览峰值说明 */
.ov-peak { margin-top: 8px; font-size: 12.5px; color: var(--sub); }
.ov-peak b { color: var(--down); }

/* 抽屉内标签页（分段控制器风格） */
.drawer-tabs { display: inline-flex; gap: 2px; margin-bottom: 10px; background: var(--soft); border-radius: 9px; padding: 3px; }
.drawer-tabs .tab { padding: 6px 16px; font-size: 12.5px; border: none; border-radius: 7px; background: transparent; color: var(--sub); cursor: pointer; transition: all .18s; font-weight: 500; }
.drawer-tabs .tab:hover { color: var(--txt); }
.drawer-tabs .tab.active { color: #fff; font-weight: 600; background: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.trend-info { text-align: right; font-size: 12.5px; color: var(--sub); margin-bottom: 4px; }
.trend-info b { color: var(--txt); }

/* 右侧抽屉（替代跳转详情页） */
.drawer-overlay { position: fixed; inset: 0; background: rgba(20,24,28,.34); opacity: 0; visibility: hidden; transition: opacity .22s ease; z-index: 40; }
.drawer-overlay.open { opacity: 1; visibility: visible; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 440px; max-width: 92vw; background: var(--bg); box-shadow: -10px 0 34px rgba(0,0,0,.14); transform: translateX(100%); transition: transform .24s ease; z-index: 50; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); background: var(--panel); flex: 0 0 auto; }
.drawer-head h2 { font-size: 16px; font-weight: 650; }
.drawer-close { border: none; background: var(--soft); width: 30px; height: 30px; border-radius: 8px; font-size: 20px; line-height: 1; cursor: pointer; color: var(--sub); transition: background .15s; }
.drawer-close:hover { background: #eaecef; }
.drawer-body { padding: 16px 18px 28px; overflow-y: auto; flex: 1 1 auto; }
.drawer .kpis { margin-bottom: 16px; }
.drawer .kpi { min-width: 86px; padding: 11px 10px; }
.drawer .kpi .val { font-size: 17px; }

/* 手机端 */
@media (max-width: 768px) {
  .wrap { padding: 14px 10px 50px; }
  .table { font-size: 12px; }
  .table th, .table td { padding: 7px 7px !important; }
  .rank { width: 34px; }
  .shopcell { min-width: 110px; max-width: 150px; }
  .kpi { min-width: 50%; }
  .chartbox { height: 180px; }
}
