:root {
  --bg: #f8f7f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6e6e73;
  --accent: #C9854A;
  --accent-light: #f4e9de;
  --border: #e8e6e1;
  --danger: #d93025;
  --success: #1e8e3e;
  --header: #0d0d0d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

header {
  background: var(--header);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
header .brand { display: flex; align-items: center; gap: 12px; }
header .logo { font-size: 22px; font-weight: 700; letter-spacing: 2px; }
header .subtitle { font-size: 12px; color: #a1a1a6; margin-top: 2px; }
header .meta { text-align: right; font-size: 11px; color: #a1a1a6; }

nav {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 68px;
  z-index: 99;
}
nav button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
nav button.active { background: var(--accent-light); color: var(--accent); }
nav button:hover { color: var(--accent); }

/* 不设最大宽度上限：手机端缩小页面（视口变宽）时内容同步拉伸，右侧不留白 */
.container { padding: 20px 24px; margin: 0 auto; }

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
}
.section-sub { font-size: 12px; color: var(--muted); margin: -8px 0 16px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.kpi-card {
  background: var(--card);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}
.kpi-card .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kpi-card .value { font-size: 28px; font-weight: 700; color: var(--text); }
.kpi-card .value.small { font-size: 22px; }
.kpi-card .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpi-card .sub span { color: var(--accent); font-weight: 600; }
.kpi-card.total { background: var(--header); color: #fff; }
.kpi-card.total .label, .kpi-card.total .sub { color: #a1a1a6; }
.kpi-card.total .value { color: #fff; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-head .ph-sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.panel-body { padding: 16px; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 8px; background: #fafafa; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:hover td { background: #fafafa; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.city { color: var(--muted); }
td.ratio { color: var(--accent); font-weight: 600; }
td.neg { color: var(--danger); }
td.pos { color: var(--success); }

.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
/* 城市分布：两行三列，南京/镇江/常州 第一排，无锡/苏州/南通 第二排 */
.city-grid-2row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 28px;
  align-items: stretch;
  margin-bottom: 4px;
}
@media (max-width: 1000px) {
  .city-grid-2row { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (max-width: 680px) {
  .city-grid-2row { grid-template-columns: 1fr; }
}
.city-card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transition: transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.city-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.12);
}
.city-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}
.city-card .city-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-light);
}
.city-card .city-name {
  font-size: 17px;
  font-weight: 700;
}
.city-card .city-owner {
  font-size: 12px;
  color: var(--muted);
}
.city-card .row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }

#map { width: 100%; height: 600px; border-radius: 12px; border: 1px solid var(--border); }

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-bar select, .filter-bar input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}

/* 一键导出 Excel 按钮 */
.export-btn {
  padding: 8px 18px;
  border: 1px solid var(--header);
  background: var(--header);
  color: #fff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
}
.export-btn:hover { background: #2a2a2a; border-color: #2a2a2a; }
.export-btn:active { transform: translateY(1px); }

/* 周期切换（全年累计 / 三季度） */
.period-toggle {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.period-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.period-toggle button.active {
  background: var(--header);
  color: #fff;
}
.period-toggle button:not(.active):hover { color: var(--accent); }

.marker-label {
  background: var(--header);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.info-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.info-row .item { font-size: 13px; }
.info-row .item strong { display: block; font-size: 18px; }

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

footer {
  padding: 20px 24px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

/* 同比颜色：上涨绿、下跌红（按用户要求） */
.yoy-up { color: var(--success); font-weight: 600; }
.yoy-down { color: var(--danger); font-weight: 600; }

/* KPI 卡片多行副信息 */
.kpi-card .sub-line {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.kpi-card.total .sub-line { color: #a1a1a6; }

/* 城市卡片 richer */
.city-card .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}
.city-card .row:last-child { border-bottom: none; }
.city-card .row .ly {
  color: var(--muted);
  font-size: 11px;
  margin-left: 4px;
}

/* 表格单元格内金额+占比+同比 */
th .th-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}
td .cell-amt { font-weight: 600; }
td .cell-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
td .cell-sub .ratio { color: var(--accent); font-weight: 500; }

.tail { color: var(--danger); font-size: 12px; margin-left: 4px; }

/* 表格容器 */
.store-table-wrap {
  overflow: auto;
  max-width: 100%;
  max-height: calc(100vh - 260px);
  border-top: 1px solid var(--border);
}

/* 地图自定义标记：圆点 + 店名（白底胶囊，凸出于地图底图文字） */
.map-pin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.map-pin .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8a94a0;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  flex-shrink: 0;
}
.map-pin .name {
  display: inline-block;
  background: rgba(255,255,255,0.95);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  font-size: 12px;
  font-weight: 600;
  color: #1f2733;
  line-height: 1.35;
}
.map-pin.store .dot { background: var(--accent); width: 12px; height: 12px; }
.map-pin.store .name { color: var(--accent); border-color: rgba(200,90,30,0.35); }

/* 网格表格：固定列宽 + 显眼网格线 + 列方向底纹 + 冻结列 */
.grid-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.grid-table th, .grid-table td { position: relative; overflow: hidden; text-overflow: ellipsis; white-space: normal; }
.grid-table th { white-space: nowrap; }
.grid-table td.sticky-col { white-space: nowrap; }

/* 表头吸顶 + 高 z-index 确保始终覆盖行 */
.grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f0f2f6;
}

/* 耐看中性灰网格线 */
.grid-table th {
  border-right: 1px solid #d0d6df;
  border-bottom: 2px solid #c5ccd6;
}
.grid-table td {
  border-right: 1px solid #e4e8ee;
  border-bottom: 1px solid #e4e8ee;
}
.grid-table td:last-child { border-right: none; }

/* 列方向底纹：全品列暖 accent，其余列用中性浅灰蓝交替 */
.grid-table th.col-total,
.grid-table td.col-total { background: #fff6ed; }
.grid-table th.col-alt,
.grid-table td.col-alt { background: #f5f8fb; }
.grid-table td.col-total .cell-amt { color: #a06b38; }

/* 行悬停高亮 */
.grid-table tbody tr:hover td { background: #edf1f6; }
.grid-table tbody tr:hover td.sticky-col { background: #e7ebf1; }

/* 冻结列 */
.grid-table th.sticky-col,
.grid-table td.sticky-col {
  position: sticky;
  background: #fff;
  z-index: 2;
  border-right: 2px solid #b8c0cc;
}
.grid-table thead th.sticky-col { z-index: 5; background: #e7ebf1; }

/* 列宽：收紧冻结区，避免右侧全品列被挤出可视区 */
.freeze-1 { left: 0; width: 60px; min-width: 60px; }
.freeze-2 { left: 60px; width: 110px; min-width: 110px; }
.freeze-3 { left: 170px; width: 190px; min-width: 190px; }
.freeze-4 { left: 360px; width: 110px; min-width: 110px; }

/* 品类列/门店名称列固定宽度，避免被长文本撑开 */
.grid-table thead th.col-store-name { width: 130px; min-width: 130px; }
.grid-table thead th:not(.sticky-col):not(.col-store-name) { width: 110px; min-width: 110px; }
.grid-table thead th.col-total { width: 120px; min-width: 120px; }

/* 城市卡片：年累 / Q3 分块颜色区分 */
.city-card .ytd-block,
.city-card .q3-block {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
}
.city-card .ytd-block { background: #f7f7f7; border: 1px solid #ededed; }
.city-card .q3-block { background: #fff8f1; border: 1px solid #f5e6d6; }
.city-card .period-label {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.city-card .ytd-block .period-label { color: var(--muted); }
.city-card .q3-block .period-label { color: var(--accent); }
.city-card .q3-block .row { color: #5c3d22; border-bottom-color: #f0e0d2; }

/* ===== 商户 / 门店面板：表格数据全部居中 ===== */
.grid-table th,
.grid-table td,
.grid-table td.num,
.grid-table td.city { text-align: center; }

/* 门店状态列（达标 / 预警） */
.grid-table thead th.col-store-status { width: 92px; min-width: 92px; }
.grid-table td.store-status { white-space: normal; }
.store-status .badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  color: #fff;
}
.store-status .badge.ok { background: var(--success); }
.store-status .badge.warn { background: var(--danger); }

/* 未达标门店：门店名称与门店编码标红 */
.grid-table tbody tr.row-warn td.store-code,
.grid-table tbody tr.row-warn td.store-name { color: var(--danger); font-weight: 600; }

/* 未达标商户：商户编码与商户名称标红 */
.grid-table tbody tr.row-warn td.mc-code,
.grid-table tbody tr.row-warn td.mc-name { color: var(--danger); font-weight: 600; }

/* 商户状态列 */
.grid-table thead th.mc-status { width: 92px; min-width: 92px; }
.grid-table td.mc-status { white-space: normal; }
.mc-status .badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  color: #fff;
}
.mc-status .badge.ok { background: var(--success); }
.mc-status .badge.warn { background: var(--danger); }

/* 明细新增门店（不在门店档案内）标记 */
.new-sc { color: var(--muted); font-size: 11px; margin-left: 4px; font-weight: 400; }

/* ===== 五维评分 TOP10 ===== */
.score-section .two-col { align-items: stretch; }
.score-section .panel { display: flex; flex-direction: column; }
.score-section .panel-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; }
/* 每条评分占等高 slot（flex:1），左右两栏 10 条 slot 严格对齐：第 1 条与第 10 条上下位置一致 */
.score-top-item { border-bottom: 1px solid var(--border); padding: 8px 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.score-top-item:last-child { border-bottom: none; }
.score-top-head { display: flex; align-items: center; gap: 8px; }
.score-rank {
  width: 22px; height: 22px; border-radius: 50%; background: var(--header); color: #fff;
  font-size: 12px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.score-top-item:nth-child(1) .score-rank { background: #C9854A; }
.score-top-item:nth-child(2) .score-rank { background: #a8a29e; }
.score-top-item:nth-child(3) .score-rank { background: #cd7f32; }
.score-name { flex: 1; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-total { font-size: 16px; font-weight: 700; color: var(--header); white-space: nowrap; }
.score-total small { font-size: 11px; color: var(--muted); font-weight: 400; }
.score-top-bars { margin-top: 8px; display: grid; gap: 4px; }
/* 商户维度条比门店少一行，条与条之间更空，撑满等高 slot，与门店栏逐行对齐 */
.mc-score-body .score-top-item { padding: 8px 0; }
.mc-score-body .score-top-bars { margin-top: 12px; gap: 10px; }
.score-bar-row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.score-bar-label { width: 52px; color: var(--muted); text-align: right; flex-shrink: 0; }
.score-bar-track { flex: 1; height: 6px; background: #eee; border-radius: 3px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; }
.score-bar-val { width: 30px; text-align: right; color: var(--text); font-weight: 600; }

/* 雷达图 */
.radar-wrap { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 300px; padding: 10px; }
.radar-svg, .drawer-radar-svg { overflow: visible; }
.radar-svg { width: 100%; max-width: 340px; height: auto; }
.radar-legend { display: flex; gap: 16px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.radar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.radar-legend i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.radar-avg-table { width: 100%; max-width: 320px; margin-top: 14px; border-top: 1px solid #eee; font-size: 12px; }
.radar-avg-head, .radar-avg-row { display: grid; grid-template-columns: 1fr 70px 70px; gap: 8px; padding: 6px 0; }
.radar-avg-head { color: var(--muted); font-weight: 600; border-bottom: 1px solid #eee; }
.radar-avg-row { color: #444; }
.radar-avg-row .dim { text-align: left; }
.radar-avg-head .top, .radar-avg-head .all, .radar-avg-row .top, .radar-avg-row .all { text-align: right; }
.radar-avg-row .top { color: #C9854A; font-weight: 700; }
.radar-avg-row .all { color: #8a94a0; font-weight: 700; }

/* ===== 商户/门店表格紧凑化：电脑端优先一屏容纳、不左右划 ===== */
.grid-table { font-size: 12px; }
.grid-table th, .grid-table td { padding: 7px 5px; }
.grid-table .cell-amt { font-size: 12.5px; }
.grid-table .cell-sub, .grid-table .ratio, .grid-table .th-sub { font-size: 10.5px; }

.freeze-1 { left: 0; width: 46px; min-width: 46px; }
.freeze-2 { left: 46px; width: 86px; min-width: 86px; }
.freeze-3 { left: 132px; width: 130px; min-width: 130px; }
.freeze-4 { left: 262px; width: 78px; min-width: 78px; }
.freeze-5 { left: 340px; width: 104px; min-width: 104px; }
.freeze-6 { left: 444px; width: 84px; min-width: 84px; }
.grid-table thead th.col-store-name { width: 104px; min-width: 104px; }
.grid-table thead th.col-store-status,
.grid-table thead th.mc-status { width: 84px; min-width: 84px; }
.grid-table thead th:not(.sticky-col):not(.col-store-name) { width: 86px; min-width: 86px; }
.grid-table thead th.col-total { width: 94px; min-width: 94px; }

/* 冻结列右缘投影：横向滚动时给出清晰分界 */
.grid-table th.freeze-6,
.grid-table td.freeze-6 { box-shadow: 3px 0 6px -3px rgba(0, 0, 0, 0.14); }

/* 中等屏幕进一步压缩，保证 1366/1440 也能一屏放下 */
@media (max-width: 1600px) {
  .grid-table { font-size: 11.5px; }
  .grid-table th, .grid-table td { padding: 6px 4px; }
  .freeze-1 { width: 42px; min-width: 42px; }
  .freeze-2 { left: 42px; width: 80px; min-width: 80px; }
  .freeze-3 { left: 122px; width: 118px; min-width: 118px; }
  .freeze-4 { left: 240px; width: 74px; min-width: 74px; }
  .freeze-5 { left: 314px; width: 98px; min-width: 98px; }
  .freeze-6 { left: 412px; width: 84px; min-width: 84px; }
  .grid-table thead th.col-store-name { width: 98px; min-width: 98px; }
  .grid-table thead th:not(.sticky-col):not(.col-store-name) { width: 80px; min-width: 80px; }
  .grid-table thead th.col-total { width: 88px; min-width: 88px; }
}

/* 手机端：隐藏城市列，冻结「编码/名称/状态」身份列，其余数据列横向滑动 */
@media (max-width: 768px) {
  .grid-table .freeze-1 { display: none; }
  .grid-table .freeze-2 { left: 0; width: 52px; min-width: 52px; }
  .grid-table .freeze-3 { left: 52px; width: 88px; min-width: 88px; }
  .grid-table .freeze-4 { left: 140px; width: 52px; min-width: 52px; }
  .grid-table .freeze-5 { left: 192px; width: 96px; min-width: 96px; }
  .grid-table .freeze-6 { left: 288px; width: 74px; min-width: 74px; }
  .grid-table thead th.col-store-status,
  .grid-table thead th.mc-status { width: 74px; min-width: 74px; }
  /* 表格贴边，避免左侧内边距露出滑动中的数据列 */
  .panel-body.store-table-wrap { padding-left: 0; padding-right: 0; }
  .grid-table thead th.col-store-name { width: 96px; min-width: 96px; }
  .grid-table thead th:not(.sticky-col):not(.col-store-name) { width: 78px; min-width: 78px; }
  .grid-table thead th.col-total { width: 84px; min-width: 84px; }
  .grid-table td { white-space: normal; }
  .score-section .two-col,
  .radar-section .two-col { grid-template-columns: 1fr; }
}

/* ===== 手机端整体适配（与电脑端同一链接，内容以电脑端为准） ===== */
@media (max-width: 768px) {
  header { padding: 12px 16px; }
  header .logo { font-size: 18px; }
  header .subtitle { font-size: 10px; }
  header .meta { font-size: 10px; max-width: 40%; }
  nav { position: static; padding: 8px 12px; gap: 4px; overflow-x: auto; }
  nav button { padding: 7px 12px; font-size: 13px; white-space: nowrap; flex-shrink: 0; }
  .container { padding: 14px 12px; }
  .section-title { font-size: 16px; margin: 18px 0 10px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { padding: 12px; }
  .kpi-card .value { font-size: 20px; }
  .kpi-card .value.small { font-size: 17px; }
  .filter-bar { gap: 8px; }
  .filter-bar select, .filter-bar input { padding: 7px 10px; font-size: 12px; max-width: 44vw; }
  .export-btn { padding: 7px 14px; font-size: 12px; }
  .panel-head { padding: 10px 12px; font-size: 13px; flex-wrap: wrap; gap: 4px; }
  .panel-body { padding: 10px 8px; }
  #map { height: 68vh; min-height: 360px; }
  footer { padding: 12px 16px; font-size: 11px; line-height: 1.6; }
  .two-col { grid-template-columns: 1fr; gap: 12px; }
  .radar-avg-table { font-size: 11px; }
}

/* ===== 标签：勃朗俱乐部 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}
.tag.brown {
  background: #C9854A;
  color: #fff;
}

/* 表格行可点击 */
.detail-trigger { cursor: pointer; }
.grid-table tbody tr.detail-trigger:hover td { background: #f0f4f8; }
.grid-table tbody tr.detail-trigger:hover td.sticky-col { background: #e8edf3; }
.score-top-item.detail-trigger { cursor: pointer; }
.score-top-item.detail-trigger:hover { background: #fafafa; border-radius: 6px; }

/* ===== 右侧详情抽屉 ===== */
#detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: flex-end;
  visibility: hidden;
  opacity: 0;
  transition: opacity .2s, visibility .2s;
}
#detail-drawer.open { visibility: visible; opacity: 1; }
#detail-drawer.open .drawer-panel { transform: translateX(0); }

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.drawer-panel {
  position: relative;
  width: 640px;
  max-width: 92vw;
  height: 100%;
  background: #fff;
  box-shadow: -8px 0 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.drawer-head {
  background: var(--header);
  color: #fff;
  padding: 20px 24px 18px;
  position: relative;
  flex-shrink: 0;
}
.drawer-head .drawer-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  padding-right: 36px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.drawer-head .drawer-sub {
  font-size: 12px;
  color: #a1a1a6;
  margin-top: 6px;
}
.drawer-head .drawer-score {
  position: absolute;
  top: 18px;
  right: 46px;
  text-align: right;
}
.drawer-head .drawer-score span {
  display: block;
  font-size: 11px;
  color: #a1a1a6;
}
.drawer-head .drawer-score strong {
  font-size: 28px;
  font-weight: 700;
  color: #C9854A;
  line-height: 1;
}
.drawer-head .drawer-score small {
  font-size: 12px;
  color: #a1a1a6;
}
.drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 50%;
  font-size: 22px;
  line-height: 32px;
  cursor: pointer;
  text-align: center;
  padding: 0;
}
.drawer-close:hover { background: rgba(255,255,255,0.2); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
}
.drawer-section { margin-bottom: 24px; }
.drawer-section:last-child { margin-bottom: 0; }
.drawer-sec-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

.drawer-radar-wrap {
  display: flex;
  justify-content: center;
  background: #fafafa;
  border-radius: 12px;
  padding: 16px;
}
.drawer-radar-svg {
  width: 100%;
  max-width: 300px;
  height: auto;
}

/* 抽屉内关键指标 */
.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.detail-metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
}
.detail-metric .dm-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
.detail-metric .dm-value {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.detail-metric .dm-value.pos { color: var(--success); }
.detail-metric .dm-value.neg { color: var(--danger); }

/* 抽屉内细项得分 */
.detail-score-row { margin-bottom: 14px; }
.detail-score-row:last-child { margin-bottom: 0; }
.detail-score-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 13px;
}
.detail-score-name { font-weight: 600; }
.detail-score-val { font-weight: 700; }
.detail-score-val small { font-size: 11px; color: var(--muted); font-weight: 400; }
.detail-score-track {
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}
.detail-score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease;
}

/* 抽屉内门店明细表格 */
.detail-store-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.detail-store-table th,
.detail-store-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
}
.detail-store-table th {
  background: #f5f5f5;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.detail-store-table td { white-space: nowrap; }
.detail-store-table td:nth-child(2) { white-space: normal; word-break: break-all; }
.detail-store-table th:nth-child(1),
.detail-store-table td:nth-child(1) { width: 90px; }
.detail-store-table th:nth-child(2),
.detail-store-table td:nth-child(2) { width: auto; }
.detail-store-table th:nth-child(3),
.detail-store-table td:nth-child(3) { width: 70px; }
.detail-store-table th:nth-child(4),
.detail-store-table td:nth-child(4) { width: 60px; }
.detail-store-table th:nth-child(5),
.detail-store-table td:nth-child(5),
.detail-store-table th:nth-child(6),
.detail-store-table td:nth-child(6) { width: 90px; }
.detail-store-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.detail-store-table td.num.cur-period { background: #fff9f3; font-weight: 600; color: #a8641f; }
.detail-store-table .badge { font-size: 11px; padding: 1px 8px; }
.detail-empty { color: var(--muted); font-size: 13px; padding: 16px 0; text-align: center; }

/* ===== 城市维度评分排名 ===== */
.city-rank-body { padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.city-rank-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.city-rank-item:last-child { border-bottom: none; }
.city-rank-head { display: flex; align-items: center; gap: 8px; }
.city-rank-no {
  width: 24px; height: 24px; border-radius: 6px;
  background: #eceae6; color: var(--muted);
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.city-rank-no.rank-1 { background: #C9854A; color: #fff; }
.city-rank-no.rank-2 { background: #a8a29e; color: #fff; }
.city-rank-no.rank-3 { background: #cd7f32; color: #fff; }
.city-rank-name { font-size: 15px; font-weight: 700; flex-shrink: 0; }
.city-rank-owner { font-size: 11px; color: var(--muted); background: #f4f4f4; padding: 1px 7px; border-radius: 4px; }
.city-rank-store { font-size: 11px; color: var(--muted); }
.city-rank-total { margin-left: auto; font-size: 17px; font-weight: 700; color: var(--header); }
.city-rank-total small { font-size: 11px; color: var(--muted); font-weight: 400; }
.city-rank-bars { margin-top: 8px; display: grid; gap: 5px; }

/* 城市各维度得分对比表 */
.city-dim-table {
  width: 100%; max-width: 340px; margin-top: 16px;
  border-top: 1px solid #eee; font-size: 12px;
}
.city-dim-head, .city-dim-row {
  display: grid;
  grid-template-columns: 46px repeat(5, 1fr) 46px;
  gap: 4px; padding: 6px 0;
  text-align: right;
}
.city-dim-head { color: var(--muted); font-weight: 600; border-bottom: 1px solid #eee; }
.city-dim-row { color: #444; border-bottom: 1px solid #f5f5f5; }
.city-dim-head .cty, .city-dim-row .cty { text-align: left; font-weight: 600; color: var(--text); }
.city-dim-row .tot, .city-dim-head .tot { color: #C9854A; font-weight: 700; }

/* ===== 商户 / 门店面板顶部总览卡片 ===== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: relative;
  overflow: hidden;
}
.summary-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--muted);
}
.summary-card.ok::before { background: var(--success); }
.summary-card.warn::before { background: var(--danger); }
.sc-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.sc-value { font-size: 32px; font-weight: 700; color: var(--text); line-height: 1.1; }
.sc-value.ok { color: var(--success); }
.sc-value.warn { color: var(--danger); }
.sc-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* 各维度得分最低 */
.lowest-block { margin-bottom: 20px; }
.lowest-title {
  font-size: 13px; font-weight: 700; color: var(--muted);
  margin-bottom: 10px; padding-left: 10px;
  border-left: 3px solid var(--accent);
}
.lowest-title .lt-scope {
  font-weight: 500; font-size: 12px; color: var(--accent); margin-left: 4px;
}
.lowest-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.lowest-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.lowest-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.10);
  border-color: #dcd6ce;
}
.lc-dim { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.lc-val { font-size: 20px; font-weight: 700; line-height: 1.1; }
.lc-val small { font-size: 11px; color: var(--muted); font-weight: 400; }
.lc-name {
  font-size: 12px; color: var(--text); margin-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lc-city { font-size: 11px; color: var(--muted); margin-top: 2px; }

@media (max-width: 768px) {
  .summary-cards { grid-template-columns: 1fr; gap: 10px; }
  .summary-card { padding: 14px 16px; }
  .sc-value { font-size: 26px; }
  .lowest-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .city-dim-table { font-size: 11px; }
  .city-dim-head, .city-dim-row { grid-template-columns: 40px repeat(5, 1fr) 40px; gap: 2px; }
}

@media (max-width: 768px) {
  .drawer-panel { width: 100%; max-width: 100%; }
  .drawer-head .drawer-score { position: static; text-align: left; margin-top: 10px; }
  .detail-metrics { grid-template-columns: repeat(2, 1fr); }
  .detail-store-table th, .detail-store-table td { padding: 7px 6px; }
}

