:root {
  --blue: #0a7cff;
  --blue-deep: #075bb8;
  --ink: #0d2740;
  --muted: #6f8294;
  --line: rgba(20, 64, 105, .1);
  --panel: rgba(255, 255, 255, .9);
  --panel-solid: #fff;
  --wash: #eef7ff;
  --amber: #f0a23a;
  --green: #35a56f;
  --shadow: 0 22px 70px rgba(26, 76, 120, .16), 0 2px 10px rgba(26, 76, 120, .06);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "SF Mono", "Roboto Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; color: var(--ink); background: #eaf4fd;
  font-family: var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid rgba(10, 124, 255, .55); outline-offset: 2px; }
::selection { background: rgba(10, 124, 255, .16); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: rgba(28, 83, 130, .2); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

#app { position: fixed; inset: 0; overflow: hidden; }

/* ---------- top bar ---------- */
.topbar {
  position: absolute; inset: 0 0 auto 0; height: 72px; z-index: 1100;
  display: flex; align-items: center; gap: 18px; padding: 0 22px;
  background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid rgba(19, 64, 105, .08);
  box-shadow: 0 8px 34px rgba(23, 68, 108, .06);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
}
.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand img { display: block; height: 34px; width: auto; }
.top-divider { width: 1px; height: 26px; background: var(--line); margin: 0 2px; }
.page-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.page-title strong { font-size: 13px; letter-spacing: -.01em; }
.page-title span { color: var(--muted); font-size: 10px; letter-spacing: .04em; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.count-pill {
  height: 30px; padding: 0 11px; display: inline-flex; align-items: center; gap: 5px;
  color: #486377; background: rgba(240, 248, 255, .8); border: 1px solid var(--line);
  border-radius: 99px; font-size: 10.5px; white-space: nowrap;
}
.count-pill b { color: var(--blue-deep); font-size: 12px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: #49677e; font-size: 13px; font-weight: 650;
  transition: .2s ease;
}
.icon-btn:hover { border-color: rgba(10, 124, 255, .34); color: var(--blue-deep); background: #f4faff; }

/* ---------- side panel ---------- */
.panel {
  position: absolute; top: 88px; left: 18px; bottom: 18px; width: 342px; z-index: 1000;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  background: var(--panel); border: 1px solid rgba(255, 255, 255, .84);
  border-radius: 24px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(26px) saturate(155%);
  backdrop-filter: blur(26px) saturate(155%);
}
.panel-head { padding: 21px 20px 0; }
.eyebrow {
  color: var(--blue-deep); font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
}
.panel h1 {
  margin: 8px 0 8px; font-size: 30px; line-height: 1.02; letter-spacing: -.055em; font-weight: 760;
}
.panel h1 span { color: var(--blue); font-weight: 500; letter-spacing: -.04em; }
.panel-lede { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; max-width: 285px; }
.stats { display: grid; grid-template-columns: 1.1fr 1.1fr .9fr; gap: 7px; padding: 16px 20px 14px; }
.stat {
  min-width: 0; padding: 10px 9px 9px; border-radius: 14px;
  background: rgba(245, 251, 255, .8); border: 1px solid rgba(19, 74, 120, .07);
}
.stat b { display: block; font-size: 20px; line-height: 1; letter-spacing: -.045em; font-weight: 720; color: var(--ink); }
.stat span { display: block; margin-top: 5px; color: var(--muted); font-size: 8.8px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.is-accent { background: linear-gradient(145deg, #eff8ff, #e7f3ff); border-color: rgba(10, 124, 255, .13); }
.stat.is-accent b { color: var(--blue-deep); }
.stat.is-soft { background: linear-gradient(145deg, #fff5fb, #fbeaf5); border-color: rgba(217, 70, 166, .14); }
.stat.is-soft b { color: #b03a7a; }
.view-picker {
  display: grid; grid-template-columns: .8fr 1.2fr; gap: 5px;
  padding: 0 20px 7px;
}
.view-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.view-field span { color: #8b9dac; font-size: 8px; letter-spacing: .04em; }
.view-field select {
  width: 100%; height: 29px; padding: 0 5px; border: 1px solid rgba(20, 74, 118, .1);
  border-radius: 7px; background: rgba(248, 252, 255, .94); color: #34556d;
  font-size: 9.5px; font-weight: 560; outline: none; cursor: pointer;
}
.view-field select:hover { border-color: rgba(10, 124, 255, .3); background: #fff; }
.view-context {
  display: flex; align-items: center; gap: 6px; padding: 0 20px 9px;
  color: #6b8294; font-size: 9px;
}
.view-context strong { color: #34556d; font-size: 9.5px; font-weight: 650; }
.view-context em { margin-left: auto; font-style: normal; color: #93a6b4; font-size: 8px; }
.brand-dot { width: 7px; height: 7px; border-radius: 50%; background: #0a7cff; box-shadow: 0 0 0 3px rgba(10,124,255,.12); }
.brand-dot.brand-juran { background: #1f9d6b; box-shadow: 0 0 0 3px rgba(31,157,107,.13); }
.brand-dot.brand-jd { background: #e5484d; box-shadow: 0 0 0 3px rgba(229,72,77,.12); }
.segmented {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; margin: 0 20px 9px; padding: 3px;
  border-radius: 11px; background: #edf5fc; border: 1px solid rgba(20, 75, 120, .05);
}
.segmented button {
  height: 30px; border-radius: 8px; color: #6e8394; font-size: 10.5px; font-weight: 560;
  transition: .2s ease;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active {
  background: #fff; color: var(--blue-deep); box-shadow: 0 2px 7px rgba(25, 83, 128, .1);
}
.filter-bar {
  display: grid; grid-template-columns: .8fr 1fr 1fr; gap: 5px;
  padding: 0 20px 10px;
}
.filter-bar[hidden] { display: none; }
.filter-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.filter-field span { color: #8b9dac; font-size: 8px; letter-spacing: .04em; }
.filter-field select {
  width: 100%; height: 28px; padding: 0 5px; border: 1px solid rgba(20, 74, 118, .1);
  border-radius: 7px; background: rgba(248, 252, 255, .92); color: #48667d;
  font-size: 9px; outline: none; cursor: pointer;
}
.filter-field select:hover { border-color: rgba(10, 124, 255, .3); background: #fff; }
.filter-field select:focus { border-color: rgba(10, 124, 255, .5); }
.filter-clear {
  margin-left: auto; padding: 2px 5px; border-radius: 4px; color: var(--blue-deep);
  font-size: 8.5px; white-space: nowrap;
}
.filter-clear:hover { background: #e9f6ff; }
.list-head {
  display: flex; justify-content: space-between; align-items: center; margin: 0 20px;
  padding: 8px 0 8px; border-bottom: 1px solid rgba(20, 74, 118, .07);
  color: var(--muted); font-size: 9.5px; letter-spacing: .02em;
}
.list-head span:last-child { font-family: var(--mono); font-size: 9px; color: #8ca0b1; }
.list { flex: 1; min-height: 0; overflow-y: auto; padding: 3px 10px 10px; }
.row {
  width: 100%; display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; gap: 9px; align-items: center;
  padding: 10px 9px; border-radius: 11px; text-align: left; transition: background .18s ease;
}
.row + .row { border-top: 1px solid rgba(22, 77, 120, .05); border-radius: 0; }
.row:hover { background: rgba(232, 246, 255, .8); }
.row.is-selected { background: rgba(225, 242, 255, .95); }
.row-dot { width: 6px; height: 6px; border-radius: 50%; background: #9ccbf2; box-shadow: 0 0 0 3px rgba(156, 203, 242, .16); }
.row.is-target .row-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(240, 162, 58, .16); }
.row-main { min-width: 0; }
.row-main strong { display: block; font-size: 11.5px; font-weight: 610; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main em { display: block; margin-top: 3px; color: #8294a4; font-size: 9px; font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.row-meta b { color: #48667e; font-family: var(--mono); font-size: 9.5px; font-weight: 500; }
.row-meta small { padding: 2px 5px; border-radius: 5px; color: #a86a0f; background: #fff4df; font-size: 8px; font-weight: 650; }
.row.is-store .row-dot { background: var(--blue); box-shadow: 0 0 0 3px rgba(10, 124, 255, .13); }
.row.is-project, .row.is-store { grid-template-columns: 25px minmax(0, 1fr) auto; }
.grade-badge, .store-badge {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  color: #fff; font-size: 10px; font-weight: 760; line-height: 1;
  box-shadow: 0 3px 9px rgba(20, 58, 88, .13);
}
.store-badge { background: linear-gradient(145deg, #168eff, #0566c9); font-size: 9px; }
.grade-badge.grade-S, .grade-pin.grade-S { background: #e5484d; }
.grade-badge.grade-Ssoft, .grade-pin.grade-Ssoft { background: #d946a6; }
.grade-badge.grade-A, .grade-pin.grade-A { background: #f0a23a; }
.grade-badge.grade-B, .grade-pin.grade-B { background: #2f8de4; }
.grade-badge.grade-C, .grade-pin.grade-C { background: #91a2b2; }
.grade-pin.grade-Ssoft b { font-size: calc(var(--pin-size) * .23); letter-spacing: -.09em; }
.grade-pin-wrap { border: 0 !important; background: transparent !important; }
.grade-dot-wrap { border: 0 !important; background: transparent !important; }
.grade-dot-marker {
  width: var(--dot-size); height: var(--dot-size); border-radius: 50%;
  background: var(--dot-color); border: 1.5px solid rgba(255, 255, 255, .95);
  box-shadow: 0 3px 9px rgba(18, 54, 83, .24), 0 0 0 1px rgba(13, 50, 80, .07);
}
.grade-pin {
  width: var(--pin-size); height: var(--pin-size); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; border: 2px solid rgba(255, 255, 255, .95);
  box-shadow: 0 8px 22px rgba(18, 54, 83, .28), 0 0 0 1px rgba(13, 50, 80, .06);
  background: var(--pin-color);
}
.grade-pin b { font-size: calc(var(--pin-size) * .31); line-height: .95; font-weight: 780; letter-spacing: -.04em; }
.grade-pin small { margin-top: 2px; font-family: var(--mono); font-size: calc(var(--pin-size) * .18); line-height: 1; opacity: .92; letter-spacing: -.03em; }
.grade-S .target-grade, .target-grade.grade-S { background: #ffe2e2; color: #a32b2f; }
.grade-Ssoft .target-grade, .target-grade.grade-Ssoft { background: #fbe0f1; color: #a32b73; }
.grade-A .target-grade, .target-grade.grade-A { background: #ffedcc; color: #99610b; }
.grade-B .target-grade, .target-grade.grade-B { background: #e4f1ff; color: #115a9f; }
.target-grade {
  display: inline-block; margin-bottom: 3px; padding: 2px 6px; border-radius: 4px;
  background: #ffedce; color: #99610b; font-size: 8px; font-weight: 650;
}
.search-item-icon.grade-S { background: #ffe7e8; color: #b43338; }
.search-item-icon.grade-Ssoft { background: #fbe0f1; color: #a32b73; }
.search-item-icon.grade-A { background: #fff0d5; color: #9c640e; }
.search-item-icon.grade-B { background: #e4f1ff; color: #145a9e; }
.grade-legend { gap: 10px; }
.grade-dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.grade-dot.grade-S { background: #e5484d; }
.grade-dot.grade-Ssoft { background: #d946a6; }
.grade-dot.grade-A { background: #f0a23a; }
.grade-dot.grade-B { background: #2f8de4; }
.legend-size {
  width: 10px; height: 10px; display: inline-block; border-radius: 50%;
  border: 1.5px solid #6f9bb8; box-shadow: 0 0 0 2px rgba(79, 140, 177, .07);
}
.empty-list { padding: 22px 10px; color: #8b9fad; font-size: 10px; text-align: center; }
.store-pin-wrap { border: 0 !important; background: transparent !important; }
.store-pin {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  color: #fff; font-size: 11px; font-weight: 800; border: 2px solid rgba(255,255,255,.94);
  box-shadow: 0 6px 17px rgba(18, 54, 83, .25);
}
.store-pin.brand-red { background: linear-gradient(145deg, #158fff, #075bb8); }
.store-pin.brand-juran { background: linear-gradient(145deg, #28b47e, #187a52); }
.store-pin.brand-jd { background: linear-gradient(145deg, #f05b60, #b52f36); }
.store-pin.is-selected { box-shadow: 0 0 0 4px rgba(10,124,255,.2), 0 7px 20px rgba(18,54,83,.3); transform: scale(1.08); }
.brand-square { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.brand-square.brand-red { background: #0a7cff; }
.brand-square.brand-juran { background: #1f9d6b; }
.brand-square.brand-jd { background: #e5484d; }
.brand-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 8px 4px;
  color: #6b8294; font-family: var(--mono); font-size: 8px; letter-spacing: .06em;
  border-bottom: 1px dashed rgba(54,123,164,.14);
}
.brand-head b { color: #34556d; font-weight: 650; }
.store-row {
  display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 8px; align-items: center;
  width: 100%; padding: 9px 8px; border-radius: 9px; text-align: left;
}
.store-row + .store-row { border-top: 1px solid rgba(22,77,120,.05); }
.store-row:hover { background: #eef8ff; }
.store-brand-chip {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  color: #fff; font-size: 9px; font-weight: 700;
}
.store-brand-chip.brand-red { background: #0a7cff; }
.store-brand-chip.brand-juran { background: #1f9d6b; }
.store-brand-chip.brand-jd { background: #e5484d; }
.store-row-main strong { display: block; font-size: 10.5px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-row-main em { display: block; margin-top: 2px; color: #8a9dac; font-size: 8.5px; font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-row-meta { display: flex; align-items: center; gap: 6px; color: #6a8294; font-family: var(--mono); font-size: 8.5px; white-space: nowrap; }
.store-row-meta b { color: #34556d; }
.grade-legend { gap: 7px; font-size: 8px; }

.ring-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 8px 5px; margin-top: 2px;
  color: #47728e; font-family: var(--mono); font-size: 8px; letter-spacing: .06em;
  border-bottom: 1px dashed rgba(54, 123, 164, .14);
}
.ring-head em { color: #91a6b5; font-style: normal; font-size: 8px; }
.ring-label-wrap { border: 0 !important; background: transparent !important; }
.ring-label {
  display: inline-block; padding: 3px 7px; border-radius: 99px;
  background: rgba(255, 255, 255, .9); border: 1px solid rgba(47, 126, 173, .3);
  color: #2f7fae; font-family: var(--mono); font-size: 8.5px; font-weight: 650;
  box-shadow: 0 3px 10px rgba(29, 94, 136, .1); white-space: nowrap;
}
.detail-grid .cell:last-child:nth-child(3n+1) { grid-column: span 1; }


.panel-foot {
  display: flex; align-items: center; gap: 7px; padding: 10px 20px 13px; border-top: 1px solid rgba(20, 74, 118, .07);
  color: #8b9ba9; font-size: 8.5px; line-height: 1.35;
}
.source-dot { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: var(--green); }
.text-btn { margin-left: auto; color: var(--blue-deep); font-size: 9px; font-weight: 600; white-space: nowrap; }

/* ---------- map ---------- */
.map-wrap { position: absolute; inset: 0; }
#map {
  position: absolute; inset: 0; z-index: 0; background: #dcecf8; font-family: var(--sans);
}
.leaflet-tile-pane { filter: saturate(.46) brightness(1.08) contrast(.9); }
.leaflet-control-attribution {
  padding: 4px 8px !important; color: #7790a1 !important; background: rgba(255, 255, 255, .74) !important;
  font-size: 8px !important; border-radius: 5px 0 0 0;
}
.leaflet-control-attribution a { color: #5c7e96 !important; }
.leaflet-control-zoom {
  margin: 0 18px 150px 0 !important; border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden;
}
.leaflet-control-zoom a {
  width: 33px !important; height: 33px !important; line-height: 33px !important;
  background: rgba(255, 255, 255, .93) !important; color: #43627a !important;
  border-color: rgba(20, 74, 118, .07) !important; font-size: 17px !important;
}
.leaflet-control-zoom a:hover { background: #f2faff !important; color: var(--blue-deep) !important; }
.leaflet-container { font-family: var(--sans); }
.leaflet-tooltip {
  padding: 6px 9px; border: 0; border-radius: 8px; background: rgba(13, 39, 64, .92);
  color: #fff; box-shadow: 0 7px 24px rgba(8, 31, 53, .2); font-size: 10px; letter-spacing: .01em;
}
.leaflet-tooltip:before { border-top-color: rgba(13, 39, 64, .92) !important; }
.leaflet-tooltip b { font-weight: 650; }
.leaflet-tooltip em { display: block; margin-top: 2px; color: rgba(255,255,255,.64); font-style: normal; font-size: 8.5px; }

/* custom pins */
.mx-pin { border: 0 !important; background: transparent !important; }
.pin { position: relative; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 9px; color: #fff; font-size: 10px; font-weight: 760; box-shadow: 0 7px 18px rgba(13, 57, 95, .25); }
.pin:after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 7px; height: 7px; transform: translateX(-50%) rotate(45deg); background: inherit; border-radius: 0 0 2px 0; }
.pin-store { background: linear-gradient(145deg, #0a8dff, #0565ca); border: 2px solid rgba(255,255,255,.8); }
.pin-mall { width: 31px; height: 31px; border-radius: 50%; background: linear-gradient(145deg, #ff9b36, #ec6c1f); border: 2px solid #fff; font-size: 12px; }
.pin-target { width: 23px; height: 23px; border-radius: 50%; background: #fff; color: #a96b0f; border: 2px solid #f0a23a; font-size: 8px; letter-spacing: -.02em; }
.pin-target:after { background: #f0a23a; bottom: -3px; width: 6px; height: 6px; }
.pin-label {
  position: absolute; top: 34px; left: 50%; transform: translateX(-50%); padding: 3px 6px;
  background: rgba(255,255,255,.9); border: 1px solid rgba(18, 67, 108, .08);
  border-radius: 5px; color: #2d526c; font-size: 8.5px; white-space: nowrap; box-shadow: 0 3px 10px rgba(16, 59, 94, .1);
}

/* ---------- map overlays ---------- */
.search-box {
  position: absolute; top: 86px; left: 382px; width: min(430px, calc(100vw - 780px)); min-width: 280px;
  z-index: 1080;
}
.search-field {
  height: 43px; display: flex; align-items: center; gap: 9px; padding: 0 10px 0 13px;
  background: rgba(255, 255, 255, .93); border: 1px solid rgba(255, 255, 255, .88);
  border-radius: 13px; box-shadow: 0 12px 32px rgba(18, 68, 108, .12); color: #698196;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-field input::placeholder { color: #8fa2b2; }
.search-field kbd { padding: 2px 5px; border: 1px solid rgba(20, 74, 118, .1); border-radius: 5px; background: #f3f9ff; color: #8ea2b2; font-family: var(--mono); font-size: 8px; }
.search-results {
  margin-top: 7px; max-height: 340px; overflow-y: auto; padding: 5px;
  background: rgba(255, 255, 255, .97); border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 14px; box-shadow: var(--shadow);
}
.search-item {
  width: 100%; display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 9px; border-radius: 9px; text-align: left;
}
.search-item:hover { background: #eff8ff; }
.search-item-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: #e6f4ff; color: var(--blue-deep); font-size: 9px; font-weight: 700; }
.search-item-icon.is-store { background: #e9f1ff; color: #1459aa; }
.search-item-main { min-width: 0; }
.search-item-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.search-item-main em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8b9caa; font-size: 8.5px; font-style: normal; margin-top: 2px; }
.search-item-meta { color: #7c92a3; font-family: var(--mono); font-size: 8.5px; }
.search-empty { padding: 13px; color: #8c9eac; font-size: 10px; text-align: center; }

.map-actions { position: absolute; top: 86px; right: 18px; z-index: 1050; display: flex; gap: 6px; }
.map-actions button {
  height: 31px; padding: 0 11px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .85); color: #567188; box-shadow: 0 5px 16px rgba(20, 67, 104, .1);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  font-size: 9.5px; font-weight: 560; transition: .2s ease;
}
.map-actions button:hover { color: var(--blue-deep); background: #fff; }
.map-actions button.is-active { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(10, 124, 255, .26); }

.legend {
  position: absolute; left: 382px; bottom: 19px; z-index: 900; display: flex; flex-wrap: wrap; gap: 12px;
  padding: 8px 11px; color: #667f91; background: rgba(255, 255, 255, .8); border: 1px solid rgba(255,255,255,.8);
  border-radius: 8px; font-size: 8.5px; box-shadow: 0 5px 18px rgba(20, 67, 104, .08);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-community { background: #8bc6f1; box-shadow: 0 0 0 2px rgba(139,198,241,.21); }
.dot-target { background: var(--amber); box-shadow: 0 0 0 2px rgba(240,162,58,.18); }
.dot-store { background: var(--blue); }
.legend-ring { width: 9px; height: 9px; border: 1px solid rgba(10,124,255,.5); border-radius: 50%; background: rgba(10,124,255,.06); }

.map-note {
  position: absolute; top: 138px; left: 382px; z-index: 800; color: rgba(69, 103, 126, .68);
  font-family: var(--mono); font-size: 8px; letter-spacing: .02em; pointer-events: none;
}

/* ---------- detail ---------- */
.detail-card {
  position: absolute; right: 18px; bottom: 18px; width: 330px; z-index: 1000;
  max-height: calc(100vh - 120px); overflow-y: auto;
  padding: 18px 18px 15px; background: rgba(255, 255, 255, .94); border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 19px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  transform: translateY(14px); opacity: 0; pointer-events: none; transition: opacity .22s ease, transform .22s ease;
}
.detail-card.is-open { opacity: 1; transform: none; pointer-events: auto; }
.detail-close { position: absolute; top: 11px; right: 11px; width: 24px; height: 24px; border-radius: 50%; color: #7990a1; background: #f1f8fe; font-size: 16px; line-height: 1; }
.detail-eyebrow { color: var(--blue-deep); font-family: var(--mono); font-size: 8.5px; letter-spacing: .11em; text-transform: uppercase; padding-right: 22px; }
.detail-card h2 { margin: 7px 25px 4px 0; font-size: 20px; letter-spacing: -.045em; line-height: 1.15; font-weight: 710; }
.detail-address { margin: 0; color: #7a8f9f; font-size: 9.5px; line-height: 1.5; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 13px; }
.detail-grid .cell { min-width: 0; padding: 8px 7px; border-radius: 8px; background: #f4faff; border: 1px solid rgba(20, 74, 118, .05); }
.detail-grid .cell span { display: block; color: #8699a8; font-size: 8px; }
.detail-grid .cell b { display: block; margin-top: 3px; color: #34556d; font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-box { margin-top: 9px; padding: 9px 10px; border-radius: 9px; background: #fff8ea; border: 1px solid rgba(240, 162, 58, .16); color: #7f5e2b; font-size: 9px; line-height: 1.5; }
.target-box b { color: #a5650b; }
.target-box .target-grade { display: inline-block; margin-bottom: 3px; padding: 2px 6px; border-radius: 4px; background: #ffedce; color: #99610b; font-size: 8px; font-weight: 650; }
.detail-actions { display: flex; gap: 6px; margin-top: 12px; }
.primary-btn, .ghost-btn { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 9.5px; font-weight: 600; }
.primary-btn { flex: 1; color: #fff; background: var(--blue); box-shadow: 0 5px 14px rgba(10,124,255,.2); }
.primary-btn:hover { background: #006fe8; }
.ghost-btn { color: #53718a; background: #eef7ff; }
.ghost-btn:hover { color: var(--blue-deep); background: #e2f1ff; }

/* ---------- modal / toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 18px;
  background: rgba(12, 38, 60, .3); opacity: 0; visibility: hidden; transition: .22s ease;
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
}
.modal-backdrop.is-open { opacity: 1; visibility: visible; }
.modal {
  position: relative; width: min(540px, 100%); max-height: 86vh; overflow: auto; padding: 26px;
  background: #fff; border-radius: 20px; box-shadow: 0 32px 100px rgba(10, 37, 61, .3);
}
.modal-close { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 50%; color: #70899a; background: #f2f8fe; font-size: 18px; }
.modal h2 { margin: 10px 0 14px; font-size: 24px; letter-spacing: -.045em; }
.modal-copy p { margin: 0 0 10px; color: #5f7688; font-size: 11px; line-height: 1.7; }
.modal-copy b { color: var(--ink); }
.modal-ok { width: 100%; margin-top: 8px; height: 38px; }
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 3000; transform: translate(-50%, 10px);
  padding: 10px 15px; border-radius: 10px; background: rgba(13, 39, 64, .92); color: #fff;
  font-size: 10.5px; opacity: 0; pointer-events: none; transition: .22s ease;
  box-shadow: 0 12px 36px rgba(10, 35, 60, .2);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .panel { width: 312px; }
  .search-box { left: 348px; width: min(400px, calc(100vw - 720px)); }
  .legend, .map-note { left: 348px; }
  .panel h1 { font-size: 28px; }
}
@media (max-width: 1060px) {
  .topbar { gap: 12px; padding: 0 16px; }
  .page-title { display: none; }
  .panel { width: 300px; left: 12px; top: 82px; bottom: 12px; }
  .search-box { left: 324px; top: 80px; width: min(380px, calc(100vw - 660px)); }
  .legend, .map-note { left: 324px; }
  .map-actions { top: 80px; right: 12px; }
  .detail-card { right: 12px; bottom: 12px; }
}
@media (max-width: 820px) {
  .topbar { height: 64px; padding: 0 12px; }
  .brand img { height: 27px; }
  .top-divider, .page-title, .count-pill:nth-of-type(2) { display: none; }
  .top-actions { gap: 5px; }
  .panel {
    top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; height: 41vh;
    border-radius: 18px;
  }
  .panel-head { padding: 13px 14px 0; }
  .panel h1 { font-size: 22px; margin: 5px 0 4px; }
  .panel-lede { display: none; }
  .stats { padding: 10px 14px 8px; }
  .stat { padding: 7px 8px; }
  .stat b { font-size: 16px; }
  .stat span { font-size: 7.5px; }
  .segmented { margin: 0 14px 5px; }
  .list-head { margin: 0 14px; padding: 5px 0; }
  .list { padding: 2px 5px 5px; }
  .row { padding: 8px 8px; }
  .panel-foot { display: none; }
  .search-box { top: 76px; left: 12px; right: 12px; width: auto; min-width: 0; }
  .map-actions { top: 126px; right: 12px; }
  .map-actions button { height: 28px; padding: 0 9px; font-size: 8.5px; }
  .legend { display: none; }
  .map-note { top: 158px; left: 12px; font-size: 7px; }
  .detail-card { left: 12px; right: 12px; bottom: calc(41vh + 20px); width: auto; max-height: 34vh; overflow: auto; }
  .leaflet-control-zoom { margin-bottom: calc(41vh + 25px) !important; margin-right: 12px !important; }
  .leaflet-control-attribution { display: none; }
}
@media (max-width: 480px) {
  .count-pill { display: none; }
  .panel { height: 43vh; }
  .stat span { font-size: 7px; }
  .search-field kbd { display: none; }
  .search-field { height: 40px; }
}
