/* 海尔门店可见性地图 · 深空蓝仪器盘（暗色 HUD + 深色底图统一） */
:root {
  --hud: rgba(9, 17, 31, 0.88);
  --hud-solid: #0b1526;
  --line: rgba(122, 166, 235, 0.14);
  --line-strong: rgba(122, 166, 235, 0.30);
  --text: #eaf1fb;
  --muted: #93a8c6;
  --dim: #5f7597;
  --accent: #3d8bff;
  --accent-soft: rgba(61, 139, 255, 0.16);
  --shadow: 0 18px 40px rgba(2, 7, 18, 0.52), 0 2px 8px rgba(2, 7, 18, 0.36);
  --sheen: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  background: #060c18;
  -webkit-font-smoothing: antialiased;
}

#map { position: absolute; inset: 0; background: #08111f; }

/* 视口暗角：把注意力收到中间，并压住底图四边的杂乱要素 */
.map-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(118% 92% at 50% 44%, rgba(6, 12, 24, 0) 40%, rgba(4, 9, 20, 0.42) 82%, rgba(3, 7, 17, 0.66) 100%),
    linear-gradient(180deg, rgba(6, 12, 24, 0.58) 0, rgba(6, 12, 24, 0) 16%,
      rgba(6, 12, 24, 0) 74%, rgba(4, 9, 20, 0.55) 100%);
}

/* ── 通用卡片 ─────────────────────────────── */
.card {
  background: linear-gradient(180deg, rgba(20, 33, 55, 0.92), rgba(9, 17, 31, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--sheen);
}

.hud { position: absolute; z-index: 20; }

/* ── 左上控制面板：品牌 + 搜索 + 筛选 ─────── */
.hud-tl {
  top: 16px;
  left: 16px;
  width: 402px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel {
  padding: 11px 12px 12px;
  background: linear-gradient(180deg, rgba(20, 33, 55, 0.95), rgba(9, 17, 31, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--sheen);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 3px 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.4px;
  color: #fff;
  background: linear-gradient(140deg, #4d97ff, #0b48c8 62%, #072f8c);
  box-shadow: 0 8px 20px rgba(30, 92, 214, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.brand-text { min-width: 0; flex: 1 1 auto; }

.brand-text h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-src {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  letter-spacing: 0.3px;
  color: #9ecdff;
  background: rgba(61, 139, 255, 0.14);
  border: 1px solid rgba(61, 139, 255, 0.3);
}

/* ── 搜索 + 筛选 ───────────────────────────── */
.search-box { position: relative; }

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  stroke: var(--dim);
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 33px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(6, 14, 28, 0.7);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.search-box input::placeholder { color: var(--dim); }

.search-box input:focus {
  background: rgba(8, 18, 34, 0.9);
  border-color: rgba(61, 139, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, 0.13);
}

/* 状态筛选胶囊 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.fx-chip {
  --c: #7f8ea6;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px 5px 7px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.fx-chip:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }

.fx-chip .fx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 6px color-mix(in srgb, var(--c) 70%, transparent);
}

.fx-chip .fx-n {
  font-size: 10.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.fx-chip.is-on {
  color: #eef5ff;
  background: rgba(61, 139, 255, 0.16);
  border-color: rgba(61, 139, 255, 0.42);
}

.fx-chip.is-on .fx-n { color: #b8d5ff; }
.fx-chip.is-off { opacity: 0.42; }
.fx-chip.is-off .fx-dot { background: #55637a; box-shadow: none; }

.fx-chip.is-all .fx-dot { display: none; }
.fx-chip.is-all { margin-right: 1px; }

#search-clear {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

#search-clear:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }

.search-results {
  margin-top: 8px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 6px;
  background: linear-gradient(180deg, rgba(18, 30, 51, 0.96), rgba(9, 17, 31, 0.97));
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
}

.sr-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.sr-item:hover, .sr-item.is-active { background: rgba(61, 139, 255, 0.14); }

.sr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--c);
  box-shadow: 0 0 0 2.5px rgba(255, 255, 255, 0.08);
}

.sr-main { min-width: 0; flex: 1; }

.sr-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-empty { padding: 14px 12px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ── 右侧栏 ───────────────────────────────── */
.hud-right {
  top: 16px;
  right: 16px;
  width: 296px;
  max-height: calc(100% - 132px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-bottom: 4px;
}

.hud-right::-webkit-scrollbar { width: 6px; }
.hud-right::-webkit-scrollbar-thumb { background: rgba(122, 166, 235, 0.22); border-radius: 3px; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 13px 14px 0;
}

.card-head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.1px;
  color: var(--muted);
  text-transform: uppercase;
}

.card-total { font-size: 11.5px; color: var(--dim); font-variant-numeric: tabular-nums; }

.card-note {
  margin: 0;
  padding: 7px 14px 12px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--dim);
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
}

.stat-cell { background: #0b1526; margin: 0; padding: 13px 14px 12px; }

.stat-cell dt {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.stat-cell dd {
  margin: 7px 0 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.stat-cell .unit { font-size: 11.5px; font-weight: 500; color: var(--dim); margin-left: 3px; }
.stat-cell.is-warn dd { color: #ffb020; }
.stat-cell.is-good dd { color: #35d07f; }

/* 图例 */
.legend { list-style: none; margin: 10px 0 0; padding: 0 8px; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.14s, opacity 0.14s;
}

.legend-item:hover { background: rgba(255, 255, 255, 0.05); }
.legend-item.is-off { opacity: 0.32; }

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--c);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07), 0 0 10px currentColor;
}

.legend-label { flex: 1; font-size: 12.5px; }
.legend-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.legend-bar {
  height: 3px;
  border-radius: 2px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.legend-bar i { display: block; height: 100%; border-radius: 2px; }

/* 省级排行 */
.rank { list-style: none; margin: 8px 0 12px; padding: 0 14px 0 10px; }

.rank li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 4px;
  font-size: 12.5px;
}

.rank .rk {
  width: 18px;
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rank .rk.is-top { color: #ffb020; font-weight: 700; }
.rank .rn { flex: 0 0 62px; color: var(--text); }
.rank .rb { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }

.rank .rb i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(61, 139, 255, 0.55), #63a4ff);
  box-shadow: 0 0 8px rgba(99, 164, 255, 0.5);
}

.rank .rv { width: 46px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ── 地图工具 ─────────────────────────────── */
/* 排在右侧信息栏之外，避免压在排行卡片上 */
.map-tools {
  position: absolute;
  right: 424px;
  bottom: 62px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-tools button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 33, 55, 0.94), rgba(9, 17, 31, 0.95));
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow), var(--sheen);
  transition: background 0.14s, transform 0.1s, border-color 0.14s;
}

.map-tools button:hover { border-color: var(--line-strong); color: #fff; }
.map-tools button:active { transform: scale(0.94); }
.map-tools button.is-on { border-color: rgba(61, 139, 255, 0.7); color: #9cc2ff; }
/* 「AI 实测」抽屉按钮只在右栏卡片被收起的窄屏出现 */
#toggle-ai { display: none; }

.drawer-close {
  display: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
}
.drawer-close:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* ── 底部状态条 ───────────────────────────── */
.hud-footer {
  left: 0;
  right: 0;
  bottom: 0;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, rgba(6, 12, 24, 0), rgba(6, 12, 24, 0.9) 68%);
  pointer-events: none;
}

.hud-footer strong { color: var(--text); font-weight: 600; }
.footer-dot { color: var(--dim); }
.footer-credit { color: var(--dim); }
