:root {
  --page: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(29, 29, 31, 0.12);
  --blue: #0071e3;
  --blue-soft: rgba(0, 113, 227, 0.1);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-rows: 64px 1fr;
  height: 100vh;
  height: 100dvh;
}

.topbar {
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 245, 247, 0.86);
  backdrop-filter: blur(18px);
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(68px, 1fr));
  gap: 4px;
  padding: 4px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.switch-button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 650;
}

.switch-button.is-active {
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

.workspace {
  position: relative;
  min-height: 0;
}

.map-view,
.search-view {
  display: none;
  height: 100%;
}

.map-view.is-active,
.search-view.is-active {
  display: block;
}

.map-frame {
  position: absolute;
  inset: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #e9ecef;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  background: #f5f5f7;
}

.map-loading.is-hidden {
  display: none;
}

.loading-title {
  font-size: 18px;
  font-weight: 700;
}

.loading-text {
  color: var(--muted);
  font-size: 13px;
}

.control-panel {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 5;
  width: min(358px, calc(100vw - 36px));
  max-height: calc(100% - 36px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.control-panel.is-collapsed {
  display: none;
}

.floating-filter {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 4;
  display: none;
  min-width: 72px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(18px);
  font-weight: 700;
}

.floating-filter.is-visible {
  display: block;
}

.panel-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 4px;
  font-size: 21px;
  line-height: 1.16;
}

h2 {
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.2;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  font-size: 20px;
  line-height: 1;
}

.active-count {
  margin: 12px 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.text-button {
  min-height: 30px;
  margin: -4px 0 14px;
  border: 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.text-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.filters {
  display: grid;
  gap: 14px;
}

.filter-group {
  display: grid;
  gap: 8px;
}

.filter-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 650;
}

.chip.is-active {
  border-color: rgba(0, 113, 227, 0.28);
  color: var(--blue);
  background: var(--blue-soft);
}

.marker-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--marker-color, #8e8e93);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.28);
}

.marker-dot::after {
  position: absolute;
  inset: -8px;
  content: "";
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 700;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--legend-color, #8e8e93);
}

.amap-info-content {
  padding: 0 !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.2) !important;
}

.map-tag {
  width: min(330px, 78vw);
  max-height: 430px;
  overflow: auto;
  padding: 14px;
  color: var(--text);
  background: #fff;
}

.map-tag-title {
  font-size: 15px;
  font-weight: 750;
}

.map-tag-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.raw-block {
  margin: 10px 0 0;
  padding: 10px;
  overflow: auto;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8f8fa;
  color: #242426;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.search-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  height: 100%;
  padding: 18px;
  overflow: hidden;
}

.search-tools {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
}

.search-box {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.search-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  outline: 0;
  color: var(--text);
  background: #f8f8fa;
}

.search-box input:focus {
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.results-column {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 2px;
}

.result-row {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
  color: var(--text);
  background: var(--surface-solid);
}

.result-row:hover {
  border-color: rgba(0, 113, 227, 0.28);
}

.result-main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 15px;
  font-weight: 750;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  background: #f0f0f2;
  font-size: 11px;
  font-weight: 700;
}

.result-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.result-raw {
  color: #3a3a3c;
  font-size: 12px;
  line-height: 1.45;
}

.empty-state {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-solid);
  text-align: center;
}

.detail-popover {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: min(430px, calc(100vw - 36px));
  max-height: min(620px, calc(100vh - 94px));
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.popover-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.meta-item {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8f8fa;
}

.meta-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.meta-value {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

#popoverRaw {
  max-height: 260px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8f8fa;
  color: #242426;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.popover-actions {
  margin: -2px 0 12px;
}

.primary-action {
  min-height: 34px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 12px;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 750;
}

.primary-action[hidden] {
  display: none;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-rows: 72px 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 12px;
  }

  .brand-block {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: baseline;
  }

  .brand-subtitle {
    margin: 0;
    text-align: right;
  }

  .view-switch {
    width: 100%;
  }

  .control-panel {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    max-height: min(58vh, 480px);
  }

  .floating-filter {
    left: 10px;
    bottom: 14px;
  }

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

  .search-tools {
    max-height: none;
  }

  .results-column {
    overflow: visible;
  }

  .detail-popover {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 70vh;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }
}
