:root {
  --food: #c81e4a;
  --hotel: #2563eb;
  --other: #8b5cf6;
  --ink: #172033;
  --muted: #64748b;
  --line: #d8e2ee;
  --panel: rgba(255, 255, 255, 0.94);
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #eef4f8;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  min-height: 100vh;
  overflow: hidden;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 100vh;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.top-panel,
.search-panel,
.category-tabs,
.detail-card {
  position: absolute;
  z-index: 500;
}

.top-panel {
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.top-panel > *,
.summary-chips span {
  pointer-events: auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.15;
  text-shadow: 0 1px 0 #fff;
}

.summary-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary-chips span,
.chip-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  font-size: 13px;
  font-weight: 800;
}

.chip-button {
  border-radius: 999px;
  color: #0f766e;
  cursor: pointer;
}

.filter-toggle {
  display: none;
}

.search-panel {
  top: 88px;
  left: 18px;
  display: grid;
  grid-template-columns: minmax(250px, 380px) 170px;
  gap: 10px;
}

.search-box,
.sort-box {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(216, 226, 238, 0.9);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search-box span,
.sort-box span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.search-box input,
.sort-box select {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  font-weight: 700;
}

.category-tabs {
  top: 166px;
  left: 18px;
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(216, 226, 238, 0.9);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.tab {
  min-width: 72px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  color: #475569;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.tab.is-active {
  color: #fff;
  background: #0f766e;
}

.detail-card {
  left: 18px;
  bottom: 18px;
  width: min(520px, calc(100% - 36px));
  max-height: 42vh;
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(216, 226, 238, 0.95);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #475569;
  background: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.detail-card.is-empty {
  color: var(--muted);
}

.empty-text {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.detail-top h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.food,
.marker-pin.food {
  background: var(--food);
}

.badge.hotel,
.marker-pin.hotel {
  background: var(--hotel);
}

.badge.other,
.marker-pin.other {
  background: var(--other);
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.meta-item {
  padding: 9px 10px;
  border-radius: 8px;
  background: #f7fafc;
  border: 1px solid #e7eef6;
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.meta-item strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.4;
}

.detail-summary {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.primary-link {
  color: #fff;
  background: #0f766e;
}

.secondary-link {
  color: #0f766e;
  background: #e8f6f3;
}

.list-panel {
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #f8fbfd;
  box-shadow: -12px 0 34px rgba(15, 23, 42, 0.08);
}

.list-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 20px 12px;
}

.list-heading h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.ghost-button {
  align-self: start;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #0f766e;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.list-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.list-toggle {
  display: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 20px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.list-status {
  margin: 0 12px 12px;
  padding: 10px 12px;
  border: 1px solid #dce7f2;
  border-radius: 8px;
  background: #fff;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.status-row strong {
  margin-right: 2px;
  color: #0f766e;
}

.status-row span {
  color: #475569;
  font-weight: 800;
}

.list-status p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 999px;
}

.dot.food {
  background: var(--food);
}

.dot.hotel {
  background: var(--hotel);
}

.dot.other {
  background: var(--other);
}

.store-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 18px;
}

.store-item {
  width: 100%;
  margin: 0 0 8px;
  border: 1px solid #e2ebf4;
  border-radius: 8px;
  color: inherit;
  background: #fff;
  overflow: hidden;
}

.store-item.is-active {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.store-item-top {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.store-select {
  width: 100%;
  padding: 12px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.store-number {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.store-number.food {
  background: var(--food);
}

.store-number.hotel {
  background: var(--hotel);
}

.store-number.other {
  background: var(--other);
}

.store-item h3 {
  margin: 0 0 5px;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
}

.store-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.store-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 9px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.store-card-actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px 56px;
}

.store-card-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 8px;
  color: #0f766e;
  background: #e8f6f3;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.empty-list {
  margin: 0 0 8px;
  padding: 18px;
  border: 1px dashed #cbd9e7;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.empty-list strong {
  display: block;
  margin-bottom: 6px;
}

.empty-list p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.primary-mini {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #0f766e;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.marker-pin {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 999px 999px 999px 4px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.28);
  font-size: 13px;
  font-weight: 900;
  transform: rotate(-45deg);
  transition:
    width 0.15s ease,
    height 0.15s ease,
    box-shadow 0.15s ease;
}

.marker-pin span {
  transform: rotate(45deg);
}

.marker-pin.is-selected {
  width: 44px;
  height: 44px;
  border-width: 4px;
  box-shadow:
    0 0 0 5px rgba(255, 255, 255, 0.72),
    0 12px 28px rgba(15, 23, 42, 0.36);
  font-size: 15px;
}

.store-cluster {
  background: transparent;
}

.cluster-bubble {
  --cluster-color: #0f766e;
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 4px solid var(--cluster-color);
  border-radius: 999px;
  color: var(--cluster-color);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.94)),
    #fff;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.86),
    0 10px 24px rgba(15, 23, 42, 0.26);
  font-size: 14px;
  font-weight: 900;
}

.cluster-bubble span {
  position: relative;
  z-index: 2;
}

.cluster-bubble.food {
  --cluster-color: var(--food);
}

.cluster-bubble.hotel {
  --cluster-color: var(--hotel);
}

.cluster-bubble.other {
  --cluster-color: var(--other);
}

.cluster-bubble.mixed {
  --cluster-color: #0f766e;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.popup-title {
  margin: 0 0 4px;
  font-weight: 900;
}

.popup-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .map-stage {
    min-height: 100vh;
  }

  .list-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 700;
    height: 68px;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    transition: height 0.18s ease;
  }

  .app-shell.list-open .list-panel {
    height: 45vh;
  }

  .app-shell.list-collapsed .list-heading {
    align-items: center;
    padding: 8px 10px;
  }

  .app-shell.list-collapsed .eyebrow {
    display: none;
  }

  .app-shell.list-collapsed .list-heading h2 {
    font-size: 17px;
    line-height: 1.1;
  }

  .app-shell.list-collapsed .list-actions {
    gap: 6px;
  }

  .app-shell.list-collapsed .ghost-button {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .app-shell.list-collapsed .legend,
  .app-shell.list-collapsed .list-status,
  .app-shell.list-collapsed .store-list {
    display: none;
  }

  .app-shell.filters-collapsed .filter-panel {
    display: none;
  }

  h1 {
    font-size: 21px;
  }

  .top-panel {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .summary-chips span {
    min-height: 30px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .chip-button {
    min-height: 30px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .filter-toggle,
  .list-toggle {
    display: inline-flex;
  }

  .search-panel {
    top: 66px;
    left: 10px;
    right: 10px;
    grid-template-columns: 1fr 116px;
    gap: 6px;
  }

  .search-box,
  .sort-box {
    gap: 0;
    padding: 6px 9px;
    border-radius: 7px;
  }

  .search-box span,
  .sort-box span {
    display: none;
  }

  .search-box input,
  .sort-box select {
    min-height: 26px;
    font-size: 13px;
  }

  .category-tabs {
    top: 112px;
    left: 10px;
    right: 10px;
    justify-content: space-between;
    gap: 4px;
    padding: 4px;
    border-radius: 7px;
  }

  .tab {
    min-width: 0;
    flex: 1;
    min-height: 28px;
    font-size: 12px;
  }

  .detail-card {
    left: 10px;
    right: 10px;
    bottom: 136px;
    width: auto;
    max-height: 27vh;
  }

  .app-shell.list-open .detail-card.is-open {
    bottom: calc(45vh + 10px);
    max-height: 24vh;
  }

  .detail-card.is-empty {
    display: none;
  }

  .detail-card.is-open {
    bottom: 78px;
    top: auto;
    transform: none;
  }

  .app-shell.list-open .detail-card.is-open {
    bottom: calc(45vh + 10px);
  }

  .detail-close {
    display: inline-grid;
    place-items: center;
  }

  .detail-card.is-open .detail-top {
    padding-right: 40px;
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    min-height: 100vh;
  }

  .map-stage {
    min-height: 100vh;
  }

  .top-panel {
    display: block;
  }

  h1 {
    font-size: 19px;
  }

  .summary-chips {
    justify-content: flex-start;
    margin-top: 6px;
    gap: 6px;
  }

  .summary-chips #totalCount {
    display: none;
  }

  .app-shell.list-collapsed .list-panel {
    height: 62px;
  }

  .search-panel {
    top: 88px;
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 6px;
  }

  .category-tabs {
    top: 132px;
    padding: 4px;
    border-radius: 7px;
  }

  .tab {
    min-height: 27px;
    font-size: 11px;
  }

  .detail-card {
    max-height: 34vh;
    padding: 12px;
  }

  .detail-top h3 {
    font-size: 16px;
  }

  .list-heading {
    padding: 12px 14px 10px;
  }

  .list-heading h2 {
    font-size: 19px;
  }

  .app-shell.list-collapsed .list-heading {
    padding: 7px 10px;
  }

  .app-shell.list-collapsed .list-heading h2 {
    font-size: 16px;
  }

  .app-shell.list-collapsed .ghost-button {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .app-shell.list-collapsed .detail-card.is-open {
    bottom: 72px;
  }

  .legend {
    padding: 0 14px 10px;
  }

  .list-status {
    margin: 0 12px 10px;
  }

  .store-card-actions {
    padding-left: 56px;
    flex-wrap: wrap;
  }
}
