:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #23262b;
  --muted: #6d727a;
  --line: #e4e2dc;
  --accent: #3b5f86;
  --repair: #3f6e9e;
  --gear: #c0782f;
  --dealer: #b0484f;
  --sales: #4d8a5c;
  --cafe: #7f5a9c;
  --shadow: 0 6px 24px rgba(30, 34, 40, .14);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191c; --surface: #212429; --ink: #e8e9eb; --muted: #9aa0a8; --line: #33373d;
    --shadow: 0 6px 24px rgba(0, 0, 0, .45);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { display: flex; flex-direction: column; overflow: hidden; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }

.top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; white-space: nowrap; color: var(--accent); }
.search { flex: 1; min-width: 0; }
.search input, .top select {
  width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); padding: 0 12px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.top select { width: auto; padding-right: 6px; }

.chips {
  display: flex; gap: 6px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  height: 32px; padding: 0 12px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); opacity: .45; }
.chip .n { font-size: 12px; opacity: .8; }
.chip.on { color: var(--ink); border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.chip.on .dot { opacity: 1; }
.chip.all { --c: var(--accent); }

.layout { flex: 1; display: grid; grid-template-columns: 340px 1fr; min-height: 0; }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.grab { display: none; }
.panel-head { display: flex; justify-content: space-between; padding: 12px 16px 8px; font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li { padding: 10px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.list li:hover, .list li.sel { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.list .nm { display: flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .nm i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.list .nm b { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.list .sub { margin-top: 3px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .empty { color: var(--muted); cursor: default; text-align: center; padding: 30px 16px; }
.note { padding: 10px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); line-height: 1.5; }

.mapwrap { position: relative; min-height: 0; }
#map { position: absolute !important; inset: 0; background: #e9e7e1; } /* 네이버 지도가 relative로 바꾸는 것 방지 */
.fab {
  position: absolute; right: 14px; bottom: 24px; z-index: 500; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; font-size: 20px;
}
.banner {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 500;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 10px; padding: 8px 14px; font-size: 13px; color: var(--muted); white-space: nowrap; max-width: calc(100% - 24px);
  overflow: hidden; text-overflow: ellipsis;
}

.card {
  position: absolute; left: 14px; bottom: 24px; z-index: 600; width: 340px; max-width: calc(100% - 28px);
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 16px; border-top: 4px solid var(--c);
}
.card .x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; }
.card h3 { margin: 0 28px 4px 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.card .tag + .tag { margin-left: 4px; color: var(--muted); background: var(--bg); }
.card .row { margin-top: 8px; font-size: 14px; line-height: 1.45; }
.card .row a { color: var(--accent); text-decoration: none; }
.card .btns { display: flex; gap: 8px; margin-top: 12px; }
.card .btns a {
  flex: 1; text-align: center; padding: 9px 0; border-radius: 10px; text-decoration: none; font-size: 14px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--ink);
}
.card .btns a.primary { background: #03c75a; border-color: #03c75a; color: #fff; }

/* 지도 마커 */
.pin {
  width: 14px; height: 14px; border-radius: 50%; background: var(--c);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); cursor: pointer;
}
.pin.sel { width: 20px; height: 20px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 35%, transparent), 0 1px 4px rgba(0,0,0,.35); }
.clu {
  display: flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer;
  color: #fff; font-size: 12px; font-weight: 700; border: 2px solid rgba(255,255,255,.9);
  background: var(--accent); box-shadow: 0 1px 6px rgba(0, 0, 0, .3);
}
.leaflet-div-icon { background: none; border: 0; }

@media (max-width: 760px) {
  .top { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); gap: 8px; }
  .brand { display: none; }
  .chips { padding: 8px 12px; }
  .layout { display: block; position: relative; }
  .mapwrap { position: absolute; inset: 0; }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 700; height: 132px;
    border-right: 0; border-radius: 16px 16px 0 0; box-shadow: var(--shadow); transition: height .25s;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.open { height: 62%; }
  .grab { display: block; border: 0; background: none; padding: 8px 0 0; cursor: pointer; }
  .grab span { display: block; margin: 0 auto; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
  .panel-head { padding-top: 6px; }
  .note { display: none; }
  .panel.open .note { display: block; }
  .fab { bottom: 148px; }
  .card { left: 12px; right: 12px; width: auto; bottom: 144px; }
}
.dist { color: var(--accent); font-weight: 600; }
.list .sub .dist { font-weight: 600; }
.card .tag.km { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-weight: 600; }
