:root {
  --ink: #172026;
  --muted: #6b7880;
  --line: #dce4e7;
  --panel: #ffffff;
  --paper: #f5f7f5;
  --green: #266d55;
  --green-soft: #e8f3ee;
  --orange: #bf6335;
  --shadow: 0 18px 40px rgba(27, 39, 45, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.gis-shell {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #fbfcfb;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-size: 24px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.15;
}

.brand p,
.topbar span,
.section-title span,
.field span,
.result-meta,
.selected-info small {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title h2 {
  font-size: 15px;
}

.section-title a {
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.segmented-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segmented,
.toolbar button,
.admin-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.segmented.active,
.toolbar button.active {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
}

.field textarea {
  min-height: 170px;
  padding: 10px 11px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.selected-info {
  display: grid;
  gap: 10px;
}

.selected-card,
.result-card {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.selected-card strong {
  font-size: 20px;
}

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

.metric {
  padding: 9px;
  border-radius: 7px;
  background: #f7faf8;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric b {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}

.result-panel {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.result-card {
  text-align: left;
  cursor: pointer;
}

.result-card.active {
  border-color: var(--orange);
  background: #fff8f4;
}

.result-card h3 {
  font-size: 15px;
  line-height: 1.35;
}

.result-price {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.result-price strong {
  color: var(--orange);
  font-size: 20px;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.result-tags span {
  padding: 4px 7px;
  border-radius: 5px;
  color: #42545a;
  background: #f1f5f3;
  font-size: 12px;
}

.map-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.toolbar button {
  padding: 0 12px;
}

.map-frame {
  position: relative;
  min-height: 520px;
  background: #e8eeeb;
}

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

.local-map {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
}

.local-land {
  cursor: pointer;
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.local-community {
  cursor: pointer;
  fill: #fff;
  stroke: var(--orange);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.local-label {
  fill: #203038;
  font-size: 12px;
  font-weight: 700;
  paint-order: stroke;
  pointer-events: none;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 4px;
}

.map-fallback {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: rgba(238, 243, 240, 0.82);
}

.map-fallback strong {
  color: var(--ink);
  font-size: 18px;
}

.legend {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 7px 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.legend strong {
  grid-column: 1 / -1;
  font-size: 13px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.popup {
  min-width: 220px;
  font-size: 13px;
  line-height: 1.6;
}

.popup strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.admin-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px;
}

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

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.inline-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.admin-actions button.primary {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.inline-actions button.primary {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.notice {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 920px) {
  .gis-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .map-frame {
    min-height: 560px;
  }

  .result-panel {
    max-height: 360px;
  }

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

  .inline-actions {
    grid-template-columns: 1fr;
  }
}
