:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7785;
  --line: #dde1e6;
  --accent: #1d4ed8;
  --select: #e11d1d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.topbar { padding: 16px 20px 8px; }
.topbar h1 { margin: 0; font-size: 22px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  padding: 8px 20px 16px;
}
.panel, .report .cards > div, .table-scroll {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.panel { padding: 16px; align-self: start; }
.panel h2 { margin: 0 0 4px; font-size: 16px; }
.hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); }

.slider-row { margin-bottom: 12px; }
.slider-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; margin-bottom: 2px;
}
.slider-head .name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.slider-head .alloc { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.slider-head .alloc b { color: var(--text); }
.slider-row input[type=range] { width: 100%; }
.slider-sub { font-size: 12px; color: var(--muted); }

.total-line { margin: 4px 0 12px; font-size: 13px; color: var(--muted); }
.btn-row { display: flex; gap: 8px; margin-bottom: 12px; }
.btn {
  flex: 1; padding: 9px 10px; font: inherit; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
}
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #1a43b8; }
.btn.dirty { box-shadow: 0 0 0 3px rgba(29, 78, 216, .25); }
.check { display: block; font-size: 14px; margin-bottom: 12px; cursor: pointer; }

.legend { border-top: 1px solid var(--line); padding-top: 10px; }
.legend label { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 4px; cursor: pointer; }
.legend-note { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.swatch-ring { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--select); display: inline-block; }

.map-wrap { min-width: 0; }
#map { height: 640px; border-radius: 10px; border: 1px solid var(--line); }

.report { padding: 8px 20px 24px; }
.report h2 { font-size: 18px; margin: 8px 0 12px; }
.report h3 { font-size: 15px; margin: 22px 0 8px; }
.badge {
  font-size: 13px; font-weight: 600; background: var(--select); color: #fff;
  padding: 2px 8px; border-radius: 999px; vertical-align: middle;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.report .cards > div { padding: 12px 14px; border-top-width: 4px; }
.cards .cn { font-weight: 600; font-size: 14px; }
.cards .big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cards .sub { font-size: 12px; color: var(--muted); }

.gu-bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 18px; }
.gu-row {
  display: grid; grid-template-columns: 62px 1fr 28px; align-items: center; gap: 8px;
  font-size: 13px; padding: 2px 4px; border-radius: 6px; cursor: pointer;
}
.gu-row:hover, .gu-row.active { background: #e8eefc; }
.gu-row .bar { height: 10px; background: #e5e9ef; border-radius: 5px; overflow: hidden; display: flex; }
.gu-row .bar span { display: block; height: 100%; }
.gu-row .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.table-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.table-tools select { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.table-scroll { overflow: auto; max-height: 520px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: #eef1f5; cursor: pointer; user-select: none; }
th.sorted-asc::after { content: " ▲"; font-size: 10px; }
th.sorted-desc::after { content: " ▼"; font-size: 10px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f3f6fd; }
.cdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 24px; }

.pop b { font-size: 14px; }
.pop div { font-size: 12px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 8px 12px 12px; }
  #map { height: 460px; }
  .report { padding: 8px 12px 24px; }
}
