:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --ink: #1f2328;
  --ink-2: #57606a;
  --muted: #8b949e;
  --line: #e8e6e1;
  --accent: #14b8a6;        /* 민트 — 그래프·포인트 */
  --accent-strong: #0f8f82; /* 민트(진) — 버튼·강조 텍스트(흰 글자 대비 확보) */
  --accent-soft: #e7f8f5;
  --neutral-mark: #a9b1ba;
  --up: #c2410c;
  --down: #1d6fb8;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.top .wrap { padding-top: 22px; padding-bottom: 18px; }
h1 { margin: 0; font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
h1 .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.sub { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h2 small { color: var(--muted); font-weight: 400; font-size: 13px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }

.picker { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.map { height: 440px; border-radius: 10px; border: 1px solid var(--line); background: #f7f9f8; z-index: 0; }
.leaflet-container { font-family: inherit; }
.leaflet-tooltip.dong-tip { font-size: 13px; padding: 4px 8px; border-color: var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.gu-label { background: none; border: 0; box-shadow: none; color: #6b7480; font-size: 11px; font-weight: 600; text-shadow: 0 0 3px #fff, 0 0 3px #fff; padding: 0; }
.gu-label::before { display: none; }
.controls { display: flex; flex-direction: column; gap: 12px; }
.controls h2 { margin: 0; }
.controls .hint { margin: -6px 0 0; }
.controls label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.picked { font-size: 14px; color: var(--ink-2); background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; }
.picked b { color: var(--accent-strong); }
select, input[type=search] {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; min-height: 42px;
}
select:focus, input:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 10px 18px; min-height: 42px;
  background: var(--accent-strong); color: #fff; cursor: pointer;
}
.btn:hover:not(:disabled) { background: #0c7b70; }
.btn:disabled { background: #a8ddd6; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--accent-strong); border: 1px solid var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }

.status { min-height: 24px; overflow-wrap: anywhere; margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.status .bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; max-width: 360px; }
.status .bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.status.err { color: #b42318; }

.filters { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 14px; border: 0; background: none; color: var(--ink-2); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }
.seg.small button { font-size: 13px; padding: 4px 10px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi .l { font-size: 13px; color: var(--ink-2); }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 13px; color: var(--muted); margin-top: 2px; }
.kpi .d .up { color: var(--up); font-weight: 600; }
.kpi .d .down { color: var(--down); font-weight: 600; }
.kpi.hl { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.chart { margin: 0 0 16px; }
.chart figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.chart figcaption h2 { margin: 0; }
.canvas { position: relative; height: 280px; }

.tscroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { color: var(--ink-2); font-weight: 600; font-size: 13px; background: #fcfbf9; }
th:first-child, td:first-child, td.t { text-align: left; }
tr:hover td { background: var(--accent-soft); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.tag.p { background: #f3effa; color: #6b4fa0; }
.tag.m { background: #eef1f4; color: var(--ink-2); }
.thead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.thead h2 { margin: 0; }
.muted { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.note ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
#top10 .seg { margin: 10px 0 14px; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank li { display: grid; grid-template-columns: 26px 72px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.rank li:hover, .rank li:focus-visible { background: var(--accent-soft); outline: none; }
.rank .no { font-weight: 700; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.rank li:nth-child(-n+3) .no { color: var(--accent-strong); }
.rank .gu { font-weight: 600; white-space: nowrap; }
.rank .track { height: 14px; background: #f1f3f2; border-radius: 4px; overflow: hidden; }
.rank .fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.rank .val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; min-width: 96px; }
.rank .val small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.foot { color: var(--muted); font-size: 12px; padding-top: 8px; padding-bottom: 32px; }

@media (max-width: 860px) {
  .picker { grid-template-columns: minmax(0, 1fr); }
  .map { height: 360px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .rank li { grid-template-columns: 22px 60px minmax(0, 1fr) auto; gap: 8px; }
  .rank .val { min-width: 80px; font-size: 14px; }
  .panel { padding: 14px; }
  .kpi { padding: 12px; }
  .kpi .l { font-size: 12px; }
  .kpi .v { font-size: 20px; }
  .canvas { height: 240px; }
}
