:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #1d4ed8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.5;
}
.top { padding: 20px 16px 8px; max-width: 1200px; margin: 0 auto; }
.top h1 { margin: 0; font-size: 1.5rem; }
.sub { margin: 4px 0 0; color: var(--muted); }
main { max-width: 1200px; margin: 0 auto; padding: 8px 16px 40px; display: grid; gap: 16px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 1.1rem; }
.panel h3 { margin: 0 0 8px; font-size: 0.95rem; }

/* 슬라이더 */
#sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; }
.slider-item .head { display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; }
.slider-item .name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.25); }
.slider-item input[type=range] { width: 100%; }
.slider-item .calc { color: var(--muted); font-size: 0.85rem; }
.sum-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; font-size: 0.9rem; }
.hint { color: var(--muted); }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
button {
  font: inherit; cursor: pointer; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
}
button:hover { background: #f2f4f7; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: #1e40af; }
button.pending { box-shadow: 0 0 0 3px rgba(29,78,216,.3); }

/* 지도 */
.mapwrap { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
#map { height: 620px; }
.legend {
  position: absolute; right: 12px; bottom: 12px; z-index: 500;
  background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 0.85rem; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.legend label { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 1px 0; }
.legend .ring { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #e11d48; display: inline-block; }

/* 요약 */
.summary-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 20px; }
.gubars { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 16px; }
.gubar { display: grid; grid-template-columns: 64px 1fr 24px; align-items: center; gap: 8px; font-size: 0.88rem; cursor: pointer; }
.gubar .bar { height: 10px; background: #e0e7ff; border-radius: 5px; overflow: hidden; }
.gubar .bar i { display: block; height: 100%; background: var(--accent); }
.gubar b { text-align: right; }
.gubar:hover .gu { text-decoration: underline; }
.clustercounts div { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; padding: 2px 0; }
.clustercounts b { margin-left: auto; }

.table-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.table-head h3 { margin: 0; }
.table-tools { display: flex; gap: 8px; align-items: center; }
select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); }
.tablewrap { overflow: auto; max-height: 460px; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 720px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: #f2f4f7; z-index: 1; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #eef2ff; }
.tablewrap.short { max-height: 340px; }
#guTable { min-width: 480px; }
#guTable th[data-key] { cursor: pointer; user-select: none; }
#guTable th[data-key]:hover { background: #e4e7ec; }
#guTable th.sorted::after { content: " ▼"; font-size: 0.7em; }
#guTable th.sorted.asc::after { content: " ▲"; }
#guTable tbody tr { cursor: default; }
#guTable td.top-zero { color: var(--muted); }
#guTable tfoot td { position: sticky; bottom: 0; background: #f2f4f7; font-weight: 700; }
.note { color: var(--muted); font-size: 0.82rem; margin: 8px 0 0; }

.tip b { font-size: 0.95rem; }
.tip table { min-width: 0; font-size: 0.82rem; }
.tip td { border: 0; padding: 1px 6px 1px 0; }

@media (max-width: 760px) {
  .summary-grid { grid-template-columns: 1fr; }
  #map { height: 460px; }
}
