:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #191d23;
  --muted: #707784;
  --line: #e6e9ed;
  --line-strong: #d6dade;
  --accent: #0e7a4e;
  --accent-deep: #0a5c3b;
  --accent-ink: #ffffff;
  --accent-soft: #e7f4ee;
  --amber: #b45309;
  --amber-soft: #fdf3e3;
  --danger: #c22a2a;
  --radius: 16px;
  --radius-s: 11px;
  --shadow: 0 1px 2px rgba(18, 26, 33, .05), 0 6px 20px rgba(18, 26, 33, .06);
  --shadow-lift: 0 4px 10px rgba(18, 26, 33, .10), 0 14px 40px rgba(18, 26, 33, .12);
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ── 상단바 ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  font-size: 21px; line-height: 1;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #12915e, #0a5c3b);
  border-radius: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 3px 8px rgba(10,92,59,.28);
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.sub { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; }

/* ── 버튼 ───────────────────────────────────────────── */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-s);
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .13s, border-color .13s, transform .06s, box-shadow .13s;
}
.btn:hover { background: #f2f4f6; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(150deg, #12915e, #0c6a44);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 3px 10px rgba(12, 106, 68, .3);
}
.btn-primary:hover { background: linear-gradient(150deg, #0f8353, #0a5c3b); }

.btn-accent { background: var(--amber-soft); border-color: #ecd9ae; color: #8a5a06; }
.btn-accent:hover { background: #f8ead1; }
.btn-danger { color: var(--danger); border-color: #f0d4d4; }
.btn-icon { padding: 7px 11px; }

.linkish {
  background: none; border: 0; padding: 0;
  color: var(--accent); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}

/* ── 배너 ───────────────────────────────────────────── */
.banner {
  padding: 9px 18px;
  font-size: 13.5px;
  background: var(--amber-soft);
  color: var(--amber);
  border-bottom: 1px solid #f0e2c4;
}
.banner-info { background: var(--accent-soft); color: var(--accent-deep); border-bottom-color: #d3e8dd; }

/* ── 필터 ───────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 9px;
  padding: 11px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  align-items: center;
}
.field { display: flex; }
.field.grow { flex: 1 1 280px; min-width: 220px; }

input[type="search"], select, textarea, .fld input {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #f6f7f9;
  border: 1.5px solid transparent;
  border-radius: var(--radius-s);
  padding: 9px 13px;
  transition: border-color .13s, background .13s, box-shadow .13s;
}
input[type="search"]:focus, select:focus, textarea:focus, .fld input:focus {
  outline: none;
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="search"]::placeholder { color: #9aa1ac; }
select { min-width: 132px; cursor: pointer; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--line-strong); border-radius: 999px;
  padding: 7px 13px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: var(--card); color: #4a515c;
  user-select: none;
  transition: background .13s, border-color .13s, color .13s;
}
.chip:hover { border-color: #b9c0c8; }
.chip:has(input:checked) {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep);
}
.chip input { accent-color: var(--accent); margin: 0; }

/* ── 레이아웃 ───────────────────────────────────────── */
.mobile-tabs { display: none; }

.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(360px, 40%) 1fr;
  min-height: 0;
}

.panel-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.list-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 10px 16px; font-size: 12.5px; color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--card);
}
.list-head #count { font-weight: 800; color: var(--ink); font-size: 14.5px; }
.hint { font-size: 12px; }

.list { list-style: none; margin: 0; padding: 12px; overflow-y: auto; flex: 1 1 auto; scrollbar-width: thin; }

/* ── 카드 ───────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px 13px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .13s, box-shadow .15s, transform .1s;
}
.card:hover { border-color: #c7cdd4; transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.card.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }

.card-top { display: flex; align-items: flex-start; gap: 8px; }
.card h3 { margin: 0; font-size: 15.5px; font-weight: 750; letter-spacing: -.015em; flex: 1 1 auto; }
.dist {
  font-size: 12px; color: var(--accent-deep); font-weight: 800; white-space: nowrap;
  background: var(--accent-soft); border-radius: 999px; padding: 3px 9px; margin-top: -1px;
}

.fav-btn {
  border: 0; background: none; padding: 0 2px;
  font-size: 19px; line-height: 1.05; cursor: pointer;
  color: #c6ccd3; flex: 0 0 auto;
  transition: color .13s, transform .1s;
}
.fav-btn:hover { transform: scale(1.2); color: #e8b64c; }
.fav-btn.is-on { color: #f2a900; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 0; }
.tag {
  font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px;
  background: #eef1f4; color: #4d545e; white-space: nowrap;
}
.tag-dd { background: var(--accent-soft); color: var(--accent-deep); }
.tag-monthly { background: var(--amber-soft); color: #96660d; }
.tag-24h { background: #e9effc; color: #2653b8; }

.addr { margin: 8px 0 0; font-size: 13.5px; color: #454b54; }
.meta { margin: 6px 0 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.meta b {
  color: var(--accent-deep); font-weight: 750; font-size: 11px;
  background: var(--accent-soft); padding: 2px 7px; border-radius: 5px; margin-right: 4px;
}
.note { margin: 7px 0 0; font-size: 12.5px; color: var(--muted); }

.card-actions { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }
.card-actions a, .card-actions button {
  font-size: 12.5px; font-weight: 600;
  padding: 6px 11px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--card); color: #383e47;
  text-decoration: none; cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s;
}
.card-actions a:hover, .card-actions button:hover { background: #f2f4f6; border-color: #bfc6cd; }

/* 카드에 표시되는 구장 사진 */
.card-photos {
  display: flex; gap: 6px; margin-top: 10px;
  overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: thin;
}
.card-photos img {
  height: 76px; width: auto; flex: 0 0 auto;
  border-radius: 8px; object-fit: cover;
  border: 1px solid var(--line);
}
.card-photos a { display: flex; flex: 0 0 auto; }
.card-photos a:hover img { border-color: var(--accent); }
.photo-more {
  display: flex; align-items: center; flex: 0 0 auto;
  padding: 0 10px; border-radius: 8px;
  background: var(--accent-soft); color: var(--muted);
  font-size: 13px; font-weight: 600;
}

/* 사진 등록 영역 */
.fld .opt { color: var(--muted); font-weight: 500; font-size: 12px; }
.photo-drop {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1.5px dashed var(--line-strong); border-radius: 10px;
  padding: 12px; background: #fafbfc;
  transition: border-color .12s, background .12s;
}
.photo-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.photo-hint { font-size: 12.5px; color: var(--muted); }

.photo-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-item { position: relative; }
.photo-item img {
  width: 92px; height: 70px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); display: block;
}
.photo-del {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: #fff; color: #444;
  font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.photo-del:hover { background: #fdeaea; color: var(--danger); border-color: #f3d3d3; }

/* 정보 더보기 — 카페 원글(요금표 전문·시설 사진). 다른 버튼보다 눈에 띄게 */
.card-actions .act-more {
  background: var(--accent-soft);
  border-color: #bfe0cf;
  color: #0b5c3b;
  font-weight: 700;
}
.card-actions .act-more:hover { background: #d6ebdf; border-color: #9fd3b9; }

.no-geo { font-size: 12px; color: var(--amber); }

.empty { padding: 48px 20px; text-align: center; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ── 지도 ───────────────────────────────────────────── */
.panel-map { min-height: 0; position: relative; }
#map { width: 100%; height: 100%; background: #e6eaee; }

.tile-soft { filter: saturate(0.38) brightness(1.07) contrast(0.92); }

/* 물방울 핀 (SVG는 app.js pinIcon 에서 생성) */
.pin-wrap { background: none; border: 0; }
.pin-wrap .pinv {
  filter: drop-shadow(0 2px 2.5px rgba(0, 0, 0, .3));
  transition: transform .12s;
  transform-origin: 50% 94%;          /* 꼭짓점 기준으로 커지게 */
}
.pin-wrap:hover .pinv { transform: scale(1.12); }

/* 핀 라벨 — 확대(줌 13+) 시 상호·요금이 핀 아래 붙는다 */
.pin-label {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  padding: 4px 9px 5px;
  text-align: center;
  line-height: 1.25;
  pointer-events: none;
}
.pin-label b { display: block; font-size: 12px; font-weight: 800; color: #1c212b; letter-spacing: -.01em; }
.pin-label span { display: block; font-size: 10.5px; font-weight: 650; color: var(--accent-deep); margin-top: 1px; }
.pin-label::before { display: none; }   /* 말꼬리 화살표 제거 */
.leaflet-container .pin-label { display: none; }
.leaflet-container.show-labels .pin-label { display: block; }

/* 핀 묶음(클러스터) */
.cl {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #17a86e, #0a5c3b 78%);
  color: #fff; font-weight: 800; font-size: 14px;
  border: 3px solid rgba(255,255,255,.94);
  box-shadow: 0 3px 10px rgba(0,0,0,.28);
}
.marker-cluster { background: none !important; }
.marker-cluster div { background: none !important; }

.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow-lift); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13.5px; line-height: 1.5; font-family: inherit; }
.leaflet-popup-content b { font-size: 14.5px; }
.leaflet-popup-content a { color: var(--accent); font-weight: 700; }

/* ── 모달 ───────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(13, 18, 24, .5);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--card); border-radius: 20px; width: min(760px, 100%);
  max-height: 90vh; overflow: auto; box-shadow: 0 24px 70px rgba(0,0,0,.35);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.modal-body { padding: 18px; }
.modal-body code { background: #f1f3f5; padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }

/* ── 관리자 표시 ────────────────────────────────────── */
.admin-who {
  font-size: 12px; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.admin-who a { color: var(--accent-deep); }

/* ── 구장 상세 ──────────────────────────────────────── */
.modal-detail { width: min(620px, 100%); }
.modal-detail .modal-head h2 { font-size: 18px; }

.d-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px; margin-bottom: 14px;
}
.d-gallery a { display: block; }
.d-gallery img {
  width: 100%; height: 116px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); display: block;
}
.d-gallery a:hover img { border-color: var(--accent); }

.modal-detail .tags { margin-bottom: 12px; }

.d-facts {
  display: grid; grid-template-columns: 68px 1fr; gap: 7px 12px;
  margin: 0 0 4px; font-size: 14px; line-height: 1.55;
}
.d-facts dt { color: var(--muted); font-weight: 600; }
.d-facts dd { margin: 0; }
.d-facts a { color: var(--accent-deep); font-weight: 600; }

.d-sec { margin-top: 18px; }
.d-sec h3 {
  margin: 0 0 7px; font-size: 13px; font-weight: 800;
  color: var(--accent-deep); letter-spacing: .01em;
}
.d-list { margin: 0; padding-left: 17px; font-size: 14px; line-height: 1.62; }
.d-list li { margin-bottom: 3px; }
.d-list li.is-warn { color: #92400e; list-style: none; margin-left: -17px; }

.d-actions { border-top: 1px solid var(--line); padding-top: 15px; margin-top: 20px; }
.d-actions .btn { text-decoration: none; }

.d-source {
  margin: 14px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--muted);
}
.d-source a { color: var(--accent-deep); font-weight: 600; white-space: nowrap; }

.tabs { display: flex; gap: 6px; margin: 14px 0 10px; }
.dtab {
  border: 1.5px solid var(--line-strong); background: var(--card); border-radius: 9px;
  padding: 7px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.dtab.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); font-weight: 750; }

textarea { font-family: ui-monospace, "Consolas", monospace; font-size: 12.5px; line-height: 1.5; resize: vertical; }

/* 사장님 등록 폼 */
.fld { display: block; margin-top: 12px; }
.fld > span { display: block; font-size: 13px; font-weight: 700; color: #40454d; margin-bottom: 5px; }
.fld .req { color: var(--danger); }
.fld input, .fld select, .fld textarea { width: 100%; }
.fld textarea { font-family: inherit; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.msg { margin: 10px 0 0; font-size: 13.5px; padding: 10px 12px; border-radius: 10px; }
.msg.ok { background: var(--accent-soft); color: var(--accent-deep); }
.msg.err { background: #fdecec; color: var(--danger); }

.foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 18px; font-size: 12px; color: var(--muted);
  background: var(--card); border-top: 1px solid var(--line);
}

/* ── 모바일 ─────────────────────────────────────────── */
@media (max-width: 860px) {
  body { font-size: 14.5px; }

  .topbar { padding: 10px 14px; gap: 8px; }
  .logo { width: 38px; height: 38px; font-size: 19px; border-radius: 11px; }
  .topbar h1 { font-size: 16.5px; }
  .sub { display: none; }
  .topbar-actions { flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions .btn { flex: 0 0 auto; font-size: 13px; padding: 8px 12px; }

  .filters { padding: 9px 14px 10px; gap: 8px; }
  .field.grow { flex-basis: 100%; min-width: 0; }
  .field select { min-width: 0; }
  .filters .field:not(.grow) { flex: 1 1 calc(33% - 8px); }
  .chips {
    flex: 1 1 100%;
    flex-wrap: nowrap; overflow-x: auto;
    padding-bottom: 2px; scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }

  /* 하단 떠 있는 목록/지도 전환 탭 */
  .mobile-tabs {
    display: flex;
    position: fixed;
    left: 50%; transform: translateX(-50%);
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 1600;
    background: rgba(23, 27, 33, .92);
    backdrop-filter: blur(8px);
    border-radius: 999px;
    padding: 4px;
    box-shadow: 0 8px 28px rgba(0,0,0,.35);
  }
  .tab {
    border: 0; background: none;
    padding: 9px 26px; font-size: 14px; font-weight: 700;
    font-family: inherit; cursor: pointer; color: #b8bec7;
    border-radius: 999px;
    transition: background .15s, color .15s;
  }
  .tab.is-active { color: #10331f; background: #fff; }

  .layout { grid-template-columns: 1fr; }
  .panel-list { border-right: 0; }
  .layout[data-view="list"] .panel-map { display: none; }
  .layout[data-view="map"] .panel-list { display: none; }
  .layout[data-view="map"] .panel-map { min-height: calc(100vh - 220px); }
  .hint { display: none; }

  .list { padding: 10px 12px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .card { padding: 13px 14px 12px; }
  .card-actions a, .card-actions button { padding: 7px 12px; }

  .foot { display: none; }

  .grid2, .grid3 { grid-template-columns: 1fr; gap: 0; }
  .modal { padding: 10px; align-items: end; }
  .modal-box { border-radius: 18px 18px 12px 12px; max-height: 94vh; }
}
