:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7785;
  --line: #e2e6ea;
  --accent: #2563eb;
  --danger: #e11d48;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  line-height: 1.5;
}
.top { padding: 20px 16px 8px; max-width: 1400px; margin: 0 auto; }
.top h1 { margin: 0 0 4px; font-size: 1.5rem; }
.top p { margin: 0; color: var(--muted); font-size: .92rem; }

.gu-summary {
  max-width: 1368px; margin: 8px auto 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.gu-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.gu-head h2 { margin: 0; font-size: 1.05rem; }
.gu-scroll { max-height: 340px; }
#guTable thead th { cursor: pointer; user-select: none; }
#guTable thead th:hover { background: #e6eaf0; }
#guTable thead th.sorted::after { content: " ▼"; font-size: .7em; color: var(--accent); }
#guTable thead th.sorted.asc::after { content: " ▲"; }
#guTable tbody tr { cursor: default; }
#guTable tbody tr.has-sel td:nth-child(3) { font-weight: 700; color: var(--danger); }
#guTable tfoot td { position: sticky; bottom: 0; background: #f0f2f5; font-weight: 700; border-top: 2px solid var(--line); }
.bar { display: inline-block; height: 8px; background: var(--danger); border-radius: 4px; margin-right: 6px; vertical-align: middle; opacity: .75; }
@media (max-width: 900px) { .gu-summary { margin-left: 16px; margin-right: 16px; } }

.layout {
  max-width: 1400px; margin: 0 auto; padding: 12px 16px;
  display: grid; grid-template-columns: 320px 1fr; gap: 16px;
}
.panel, .summary {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.panel h2, .summary h2 { margin: 0 0 8px; font-size: 1.05rem; }
.panel h2:not(:first-child) { margin-top: 20px; }
.hint { margin: 0 0 12px; color: var(--muted); font-size: .85rem; }

.slider-item { margin-bottom: 12px; }
.slider-label { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.slider-label .pct { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--accent); }
.slider-item input[type=range] { width: 100%; margin: 4px 0 0; accent-color: var(--accent); }
.slider-sub { font-size: .78rem; color: var(--muted); }

.sum-row { font-size: .85rem; color: var(--muted); margin: 4px 0 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 8px; padding: 9px 14px; font: inherit; cursor: pointer;
}
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #1d4ed8; }
.btn.dirty { box-shadow: 0 0 0 3px rgba(37, 99, 235, .3); }
.warn { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: #fff4e5; color: #8a5300; font-size: .85rem; }

.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.legend { margin-top: 12px; font-size: .85rem; display: grid; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-ring { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--danger); flex: none; }

.map-wrap { min-height: 560px; }
#map { height: 100%; min-height: 560px; border-radius: 12px; border: 1px solid var(--line); }

.summary { max-width: 1368px; margin: 4px auto 16px; }
@media (min-width: 1400px) { .summary { margin-left: auto; margin-right: auto; } }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 20px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; border-left-width: 6px; }
.card .name { font-size: .85rem; color: var(--muted); }
.card .val { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .sub { font-size: .78rem; color: var(--muted); }
.card.total { border-left-color: var(--danger); }

.table-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.table-head h3 { margin: 0; font-size: 1rem; }
.table-head select { margin-left: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); font: inherit; }
.table-scroll { overflow: auto; max-height: 520px; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 8px 10px; text-align: left; white-space: nowrap; }
thead th { position: sticky; top: 0; background: #f0f2f5; border-bottom: 1px solid var(--line); z-index: 1; }
tbody tr { border-bottom: 1px solid var(--line); cursor: pointer; }
tbody tr:hover { background: #f7faff; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; gap: 6px; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 8px 16px 24px; }

.leaflet-tooltip.tip { font-size: .82rem; line-height: 1.4; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .map-wrap, #map { min-height: 420px; }
  .summary { margin-left: 16px; margin-right: 16px; }
}
