:root {
  --bg: #0b0f14;
  --card: #141a22;
  --header: #0f141b;
  --text: #e8eef6;
  --muted: #8b98a8;
  --line: #2a3441;
  --accent: #3b82f6;
  --ok: #34d399;
  --row-alt: #10161e;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
body { min-height: 100vh; overflow-x: hidden; }

.view { display: none; min-height: 100vh; padding-bottom: calc(16px + var(--safe-bot)); }
.view.active { display: block; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(12px + var(--safe-top)) 14px 10px;
  background: var(--header);
  border-bottom: 1px solid var(--line);
}
.brand h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.brand .sub { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.detail-top .brand { flex: 1; min-width: 0; }
.back {
  width: 36px; height: 36px; border: none; border-radius: 10px;
  background: var(--card); color: var(--text); font-size: 18px;
  flex-shrink: 0; cursor: pointer;
}
.mode-pill {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
  color: var(--ok);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px 0;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}
.stat b { display: block; font-size: 18px; color: var(--accent); }
.stat span { font-size: 11px; color: var(--muted); }

.toolbar { padding: 12px 14px 0; }
#search {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
#search:focus { border-color: var(--accent); }

.list { padding: 10px 14px 0; display: flex; flex-direction: column; gap: 8px; }
.city-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.city-item:hover { border-color: rgba(59, 130, 246, 0.45); }
.city-item:active { border-color: var(--accent); }
.city-item .name { font-weight: 700; font-size: 16px; }
.city-item .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.city-item .count { font-size: 20px; font-weight: 800; color: var(--accent); text-align: right; }
.city-item .count small { font-size: 11px; font-weight: 500; color: var(--muted); }
.city-item.brand-hit {
  border-color: rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), var(--card));
}
.city-item.brand-hit .name { color: #93c5fd; }
.city-item.brand-hit .tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.3);
  vertical-align: middle;
}

.brand-summary {
  margin: 10px 14px 0;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.brand-summary .bs-line {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.55;
  word-break: break-word;
}
.brand-summary .bs-line:first-child { margin-top: 0; }
.brand-summary .bs-line b { color: #cbd5e1; font-weight: 600; }
.brand-summary .bs-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 2px 6px 2px 0;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #bfdbfe;
  vertical-align: middle;
}
/* 地名后的数量：高亮显示，避免和省/市名粘在一起 */
.brand-summary .bs-chip .bs-name {
  color: #bfdbfe;
  font-weight: 500;
}
.brand-summary .bs-chip .bs-n {
  min-width: 1.1em;
  padding: 0 6px;
  border-radius: 999px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(59, 130, 246, 0.55);
  line-height: 1.45;
}
.brand-summary .bs-chip.bs-more {
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.4);
  display: inline-block;
  gap: 0;
}
.brand-summary .bs-chip.bs-more:hover {
  background: rgba(251, 191, 36, 0.22);
}
.brand-summary .bs-chip.bs-more:active {
  transform: scale(0.98);
}

.table-wrap {
  margin: 10px 0 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--line);
}
.poi-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: var(--bg);
  font-size: 13px;
}
.poi-table th,
.poi-table td {
  border: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}
.poi-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #121820;
  color: #c5d0dc;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}
.poi-table tbody tr:nth-child(even) { background: var(--row-alt); }
.poi-table tbody tr:nth-child(odd) { background: #0c1117; }
.poi-table .col-num {
  width: 42px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.poi-table .col-name {
  font-weight: 600;
  color: #f1f5f9;
  min-width: 140px;
}
.poi-table .col-city {
  white-space: nowrap;
  color: #93c5fd;
  font-weight: 600;
  min-width: 56px;
}
.poi-table .col-district {
  white-space: nowrap;
  color: #cbd5e1;
}
.poi-table .col-addr {
  color: #a8b6c6;
  min-width: 180px;
  max-width: 320px;
}
.poi-table .col-tel {
  white-space: nowrap;
  color: #93c5fd;
  font-variant-numeric: tabular-nums;
  min-width: 110px;
}
.poi-table .dash { color: var(--muted); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
}
.hidden { display: none !important; }

@media (min-width: 900px) {
  #app { max-width: 980px; margin: 0 auto; }
  .table-wrap {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}
