:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #66757f;
  --line: #dce4e7;
  --paper: #f7f8f6;
  --panel: #ffffff;
  --green: #2d7d63;
  --green-dark: #1e604b;
  --clay: #c8753d;
  --amber: #e4a940;
  --blue: #426f91;
  --shadow: 0 18px 38px rgba(22, 34, 42, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  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;
  background: var(--green-dark);
  color: #fff;
  font-size: 24px;
  font-weight: 750;
}

h1,
h2,
p {
  margin: 0;
}

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

.brand p,
.import-panel p,
.topbar span,
.section-title span {
  color: var(--muted);
  font-size: 13px;
}

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

.search-panel {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

.compact {
  max-width: 180px;
}

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

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

.segmented {
  min-height: 38px;
}

.segmented.active {
  border-color: var(--green);
  background: #e7f2ed;
  color: var(--green-dark);
  font-weight: 700;
}

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

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

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

.selected-card {
  display: grid;
  gap: 12px;
}

.selected-card .place {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

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

.selected-card .metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafbf9;
}

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

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.15;
}

.investment-card {
  display: grid;
  gap: 10px;
}

.investment-card p {
  color: #43545b;
  font-size: 13px;
  line-height: 1.55;
}

.gov-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--green);
  border-radius: 7px;
  background: #eef7f2;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.industry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.industry-tags span {
  padding: 5px 8px;
  border: 1px solid #d9e3dd;
  border-radius: 999px;
  background: #f7faf8;
  color: #2b4c43;
  font-size: 12px;
}

.county-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.county-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.county-button.active {
  border-color: var(--green);
  background: #edf7f2;
}

.county-button span {
  color: var(--muted);
  font-size: 12px;
}

.file-input {
  width: 100%;
  margin-bottom: 8px;
}

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

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

.toolbar {
  display: flex;
  gap: 7px;
}

.toolbar button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 20px;
}

.map-stage {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(45, 125, 99, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(45, 125, 99, 0.08) 1px, transparent 1px),
    #edf3ef;
  background-size: 42px 42px;
  cursor: grab;
}

.map-stage:active {
  cursor: grabbing;
}

.sichuan-map {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.province {
  fill: url(#provinceFill);
  stroke: #78948a;
  stroke-width: 3;
}

.basin {
  fill: rgba(255, 255, 255, 0.38);
  stroke: rgba(82, 112, 104, 0.35);
  stroke-width: 2;
}

.terrain {
  stroke: rgba(103, 126, 100, 0.22);
  stroke-width: 1.5;
}

.terrain-west {
  fill: rgba(92, 131, 116, 0.18);
}

.terrain-south {
  fill: rgba(196, 141, 86, 0.15);
}

.detail-lines path {
  fill: none;
  stroke: rgba(91, 111, 106, 0.34);
  stroke-dasharray: 7 8;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.river-lines path {
  fill: none;
  stroke: rgba(65, 111, 145, 0.34);
  stroke-linecap: round;
  stroke-width: 3;
}

.city-node {
  cursor: pointer;
}

.city-node circle {
  stroke: #fff;
  stroke-width: 3;
  transition: transform 160ms ease, filter 160ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.city-node:hover circle,
.city-node.active circle {
  transform: scale(1.25);
  filter: drop-shadow(0 7px 8px rgba(29, 48, 42, 0.28));
}

.city-node text {
  fill: #1d2b2f;
  font-size: 15px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 5px;
  stroke-linejoin: round;
  pointer-events: none;
}

.county-node {
  cursor: pointer;
}

.county-node line {
  pointer-events: none;
  stroke: rgba(64, 82, 87, 0.26);
  stroke-width: 1;
}

.county-hit {
  fill: transparent;
  pointer-events: all;
  stroke: none;
}

.county-node circle:not(.county-hit) {
  fill: #fff;
  stroke: var(--green-dark);
  stroke-width: 2;
  transition: transform 160ms ease, fill 160ms ease, stroke 160ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.county-node:hover circle:not(.county-hit),
.county-node.active circle:not(.county-hit) {
  fill: var(--green-dark);
  stroke: #fff;
  transform: scale(1.35);
}

.county-node text {
  fill: #203038;
  font-size: 11px;
  font-weight: 650;
  paint-order: stroke;
  pointer-events: none;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-linejoin: round;
  stroke-width: 4px;
}

.legend {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  font-size: 13px;
}

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

.swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.high {
  background: var(--clay);
}

.mid {
  background: var(--amber);
}

.low {
  background: var(--blue);
}

.county {
  background: var(--green-dark);
}

.table-wrap {
  min-width: 0;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 14px 18px 18px;
}

.table-scroll {
  height: 196px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f4f7f5;
  color: #43545b;
  font-weight: 700;
}

tbody tr:hover {
  background: #f8fbf9;
}

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

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

  .map-workspace {
    grid-template-rows: auto 420px 260px;
  }

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