:root {
  --bg: #f2f5f4;
  --panel: #ffffff;
  --line: #e3e9e6;
  --text: #1f2937;
  --muted: #6b7280;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --amber: #d97706;
  --gray-fill: #e6eae8;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sample-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  white-space: nowrap;
}

.stat-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 86px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafcfb;
}

.stat b {
  font-size: 16px;
  color: var(--teal-dark);
  letter-spacing: 0;
}

.stat span {
  font-size: 11px;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2.35fr) minmax(340px, 1fr);
  gap: 14px;
  max-width: 1560px;
  margin: 14px auto;
  padding: 0 14px;
  align-items: start;
}

.map-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  height: calc(100vh - 116px);
  min-height: 560px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 14px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.btn-back {
  border: 1px solid var(--line);
  background: #fafcfb;
  color: var(--teal-dark);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
}

.btn-back:hover {
  background: #eef6f4;
}

.crumb {
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-note {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

#map {
  position: absolute;
  inset: 0;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  z-index: 5;
}

.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: calc(100vh - 116px);
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
}

.search-box {
  position: relative;
  padding: 12px 12px 8px;
}

.search-box input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafcfb;
  outline: none;
}

.search-box input:focus {
  border-color: var(--teal);
  background: #fff;
}

.suggestions {
  position: absolute;
  top: 54px;
  left: 12px;
  right: 12px;
  z-index: 20;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  max-height: 280px;
  overflow: auto;
}

.suggestions li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.suggestions li:hover {
  background: #f0f7f5;
}

.suggestion-name {
  color: var(--text);
}

.suggestion-status {
  color: var(--muted);
  margin-left: 8px;
}

.suggestion-status.has {
  color: var(--teal-dark);
}

.suggestion-empty {
  color: #94a3b8;
  padding: 8px 10px;
  font-size: 13px;
}

.coverage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 6px;
}

.coverage-title {
  font-weight: 600;
  font-size: 14px;
}

.coverage-nums {
  font-size: 12px;
  color: var(--muted);
}

.filters {
  display: flex;
  gap: 6px;
  padding: 0 12px 8px;
}

.filter-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.filter-btn.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.province-list {
  flex: 1;
  overflow: auto;
  padding: 0 6px 8px;
}

.province-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 1px 0;
  padding: 7px 8px;
  border: none;
  background: none;
  text-align: left;
  border-radius: 6px;
}

.province-row:hover {
  background: #f0f7f5;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.status-dot.has {
  background: var(--teal);
}

.status-dot.empty {
  background: #c4cbc8;
}

.province-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.province-count {
  font-size: 12px;
  color: var(--teal-dark);
  background: #e8f5f1;
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}

.province-empty {
  font-size: 12px;
  color: #9aa6a1;
  background: var(--gray-fill);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}

.detail-panel {
  border-top: 1px solid var(--line);
  max-height: 50vh;
  overflow: auto;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #f7faf9;
  position: sticky;
  top: 0;
}

.detail-title {
  font-weight: 600;
  font-size: 14px;
}

.detail-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.detail-close {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
}

.detail-close:hover {
  background: #f0f7f5;
}

.detail-list {
  padding: 6px 10px 12px;
}

.detail-item {
  padding: 9px 6px;
  border-bottom: 1px solid #eef2f0;
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-item.clickable {
  cursor: pointer;
}

.detail-item.clickable:hover {
  background: #f0f7f5;
  border-radius: 6px;
}

.detail-item-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.detail-item-name {
  font-size: 13px;
  font-weight: 600;
}

.detail-item-count {
  font-size: 12px;
  color: var(--teal-dark);
  white-space: nowrap;
}

.detail-item-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.detail-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.foot {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 10px 16px 18px;
  color: #9aa6a1;
  font-size: 12px;
}

.foot .icp-link {
  color: inherit;
  text-decoration: none;
}

.foot .icp-link:hover {
  text-decoration: underline;
}

@media (max-width: 960px) {
  .topbar {
    padding: 10px 12px;
  }

  .layout {
    grid-template-columns: 1fr;
    margin: 10px auto;
    padding: 0 10px;
    gap: 10px;
  }

  .map-panel {
    position: static;
    height: auto;
    min-height: 0;
  }

  .map-wrap {
    height: 64vh;
    min-height: 420px;
    max-height: 600px;
  }

  .side-panel {
    position: static;
    max-height: none;
  }

  .province-list {
    max-height: 420px;
  }

  .stat {
    min-width: 72px;
    padding: 5px 8px;
  }

  .stat b {
    font-size: 14px;
  }

  .legend-note {
    display: none;
  }

  .foot {
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
}
