:root {
  --surface: #ffffff;
  --page: #e4f2fb;
  --border: #e3e3e0;
  --text: #1f1f1f;
  --text-2: #6b6b6b;
  --accent: #1f1f1f;
  --select: #e0101a;
  --c0: #257de0; /* 출근집중형 */
  --c1: #00b894; /* 주말집중형 */
  --c2: #f2a600; /* 최다이용량 */
  --c3: #f47230; /* 퇴근집중형 */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

h1, h2 { margin: 0; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 15px; margin-bottom: 10px; }
.mt { margin-top: 22px; }

.page-header { padding: 20px 24px 12px; }
.sub { margin: 4px 0 0; color: var(--text-2); }

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  padding: 0 24px;
}

.panel, .card, .kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.panel { padding: 18px; }
.hint { color: var(--text-2); font-size: 12.5px; margin: 0 0 14px; }

/* 슬라이더 */
.slider-row { margin-bottom: 14px; }
.slider-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.slider-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.swatch {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block; flex: none;
}
.slider-val { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; }
.slider-val b { color: var(--text); }
.slider-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider-meta { color: var(--text-2); font-size: 12px; }

.sum-row {
  display: flex; justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 10px; margin-top: 4px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sum-row .off { color: #b25000; }

.btn-row { display: flex; gap: 8px; margin-top: 14px; }
.btn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; padding: 9px 12px; font: inherit; cursor: pointer;
}
.btn:hover { background: #f0f0ee; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); flex: 1; font-weight: 600; }
.btn.primary:hover { background: #3a3a3a; }
.btn.primary.attention { box-shadow: 0 0 0 3px rgba(224, 16, 26, .25); }
.btn.small { padding: 5px 10px; font-size: 13px; }

.pending { color: #b25000; font-size: 12.5px; margin: 8px 0 0; }

.check { display: flex; align-items: center; gap: 6px; cursor: pointer; margin-bottom: 10px; }

.legend { display: grid; gap: 6px; font-size: 13px; }
.legend label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.legend .count { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.legend .sel-swatch {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2.5px solid var(--select); background: #bbb;
  box-shadow: inset 0 0 0 2px #fff;
}

/* 지도 */
.map-wrap { min-height: 620px; position: relative; }
.map-notice {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  z-index: 500; margin: 0; max-width: 80%;
  background: #fff7e6; color: #8a4b00; border: 1px solid #f0c98a;
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
#map {
  height: 100%; min-height: 620px;
  border-radius: 10px; border: 1px solid var(--border);
}
#map.no-tiles { background: #e4ebef; }
.leaflet-tooltip.gu-label {
  background: transparent; border: 0; box-shadow: none; padding: 0;
  color: #6b6b6b; font-size: 11px; font-weight: 600;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
}
.leaflet-tooltip.gu-label::before { display: none; }
.leaflet-popup-content { font-size: 13px; line-height: 1.55; margin: 12px 14px; }
.popup-title { font-weight: 700; margin-bottom: 4px; }
.popup-tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 11.5px; color: #fff; margin-bottom: 6px;
}
.popup-sel { color: var(--select); font-weight: 600; }
.popup-grid { display: grid; grid-template-columns: auto auto; gap: 0 12px; }
.popup-grid span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }

/* 요약 */
.summary { padding: 16px 24px 8px; }
.kpis {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--text-2); font-size: 12.5px; }
.kpi .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .note { color: var(--text-2); font-size: 12px; }

.summary-grid {
  display: grid; grid-template-columns: 340px 1fr; gap: 16px;
}
.card { padding: 18px; min-width: 0; }

/* 구별 막대 */
.bars { display: grid; gap: 5px; }
.bar-row {
  display: grid; grid-template-columns: 70px 1fr 28px;
  align-items: center; gap: 8px; font-size: 13px;
  cursor: pointer; border-radius: 4px; padding: 1px 2px;
}
.bar-row:hover { background: #f3f3f1; }
.bar-row.active { background: #ecebe7; font-weight: 600; }
.bar-track { display: flex; height: 14px; gap: 2px; }
.bar-seg { height: 100%; }
.bar-seg:first-child { border-radius: 2px 0 0 2px; }
.bar-seg:last-child { border-radius: 0 4px 4px 0; }
.bar-num { text-align: right; font-variant-numeric: tabular-nums; }
.bar-zero { color: var(--text-2); }

/* 표 */
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.table-head h2 { margin: 0; }
.table-tools { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.table-tools select { margin-left: 6px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border); font: inherit; }
.table-scroll { max-height: 520px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid #efefec; white-space: nowrap; text-align: left; }
th {
  position: sticky; top: 0; background: #fafaf8; z-index: 1;
  cursor: pointer; user-select: none; font-weight: 600;
}
th.sorted::after { content: " ▼"; font-size: 10px; }
th.sorted.asc::after { content: " ▲"; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f6f6f3; }
td.name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-flex; align-items: center; gap: 6px; }

.page-footer { color: var(--text-2); font-size: 12px; padding: 12px 24px 28px; }

@media (max-width: 1000px) {
  .layout, .summary-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .map-wrap, #map { min-height: 460px; }
}
