* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f7fa;
  color: #1f2933;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.store-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid #d9e2ec;
}

.store-topbar h1 {
  margin: 0;
  font-size: 24px;
}

.store-topbar p {
  margin: 5px 0 0;
  color: #65758b;
}

.nav-link {
  color: #1769aa;
  text-decoration: none;
}

.searchbar {
  display: grid;
  grid-template-columns: 150px minmax(170px, 1fr) minmax(180px, 1.2fr) 95px 120px 120px auto auto auto;
  gap: 10px;
  padding: 12px 24px;
  background: #ffffff;
  border-bottom: 1px solid #d9e2ec;
}

.searchbar label {
  display: grid;
  gap: 5px;
  color: #52616f;
  font-size: 13px;
}

.searchbar input,
.searchbar select {
  height: 36px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid #c9d3df;
  border-radius: 6px;
  background: #ffffff;
  font-size: 14px;
}

button {
  align-self: end;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: #1769aa;
  color: #ffffff;
  cursor: pointer;
}

button:hover {
  background: #125482;
}

button:disabled {
  background: #b7c6d8;
  cursor: default;
}

.store-workspace {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 360px;
  gap: 16px;
  height: calc(100vh - 142px);
  padding: 16px;
}

.map-panel,
.store-list-panel {
  min-height: 0;
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
}

.map-panel {
  position: relative;
  overflow: hidden;
}

.map-toolbar {
  position: absolute;
  z-index: 10;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d9e2ec;
  border-radius: 8px;
}

.map-toolbar button {
  width: 34px;
  padding: 0;
}

.map-toolbar span {
  min-width: 54px;
  color: #425466;
  text-align: center;
}

.map-canvas {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #e8f1f2;
}

.map-canvas.leaflet-map {
  background: #dbe7ef;
}

.map-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(23, 105, 170, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 105, 170, 0.12) 1px, transparent 1px);
  background-size: 54px 54px;
}

.map-layer {
  position: absolute;
  inset: 0;
  transform-origin: center center;
}

.center-pin,
.store-pin {
  position: absolute;
  transform: translate(-50%, -100%);
}

.center-pin {
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #d92d20;
  box-shadow: 0 2px 10px rgba(31, 41, 51, 0.3);
}

.store-pin {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 2px solid #ffffff;
  border-radius: 18px 18px 18px 4px;
  background: #1769aa;
  color: #ffffff;
  font-size: 13px;
  line-height: 28px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(31, 41, 51, 0.24);
  cursor: pointer;
}

.store-pin.active {
  background: #b54708;
}

.leaflet-store-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid #ffffff;
  border-radius: 18px 18px 18px 4px;
  background: #1769aa;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 12px rgba(31, 41, 51, 0.24);
}

.leaflet-store-pin.active {
  background: #b54708;
}

.leaflet-current-pin {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #d92d20;
  box-shadow: 0 4px 14px rgba(31, 41, 51, 0.32);
}

.leaflet-current-pin span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
}

.leaflet-container {
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.store-list-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.store-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid #e5eaf0;
}

.store-list-head h2 {
  margin: 0;
  font-size: 18px;
}

.store-list-head span {
  color: #65758b;
  font-size: 14px;
}

.state {
  padding: 18px;
  color: #65758b;
}

.error {
  color: #b42318;
  background: #fff1f0;
}

.store-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.store-card {
  width: 100%;
  height: auto;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid #e5eaf0;
  border-radius: 0;
  background: #ffffff;
  color: inherit;
  text-align: left;
}

.store-card:hover,
.store-card.active {
  background: #eef6fb;
}

.store-card strong {
  display: block;
  margin-bottom: 8px;
  line-height: 1.45;
}

.store-card p {
  margin: 5px 0;
  color: #52616f;
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #edf1f5;
  color: #425466;
  font-size: 12px;
}

.store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.store-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #b7c6d8;
  border-radius: 6px;
  background: #ffffff;
  color: #1769aa;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.store-action:hover {
  background: #eef6fb;
}

.store-action.disabled {
  border-color: #d9e2ec;
  color: #8a97a6;
}

.store-products {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.store-product {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  background: #f8fafc;
  color: inherit;
  text-decoration: none;
}

.store-product:hover {
  border-color: #b7c6d8;
  background: #eef6fb;
}

.store-product img {
  width: 58px;
  height: 58px;
  border-radius: 6px;
  background: #edf1f5;
  object-fit: cover;
}

.store-product-body {
  min-width: 0;
}

.store-product-body strong {
  display: -webkit-box;
  margin: 0 0 7px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.35;
}

.store-product-body b {
  margin-right: 8px;
  color: #b54708;
}

.store-product-body del {
  color: #8a97a6;
  font-size: 12px;
}

.products-toggle {
  width: 100%;
  height: 32px;
  border: 1px solid #b7c6d8;
  background: #ffffff;
  color: #1769aa;
  font-size: 13px;
}

.products-toggle:hover {
  background: #eef6fb;
}

.route-dialog {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.45);
}

.route-dialog[hidden] {
  display: none;
}

.route-card {
  width: min(520px, 100%);
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

.route-head,
.route-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5eaf0;
}

.route-head h2 {
  margin: 0;
  font-size: 18px;
}

#routeCloseButton {
  width: 34px;
  padding: 0;
  background: #edf1f5;
  color: #425466;
}

.route-content {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.route-line {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  background: #f8fafc;
}

.route-line span,
.route-summary span {
  color: #65758b;
  font-size: 12px;
}

.route-line small {
  color: #52616f;
  line-height: 1.45;
}

.route-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.route-summary div {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-radius: 8px;
  background: #eef6fb;
}

.route-note {
  margin: 0;
  color: #65758b;
  line-height: 1.55;
}

.route-steps {
  display: grid;
  gap: 8px;
  max-height: 220px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.route-steps li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 9px;
  align-items: start;
}

.route-steps li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1769aa;
  color: #ffffff;
  font-size: 12px;
}

.route-steps p {
  margin: 0;
  line-height: 1.45;
}

.route-steps small {
  display: block;
  margin-top: 3px;
  color: #65758b;
}

.route-actions {
  justify-content: flex-end;
  border-top: 1px solid #e5eaf0;
  border-bottom: 0;
}

@media (max-width: 980px) {
  .store-topbar,
  .store-workspace {
    display: block;
  }

  .searchbar {
    grid-template-columns: 1fr 1fr;
  }

  .store-workspace {
    height: auto;
    padding: 12px;
  }

  .map-panel {
    height: 56vh;
    margin-bottom: 12px;
  }

  .store-list-panel {
    height: auto;
    max-height: none;
  }
}

@media (max-width: 620px) {
  .searchbar {
    grid-template-columns: 1fr;
  }
}
