/* 따릉이 정거장 선발 지도 */
:root {
  --bg: #ffffff;
  --soft: #f6f7f9;
  --ink: #16181d;
  --muted: #5b6270;
  --line: #e3e6eb;
  --sel: #e0157a;
  --accent: #1f6f4a;
  --c0: #9ec5f0; --c0l: #4f86c6;
  --c1: #f6b8d1; --c1l: #d46a9a;
  --c2: #fff4b8; --c2l: #d9bc3a;
  --c3: #cdb4ec; --c3l: #8a63c2;
  color-scheme: light;
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 "Noto Sans KR", system-ui, -apple-system, "Malgun Gothic", sans-serif; overflow-x: clip; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.15; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
button, select, input { font: inherit; }
.band { padding-block: clamp(20px, 3vw, 36px); padding-left: max(4vw, 16px); padding-right: max(4vw, 16px); }
.wrap { max-width: 1320px; margin: 0 auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* header */
.head { background: var(--soft); border-bottom: 1px solid var(--line); }
.head-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 40px; align-items: end; }
.lede { margin: 10px 0 0; max-width: 62ch; color: var(--muted); font-size: 15px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, auto)); gap: 10px 28px; }
.kpi b { display: block; font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi span { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* top area */
.top { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.map-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--soft); }
#map { height: min(680px, 72vh); min-height: 420px; background: #eef0f2; }
.map-foot { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); cursor: pointer; font-size: 13px; color: var(--ink); }
.chip i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid; }
.chip.off { opacity: 0.4; text-decoration: line-through; }
.chip.selkey i { background: #fff; border: 3px solid var(--sel); width: 14px; height: 14px; }
.chip.selkey { cursor: default; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--sel); }

/* panel */
.panel { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--bg); position: sticky; top: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }
.presets button { border: 1px solid var(--line); background: var(--soft); border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer; color: var(--ink); }
.presets button:hover { border-color: var(--muted); }
.presets button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.sl { padding: 12px 0; border-bottom: 1px solid var(--line); }
.sl-top { display: flex; align-items: center; gap: 8px; }
.sl-top .dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid; flex: none; }
.sl-top .nm { font-weight: 700; }
.sl-top .sz { color: var(--muted); font-size: 12px; }
.sl-top .cnt { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sl-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px 46px; gap: 8px; align-items: center; margin-top: 8px; }
.sl-row button { height: 32px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; cursor: pointer; font-weight: 700; color: var(--ink); }
.sl-row button:hover { background: var(--soft); }
.sl-row output { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }
input[type=range] { width: 100%; height: 28px; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 8px; background: linear-gradient(to right, var(--tc) var(--p), var(--line) var(--p)); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 8px; background: linear-gradient(to right, var(--tc) var(--p), var(--line) var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -6px; border-radius: 50%; background: #fff; border: 2px solid var(--tl); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--tl); }
input[type=range]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.alloc { display: flex; justify-content: space-between; margin: 12px 0 4px; font-size: 14px; }
.pending { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: #fff4e5; color: #8a4b00; font-size: 13px; }
.primary { width: 100%; margin-top: 12px; height: 46px; border: 0; border-radius: 10px; background: var(--sel); color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; }
.primary:hover { filter: brightness(0.93); }
.primary:disabled { background: #c9ccd2; cursor: not-allowed; }
.primary.pulse { box-shadow: 0 0 0 4px rgba(224, 21, 122, .18); }
.diff { margin: 10px 0 0; font-size: 13px; color: var(--muted); min-height: 1.4em; }
.ghost { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 13px; color: var(--ink); }
.ghost:hover { background: var(--soft); }

/* gu summary (top) */
.gu-summary { margin-bottom: 20px; }
.gu-total { margin: 0; font-size: 13px; color: var(--muted); }
.gu-total b { color: var(--ink); }
.gu-tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.gu-tables table { font-size: 14px; }
.gu-tables th { position: static; cursor: default; }
.gu-tables td, .gu-tables th { padding: 6px 10px; }
.gu-tables tbody tr.on { background: #fde8f2; }
.gu-tables .top100 b { color: var(--sel); }
.gu-tables .zero { color: #a0a6b0; }

/* lower */
.lower { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--bg); }
.card-head { margin-bottom: 12px; }
.card-head.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); color: var(--ink); font-size: 14px; }
.gu-bars { display: grid; gap: 3px; }
.gu { display: grid; grid-template-columns: 66px minmax(0, 1fr) 28px; gap: 8px; align-items: center; padding: 3px 4px; border-radius: 6px; cursor: pointer; border: 0; background: none; text-align: left; color: var(--ink); font-size: 13px; }
.gu:hover { background: var(--soft); }
.gu.on { background: #fde8f2; }
.gu .bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--soft); }
.gu .bar i { display: block; height: 100%; }
.gu .n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.gu.zero { color: #a0a6b0; }
.scroll { overflow-x: auto; max-height: 640px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--soft); font-weight: 700; font-size: 13px; cursor: pointer; user-select: none; z-index: 1; }
th.sorted::after { content: " ▾"; }
th.sorted.asc::after { content: " ▴"; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fafbfc; }
tbody tr.focus { background: #fde8f2; }
td.nm { white-space: normal; min-width: 180px; font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.tag i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid; }
.foot { margin-top: 8px; }
.foot-band { color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

/* leaflet popup */
.pop h3 { margin: 0 0 2px; font-size: 15px; }
.pop .meta { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.pop table { font-size: 12px; }
.pop td { padding: 2px 8px 2px 0; border: 0; }
.pop .badge { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 999px; background: var(--sel); color: #fff; font-size: 12px; font-weight: 700; }
.leaflet-container { font-family: inherit; }
.base-tiles { filter: saturate(0.9) brightness(1.03); }

@media (max-width: 1080px) {
  .head-in { grid-template-columns: 1fr; }
  .lower { grid-template-columns: 1fr; }
  .gu-bars { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); column-gap: 20px; }
}
@media (max-width: 900px) {
  .gu-tables { grid-template-columns: 1fr; }
  .gu-tables table + table thead { display: none; }
  .top { grid-template-columns: 1fr; }
  .panel { position: static; }
  #map { height: 62vh; min-height: 360px; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table { font-size: 13px; }
  th, td { padding: 6px 6px; }
}
