* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --grade-a: #e74c3c;
  --grade-b: #3498db;
  --grade-c: #2ecc71;
  --grade-series: #f39c12;
  --grade-unknown: #95a5a6;
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===== 顶栏 ===== */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1100;
  flex-wrap: wrap;
  height: auto;
  min-height: 60px;
  padding: 8px 20px;
}
.brand h1 { font-size: 18px; font-weight: 700; }
.brand .subtitle { font-size: 12px; color: var(--text-muted); margin-left: 8px; }

.stats { display: flex; gap: 16px; }
.stats .stat { font-size: 13px; color: var(--text-muted); }
.stats .stat em { font-style: normal; font-weight: 700; color: var(--text); font-size: 15px; }
.stats .grade-a em { color: var(--grade-a); }
.stats .grade-b em { color: var(--grade-b); }
.stats .grade-c em { color: var(--grade-c); }

.filters { display: flex; gap: 10px; margin-left: auto; }
.filters select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  outline: none;
}
.filters select:focus { border-color: #3b82f6; }

/* ===== 布局 ===== */
.layout {
  display: flex;
  height: calc(100vh - 60px);
}
#map {
  flex: 1;
  height: 100%;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: 360px;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  z-index: 1000;
}
.sidebar-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}
.empty-icon { font-size: 48px; }
.sidebar-empty p { font-size: 14px; line-height: 1.6; }

.sidebar-detail { padding: 20px; }
.detail-head { margin-bottom: 18px; }
.grade-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}
.grade-badge.A { background: var(--grade-a); }
.grade-badge.B { background: var(--grade-b); }
.grade-badge.C { background: var(--grade-c); }
.grade-badge.S { background: var(--grade-series); }
.grade-badge.default { background: var(--grade-unknown); }
.detail-head h2 { font-size: 20px; font-weight: 700; line-height: 1.4; }

.detail-body { display: flex; flex-direction: column; gap: 12px; }
.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
}
.detail-row .label {
  flex-shrink: 0;
  width: 80px;
  color: var(--text-muted);
  font-size: 13px;
}
.detail-row span:last-child { flex: 1; word-break: break-all; }

.detail-foot {
  margin-top: 20px;
  padding: 14px;
  background: #f9fafb;
  border-radius: 8px;
  text-align: center;
}
.detail-foot .hint { font-size: 12px; color: var(--text-muted); }

/* ===== 地图弹窗 ===== */
.leaflet-popup-content-wrapper { border-radius: 8px; }
.leaflet-popup-content { margin: 10px 14px; }
.popup-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.popup-meta { font-size: 12px; color: var(--text-muted); }

/* 图例 */
.legend {
  position: absolute;
  bottom: 24px;
  left: 24px;
  background: rgba(255,255,255,0.95);
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
  font-size: 12px;
  z-index: 900;
}
.legend h4 { font-size: 12px; margin-bottom: 6px; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
