/* Trang bản đồ: toàn bộ thành phần nằm gọn trong một khung nhìn, các cột tự cuộn nội bộ. */
.map-page {
  --map-max: none;
  --map-gutter: clamp(6px, 0.7vw, 12px);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 72px);
  height: calc(100dvh - 72px);
  min-height: 560px;
  overflow: hidden;
}

/* ---- Banner ---- */
.map-page .map-hero {
  flex: none;
  min-height: 0;
  padding: clamp(10px, 2vh, 20px) var(--map-gutter) clamp(30px, 4.5vh, 44px);
  background-position: center 48%;
}
.map-page .map-hero .hero-inner {
  max-width: var(--map-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
}
.map-hero-text {
  min-width: 0;
  flex: 1 1 520px;
}
.map-page .map-hero h1 {
  font-size: clamp(26px, 3.4vw, 40px);
  margin: 0;
  line-height: 1.2;
}
.map-page .hero-subtitle {
  margin: 2px 0 clamp(6px, 1.2vh, 12px);
  font-size: clamp(12px, 1.1vw, 15px);
}
.map-page .hero-search {
  width: min(600px, 100%);
  max-width: 100%;
  height: 44px;
  margin: 0;
  border-radius: 18px;
  padding: 4px 5px 4px 16px;
  gap: 10px;
}
.map-page .hero-search input {
  padding: 6px 0;
  margin: 0;
}
.map-page .hero-search .btn {
  min-width: 110px;
  height: 34px;
  border-radius: 24px;
  background: #416e59;
  padding: 6px 16px;
}
.map-categories {
  display: flex;
  gap: clamp(8px, 1.4vw, 24px);
  flex: 0 1 auto;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 4px 4px;
  scrollbar-width: none;
}
.map-categories::-webkit-scrollbar {
  display: none;
}
.map-categories button {
  flex: 0 0 auto;
  min-width: 70px;
  max-width: 110px;
  padding: 0;
  color: #fff;
  text-align: center;
}
.map-categories button > span {
  display: grid;
  place-items: center;
  margin: 0 auto 4px;
  width: 44px;
  height: 44px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f6fbfbea;
  color: var(--category-color);
}
.map-categories strong {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.map-category-glyph {
  width: 24px;
  height: 24px;
}
.map-categories button.active > span {
  background: var(--teal);
  box-shadow: 0 0 0 4px #ffffff30;
}
.map-categories button.active .map-category-glyph {
  background: #fff;
}

/* ---- Khung 3 cột ---- */
.map-page .map-layout {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  max-width: var(--map-max);
  margin: calc(-1 * clamp(22px, 3.4vh, 34px)) auto 0;
  padding: 0 var(--map-gutter) var(--map-gutter);
  display: grid;
  grid-template-columns: clamp(270px, 22vw, 380px) minmax(0, 1fr) clamp(
      210px,
      15.5vw,
      270px
    );
  gap: 12px;
  position: relative;
}
.map-page .map-layout > * {
  min-height: 0;
  min-width: 0;
}
.map-page .map-list,
.map-page .layers-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.map-page .map-list {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}
.map-page .map-list .tabs {
  flex: none;
  gap: 0;
  background: #f6f7f9;
  border-radius: 8px;
  margin-bottom: 0;
}
.map-page .map-list .tabs button {
  flex: 1;
  padding: 9px 6px;
  font-size: 12px;
  white-space: nowrap;
}
.map-tab-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.map-tab-body[hidden] {
  display: none;
}
.map-list-toolbar {
  display: flex;
  gap: 8px;
  margin: 10px 0 0;
}
.map-list-toolbar select {
  flex: 1;
  margin: 0;
  padding: 7px 10px;
  font-size: 12px;
}
.map-list-toolbar .btn {
  flex: none;
  background: #fff;
  color: var(--ink);
}
#map-filter-panel {
  margin-top: 8px;
}
#map-filter-panel select {
  margin: 0;
  width: 100%;
}
.map-place-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}
.map-place {
  position: relative;
  display: block;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.map-place[hidden] {
  display: none;
}
.map-place-open {
  display: flex;
  text-align: left;
  gap: 12px;
  padding: 0 18px 0 0;
  width: 100%;
}
.map-place-open > img {
  width: clamp(80px, 7vw, 120px);
  height: clamp(62px, 8.5vh, 96px);
  border-radius: 7px;
  object-fit: cover;
  flex: none;
}
.map-place-open > span {
  flex: 1;
  min-width: 0;
}
.map-place strong {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  margin: 0 0 4px;
}
.map-place .tag {
  display: inline-block;
  background: #d8efe3;
  border-radius: 4px;
  color: #185b47;
  padding: 2px 6px;
  font-size: 10px;
}
.map-place small {
  display: block;
  font-size: 10px;
  line-height: 1.5;
  margin-top: 4px;
  color: var(--muted);
}
.map-row-meta {
  display: flex;
  justify-content: space-between;
  gap: 3px;
}
.map-favorite {
  position: absolute;
  right: 0;
  top: 8px;
  padding: 4px;
  background: #fff;
}
.map-favorite .icon {
  width: 16px;
  height: 16px;
}
.map-favorite[aria-pressed="true"] {
  background: #ffe0e4;
  border-radius: 50%;
}
.map-page .pagination {
  flex: none;
  margin: 10px 0 2px;
  gap: 6px;
}
.map-page .pagination button {
  width: 28px;
  height: 29px;
  padding: 0;
  font-size: 11px;
}
.map-page #map-list-count {
  flex: none;
  font-size: 10px;
  text-align: center;
}

/* ---- Tour gợi ý ---- */
#tour-list {
  padding-top: 10px;
  overflow-y: auto;
  min-height: 0;
}
.map-tour {
  display: flex;
  gap: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0 0 10px;
  padding: 8px;
  width: 100%;
  background: #fff;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.map-tour:hover {
  border-color: var(--teal);
  box-shadow: 0 3px 12px #0a4a4214;
}
.map-tour > img {
  width: 92px;
  height: 72px;
  border-radius: 7px;
  object-fit: cover;
  flex: none;
}
.map-tour-body {
  min-width: 0;
  flex: 1;
}
.map-tour strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.4;
  margin-bottom: 6px;
}
.tour-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 10.5px;
  color: var(--muted);
}
.tour-chips > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tour-chips > span:empty {
  display: none;
}
.tour-chips .icon {
  width: 12px;
  height: 12px;
}
#tour-detail {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-top: 10px;
  scrollbar-width: thin;
}
#tour-detail[hidden],
#tour-list[hidden] {
  display: none;
}
.tour-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--teal);
  padding: 0;
  margin-bottom: 8px;
}
.tour-back .icon {
  width: 14px;
  height: 14px;
}
.tour-cover {
  width: 100%;
  height: clamp(90px, 15vh, 150px);
  object-fit: cover;
  border-radius: 10px;
}
.tour-title {
  font-size: 15px;
  line-height: 1.4;
  margin: 10px 0 6px;
}
.tour-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0;
}
.tour-stats > div {
  background: #f1f7f6;
  border-radius: 8px;
  padding: 7px 4px;
  text-align: center;
}
.tour-stats b {
  display: block;
  font-size: 13px;
  color: var(--teal);
}
.tour-stats small {
  font-size: 9.5px;
  color: var(--muted);
}
.tour-desc {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin: 6px 0 10px;
}
.tour-stops {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.tour-stop {
  position: relative;
  padding-left: 0;
}
.tour-stop > button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 6px 4px;
  border-radius: 8px;
}
.tour-stop > button:hover {
  background: #f1f7f6;
}
.stop-no {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px var(--teal);
}
.tour-stop img {
  width: 46px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  flex: none;
}
.tour-stop span.stop-text {
  min-width: 0;
}
.tour-stop strong {
  display: block;
  font-size: 11.5px;
  line-height: 1.35;
}
.tour-stop small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}
.tour-leg {
  margin: 0 0 0 17px;
  padding: 3px 0 3px 22px;
  border-left: 2px dashed #9cc4bd;
  font-size: 10.5px;
  color: #3d6f67;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tour-leg .icon {
  width: 12px;
  height: 12px;
}
.tour-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.tour-actions .btn {
  flex: 1;
  font-size: 11px;
  padding: 8px 6px;
}
.tour-loading {
  font-size: 11px;
  color: var(--muted);
  padding: 14px 4px;
}

#itinerary-summary {
  display: block;
  font-size: 11px;
  margin: 6px 0 10px;
}

/* ---- Cột giữa ---- */
.map-center {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-canvas-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
  border: 6px solid #fff;
  border-radius: 14px;
  overflow: hidden;
  background: #e2ebdd;
  box-shadow: var(--shadow);
}
.map-page .main-map {
  position: absolute;
  inset: 0;
  height: 100%;
  border-radius: 8px;
}
.map-floating-tools {
  position: absolute;
  left: 10px;
  top: 112px;
  display: grid;
  gap: 8px;
  z-index: 2;
}
.map-floating-tools .icon-btn {
  background: #fff;
  box-shadow: 0 1px 7px #0002;
  width: 33px;
  height: 35px;
  border-radius: 6px;
}
.map-floating-tools .icon-btn[aria-pressed="true"] {
  background: var(--teal);
}
.map-floating-tools .icon-btn[aria-pressed="true"] .icon {
  filter: brightness(0) invert(1);
}

/* ---- Cột lớp bản đồ ---- */
.map-page .layers-panel {
  padding: 12px 14px;
}
.map-page .layers-panel > h3 {
  font-size: 13px;
  margin: 0 0 4px;
}
.map-page .layers-panel > h3:not(:first-child) {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}
.map-page .switch-row {
  margin: 7px 0;
  font-size: 11px;
  gap: 8px;
  line-height: 1.3;
}
.layer-symbol {
  width: 22px;
  height: 22px;
}
.map-page .basemap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.map-page .basemap-grid button {
  padding: 0;
  border: 0;
  background: none;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.map-page .basemap-grid img {
  height: clamp(32px, 5vh, 49px);
  width: 100%;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 7px;
}
.map-page .basemap-grid .active img {
  border-color: var(--teal);
}
.map-page .map-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 4px;
}
.map-page .map-tools button {
  border: 0;
  padding: 2px 0;
  gap: 3px;
  font-size: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.25;
  text-align: center;
}
.map-page .map-tools button.active > .icon {
  background: #d6eee7;
}
.map-page .weather-box {
  padding: 8px;
  font-size: 11px;
  line-height: 1.5;
}
.map-page .weather-box strong {
  font-size: 22px;
}

/* ---- Marker đánh số điểm dừng của tour ---- */
.tour-marker {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid #fff;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px #0006;
  cursor: pointer;
  z-index: 3;
}
.tour-marker.is-start {
  background: #2e7d32;
}
.tour-marker.is-end {
  background: #c62828;
}

/* ---- Màn hình trung bình: 2 cột, lớp bản đồ xuống dưới ---- */
@media (max-width: 1100px) {
  .map-page {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .map-page .map-layout {
    grid-template-columns: clamp(250px, 32vw, 320px) minmax(0, 1fr);
    flex: none;
  }
  .map-page .map-list {
    height: min(78vh, 760px);
  }
  .map-page .map-center {
    height: min(78vh, 760px);
  }
  .map-page .layers-panel {
    grid-column: 1 / -1;
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px 18px;
    align-content: start;
  }
  .map-page .layers-panel > h3,
  .map-page .layers-panel > small,
  .map-page .layers-panel > .text-btn,
  .map-page .layers-panel > output,
  .map-page .layers-panel > #custom-layers,
  .map-page .layers-panel > .weather-box {
    grid-column: 1 / -1;
  }
  .map-page .layers-panel > .basemap-grid,
  .map-page .layers-panel > .map-tools {
    grid-column: span 2;
  }
  .map-page .layers-panel > h3:not(:first-child) {
    margin-top: 6px;
  }
}

/* ---- Điện thoại: 1 cột, bản đồ lên trước ---- */
@media (max-width: 760px) {
  .map-page .map-hero .hero-inner {
    gap: 6px;
  }
  .map-page .hero-search {
    height: 42px;
  }
  .map-page .hero-search .btn {
    min-width: 84px;
    font-size: 11px;
  }
  .map-categories {
    width: 100%;
  }
  .map-categories button {
    min-width: 64px;
  }
  .map-categories button > span {
    width: 38px;
    height: 38px;
  }
  .map-categories strong {
    font-size: 9.5px;
  }
  .map-page .map-layout {
    grid-template-columns: 1fr;
  }
  .map-page .map-center {
    order: -1;
    height: auto;
  }
  .map-page .map-canvas-shell {
    flex: none;
    height: 62vh;
    min-height: 340px;
  }
  .map-page .map-list {
    height: auto;
    max-height: 560px;
  }
  .map-page .layers-panel {
    grid-template-columns: 1fr 1fr;
  }
  .map-page .layers-panel > .basemap-grid,
  .map-page .layers-panel > .map-tools {
    grid-column: 1 / -1;
  }
  .map-page .basemap-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .photo-marker > strong {
    display: none;
  }
}

/* ---- Màn hình thấp (laptop 768px): nén banner và dải điểm nổi bật ---- */
@media (min-width: 1101px) and (max-height: 820px) {
  .map-categories button > span {
    width: 38px;
    height: 38px;
  }
  .map-category-glyph {
    width: 21px;
    height: 21px;
  }
  .map-categories strong {
    font-size: 10px;
  }
  .map-page .hero-search {
    height: 40px;
  }
  .map-page .hero-search .btn {
    height: 30px;
  }
}

@media print {
  .map-page {
    height: auto;
    overflow: visible;
  }
  .map-page .map-layout {
    display: block;
    margin: 0;
    padding: 0;
  }
  .map-page .map-canvas-shell {
    height: 90vh;
  }
}

.map-categories strong {
  text-shadow: 0 1px 3px #000a;
}
@media (max-width: 1500px) {
  .map-page .map-list .tabs button {
    font-size: 11px;
    padding: 9px 4px;
  }
}

@media (max-width: 760px) {
  .map-page .map-hero h1 {
    font-size: 24px;
  }
}

/* ===== Điều chỉnh đợt 3 ===== */
.map-page .map-layout {
  max-width: none;
  grid-template-columns: clamp(238px, 16.5vw, 290px) minmax(0, 1fr) clamp(
      200px,
      14vw,
      250px
    );
  gap: 10px;
}
.map-page .map-hero .hero-inner {
  max-width: none;
}
.map-page .map-list {
  overflow-x: hidden;
}
.map-page .map-list .tabs {
  min-width: 0;
}
.map-page .map-list .tabs button {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-tab-body,
.map-place-list,
#tour-list,
#tour-detail,
#directions-detail,
.map-place,
.map-tour {
  min-width: 0;
  max-width: 100%;
}
.map-place-open > span,
.map-tour-body,
.stop-text {
  overflow-wrap: anywhere;
}
.map-place-open > img {
  width: clamp(64px, 5.4vw, 92px);
}
.map-page .layers-panel {
  overflow: hidden auto;
}
.map-center {
  gap: 0;
}
.map-canvas-shell {
  min-height: 0;
}

/* ---- Thẻ thời tiết trên bản đồ ---- */
.weather-card {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 200px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #ffffffec;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px #0a2a2538;
  font-size: 11px;
  color: var(--ink);
}
.weather-card[hidden] {
  display: none;
}
.wx {
  display: inline-block;
  width: 22px;
  height: 22px;
  background: var(--wx, #7b8794);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  flex: none;
}
.wx.wx-lg {
  width: 44px;
  height: 44px;
}
.wc-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wc-head b {
  display: block;
  font-size: 24px;
  line-height: 1.1;
  color: var(--teal-dark);
}
.wc-head span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.wc-head span::first-letter {
  text-transform: uppercase;
}
.wc-metrics {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 8px 0;
  padding: 6px 0;
  border-block: 1px solid var(--line);
}
.wc-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
}
.wc-metrics .icon {
  width: 13px;
  height: 13px;
}
.wc-forecast {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  text-align: center;
}
.wc-forecast > div {
  display: grid;
  justify-items: center;
  gap: 2px;
}
.wc-forecast small {
  font-size: 9px;
  color: var(--muted);
}
.wc-forecast b {
  font-size: 11px;
}
.wc-src {
  display: block;
  margin-top: 6px;
  font-size: 9px;
  color: var(--muted);
  text-align: right;
}

/* ---- Chỉ đường từng bước ---- */
#directions-detail {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 10px;
  scrollbar-width: thin;
}
.dir-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dir-steps li {
  border-bottom: 1px solid var(--line);
}
.dir-steps button {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px 2px;
}
.dir-steps button:hover {
  background: #f1f7f6;
}
.dir-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e3f1ee;
}
.dir-icon .icon {
  width: 17px;
  height: 17px;
}
.dir-text {
  font-size: 11.5px;
  line-height: 1.4;
  min-width: 0;
}
.dir-text small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 1px;
}
.origin-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow:
    0 0 0 4px #1a73e840,
    0 2px 6px #0005;
}

/* ---- Cột phải gọn, không cuộn ---- */
.map-page .layers-panel {
  padding: 10px 12px;
}
.map-page .switch-row {
  margin: 5px 0;
}
.map-page .layers-panel > h3:not(:first-child) {
  padding-top: 8px;
  margin-top: 8px;
}
.map-page .layers-panel > small.muted {
  display: block;
  font-size: 9px;
  line-height: 1.4;
  margin-top: 6px;
}
@media (min-width: 1101px) and (max-height: 900px) {
  .map-page .basemap-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }
  .map-page .basemap-grid button {
    font-size: 8.5px;
  }
  .map-page .basemap-grid img {
    height: 28px;
  }
  .map-page .map-tools {
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
  }
  .map-page .map-tools button {
    font-size: 0;
    gap: 0;
  }
  .map-page .layers-panel > small.muted {
    display: none;
  }
  .map-page .switch-row {
    margin: 3px 0;
  }
}
@media (min-width: 1101px) and (max-height: 760px) {
  .map-page .layers-panel > h3 {
    font-size: 12px;
    margin-bottom: 2px;
  }
  .map-page .switch-row {
    margin: 2px 0;
    font-size: 10.5px;
  }
  .layer-symbol {
    width: 18px;
    height: 18px;
  }
}
@media (max-width: 760px) {
  .weather-card {
    width: 170px;
    padding: 8px 10px;
  }
}

.page-status {
  align-self: center;
  font-size: 11px;
  padding: 0 8px;
  color: var(--ink);
}
.map-page .pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ===== Điều chỉnh đợt 4 ===== */
/* Banner căn giữa cùng lề với header/các trang khác; chỉ khung bản đồ tràn rộng */
.map-page .map-hero {
  padding-left: max(5%, calc((100vw - 1536px) / 2));
  padding-right: max(5%, calc((100vw - 1536px) / 2));
}
.map-page .map-hero .hero-inner {
  max-width: 1536px;
  margin: 0 auto;
}

/* Hai panel cân đối hai bên bản đồ */
.map-page .map-layout {
  grid-template-columns: clamp(260px, 18vw, 340px) minmax(0, 1fr) clamp(
      260px,
      18vw,
      340px
    );
}
.map-place-list,
#tour-list,
#tour-detail,
#directions-detail,
.map-tab-body {
  overflow-x: hidden;
}

/* Dòng điểm đến gọn: vừa 5 điểm mỗi trang */
.map-place {
  padding: 7px 0;
}
.map-place-open > img {
  width: clamp(64px, 5vw, 84px);
  height: clamp(52px, 6.4vh, 68px);
}
.map-place strong {
  font-size: 12px;
  line-height: 1.3;
  margin: 0 0 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.map-place-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
}
.map-place-meta .map-row-meta {
  display: inline-flex;
  margin: 0;
  font-size: 10px;
}
.map-place .map-place-addr {
  margin-top: 3px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Popup điểm: mô tả ngắn + nút VR360 */
.map-popup {
  min-width: 250px;
}
.map-popup h3 {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.35;
}
.map-popup .tag {
  display: inline-block;
  background: #d8efe3;
  color: #185b47;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  margin-bottom: 6px;
}
.map-popup .popup-desc {
  margin: 4px 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: #44525a;
}
.map-popup .popup-addr {
  display: flex;
  gap: 5px;
  align-items: flex-start;
  margin: 4px 0 8px;
  font-size: 10.5px;
  color: var(--muted);
}
.map-popup .popup-addr .icon {
  width: 12px;
  height: 12px;
  margin-top: 2px;
  flex: none;
}
.map-popup .action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.map-popup .action-row .btn {
  flex: 1 1 auto;
  justify-content: center;
  text-align: center;
  font-size: 10.5px;
  padding: 7px 8px;
}
.map-popup .vr-btn {
  flex-basis: 100%;
  background: #0b6bcb;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 9px;
}
.map-popup .vr-btn .icon {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

/* Lịch trình mẫu */
.preset-title {
  margin: 14px 0 6px;
  font-size: 12px;
}
.preset-list {
  display: grid;
  gap: 6px;
}
.preset-list .preset-title {
  margin: 8px 0 2px;
}
.preset {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}
.preset:hover {
  border-color: var(--teal);
  background: #f1f7f6;
}
.preset strong {
  display: block;
  font-size: 11.5px;
  line-height: 1.35;
}
.preset small {
  color: var(--muted);
  font-size: 10px;
}

/* Công cụ: lưới 4 cột, gồm Hướng Bắc + Xóa phép đo */
.map-page .map-tools {
  grid-template-columns: repeat(4, 1fr);
}
.map-page .map-tools button {
  font-size: 9px;
  color: var(--ink);
}
#measure-output {
  display: block;
  font-size: 11px;
  color: var(--teal-dark);
  font-weight: 600;
  margin-top: 6px;
}
#measure-output:empty {
  display: none;
}
@media (min-width: 1101px) and (max-height: 900px) {
  .map-page .map-tools {
    grid-template-columns: repeat(8, 1fr);
  }
}
@media (max-width: 1100px) {
  .map-page .map-tools {
    grid-template-columns: repeat(4, 1fr);
  }
}

.map-popup > img {
  height: 92px;
}
.map-popup .popup-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mapboxgl-popup,
.maplibregl-popup {
  z-index: 6;
}
.map-page [data-map-panel="itinerary"] h3 {
  font-size: 14px;
  margin: 10px 0 4px;
}
.map-page [data-map-panel="itinerary"] p.muted {
  font-size: 11px;
  line-height: 1.5;
  margin: 0 0 8px;
}
.map-page [data-map-panel="itinerary"] input {
  font-size: 12px;
  padding: 8px 10px;
  width: 100%;
}
.map-page #itinerary-stops {
  margin: 8px 0;
  padding-left: 0;
  list-style: none;
  font-size: 12px;
}
.map-page #itinerary-stops li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  cursor: grab;
}
.map-page #itinerary-stops li button {
  font-size: 15px;
  color: var(--muted);
  padding: 0 6px;
}

/* ===== Đợt 5: căn giữa, phân trang tự động, màu sắc cho hai panel ===== */
.map-page .map-layout {
  max-width: 1680px;
  margin: calc(-1 * clamp(22px, 3.4vh, 34px)) auto 0;
  padding: 0 clamp(8px, 1vw, 16px) clamp(8px, 1vw, 14px);
  grid-template-columns: clamp(270px, 17vw, 330px) minmax(0, 1fr) clamp(
      270px,
      17vw,
      330px
    );
}

/* Danh sách phân trang: chia đều khoảng trống, không để trắng */
.pg-list {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 1px;
}
.pg-list > * {
  flex: 0 0 auto;
}
.pg-list.is-full > * {
  flex: 1 1 auto;
}
.pg-list.measuring > * {
  flex: none !important;
}
.pg-list > .is-filtered {
  display: none;
}
.tab-browser {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.tab-browser[hidden] {
  display: none;
}
.map-page .pagination {
  flex: none;
  margin: 8px 0 2px;
  justify-content: center;
}
.map-page .pagination button {
  border-radius: 8px;
  background: #e8f3ef;
  color: var(--teal-dark);
  border-color: #cfe6df;
  font-size: 14px;
  width: 30px;
  height: 28px;
}
.page-status {
  font-weight: 600;
  color: var(--teal-dark);
}

/* ---- Panel trái ---- */
.map-page .map-list {
  background: linear-gradient(180deg, #e9f7f2 0, #fff 150px);
  border: 1px solid #d5e9e2;
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 6px 22px #0f766e14;
}
.map-page .map-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #d9eee7;
}
.map-page .map-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: #35625a;
  background: transparent;
  white-space: nowrap;
  min-width: 0;
}
.map-page .map-tabs button .icon {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  flex: none;
}
.map-page .map-tabs button.active {
  background: linear-gradient(135deg, #0f766e, #16a085);
  color: #fff;
  box-shadow: 0 3px 10px #0f766e55;
  border: 0;
}
.map-page .map-tabs button.active .icon {
  filter: brightness(0) invert(1);
  opacity: 1;
}
.map-page .map-list-toolbar select {
  border-radius: 10px;
  border-color: #cfe6df;
  background: #fff;
}
.map-page .map-list-toolbar .btn {
  border-radius: 10px;
  border: 1px solid #cfe6df;
}
.map-page .map-place {
  background: #fff;
  border: 1px solid #e3eeea;
  border-left: 4px solid var(--cat, #0f766e);
  border-radius: 12px;
  padding: 8px 10px 8px 8px;
  box-shadow: 0 1px 4px #0f766e10;
  display: flex;
  align-items: center;
  transition:
    box-shadow 0.15s,
    transform 0.15s;
}
.map-page .map-place:hover {
  box-shadow: 0 5px 16px #0f766e26;
  transform: translateY(-1px);
}
.map-page .map-place-open {
  align-items: center;
  padding-right: 22px;
}
.map-page .map-place .tag {
  background: color-mix(in srgb, var(--cat, #0f766e) 15%, #fff);
  color: color-mix(in srgb, var(--cat, #0f766e) 75%, #000);
  font-weight: 600;
}
.map-page .map-row-meta .icon {
  width: 11px;
  height: 11px;
  margin-right: 2px;
  filter: invert(67%) sepia(82%) saturate(1500%) hue-rotate(2deg);
}
.map-page .map-row-meta {
  align-items: center;
}
.vr-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #0b6bcb;
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 9.5px;
  font-weight: 700;
}
.vr-badge .icon {
  width: 11px;
  height: 11px;
  filter: brightness(0) invert(1);
}
.map-place .map-place-addr {
  display: flex;
  align-items: center;
  gap: 3px;
}
.map-place .map-place-addr .icon {
  width: 10px;
  height: 10px;
  opacity: 0.55;
  flex: none;
}
.map-favorite {
  top: 50%;
  transform: translateY(-50%);
  right: 6px;
  background: transparent;
}
.map-favorite:hover .icon {
  filter: invert(25%) sepia(90%) saturate(4000%) hue-rotate(340deg);
}

/* Tour: thẻ có ảnh và nhãn thời gian */
.map-page .map-tour {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px;
  border: 1px solid #e3eeea;
  border-left: 4px solid var(--tc, #0f766e);
  border-radius: 12px;
  box-shadow: 0 1px 4px #0f766e10;
}
.tour-thumb {
  position: relative;
  flex: none;
  width: clamp(84px, 6.4vw, 108px);
  height: clamp(60px, 7.5vh, 82px);
  border-radius: 9px;
  overflow: hidden;
}
.tour-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tour-thumb em {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-style: normal;
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  background: var(--tc, #0f766e);
  border-radius: 8px;
  padding: 1px 7px;
}
.map-tour .tour-chips > span {
  background: color-mix(in srgb, var(--tc, #0f766e) 10%, #fff);
  color: color-mix(in srgb, var(--tc, #0f766e) 80%, #000);
  border-radius: 8px;
  padding: 1px 6px;
}

/* Lịch trình */
.itinerary-head {
  flex: none;
  padding-top: 10px;
}
.itinerary-head input {
  border-radius: 10px;
  border: 1px solid #cfe6df;
  font-weight: 600;
}
.map-page #itinerary-stops {
  counter-reset: stop;
  max-height: 26vh;
  overflow-y: auto;
  margin: 8px 0 4px;
}
.map-page #itinerary-stops li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f4faf8;
  border: 1px solid #e0eeea;
  border-radius: 9px;
  margin-bottom: 4px;
  padding: 5px 8px;
  line-height: 1.3;
}
.map-page #itinerary-stops li::before {
  counter-increment: stop;
  content: counter(stop);
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}
.map-page #itinerary-stops li button {
  margin-left: auto;
}
.itinerary-empty {
  font-size: 11px;
  line-height: 1.5;
  padding: 10px;
  border: 1px dashed #b9d8cf;
  border-radius: 10px;
  background: #f4faf8;
  margin: 8px 0;
}
.itinerary-empty[hidden] {
  display: none;
}
.itinerary-head .btn {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
}
.itinerary-head .btn .icon {
  filter: brightness(0) invert(1);
  width: 14px;
  height: 14px;
}
.preset-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 6px;
  color: var(--teal-dark);
}
.preset-title .icon {
  width: 14px;
  height: 14px;
}
.map-page .preset {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--tc, #0f766e);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 1px 4px #0f766e10;
}
.preset-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--tc, #0f766e) 14%, #fff);
}
.preset-ico .icon {
  width: 17px;
  height: 17px;
}
.preset-body {
  min-width: 0;
}
.preset.is-saved {
  background: #fffaf0;
}

/* ---- Panel phải: các nhóm thẻ có màu ---- */
.map-page .layers-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  background: linear-gradient(180deg, #eaf3ff 0, #fff 150px);
  border: 1px solid #d6e4f3;
  border-radius: 16px;
  box-shadow: 0 6px 22px #2563eb14;
}
.lp-section {
  background: #fff;
  border: 1px solid #e2ebf3;
  border-radius: 12px;
  padding: 9px 10px 10px;
  --h: #0f766e;
}
.lp-section:nth-of-type(2) {
  --h: #9333ea;
}
.lp-section:nth-of-type(3) {
  --h: #2563eb;
}
.lp-section:nth-of-type(4) {
  --h: #f59e0b;
}
.map-page .lp-section > h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  font-size: 12.5px;
  color: #12302b;
}

/* Nền bản đồ: thẻ ảnh có nhãn */
.lp-base {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.map-page .basemap-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(44px, 96px);
  gap: 6px;
}
.map-page .basemap-grid button {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #dfe8e4;
  outline: 2px solid transparent;
  outline-offset: -2px;
}
.map-page .basemap-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  border-radius: 0;
  display: block;
}
.map-page .basemap-grid button span {
  position: absolute;
  inset: auto 0 0 0;
  padding: 10px 6px 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: #fff;
  text-align: left;
  background: linear-gradient(transparent, #000a);
}
.map-page .basemap-grid button.active {
  outline-color: #2563eb;
  box-shadow: 0 0 0 3px #2563eb30;
}

/* Công cụ: ô màu */
.map-page .map-tools {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 4px;
}
.map-page .map-tools button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 3px 0;
  border: 0;
  background: none;
  font-size: 9px;
  line-height: 1.2;
  color: #33434b;
  text-align: center;
}
.tool-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--c);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--c) 35%, transparent);
  transition: transform 0.15s;
}
.map-page .map-tools button:hover .tool-ico {
  transform: translateY(-2px);
}
.map-page .map-tools button.active .tool-ico {
  outline: 3px solid color-mix(in srgb, var(--c) 35%, #fff);
}
.lp-note {
  display: block;
  font-size: 9px;
  line-height: 1.4;
  color: var(--muted);
  padding: 0 4px;
}

@media (min-width: 1101px) and (max-height: 960px) {
  .map-page .layers-panel {
    gap: 6px;
    padding: 8px;
  }
  .lp-section {
    padding: 7px 8px 8px;
  }
  .map-page .lp-section > h3 {
    margin-bottom: 6px;
    font-size: 12px;
  }
  .map-page .basemap-grid {
    grid-auto-rows: minmax(34px, 56px);
  }
  .map-page .map-tools {
    grid-template-columns: repeat(8, 1fr);
  }
  .map-page .map-tools button {
    font-size: 0;
    gap: 0;
  }
  .tool-ico {
    width: 100%;
    height: 28px;
    border-radius: 8px;
  }
  .lp-note {
    display: none;
  }
}
@media (max-width: 1100px) {
  .map-page .layers-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    justify-content: stretch;
  }
  .map-page .map-tools {
    grid-template-columns: repeat(4, 1fr);
  }
  .map-page .map-tools button {
    font-size: 9px;
  }
  .tool-ico {
    width: 34px;
    height: 34px;
  }
}
@media (max-width: 760px) {
  .map-page .layers-panel {
    grid-template-columns: 1fr;
  }
}
.map-page .map-tabs button {
  font-size: 11px;
  padding: 7px 2px;
  gap: 4px;
}
.map-page .map-tabs button .icon {
  width: 13px;
  height: 13px;
}
.place-thumb {
  position: relative;
  flex: none;
  display: block;
}
.place-info {
  flex: 1;
  min-width: 0;
}
.map-page .map-place {
  padding: 6px 10px 6px 8px;
}
.map-page .map-place .map-place-meta .map-row-meta:empty,
.map-page .map-place .map-row-meta > span:empty {
  display: none;
}
.map-page
  .map-place
  .map-row-meta:not(:has(.icon)):not(:has([data-distance]:not(:empty))) {
  display: none;
}
.map-place-open > .place-thumb {
  flex: none;
}
.place-thumb img {
  width: clamp(60px, 4.8vw, 80px);
  height: clamp(46px, 6vh, 62px);
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .layers-panel {
    gap: 4px;
    padding: 6px;
  }
  .lp-section {
    padding: 5px 7px 6px;
  }
  .map-page .lp-section > h3 {
    margin-bottom: 4px;
    font-size: 11.5px;
  }
  .map-page .basemap-grid {
    grid-auto-rows: minmax(28px, 34px);
    gap: 4px;
  }
  .tool-ico {
    height: 24px;
  }
  .itinerary-empty {
    display: none;
  }
  .map-page .map-list {
    padding: 8px 10px;
  }
}

.lp-base .basemap-grid {
  grid-auto-rows: minmax(34px, 1fr);
}
.lp-base .basemap-grid button {
  max-height: 120px;
}

/* ===== Đợt 6: bỏ vạch màu bên thẻ, trả ô nền bản đồ về ảnh nhỏ + nhãn dưới ===== */
.map-page .map-place,
.map-page .map-tour,
.map-page .preset {
  border: 1px solid #e3ebe8;
  border-radius: 12px;
  box-shadow: none;
  background: #fff;
}
.map-page .map-place:hover,
.map-page .map-tour:hover,
.map-page .preset:hover {
  border-color: #9fcfc4;
  box-shadow: 0 4px 14px #0f766e1f;
  transform: none;
}
.map-page .preset.is-saved {
  background: #fffaf0;
  border-color: #f0dcae;
}
.map-page .map-place-meta .vr-badge {
  display: inline-flex;
}

/* Nền bản đồ: ảnh nhỏ bo góc, tên nằm dưới ảnh */
.lp-base {
  flex: 0 0 auto;
}
.map-page .basemap-grid,
.lp-base .basemap-grid {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: auto;
  gap: 8px 8px;
}
.map-page .basemap-grid button,
.lp-base .basemap-grid button {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: none;
  outline: 0;
  box-shadow: none;
  font-size: 10.5px;
  color: #33434b;
}
.map-page .basemap-grid img {
  width: 100%;
  height: clamp(36px, 6vh, 54px);
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 8px;
  display: block;
}
.map-page .basemap-grid button span,
.lp-base .basemap-grid button span {
  position: static;
  padding: 0;
  background: none;
  color: inherit;
  font-size: 10.5px;
  font-weight: 500;
  text-align: center;
}
.map-page .basemap-grid button.active img {
  border-color: var(--teal);
}
.map-page .basemap-grid button.active span {
  color: var(--teal-dark);
  font-weight: 700;
}
@media (min-width: 1101px) and (max-height: 960px) {
  .map-page .basemap-grid img {
    height: 30px;
  }
  .map-page .basemap-grid {
    gap: 5px 8px;
  }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .basemap-grid img {
    height: 22px;
  }
  .map-page .basemap-grid button span,
  .lp-base .basemap-grid button span {
    font-size: 9.5px;
  }
  .map-page .basemap-grid {
    gap: 3px 6px;
  }
}

/* Hàng thông tin gọn: loại + VR cùng một dòng */
.map-page .map-place-meta {
  gap: 2px 5px;
  flex-wrap: nowrap;
}
.map-page .map-place .tag {
  padding: 2px 5px;
  white-space: nowrap;
}
.map-page .map-place-meta .vr-badge {
  padding: 1px 5px;
  flex: none;
}
.map-page .map-place-meta .map-row-meta {
  min-width: 0;
  white-space: nowrap;
}

/* Ảnh nền bản đồ tự giãn theo chỗ còn lại của panel */
.map-page .lp-base {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.map-page .lp-base .basemap-grid {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.map-page .lp-base .basemap-grid button {
  min-height: 0;
  height: 100%;
}
.map-page .lp-base .basemap-grid img {
  flex: 1 1 0;
  min-height: 18px;
  height: auto;
  max-height: 104px;
}

.map-page .map-place-meta {
  flex-wrap: wrap;
}

/* =====================================================================
   Đợt 7: đối chiếu prototype — header trong suốt, tab gạch chân,
   thẻ trắng phẳng, công tắc xanh, công cụ dạng ô viền
   ===================================================================== */

/* ---- Menu chính trong suốt đè lên banner ---- */

/* Header nằm đè lên banner: trang tự cao đủ cả vùng header */
.map-page {
  height: 100vh;
  height: 100dvh;
}
.map-page .map-hero {
  padding-top: calc(72px + clamp(6px, 1.4vh, 16px));
}
@media (max-width: 1100px) {
  .map-page {
    height: auto;
  }
}
@media (max-width: 760px) {
  .map-page .map-hero {
    padding-top: calc(64px + 10px);
  }
}

/* ---- Panel trái: trắng, tab gạch chân ---- */
.map-page .map-list {
  background: #fff;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 4px 20px #1d30361a;
  padding: 6px 14px 10px;
}
.map-page .map-tabs {
  display: flex;
  gap: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  border-bottom: 1px solid var(--line);
}
.map-page .map-tabs button {
  flex: 1 1 auto;
  padding: 11px 4px 10px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #56636b;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.map-page .map-tabs button.active {
  background: none;
  box-shadow: none;
  color: var(--teal);
  border-bottom-color: var(--teal);
}
.tab-count:before {
  content: "(";
}
.tab-count:after {
  content: ")";
}
.map-page .map-list-toolbar {
  margin-top: 10px;
}
.map-page .map-list-toolbar select,
.map-page .map-list-toolbar .btn {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

/* Danh sách điểm đến: dòng phẳng, ngăn cách bằng đường kẻ mảnh */
.pg-list {
  gap: 0;
}
.map-page .map-place,
.map-page .map-tour,
.map-page .preset {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
.map-page .map-place {
  padding: 9px 0;
}
.map-page .map-place:hover,
.map-page .map-tour:hover,
.map-page .preset:hover {
  background: #f6faf8;
  border-color: var(--line);
  box-shadow: none;
}
.map-page .map-place-open {
  gap: 12px;
  padding-right: 24px;
}
.place-thumb img {
  width: clamp(78px, 6.2vw, 112px);
  height: clamp(56px, 7.6vh, 78px);
  border-radius: 7px;
}
.map-page .map-place strong {
  font-size: 12.5px;
  line-height: 1.35;
}
.map-page .map-place .tag {
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 500;
}
.map-page .map-favorite {
  right: 0;
}
.vr-badge {
  border-radius: 5px;
  background: #e8f1fd;
  color: #0b5cad;
  font-weight: 600;
}
.vr-badge .icon {
  filter: invert(21%) sepia(97%) saturate(1900%) hue-rotate(196deg);
}

/* Tour và lịch trình mẫu cũng là dòng phẳng */
.map-page .map-tour {
  padding: 10px 0;
}
.tour-thumb {
  border-radius: 7px;
}
.tour-thumb em {
  background: #0f766ecc;
  font-weight: 600;
}
.map-tour .tour-chips > span {
  background: none;
  padding: 0;
  color: #56636b;
}
.map-page .preset {
  padding: 10px 2px;
}
.preset-ico {
  background: #e8f3ef;
}
.map-page .preset.is-saved {
  background: none;
}
.preset.is-saved .preset-body small {
  color: #b7791f;
}
.map-page #itinerary-stops li {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  margin: 0;
}
.itinerary-empty {
  background: none;
  border: 1px dashed var(--line);
}
.itinerary-head input {
  border: 1px solid var(--line);
  border-radius: 8px;
}
.preset-title {
  color: var(--ink);
  font-size: 12.5px;
}

/* Phân trang số như prototype */
.map-page .pagination {
  gap: 6px;
  margin: 10px 0 2px;
}
.map-page .pagination button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}
.map-page .pagination button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.map-page .pagination button:disabled {
  opacity: 0.35;
}

/* ---- Panel phải: trắng, các mục ngăn bằng đường kẻ ---- */
.map-page .layers-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
  padding: 6px 16px 12px;
  background: #fff;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 4px 20px #1d30361a;
  overflow: hidden;
}
.lp-section {
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 0 8px;
}
.lp-section:first-of-type {
  border-top: 0;
  padding-top: 8px;
}
.map-page .lp-section > h3 {
  margin: 0 0 6px;
  padding: 0;
  border: 0;
  font-size: 13.5px;
  color: var(--ink);
}
.layer-list {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 12px;
}
.map-page .layer-list .switch-row {
  margin: 6px 0;
  font-size: 11.5px;
  gap: 9px;
  min-width: 0;
  line-height: 1.25;
}
.map-page .layer-list .switch-row .lc-name {
  min-width: 0;
}
.map-page .layer-list .switch-row:has(input:disabled) {
  opacity: 0.55;
}
.map-page .lp-base {
  flex: 1 1 auto;
  min-height: 0;
}
.map-page .basemap-grid button span {
  color: #33434b;
}

/* Công cụ: ô viền, icon màu */
.map-page .map-tools {
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 6px;
}
.map-page .map-tools button {
  gap: 4px;
  font-size: 9.5px;
  color: #33434b;
}
.map-page .tool-ico {
  width: 100%;
  max-width: 46px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}
.map-page .map-tools button:hover .tool-ico {
  transform: none;
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 8%, #fff);
}
.map-page .map-tools button.active .tool-ico {
  outline: 0;
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, #fff);
}
.mi {
  display: block;
  width: 17px;
  height: 17px;
  background: var(--c);
  -webkit-mask: var(--m) center / contain no-repeat;
  mask: var(--m) center / contain no-repeat;
}
.lp-note {
  margin-top: auto;
  padding: 8px 0 0;
}

/* Màn hình thấp: gọn lại, công tắc 2 cột */
@media (min-width: 1101px) and (max-height: 1000px) {
  .layer-list {
    grid-template-columns: 1fr 1fr;
  }
  .map-page .layer-list .switch-row {
    margin: 4px 0;
    font-size: 10.5px;
    gap: 6px;
  }
  .map-page .layer-list .switch-row input {
    width: 26px;
    flex: none;
  }
  .map-page .layer-list .switch-row .layer-symbol {
    width: 20px;
    height: 20px;
    flex: none;
  }
  .map-page .layers-panel {
    padding: 4px 12px 8px;
  }
  .lp-section {
    padding: 7px 0 6px;
  }
  .map-page .lp-section > h3 {
    margin-bottom: 4px;
    font-size: 12.5px;
  }
  .map-page .map-tools {
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
  }
  .map-page .map-tools button {
    font-size: 0;
    gap: 0;
  }
  .map-page .tool-ico {
    height: 28px;
    border-radius: 8px;
  }
  .mi {
    width: 14px;
    height: 14px;
  }
  .lp-note {
    display: none;
  }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .map-list {
    padding: 4px 12px 8px;
  }
  .map-page .map-tabs button {
    padding: 8px 2px 7px;
  }
  .lp-section {
    padding: 5px 0 4px;
  }
  .map-page .layer-list .switch-row {
    margin: 2px 0;
  }
}
@media (max-width: 1100px) {
  .layer-list {
    grid-template-columns: 1fr 1fr;
  }
  .map-page .layers-panel {
    display: block;
    padding: 8px 16px 14px;
  }
}
@media (max-width: 760px) {
  .layer-list {
    grid-template-columns: 1fr;
  }
}

.map-page .map-tabs {
  gap: 8px;
  justify-content: space-between;
}
.map-page .map-tabs button {
  flex: 0 1 auto;
  padding: 11px 2px 10px;
  font-size: 11.5px;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
}

@media (max-width: 760px) {
  .map-page .map-hero .hero-inner,
  .map-page .map-hero-text,
  .map-page .hero-search {
    min-width: 0;
    max-width: 100%;
  }
}

/* ===== Responsive (đặt cuối để thắng các khai báo lưới 3 cột ở trên) ===== */
@media (max-width: 1100px) {
  .map-page .map-layout {
    grid-template-columns: clamp(250px, 34vw, 330px) minmax(0, 1fr);
    flex: none;
  }
  .map-page .map-list,
  .map-page .map-center {
    height: min(78vh, 760px);
  }
  .map-page .layers-panel {
    grid-column: 1 / -1;
    height: auto;
  }
}
@media (max-width: 760px) {
  .map-page .map-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .map-page .map-center {
    order: -1;
    height: auto;
  }
  .map-page .map-canvas-shell {
    flex: none;
    height: 62vh;
    min-height: 340px;
  }
  .map-page .map-list {
    height: auto;
    min-height: 420px;
  }
  .map-page .map-place-list,
  .map-page #tour-list,
  .map-page #itinerary-presets {
    min-height: 360px;
  }
  .map-page .layers-panel {
    grid-column: auto;
  }
}

@media (max-width: 1100px) {
  .map-page .lp-base .basemap-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
  }
  .map-page .lp-base .basemap-grid button {
    height: auto;
  }
  .map-page .lp-base .basemap-grid img {
    flex: none;
    height: 70px;
  }
}
@media (max-width: 760px) {
  .map-page .lp-base .basemap-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Ô nền bản đồ: chỉ viền ảnh, không viền cả thẻ */
.map-page .basemap-grid button,
.map-page .basemap-grid button.active,
.map-page .lp-base .basemap-grid button,
.map-page .lp-base .basemap-grid button.active {
  outline: 0;
  box-shadow: none;
  background: none;
  border: 0;
  border-radius: 0;
}
.map-page .lp-base .basemap-grid {
  align-content: start;
  gap: 10px 12px;
}
.map-page .lp-base .basemap-grid img {
  border-radius: 9px;
  max-height: 92px;
}
.map-page .basemap-grid button.active img {
  border-color: var(--teal);
  box-shadow: 0 2px 8px #0f766e40;
}

/* Tab trái: chiều rộng theo nội dung, không bị cắt chữ */
.map-page .map-list .map-tabs {
  overflow: visible;
  gap: 6px;
  justify-content: space-between;
  margin-bottom: 0;
}
.map-page .map-list .map-tabs button {
  flex: 0 1 auto;
  padding: 11px 2px 10px;
  font-size: 11.5px;
  overflow: visible;
  text-overflow: clip;
}

/* Ô nền bản đồ: hai hàng đều nhau, ảnh sát nhãn */
.map-page .lp-base .basemap-grid {
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-content: stretch;
  gap: 10px 12px;
}
.map-page .lp-base .basemap-grid button {
  align-self: start;
  height: auto;
  max-height: none;
}
.map-page .lp-base .basemap-grid img {
  max-height: 124px;
  min-height: 26px;
}

/* Ô nền bản đồ: ảnh cao theo màn hình, khoảng trống chia đều giữa các mục */
.map-page .layers-panel {
  justify-content: space-between;
}
.map-page .lp-base {
  flex: 0 0 auto;
}
.map-page .lp-base .basemap-grid {
  grid-template-rows: auto auto;
  align-content: start;
}
.map-page .lp-base .basemap-grid img {
  flex: none;
  height: clamp(54px, 9vh, 104px);
  max-height: none;
  min-height: 0;
}
@media (min-width: 1101px) and (max-height: 1000px) {
  .map-page .lp-base .basemap-grid img {
    height: clamp(34px, 6.2vh, 56px);
  }
  .map-page .lp-base .basemap-grid {
    gap: 6px 10px;
  }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .lp-base .basemap-grid img {
    height: 24px;
  }
  .map-page .lp-base .basemap-grid {
    gap: 3px 8px;
  }
}
@media (max-width: 1100px) {
  .map-page .lp-base .basemap-grid img {
    height: 70px;
  }
}

@media (min-width: 1101px) and (min-height: 1001px) {
  .map-page .lp-base .basemap-grid img {
    height: clamp(52px, 7vh, 84px);
  }
}

/* ===== Panel phải gọn: Lớp bản đồ / Nền bản đồ / Công cụ ===== */
.map-page .layers-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  padding: 10px 16px 12px;
}
.map-page .layers-panel > .lp-section {
  flex: 0 0 auto;
}
.map-page .layers-panel > .lp-section.lp-base {
  flex: 1 1 auto;
  min-height: 0;
}
.map-page .layer-list {
  grid-template-columns: 1fr;
}
.map-page .layer-list .switch-row {
  margin: 8px 0;
  font-size: 12px;
}

/* Công cụ: 3 cột × 2 hàng, ô viền xám, icon đen */
.map-page .map-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 8px;
}
.map-page .map-tools button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 11px;
  line-height: 1.25;
  color: var(--ink);
  text-align: center;
}
.map-page .tool-ico {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 64px;
  height: 52px;
  border: 1px solid #dfe5e8;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.map-page .tool-ico .icon {
  width: 22px;
  height: 22px;
  filter: none;
  opacity: 0.85;
}
.map-page .map-tools button:hover .tool-ico {
  border-color: var(--teal);
  background: #f1f8f6;
}
.map-page .map-tools button.active .tool-ico {
  border-color: var(--teal);
  background: #dff1ec;
  outline: 0;
}
.map-page .tool-name {
  display: block;
  max-width: 100%;
}
.measure-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f1f8f6;
}
.measure-row[hidden] {
  display: none;
}
.measure-row output {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal-dark);
}
.measure-row button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid #cfe6df;
  border-radius: 8px;
  background: #fff;
  font-size: 11px;
}
.measure-row button .icon {
  width: 13px;
  height: 13px;
}

/* Màn hình thấp: giữ 3 cột, thu nhỏ ô */
@media (min-width: 1101px) and (max-height: 1000px) {
  .map-page .map-tools {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }
  .map-page .map-tools button {
    font-size: 0;
    gap: 0;
  }
  .map-page .tool-ico {
    height: 34px;
    border-radius: 9px;
    max-width: none;
  }
  .map-page .tool-ico .icon {
    width: 17px;
    height: 17px;
  }
  .map-page .layer-list .switch-row {
    margin: 5px 0;
  }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .layer-list {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 1100px) {
  .map-page .map-tools {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .map-page .map-tools button {
    font-size: 11px;
  }
}
@media (max-width: 640px) {
  .map-page .map-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1101px) and (min-height: 1001px) {
  .map-page .lp-base .basemap-grid img {
    height: clamp(70px, 14.5vh, 150px);
  }
  .map-page .lp-base .basemap-grid {
    gap: 12px 12px;
  }
  .map-page .layer-list .switch-row {
    margin: 11px 0;
  }
}

/* Thẻ thời tiết nằm trong panel phải */
.map-page .layers-panel > .weather-card {
  position: static;
  width: auto;
  padding: 10px 0 8px;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  box-shadow: none;
  border-top: 1px solid var(--line);
}
.map-page .layers-panel > .weather-card[hidden] {
  display: none;
}
.map-page .layers-panel > .weather-card .wc-forecast {
  grid-template-columns: repeat(5, 1fr);
}
.map-page .layers-panel .wc-src {
  margin-top: 4px;
}
@media (min-width: 1101px) and (max-height: 900px) {
  .map-page .layers-panel > .weather-card .wc-forecast,
  .map-page .layers-panel > .weather-card .wc-src {
    display: none;
  }
  .map-page .layers-panel > .weather-card {
    padding: 6px 0;
  }
  .map-page .layers-panel > .weather-card .wx.wx-lg {
    width: 34px;
    height: 34px;
  }
  .map-page .layers-panel > .weather-card .wc-metrics {
    margin: 4px 0 0;
    padding: 4px 0 0;
  }
}
@media (max-width: 1100px) {
  .map-page .layers-panel > .weather-card {
    grid-column: auto;
  }
}

@media (min-width: 1101px) and (min-height: 1001px) {
  .map-page .lp-base .basemap-grid img {
    height: clamp(50px, 8.2vh, 92px);
  }
  .map-page .lp-base .basemap-grid {
    gap: 10px 12px;
  }
  .map-page .layer-list .switch-row {
    margin: 9px 0;
  }
}

/* ===== Bản đồ: cột nút trái, overview Việt Nam, dải điểm nổi bật ===== */
.map-page .map-floating-tools {
  top: 118px;
  left: 10px;
  gap: 8px;
}
.map-page .map-floating-tools .icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}
.map-overview {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: clamp(120px, 11vw, 168px);
  aspect-ratio: 1.3;
  border: 1.5px solid #ffffffd9;
  border-radius: 12px;
  overflow: hidden;
  background: #cfd8dc;
  box-shadow: 0 4px 16px #0003;
  pointer-events: none;
}
.map-overview #overview-map {
  position: absolute;
  inset: 0;
}
.map-overview .mapboxgl-ctrl-top-right,
.map-overview .maplibregl-ctrl-top-right,
.map-overview .mapboxgl-ctrl-top-left,
.map-overview .mapboxgl-ctrl-bottom-right,
.map-overview .maplibregl-ctrl-bottom-right {
  display: none;
}
.map-overview .mapboxgl-ctrl-bottom-left,
.map-overview .maplibregl-ctrl-bottom-left {
  transform: scale(0.7);
  transform-origin: left bottom;
}
.ov-north {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  justify-items: center;
  width: 24px;
  padding: 3px 0 2px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 4px #0003;
  font-size: 9px;
  line-height: 1;
}
.ov-north .icon {
  width: 12px;
  height: 12px;
}
.ov-label {
  position: absolute;
  left: 8px;
  bottom: 6px;
  font-size: 11px;
  color: #263238;
  text-shadow:
    0 0 3px #fff,
    0 0 3px #fff;
}
.map-page .map-center {
  gap: 10px;
}
.map-page .map-highlights {
  flex: none;
  padding: 10px 14px 12px;
  border-radius: 14px;
  margin: 0;
}
.map-page .map-highlights h3 {
  margin: 0 0 8px;
  font-size: 13px;
}
.hl-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hl-nav {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.hl-nav .icon {
  width: 15px;
  height: 15px;
}
.hl-track {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.hl-track::-webkit-scrollbar {
  display: none;
}
.hl-card {
  flex: 0 0 calc((100% - 30px) / 4);
  min-width: 130px;
  display: block;
  padding: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  text-align: left;
  scroll-snap-align: start;
}
.hl-card:hover {
  border-color: var(--teal);
}
.hl-card img {
  display: block;
  width: 100%;
  height: clamp(44px, 7.5vh, 74px);
  object-fit: cover;
}
.hl-card strong {
  display: block;
  margin: 6px 9px 4px;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hl-tag {
  display: inline-block;
  margin: 0 9px;
  padding: 2px 8px;
  border-radius: 5px;
  background: #d8efe3;
  color: #185b47;
  font-size: 10px;
}
@media (min-width: 1101px) and (max-height: 860px) {
  .map-page .map-highlights h3 {
    display: none;
  }
  .map-page .map-highlights {
    padding: 8px 12px;
  }
  .hl-card img {
    height: 36px;
  }
  .hl-card strong {
    margin-top: 4px;
  }
  .hl-tag {
    display: none;
  }
  .hl-card {
    padding-bottom: 6px;
  }
}
@media (max-width: 1100px) {
  .map-page .map-center {
    height: auto;
  }
  .map-page .map-canvas-shell {
    flex: none;
    height: 62vh;
    min-height: 360px;
  }
}
@media (max-width: 760px) {
  .map-overview {
    width: 96px;
  }
  .hl-card {
    flex-basis: 150px;
  }
}

.map-overview {
  width: clamp(104px, 9vw, 140px);
  aspect-ratio: 0.92;
}
@media (max-width: 760px) {
  .map-overview {
    width: 84px;
  }
}

/* ===== Công cụ luôn 3 cột × 2 hàng; banner gọn ===== */
@media (min-width: 1101px) {
  .map-page .map-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 6px;
  }
  .map-page .map-tools button {
    font-size: 10.5px;
    gap: 4px;
  }
}
@media (min-width: 1101px) and (max-height: 1000px) {
  .map-page .map-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 4px;
  }
  .map-page .map-tools button {
    font-size: 10px;
    gap: 3px;
  }
  .map-page .tool-ico {
    height: 36px;
    max-width: 56px;
  }
  .map-page .tool-ico .icon {
    width: 18px;
    height: 18px;
  }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .tool-ico {
    height: 30px;
    max-width: 48px;
  }
  .map-page .map-tools {
    gap: 4px 4px;
  }
  .map-page .map-tools button {
    font-size: 9.5px;
    gap: 2px;
  }
}

/* Banner nhỏ gọn, cân đối với phần thân trang */
.map-page .map-hero {
  padding-top: calc(72px + 2px);
  padding-bottom: 36px;
}
.map-page .map-hero h1 {
  font-size: clamp(24px, 2.3vw, 32px);
  margin: 0;
}
.map-page .hero-subtitle {
  margin: 1px 0 6px;
  font-size: clamp(11px, 0.95vw, 13px);
}
.map-page .hero-search {
  height: 38px;
  width: min(500px, 100%);
  border-radius: 14px;
}
.map-page .hero-search .btn {
  height: 30px;
  min-width: 96px;
  font-size: 12px;
}
.map-categories {
  gap: clamp(6px, 1vw, 16px);
}
.map-categories button {
  min-width: 58px;
}
.map-categories button > span {
  width: 36px;
  height: 36px;
  margin-bottom: 2px;
}
.map-category-glyph {
  width: 20px;
  height: 20px;
}
.map-categories strong {
  font-size: 10px;
}
.map-page .map-layout {
  margin-top: calc(-1 * clamp(18px, 3vh, 28px));
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .hero-subtitle {
    display: none;
  }
  .map-page .map-hero {
    padding-bottom: 30px;
  }
}

.map-overview {
  pointer-events: auto;
  cursor: pointer;
}
.map-overview #overview-map .mapboxgl-canvas {
  cursor: pointer;
}

/* ---- Mật độ du khách & giao thông trực tiếp ---- */
.map-marker .crowd-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #94a3b8;
  box-shadow: 0 1px 4px #0004;
  pointer-events: none;
}
.map-marker[data-crowd="low"] .crowd-dot { background: #16a34a; }
.map-marker[data-crowd="moderate"] .crowd-dot { background: #eab308; }
.map-marker[data-crowd="high"] .crowd-dot { background: #ea580c; }
.map-marker[data-crowd="full"] .crowd-dot { background: #dc2626; animation: crowd-pulse 1.6s ease-out infinite; }
@keyframes crowd-pulse {
  0% { box-shadow: 0 0 0 0 #dc2626aa; }
  100% { box-shadow: 0 0 0 11px #dc262600; }
}
@media (prefers-reduced-motion: reduce) {
  .map-marker[data-crowd="full"] .crowd-dot { animation: none; }
}
.map-page.crowd-off .crowd-dot,
.map-page.crowd-off .crowd-chip,
.map-page.crowd-off .crowd-alerts { display: none; }

.crowd-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  background: #64748b;
}
.crowd-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.crowd-chip.lv-low { background: #15803d; }
.crowd-chip.lv-moderate { background: #a16207; }
.crowd-chip.lv-high { background: #c2410c; }
.crowd-chip.lv-full { background: #b91c1c; }

.crowd-alerts {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: min(300px, calc(100% - 230px));
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid #fecaca;
  background: #fffbfbf2;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px #0a2a2538;
  font-size: 11.5px;
}
.crowd-alerts[hidden] { display: none; }
.crowd-alerts .ca-head { display: flex; align-items: center; gap: 6px; color: #b91c1c; }
.crowd-alerts .ca-head .icon { width: 15px; height: 15px; }
.crowd-alerts .ca-head strong { flex: 1; font-size: 12px; }
.crowd-alerts .ca-close { border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: #7f1d1d; padding: 0 2px; }
.crowd-alerts ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.crowd-alerts li button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: #1f2937;
}
.crowd-alerts li button:hover,
.crowd-alerts li button:focus-visible { background: #fee2e2; }
.crowd-alerts li i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #ea580c; }
.crowd-alerts li.lv-full i { background: #dc2626; }
.crowd-alerts li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crowd-alerts li b { flex: none; font-size: 10.5px; color: #b91c1c; }
.crowd-alerts small { display: block; margin-top: 4px; color: #6b7280; }

.map-legend {
  position: absolute;
  left: 10px;
  bottom: 32px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  max-width: calc(100% - 20px);
  padding: 7px 10px;
  border-radius: 10px;
  background: #ffffffeb;
  box-shadow: 0 2px 10px #0a2a2530;
  font-size: 10px;
  color: #334155;
}
.map-legend[hidden] { display: none; }
.map-legend strong { display: block; margin-bottom: 3px; font-size: 10px; }
.map-legend ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.map-legend li { display: inline-flex; align-items: center; gap: 4px; }
.map-legend li i { width: 9px; height: 9px; border-radius: 50%; }
.map-legend .lg-bar { display: block; width: 110px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #22c55e, #eab308, #f97316, #dc2626); }
.map-legend .lg-scale { display: flex; justify-content: space-between; gap: 6px; color: #64748b; }
.map-legend .lg-scale small { font-size: 9px; }
.map-legend .lg-time { font-weight: 500; color: #64748b; font-size: 9.5px; }
.map-legend .lg-time.stale { color: #b45309; }

.popup-crowd {
  margin: 6px 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--lv, #16a34a) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--lv, #16a34a) 35%, #fff);
}
.popup-crowd .pc-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.popup-crowd .pc-head small { margin-left: auto; color: #475569; font-size: 10.5px; }
.popup-crowd .pc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lv); }
.popup-crowd .pc-head strong { color: var(--lv); }
.popup-crowd .pc-bar { height: 6px; margin: 5px 0; border-radius: 3px; background: #e2e8f0; overflow: hidden; }
.popup-crowd .pc-bar i { display: block; height: 100%; border-radius: 3px; background: var(--lv); }
.popup-crowd .pc-meta,
.popup-crowd .pc-note { display: block; font-size: 10px; color: #64748b; line-height: 1.45; }
.popup-traffic { display: flex; align-items: center; gap: 6px; margin: 4px 0; font-size: 11px; color: #334155; }
.popup-traffic[hidden] { display: none; }
.popup-traffic .icon { width: 14px; height: 14px; }
.popup-traffic.tf-slow strong { color: #a16207; }
.popup-traffic.tf-heavy strong { color: #c2410c; }
.popup-traffic.tf-jam strong { color: #b91c1c; }
.popup-traffic.tf-free strong { color: #15803d; }
.incident-popup { min-width: 0; }
@media (max-width: 760px) {
  .crowd-alerts { width: calc(100% - 20px); top: 8px; }
}

/* ---- Sửa xô lệch panel Lớp bản đồ: các khối không bị co lại, ô nền bản đồ tự giãn theo nội dung ---- */
.map-page .layers-panel {
  overflow-y: auto;
  scrollbar-width: thin;
}
.map-page .layers-panel > * {
  flex: none;
}
.map-page .lp-section {
  flex: none;
  min-height: min-content;
}
.map-page .lp-base .basemap-grid {
  height: auto;
  min-height: 0;
  grid-auto-rows: auto;
  align-items: start;
}
.map-page .lp-base .basemap-grid button {
  height: auto;
  min-height: 0;
  max-height: none;
}
.map-page .lp-base .basemap-grid img {
  height: clamp(40px, 6vh, 60px);
}
.map-page .lp-base .basemap-grid button span {
  position: static;
  padding: 0;
  background: none;
  color: #33434b;
  line-height: 1.3;
}
.map-page .lp-layers .layer-list { display: grid; gap: 2px; }
.map-page .layers-panel > .lp-section.lp-base {
  flex: 0 0 auto;
  min-height: min-content;
}
.map-page .layers-panel > .lp-section.lp-base .basemap-grid img {
  height: clamp(40px, 6vh, 64px);
}
.map-page .layers-panel .layer-list .switch-row {
  margin: 5px 0;
}
.map-page .layers-panel { gap: 8px; justify-content: flex-start; }
.map-page .layers-panel { gap: 4px; padding-top: 8px; padding-bottom: 8px; }
.map-page .layers-panel .layer-list .switch-row { margin: 2px 0; }
.map-page .layers-panel .lp-section { padding-top: 6px; padding-bottom: 6px; }
.map-page .layers-panel > .lp-section.lp-base .basemap-grid img { height: clamp(34px, 5vh, 56px); }
.map-page .layers-panel .map-tools button { padding-top: 3px; padding-bottom: 3px; }
.map-page .layers-panel .tool-ico { height: 28px; }
.crowd-alerts { left: 58px; width: min(300px, calc(100% - 290px)); }
@media (max-width: 760px) { .crowd-alerts { left: 58px; width: calc(100% - 68px); } }

/* ---- Dịch vụ du lịch & tuyến từ chatbot ---- */
.map-page .svc-layer-list { grid-template-columns: 1fr 1fr; column-gap: 6px; }
.map-page .svc-layer-list .switch-row { font-size: 11px; }
.svc-popup .svc-row { display: flex; gap: 6px; align-items: flex-start; margin: 3px 0; font-size: 11px; color: #334155; overflow-wrap: anywhere; }
.svc-popup .svc-row .icon { width: 13px; height: 13px; flex: none; margin-top: 2px; }
.svc-popup .svc-row a { color: #00695f; }
.svc-popup .svc-stars { color: #d97706; font-size: 11px; }
.svc-popup .svc-verified { display: inline-block; padding: 1px 6px; border-radius: 4px; background: #dcfce7; color: #166534; font-size: 10px; }
.svc-popup .svc-src { display: block; margin: 4px 0 6px; font-size: 10px; color: #94a3b8; }
.svc-focus, .ai-stop {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid #fff; color: #fff; font: 700 12px "Be Vietnam Pro", sans-serif; box-shadow: 0 2px 8px #0005; cursor: pointer;
}
.svc-focus { background: #7c3aed; }
.ai-stop { background: #9333ea; cursor: default; }
.map-marker.is-highlight > span { box-shadow: 0 0 0 4px #9333ea, 0 0 0 8px #9333ea33; }
.map-marker.is-highlight { z-index: 15; }

/* ===================================================================
   Thiết kế lại (11/2026): panel phải chỉ còn các lớp, không cuộn;
   bỏ dải "điểm nổi bật", thay bằng thanh mảnh dưới bản đồ
   (thời tiết · nền bản đồ · công cụ) để bản đồ cao hơn.
   =================================================================== */
.map-page .map-center { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.map-page .map-canvas-shell { flex: 1 1 auto; min-height: 320px; }

/* ---- Panel lớp ---- */
.map-page .mx-panel {
  display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto;
  padding: 14px 14px 12px; border-radius: 16px; background: #fff; border: 1px solid #e3ebe8;
  box-shadow: 0 6px 22px #0f3b3514; scrollbar-width: thin;
}
.mx-sec h3 {
  display: flex; align-items: center; gap: 7px; margin: 0 0 8px; padding: 0;
  font-size: 13px; font-weight: 700; color: #0c1930;
}
.mx-sec h3 .icon { width: 16px; height: 16px; opacity: 0.7; }
.mx-sec + .mx-sec { padding-top: 12px; border-top: 1px solid #eef2f4; }
.mx-rows { display: grid; gap: 2px; }
.mx-row {
  display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 9px; cursor: pointer;
  font-size: 12.5px; color: #1e293b; user-select: none;
}
.mx-row:hover { background: #f4f8f7; }
.mx-ico {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  background: color-mix(in srgb, var(--c, #0f766e) 14%, #fff);
}
.mx-ico .icon { width: 15px; height: 15px; filter: none; }
.mx-name { flex: 1; min-width: 0; line-height: 1.3; }
/* Công tắc dạng iOS dựng từ checkbox gốc (giữ nguyên khả năng truy cập bàn phím). */
.mx-switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 34px; height: 20px; margin: 0;
  border-radius: 999px; background: #cfd8dc; cursor: pointer; transition: background 0.15s;
}
.mx-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px #0003; transition: transform 0.15s;
}
.mx-switch:checked { background: #0f766e; }
.mx-switch:checked::after { transform: translateX(14px); }
.mx-switch:focus-visible { outline: 3px solid #99f6e4; outline-offset: 1px; }
.mx-switch:disabled { opacity: 0.45; cursor: not-allowed; }
.mx-row:has(.mx-switch:disabled) { cursor: not-allowed; color: #94a3b8; }
.mx-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mx-chip {
  position: relative; display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 10px;
  border: 1px solid #e2e8f0; background: #fff; cursor: pointer; font-size: 12px; color: #334155; user-select: none;
  transition: border-color 0.15s, background 0.15s;
}
.mx-chip .mx-ico { width: 24px; height: 24px; }
.mx-chip input { position: absolute; opacity: 0; pointer-events: none; }
.mx-chip:hover { border-color: color-mix(in srgb, var(--c) 45%, #fff); }
.mx-chip:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); color: #0c1930; font-weight: 600; }
.mx-chip:has(input:checked) .mx-ico { background: var(--c); }
.mx-chip:has(input:checked) .mx-ico .icon { filter: brightness(0) invert(1); }
.mx-chip:has(input:focus-visible) { outline: 3px solid #99f6e4; }
.mx-note { margin: 8px 0 0; font-size: 10.5px; line-height: 1.45; color: #94a3b8; }

/* ---- Thanh dưới bản đồ ---- */
.map-page .map-dock {
  flex: none; display: flex; align-items: stretch; gap: 0; margin: 0; padding: 10px 6px;
  border-radius: 14px; background: #fff; border: 1px solid #e3ebe8; box-shadow: 0 6px 22px #0f3b3514;
}
.mx-dock-sec { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 0 14px; min-width: 0; }
.mx-dock-sec + .mx-dock-sec, .mx-weather + .mx-dock-sec { border-left: 1px solid #eef2f4; }
.map-dock h3 { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #64748b; }
.map-page .map-dock .mx-bases { display: flex; gap: 8px; }
.map-page .map-dock .mx-bases button {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 64px;
  padding: 0; border: 0; background: none; cursor: pointer; font-size: 10.5px; color: #475569; box-shadow: none; outline: 0;
}
.map-page .map-dock .mx-bases img {
  width: 64px; height: 40px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; box-shadow: 0 1px 4px #0002;
}
.map-page .map-dock .mx-bases span { position: static; padding: 0; background: none; color: inherit; font-weight: 500; white-space: nowrap; }
.map-page .map-dock .mx-bases button.active img { border-color: #0f766e; }
.map-page .map-dock .mx-bases button.active span { color: #0f766e; font-weight: 700; }
.map-page .map-dock .mx-bases button:focus-visible img { outline: 3px solid #99f6e4; }
.mx-tools { display: flex; gap: 4px; }
.mx-tools button {
  display: flex; flex-direction: column; align-items: center; gap: 3px; width: 62px; padding: 6px 2px;
  border: 1px solid transparent; border-radius: 10px; background: none; cursor: pointer; font-size: 10.5px; color: #475569; line-height: 1.15;
}
.mx-tools button .icon { width: 20px; height: 20px; }
.mx-tools button:hover, .mx-tools button:focus-visible { background: #f0fdfa; border-color: #b7dcd5; color: #0f766e; }
.mx-tools button.active { background: #0f766e; color: #fff; }
.mx-tools button.active .icon { filter: brightness(0) invert(1); }
.mx-tools button span { text-align: center; }
.mx-weather[hidden] { display: none; }
.mx-weather { flex: 1 1 auto; display: flex; align-items: center; gap: 14px; padding: 0 14px; min-width: 0; font-size: 11px; color: #334155; }
.mx-weather .wc-head { display: flex; align-items: center; gap: 8px; flex: none; }
.mx-weather .wc-head b { display: block; font-size: 22px; line-height: 1; color: #0c1930; }
.mx-weather .wc-head span { display: block; margin-top: 2px; color: #64748b; font-size: 11px; white-space: nowrap; }
.mx-weather .wx { display: inline-block; width: 22px; height: 22px; background: var(--wx, #7b8794); mask-size: contain; -webkit-mask-size: contain; mask-repeat: no-repeat; -webkit-mask-repeat: no-repeat; }
.mx-weather .wx.wx-lg { width: 34px; height: 34px; }
.mx-weather .wc-metrics { display: grid; gap: 3px; flex: none; }
.mx-weather .wc-metrics span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.mx-weather .wc-metrics .icon { width: 13px; height: 13px; opacity: 0.7; }
.mx-weather .wc-forecast { display: flex; gap: 2px; min-width: 0; overflow: hidden; }
.mx-weather .wc-forecast > div { display: grid; justify-items: center; gap: 1px; width: 40px; padding: 3px 0; border-radius: 8px; }
.mx-weather .wc-forecast > div:first-child { background: #f1f5f9; }
.mx-weather .wc-forecast small { font-size: 9.5px; color: #64748b; }
.mx-weather .wc-forecast b { font-size: 11px; }
.mx-weather .wc-src { display: none; }
.map-page .mx-measure {
  position: absolute; left: 50%; bottom: 12px; z-index: 3; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; border-radius: 999px;
  background: #0c1930e6; color: #fff; font-size: 12.5px; box-shadow: 0 6px 18px #0004;
}
.map-page .mx-measure[hidden] { display: none; }
.map-page .mx-measure button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 0; border-radius: 999px; background: #ffffff26; color: #fff; font: inherit; cursor: pointer; }
.map-page .mx-measure button .icon { width: 14px; height: 14px; filter: brightness(0) invert(1); }
/* Màn hình hẹp chiều cao: rút gọn nhãn công cụ, giữ biểu tượng. */
@media (min-width: 1101px) and (max-height: 820px) {
  .mx-tools button span, .map-page .map-dock .mx-bases span { display: none; }
  .mx-tools button { width: 40px; }
  .map-page .map-dock .mx-bases img { height: 34px; width: 52px; }
  .mx-row { padding: 3px 6px; }
}
@media (max-width: 1360px) and (min-width: 1101px) {
  .mx-weather .wc-forecast > div:nth-child(n + 4) { display: none; }
  .mx-tools button { width: 54px; }
}
@media (max-width: 1100px) {
  .map-page .map-dock { flex-wrap: wrap; row-gap: 10px; }
  .mx-weather { flex-basis: 100%; }
  .mx-weather + .mx-dock-sec { border-left: 0; }
  .map-page .mx-panel { overflow: visible; }
}
@media (max-width: 760px) {
  .mx-tools { flex-wrap: wrap; }
  .mx-dock-sec { padding: 0 8px; }
  .mx-chips { grid-template-columns: 1fr 1fr; }
}
/* Không cho CSS cũ kéo giãn các khối/dòng của panel lớp. */
.map-page .mx-panel > * { flex: none; }
.map-page .mx-panel .mx-rows, .map-page .mx-panel .mx-chips { align-content: start; }
.map-page .mx-panel .mx-row, .map-page .mx-panel .mx-chip { margin: 0; min-height: 0; height: auto; }
.mx-weather .wc-forecast small { white-space: nowrap; }
.mx-tools button span { white-space: nowrap; }
.mx-tools button { width: auto; min-width: 46px; padding: 6px 6px; }

/* ---- Cảnh báo đông khách: nút gọn + danh sách thả xuống ---- */
.map-page .crowd-alerts {
  top: 10px; left: 58px; width: auto; max-width: min(320px, calc(100% - 250px));
  padding: 0; border: 0; background: none; box-shadow: none; backdrop-filter: none;
}
.crowd-alerts .ca-toggle {
  display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 10px 6px 8px;
  border: 1px solid #fecaca; border-radius: 999px; background: #fffbfbf2; backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px #0a2a2530; cursor: pointer; font: inherit; color: #7f1d1d; text-align: left;
}
.crowd-alerts .ca-toggle:hover, .crowd-alerts .ca-toggle:focus-visible { border-color: #f87171; outline: none; }
.crowd-alerts .ca-toggle > .icon { width: 16px; height: 16px; flex: none; }
.crowd-alerts .ca-count { flex: none; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; }
.crowd-alerts .ca-sum { min-width: 0; display: grid; line-height: 1.2; }
.crowd-alerts .ca-sum strong { font-size: 12px; }
.crowd-alerts .ca-sum small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; color: #991b1b; }
.crowd-alerts .ca-chev { width: 14px; height: 14px; flex: none; transition: transform 0.15s; }
.crowd-alerts.open .ca-chev { transform: rotate(180deg); }
.crowd-alerts.open .ca-toggle { border-radius: 14px 14px 4px 4px; }
.map-page .crowd-alerts ul {
  margin: 4px 0 0; padding: 6px; max-height: min(190px, 40vh); overflow-y: auto; list-style: none; display: grid; gap: 2px;
  border: 1px solid #fecaca; border-radius: 4px 4px 14px 14px; background: #fffbfbf5; backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px #0a2a2530; scrollbar-width: thin;
}
.map-page .crowd-alerts ul[hidden] { display: none; }
@media (max-width: 760px) {
  .map-page .crowd-alerts { max-width: calc(100% - 68px); }
}
/* Thanh dưới bản đồ: các khối nền + công cụ không bị cắt; thời tiết co lại trước. */
.map-page .map-dock { overflow: hidden; }
.mx-dock-base, .mx-dock-tools { flex: none; }
.mx-weather { flex: 1 1 0; overflow: hidden; }
.mx-tools button { min-width: 44px; padding: 6px 4px; }
@media (max-width: 1700px) {
  .mx-weather .wc-metrics { display: none; }
  .mx-weather .wc-forecast > div:nth-child(n + 4) { display: none; }
}
@media (max-width: 1500px) and (min-width: 1101px) {
  .mx-weather .wc-forecast { display: none; }
  .map-page .map-dock .mx-bases button, .map-page .map-dock .mx-bases img { width: 56px; }
  .mx-dock-sec { padding: 0 10px; }
}

/* ===== Đợt 2: thanh dưới mỏng một hàng, thời tiết vào panel phải, nút gạt mới ===== */
/* Nút gạt: checkbox gốc ẩn (vẫn nhận bàn phím), giao diện vẽ bằng .mx-tog. */
.map-page .mx-panel .mx-switch {
  appearance: auto; position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0);
}
.map-page .mx-panel .mx-switch::after { content: none; }
.mx-row { position: relative; }
.mx-tog {
  flex: none; position: relative; width: 36px; height: 20px; border-radius: 999px; background: #e2e8f0;
  box-shadow: inset 0 0 0 1px #cbd5e1; transition: background 0.18s, box-shadow 0.18s;
}
.mx-tog::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px #0f172a40; transition: transform 0.18s;
}
.mx-switch:checked + .mx-tog { background: #0f766e; box-shadow: inset 0 0 0 1px #0f766e; }
.mx-switch:checked + .mx-tog::after { transform: translateX(16px); }
.mx-switch:focus-visible + .mx-tog { outline: 3px solid #99f6e4; outline-offset: 2px; }
.mx-switch:disabled + .mx-tog { opacity: 0.4; }
.mx-row:hover .mx-tog { box-shadow: inset 0 0 0 1px #94a3b8; }
.mx-row:hover .mx-switch:checked + .mx-tog { box-shadow: inset 0 0 0 1px #0b5c55; }
@media (prefers-reduced-motion: reduce) { .mx-tog, .mx-tog::after { transition: none; } }

/* Thời tiết trong panel phải (thẻ dọc). */
.mx-wx-sec:has(#weather-card[hidden]) { display: none; }
.map-page .mx-panel .mx-weather { display: grid; gap: 8px; padding: 0; font-size: 11.5px; overflow: visible; flex: none; }
.map-page .mx-panel .mx-weather .wc-head { display: flex; align-items: center; gap: 10px; }
.map-page .mx-panel .mx-weather .wc-head b { font-size: 24px; }
.map-page .mx-panel .mx-weather .wc-metrics { display: flex; gap: 12px; color: #475569; }
.map-page .mx-panel .mx-weather .wc-forecast { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; overflow: visible; }
.map-page .mx-panel .mx-weather .wc-forecast > div { display: grid; width: auto; }
.map-page .mx-panel .mx-weather .wc-forecast > div:nth-child(n) { display: grid; }
.map-page .mx-panel .mx-weather .wc-src { display: block; font-size: 10px; color: #94a3b8; }

/* Thanh dưới: một hàng mỏng, không tiêu đề khối dài. */
.map-page .map-dock { align-items: center; padding: 6px 8px; border-radius: 12px; min-height: 0; }
.map-page .map-dock .mx-dock-sec { flex-direction: row; align-items: center; gap: 10px; padding: 0 12px; }
.map-page .map-dock .mx-dock-tools { margin-left: auto; border-left: 1px solid #eef2f4; }
.map-page .map-dock h3 { font-size: 10px; }
.map-page .map-dock .mx-bases { gap: 6px; }
.map-page .map-dock .mx-bases button {
  flex-direction: row; width: auto; gap: 6px; padding: 3px 9px 3px 3px; border: 1px solid #e2e8f0; border-radius: 999px; font-size: 11.5px;
}
.map-page .map-dock .mx-bases img { width: 26px; height: 26px; border-radius: 50%; border: 0; box-shadow: none; }
.map-page .map-dock .mx-bases button.active { border-color: #0f766e; background: #f0fdfa; }
.map-page .map-dock .mx-bases button.active img { border: 0; outline: 2px solid #0f766e; outline-offset: 1px; }
.map-page .map-dock .mx-bases button span { display: inline; }
.map-page .map-dock .mx-tools { gap: 2px; }
.map-page .map-dock .mx-tools button { flex-direction: row; gap: 5px; min-width: 0; width: auto; padding: 7px 9px; font-size: 11.5px; border-radius: 9px; }
.map-page .map-dock .mx-tools button .icon { width: 17px; height: 17px; }
.map-page .map-dock .mx-tools button span { display: inline; }
@media (max-width: 1600px) and (min-width: 1101px) {
  .map-page .map-dock .mx-tools button span { display: none; }
}
@media (max-width: 1300px) and (min-width: 1101px) {
  .map-page .map-dock .mx-bases button span { display: none; }
  .map-page .map-dock .mx-bases button { padding: 3px; }
}
/* Màn thấp: thẻ thời tiết bỏ dự báo để panel không phải cuộn. */
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .mx-panel .mx-weather .wc-forecast, .map-page .mx-panel .mx-weather .wc-src { display: none; }
  .map-page .mx-panel { gap: 10px; padding-top: 10px; }
  .mx-sec + .mx-sec { padding-top: 8px; }
  .mx-sec h3 { margin-bottom: 4px; }
  .mx-chip { padding: 4px 8px; }
  .map-page .map-dock .mx-bases button span, .map-page .map-dock .mx-tools button span { display: none; }
}
@media (max-width: 1100px) {
  .map-page .map-dock { flex-wrap: wrap; }
  .map-page .map-dock .mx-dock-tools { margin-left: 0; border-left: 0; }
}
/* Nhãn trên thanh dưới ẩn/hiện theo bề rộng thực của thanh (container query), không theo màn hình. */
.map-page .map-dock { container-type: inline-size; container-name: mapdock; }
.map-page .map-dock .mx-tools button span, .map-page .map-dock .mx-bases button span { display: inline; }
.map-page .map-dock .mx-bases button { padding: 3px 8px 3px 3px; }
.map-page .map-dock .mx-tools button { padding: 7px 7px; }
@container mapdock (max-width: 1080px) { .mx-tools button span { display: none !important; } .mx-tools button { padding: 7px !important; } }
@container mapdock (max-width: 640px) { .mx-bases button span { display: none !important; } .mx-bases button { padding: 3px !important; } .mx-dock-base h3 { display: none; } }
@media (min-width: 1101px) and (max-height: 960px) {
  .map-page .mx-panel .mx-weather .wc-forecast, .map-page .mx-panel .mx-weather .wc-src { display: none; }
}
/* Thẻ thời tiết panel: luôn có dự báo (hôm nay + 3 ngày) dạng một hàng gọn. */
.map-page .mx-panel .mx-weather .wc-forecast { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.map-page .mx-panel .mx-weather .wc-forecast > div:nth-child(n + 5) { display: none !important; }
.map-page .mx-panel .mx-weather .wc-forecast > div { display: grid !important; padding: 4px 0; background: #f8fafc; border-radius: 8px; }
.map-page .mx-panel .mx-weather .wc-forecast > div:first-child { background: #ecfdf5; }
.map-page .mx-panel .mx-weather .wc-forecast .wx { width: 18px; height: 18px; }
@media (min-width: 1101px) and (max-height: 960px) {
  .map-page .mx-panel .mx-weather .wc-metrics, .map-page .mx-panel .mx-weather .wc-src { display: none; }
  .map-page .mx-panel .mx-row { padding-top: 3px; padding-bottom: 3px; }
  .map-page .mx-panel .mx-chip { padding-top: 4px; padding-bottom: 4px; }
  .map-page .mx-panel .mx-weather .wc-head b { font-size: 20px; }
  .map-page .mx-panel .mx-weather .wx.wx-lg { width: 28px; height: 28px; }
}

/* ===== Đợt 3: bỏ thanh dưới; nền bản đồ là nút trong bản đồ; công cụ vào panel ===== */
.map-page .map-center { gap: 0; }
.map-page .map-canvas-shell { flex: 1 1 auto; }

/* Nút chọn nền (góc dưới trái bản đồ, kiểu ô ảnh thu nhỏ). */
.mx-basepick { position: absolute; left: 10px; bottom: 30px; z-index: 4; }
.mx-basepick-btn {
  position: relative; display: block; width: 68px; height: 68px; padding: 0; border: 3px solid #fff; border-radius: 12px; overflow: hidden;
  background: #e2e8f0; box-shadow: 0 4px 14px #0f172a40; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
.mx-basepick-btn:hover, .mx-basepick-btn:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 20px #0f172a4d; outline: none; }
.mx-basepick-btn:focus-visible { border-color: #5eead4; }
.mx-basepick-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mx-basepick-btn span {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 3px;
  padding: 10px 2px 3px; background: linear-gradient(transparent, #000b); color: #fff; font-size: 10.5px; font-weight: 700;
}
.mx-basepick-btn span .icon { width: 11px; height: 11px; filter: brightness(0) invert(1); }
.map-page .mx-basepick-menu {
  position: absolute; left: 76px; bottom: 0; display: flex; gap: 8px; padding: 8px; border-radius: 14px;
  background: #fffffff5; backdrop-filter: blur(6px); box-shadow: 0 10px 28px #0f172a40; animation: mx-pop 0.16s ease-out;
}
.map-page .mx-basepick-menu[hidden] { display: none; }
.map-page .mx-basepick-menu button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 66px; padding: 0; border: 0; background: none; box-shadow: none;
  outline: 0; cursor: pointer; font-size: 10.5px; color: #334155; position: static;
}
.map-page .mx-basepick-menu img { width: 62px; height: 50px; border-radius: 9px; object-fit: cover; border: 2px solid transparent; box-shadow: 0 1px 4px #0002; }
.map-page .mx-basepick-menu button:hover img { border-color: #99f6e4; }
.map-page .mx-basepick-menu button:focus-visible img { outline: 3px solid #5eead4; }
.map-page .mx-basepick-menu button.active img { border-color: #0f766e; }
.map-page .mx-basepick-menu button.active span { color: #0f766e; font-weight: 700; }
.map-page .mx-basepick-menu button span { position: static; padding: 0; background: none; color: inherit; white-space: nowrap; }
@keyframes mx-pop { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: none; } }
/* Chú giải dời sang phải nút nền. */
.map-page .map-legend { left: 88px; bottom: 30px; }

/* Công cụ trong panel phải: lưới 3 cột, biểu tượng + nhãn ngắn. */
.map-page .mx-panel .mx-tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.map-page .mx-panel .mx-tools-grid button {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 6px; width: auto; min-width: 0;
  padding: 7px 8px; border: 1px solid #e2e8f0; border-radius: 9px; background: #fff; font-size: 11.5px; color: #334155; cursor: pointer;
}
.map-page .mx-panel .mx-tools-grid button .icon { width: 16px; height: 16px; flex: none; }
.map-page .mx-panel .mx-tools-grid button span { display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-page .mx-panel .mx-tools-grid button:hover, .map-page .mx-panel .mx-tools-grid button:focus-visible { border-color: #0f766e; background: #f0fdfa; color: #0f766e; outline: none; }
.map-page .mx-panel .mx-tools-grid button.active { background: #0f766e; border-color: #0f766e; color: #fff; }
.map-page .mx-panel .mx-tools-grid button.active .icon { filter: brightness(0) invert(1); }
/* Màn thấp: công cụ thành một hàng biểu tượng. */
@media (min-width: 1101px) and (max-height: 960px) {
  .map-page .mx-panel .mx-tools-grid { grid-template-columns: repeat(6, 1fr); }
  .map-page .mx-panel .mx-tools-grid button { justify-content: center; padding: 7px 0; }
  .map-page .mx-panel .mx-tools-grid button span { display: none; }
}
@media (max-width: 760px) {
  .mx-basepick-btn { width: 56px; height: 56px; }
  .map-page .mx-basepick-menu { left: 64px; flex-wrap: wrap; width: 160px; }
  .map-page .map-legend { left: 74px; max-width: calc(100% - 84px); }
}
@media (min-width: 1101px) and (max-height: 960px) {
  .map-page .mx-panel { gap: 9px; padding-top: 10px; padding-bottom: 8px; }
  .map-page .mx-panel .mx-sec + .mx-sec { padding-top: 8px; }
  .map-page .mx-panel .mx-sec h3 { margin-bottom: 5px; }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .mx-panel { gap: 6px; padding-top: 8px; padding-bottom: 6px; }
  .map-page .mx-panel .mx-sec + .mx-sec { padding-top: 6px; }
  .map-page .mx-panel .mx-sec h3 { margin-bottom: 3px; font-size: 12.5px; }
  .map-page .mx-panel .mx-row { padding-top: 1px; padding-bottom: 1px; }
  .map-page .mx-panel .mx-ico { width: 24px; height: 24px; }
  .map-page .mx-panel .mx-chip { padding-top: 2px; padding-bottom: 2px; }
  .map-page .mx-panel .mx-chips { gap: 4px; }
  .map-page .mx-panel .mx-weather { gap: 4px; }
  .map-page .mx-panel .mx-weather .wc-forecast > div { padding: 2px 0; }
  .map-page .mx-panel .mx-tools-grid button { padding: 5px 0; }
}
/* Vị trí người dùng chọn (chuột phải / giữ lâu) */
.pick-marker { width: 22px; height: 30px; background: #9333ea; clip-path: path('M11 0C4.9 0 0 4.9 0 11c0 8.3 11 19 11 19s11-10.7 11-19C22 4.9 17.1 0 11 0z'); filter: drop-shadow(0 2px 3px #0005); }
.pick-menu { display: grid; gap: 4px; min-width: 190px; font-family: "Be Vietnam Pro", sans-serif; }
.pick-menu strong { font-size: 13px; }
.pick-menu small { color: #64748b; font-size: 10.5px; margin-bottom: 2px; }
.pick-menu button { text-align: left; padding: 6px 8px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; font: 12px "Be Vietnam Pro", sans-serif; cursor: pointer; }
.pick-menu button:hover, .pick-menu button:focus-visible { border-color: #9333ea; background: #faf5ff; outline: none; }
.pick-menu button.pick-clear { margin-top: 2px; color: #b91c1c; border-color: #fecaca; }
.pick-menu button.pick-clear:hover { background: #fef2f2; border-color: #f87171; }

/* ===================================================================
   Panel phải luôn vừa khít chiều cao, không cuộn, không trống cuối:
   - "Lớp bản đồ" và "Dịch vụ" giữ kích thước tự nhiên;
   - "Thời tiết" và "Công cụ" CHIA NHAU phần còn lại (flex-basis 0) và tự đổi kiểu hiển thị
     theo chỗ được chia (container query): hẹp → gọn, rộng → chi tiết.
   =================================================================== */
@media (min-width: 1101px) {
  .map-page .mx-panel { overflow: hidden; }
  .map-page .mx-panel > .mx-wx-sec { flex: 3 1 0; min-height: 150px; display: flex; flex-direction: column; container: wxsec / size; overflow: hidden; }
  .map-page .mx-panel > .mx-tools-sec { flex: 1 1 0; min-height: 64px; display: flex; flex-direction: column; container: toolsec / size; overflow: hidden; }

  /* --- Thời tiết: mặc định GỌN (đầu thẻ + 4 ô dự báo ngang) --- */
  .map-page .mx-panel .mx-weather { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 0; overflow: hidden; }
  .map-page .mx-panel .mx-weather > * { width: 100%; box-sizing: border-box; flex: none; margin: 0; }
  .map-page .mx-panel .mx-weather .wc-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: #f0f7f6; }
  .map-page .mx-panel .mx-weather .wc-head b { font-size: 22px; }
  .map-page .mx-panel .mx-weather .wc-head span { font-size: 11.5px; white-space: normal; }
  .map-page .mx-panel .mx-weather .wc-metrics, .map-page .mx-panel .mx-weather .wc-src { display: none; }
  .map-page .mx-panel .mx-weather .wc-forecast {
    display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(0, 120px); gap: 4px; max-height: none; overflow: hidden;
    flex: 1 1 auto; min-height: 50px; align-content: stretch;
  }
  .map-page .mx-panel .mx-weather .wc-forecast > div { align-content: center; gap: 4px !important; }
  .map-page .mx-panel .mx-weather .wc-forecast .wx { width: 24px; height: 24px; }
  .map-page .mx-panel .mx-weather .wc-forecast b { font-size: 14px !important; }
  .map-page .mx-panel .mx-weather .wc-forecast > div {
    display: grid; grid-template-columns: 1fr; justify-items: center; align-items: center; gap: 0; width: auto; padding: 3px 0;
    border-radius: 9px; background: #f8fafc; border: 1px solid #eef2f6;
  }
  .map-page .mx-panel .mx-weather .wc-forecast > div:first-child { background: #ecfdf5; border-color: #bbf7d0; }
  .map-page .mx-panel .mx-weather .wc-forecast small { font-size: 10px; font-weight: 600; color: #334155; white-space: nowrap; }
  .map-page .mx-panel .mx-weather .wc-forecast em { display: none; font-style: normal; font-size: 11.5px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .map-page .mx-panel .mx-weather .wc-forecast b { font-size: 12px; color: #0c1930; }

  /* Có chỗ vừa: dự báo thành danh sách theo hàng, các hàng giãn đều lấp chỗ trống. */
  @container wxsec (min-height: 196px) {
    .map-page .mx-panel .mx-weather .wc-forecast { flex: 1 1 auto; grid-template-columns: 1fr; grid-auto-rows: minmax(24px, 54px); align-content: start; }
    .map-page .mx-panel .mx-weather .wc-forecast > div { grid-template-columns: 70px 26px 1fr auto; justify-items: start; gap: 8px; padding: 0 10px; }
    .map-page .mx-panel .mx-weather .wc-forecast small { font-size: 12px; }
    .map-page .mx-panel .mx-weather .wc-forecast em { display: block; }
    .map-page .mx-panel .mx-weather .wc-forecast b { font-size: 14px; justify-self: end; }
    .map-page .mx-panel .mx-weather .wc-head b { font-size: 26px; }
    .map-page .mx-panel .mx-weather .wc-head { padding: 8px 12px; }
  }
  /* Có nhiều chỗ: thêm 3 ô chỉ số (gió, độ ẩm, cảm giác như) và nguồn. */
  @container wxsec (min-height: 300px) {
    .map-page .mx-panel .mx-weather .wc-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0; border: 0; }
    .map-page .mx-panel .mx-weather .wc-metrics span {
      display: flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 4px; border-radius: 10px;
      background: #f8fafc; border: 1px solid #eef2f6; font-size: 12px; font-weight: 600; color: #334155; white-space: nowrap;
    }
    .map-page .mx-panel .mx-weather .wc-metrics .icon { width: 15px; height: 15px; }
  }
  @container wxsec (min-height: 360px) {
    .map-page .mx-panel .mx-weather .wc-src { display: block; margin-top: auto; text-align: right; font-size: 10px; color: #94a3b8; }
  }

  /* --- Công cụ: mặc định 1 hàng 6 biểu tượng; có chỗ thì lưới 3 cột có chữ, nút giãn tới đáy --- */
  .map-page .mx-panel .mx-tools-sec .mx-tools-grid {
    flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: minmax(34px, 1fr); gap: 6px;
  }
  .map-page .mx-panel .mx-tools-sec .mx-tools-grid button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: auto; min-width: 0; height: auto; max-height: 72px;
    padding: 4px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; font-size: 11.5px; color: #334155;
  }
  .map-page .mx-panel .mx-tools-sec .mx-tools-grid button:hover { border-color: #0f766e; background: #f0fdfa; color: #0f766e; }
  .map-page .mx-panel .mx-tools-sec .mx-tools-grid button .icon { width: 18px; height: 18px; }
  .map-page .mx-panel .mx-tools-sec .mx-tools-grid button span { display: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  @container toolsec (min-height: 120px) {
    .map-page .mx-panel .mx-tools-sec .mx-tools-grid { grid-template-columns: repeat(3, 1fr); }
    .map-page .mx-panel .mx-tools-sec .mx-tools-grid button span { display: block; }
  }
}
/* Lớp bản đồ và Dịch vụ cũng giãn nhẹ (dòng / nút giãn đều) để màn hình rất cao vẫn không trống cuối panel. */
@media (min-width: 1101px) {
  .map-page .mx-panel > .mx-sec:not(.mx-wx-sec):not(.mx-tools-sec) { flex: 0.15 0 auto; display: flex; flex-direction: column; }
  .map-page .mx-panel > .mx-sec:not(.mx-wx-sec):not(.mx-tools-sec) > .mx-rows:not(:empty) { flex: 1 0 auto; display: grid; grid-auto-rows: minmax(min-content, 1fr); align-content: stretch; }
  .map-page .mx-panel > .mx-sec:not(.mx-wx-sec):not(.mx-tools-sec) > .mx-chips { flex: 1 0 auto; grid-auto-rows: minmax(min-content, 1fr); align-content: stretch; }
  .map-page .mx-panel .mx-chips .mx-chip { align-self: stretch; }
  .map-page .mx-panel .mx-rows .mx-row { align-self: stretch; }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .mx-panel > .mx-wx-sec { min-height: 132px; }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .mx-panel .mx-weather { gap: 4px; }
  .map-page .mx-panel .mx-weather .wc-head { padding: 4px 10px; }
  .map-page .mx-panel .mx-weather .wc-head .wx-lg { width: 28px; height: 28px; }
  .map-page .mx-panel .mx-weather .wc-forecast { min-height: 0; }
  .map-page .mx-panel .mx-weather .wc-forecast > div { gap: 0 !important; padding: 2px 0; }
  .map-page .mx-panel .mx-weather .wc-forecast .wx { width: 16px; height: 16px; }
  .map-page .mx-panel .mx-weather .wc-forecast b { font-size: 12px !important; line-height: 1.2; }
  .map-page .mx-panel .mx-weather .wc-forecast small { line-height: 1.2; }
}

/* ===================================================================
   Popup dịch vụ du lịch và sự cố giao thông (TomTom): đầu thẻ màu theo loại / mức độ,
   danh sách thông tin có biểu tượng, nút thao tác rõ ràng, dòng nguồn nhỏ ở cuối.
   =================================================================== */
.pp-popup .mapboxgl-popup-content, .pp-popup .maplibregl-popup-content { padding: 0; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 32px #0f172a2e; }
.pp-popup .mapboxgl-popup-close-button, .pp-popup .maplibregl-popup-close-button { top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; color: #fff; background: #0f172a40; font-size: 16px; line-height: 22px; }
.pp-popup .mapboxgl-popup-close-button:hover { background: #0f172a70; }
.pp { --c: #0f766e; font-family: "Be Vietnam Pro", system-ui, sans-serif; color: #0f172a; min-width: 230px; }
.pp-head { display: flex; align-items: center; gap: 10px; padding: 12px 34px 12px 12px; background: var(--c); color: #fff; }
.pp-ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #ffffff2e; box-shadow: inset 0 0 0 1px #ffffff40; }
.pp-ico .icon { width: 20px; height: 20px; filter: brightness(0) invert(1); }
.pp-title { min-width: 0; }
.pp-title h3 { margin: 0; font-size: 14px; line-height: 1.3; font-weight: 700; color: #fff; overflow-wrap: anywhere; }
.pp-kind { display: block; margin-top: 2px; font-size: 11.5px; opacity: 0.92; }
.pp-stars { color: #fde68a; letter-spacing: 1px; }
.pp-ok { color: #bbf7d0; font-weight: 600; }
.pp-badge { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: #ffffff33; font-size: 11px; font-weight: 600; }
.pp-desc { margin: 10px 12px 0; font-size: 12.5px; line-height: 1.5; color: #334155; }
.pp-list { list-style: none; margin: 8px 12px 0; padding: 0; display: grid; gap: 5px; }
.pp-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.45; color: #334155; overflow-wrap: anywhere; }
.pp-list li .icon { flex: none; width: 15px; height: 15px; margin-top: 1px; padding: 3px; border-radius: 6px; background: color-mix(in srgb, var(--c) 12%, #fff); box-sizing: content-box; }
.pp-list a { color: color-mix(in srgb, var(--c) 80%, #0f172a); font-weight: 600; text-decoration: none; }
.pp-list a:hover { text-decoration: underline; }
.pp-stats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin: 10px 12px 0; }
.pp-stats > div { padding: 8px; border-radius: 10px; text-align: center; background: color-mix(in srgb, var(--c) 10%, #fff); border: 1px solid color-mix(in srgb, var(--c) 25%, #fff); }
.pp-stats b { display: block; font-size: 18px; line-height: 1.1; color: var(--c); }
.pp-stats small { font-size: 10.5px; color: #64748b; }
.pp-warn { margin: 8px 12px 0; padding: 6px 9px; border-radius: 8px; background: #fef2f2; color: #b91c1c; font-size: 11.5px; font-weight: 600; }
.pp-actions { display: flex; gap: 6px; margin: 10px 12px 0; }
.pp > :last-child { margin-bottom: 12px; }
.pp > .pp-src:last-child { margin-bottom: 0; }
.pp-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; border-radius: 9px; border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); background: #fff; color: color-mix(in srgb, var(--c) 85%, #0f172a); font: 600 12px "Be Vietnam Pro", sans-serif; cursor: pointer; text-decoration: none; }
.pp-btn .icon { width: 14px; height: 14px; }
.pp-btn.primary { background: var(--c); border-color: var(--c); color: #fff; }
.pp-btn.primary .icon { filter: brightness(0) invert(1); }
.pp-btn:hover { filter: brightness(1.06); box-shadow: 0 3px 10px color-mix(in srgb, var(--c) 30%, transparent); }
.pp-src { margin: 10px 0 0; padding: 7px 12px 9px; border-top: 1px solid #f1f5f9; font-size: 10.5px; color: #94a3b8; }

/* Dạng gọn (ít chỗ): ô dự báo thấp → thu nhỏ biểu tượng, giãn dòng để chữ không bị cắt. */
@media (min-width: 1101px) {
  @container wxsec (max-height: 195.98px) {
    .map-page .mx-panel .mx-weather .wc-forecast > div { padding: 1px 0 !important; gap: 0 !important; align-content: center; }
    .map-page .mx-panel .mx-weather .wc-forecast .wx { width: 18px !important; height: 18px !important; }
    .map-page .mx-panel .mx-weather .wc-forecast small { line-height: 1.15; font-size: 10px; }
    .map-page .mx-panel .mx-weather .wc-forecast b { line-height: 1.1; font-size: 13px !important; }
  }
}
/* Thanh công cụ nổi trên bản đồ: khi rê chuột nền xanh nhạt + biểu tượng giữ màu tối (trước đây biểu tượng
   bị đổi sang trắng trên nền trắng nên nút trông như trống). Nút đang bật vẫn nền xanh, biểu tượng trắng. */
.map-floating-tools .icon-btn:hover:not([aria-pressed="true"]) { background: #e6f2f0; }
.map-floating-tools .icon-btn:not([aria-pressed="true"]):hover .icon,
.map-floating-tools .icon-btn:not([aria-pressed="true"]):focus .icon { filter: none; }
.map-floating-tools .icon-btn[aria-pressed="true"]:hover { background: #00574f; }

/* ===================================================================
   Thời tiết (kiểu thẻ phẳng): nền trắng, biểu tượng xanh dương trong ô vuông xanh nhạt,
   nhiệt độ chữ đậm, chỉ số dạng ô biểu tượng + nhãn, ô dự báo nền trắng viền xám.
   =================================================================== */
.map-page .mx-panel .mx-weather .wx { --wx: #1d8fd6 !important; animation: none !important; }
.map-page .mx-panel .mx-weather .wc-head { position: static; padding: 4px 0 !important; border: 0 !important; background: none !important; gap: 12px !important; }
/* Ô vuông xanh nhạt chứa biểu tượng thời tiết (biểu tượng xanh dương). */
.wx-tile { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #e3f2fb; }
.wx-tile .wx { width: 18px !important; height: 18px !important; }
.wx-tile-lg { width: 52px; height: 52px; border-radius: 14px; }
.wx-tile-lg .wx { width: 32px !important; height: 32px !important; }
.map-page .mx-panel .mx-weather .wc-head b { color: #0f2a44 !important; font-size: 28px; font-weight: 700; }
.map-page .mx-panel .mx-weather .wc-head span { color: #64748b !important; opacity: 1 !important; font-size: 12.5px !important; }
.map-page .mx-panel .mx-weather .wc-metrics span {
  flex-direction: column !important; gap: 2px !important; padding: 6px 4px !important; border-radius: 10px;
  background: #fff !important; border: 1px solid #e5e9ee !important; color: #0f2a44 !important; font-weight: 700;
}
.map-page .mx-panel .mx-weather .wc-metrics .icon { width: 15px !important; height: 15px !important; padding: 5px; border-radius: 8px; background: #e3f2fb; box-sizing: content-box; opacity: 1 !important; filter: invert(42%) sepia(93%) saturate(1352%) hue-rotate(176deg) brightness(91%) contrast(92%); }
.map-page .mx-panel .mx-weather .wc-forecast > div {
  background: #fff !important; border: 1px solid #e5e9ee !important; border-radius: 10px;
  transition: none !important; transform: none !important; box-shadow: none !important;
}
.map-page .mx-panel .mx-weather .wc-forecast > div:first-child { background: #fff !important; border-color: #cfe6f5 !important; }
.map-page .mx-panel .mx-weather .wc-forecast small { color: #0f2a44 !important; font-weight: 700 !important; }
.map-page .mx-panel .mx-weather .wc-forecast b { color: #0f2a44 !important; }
.map-page .mx-panel .mx-weather .wc-forecast em { color: #64748b; }

/* Công cụ: nút trắng viền xám, biểu tượng và chữ màu đen; rê chuột nền xám nhạt. */
.mx-tico { display: block; width: 18px; height: 18px; flex: none; background: #1f2937; mask-size: contain; -webkit-mask-size: contain; mask-repeat: no-repeat; -webkit-mask-repeat: no-repeat; mask-position: center; -webkit-mask-position: center; }
.map-page .mx-panel .mx-tools-sec .mx-tools-grid button { border: 1px solid #e2e8f0 !important; background: #fff !important; color: #1f2937 !important; }
.map-page .mx-panel .mx-tools-sec .mx-tools-grid button:hover, .map-page .mx-panel .mx-tools-sec .mx-tools-grid button.active, .map-page .mx-panel .mx-tools-sec .mx-tools-grid button[aria-pressed='true'] { background: #f1f5f9 !important; border-color: #cbd5e1 !important; color: #0f172a !important; }
/* Khoảng đệm dưới để nút công cụ không sát đáy panel. */
.map-page .mx-panel { padding-bottom: 18px !important; }
/* Màn thấp: danh sách lớp dài thêm ("Nhà 3D") → khối thời tiết / công cụ được phép gọn hơn để panel không cuộn. */
@media (min-width: 1101px) and (max-height: 960px) {
  .map-page .mx-panel > .mx-wx-sec { min-height: 118px; }
  .map-page .mx-panel > .mx-tools-sec { min-height: 58px; }
  .map-page .mx-panel .mx-weather .wx-tile-lg { width: 40px; height: 40px; border-radius: 11px; }
  .map-page .mx-panel .mx-weather .wx-tile-lg .wx { width: 24px !important; height: 24px !important; }
  .map-page .mx-panel .mx-weather .wc-head b { font-size: 22px !important; }
  .map-page .mx-panel .mx-weather .wc-forecast .wx-tile { width: 22px; height: 22px; }
  .map-page .mx-panel .mx-weather .wc-forecast .wx-tile .wx { width: 15px !important; height: 15px !important; }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .mx-panel > .mx-wx-sec { min-height: 104px; }
  .map-page .mx-panel .mx-rows .mx-row { min-height: 0; padding-top: 1px; padding-bottom: 1px; }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .mx-panel .mx-weather .wc-forecast .wx-tile { display: none; }
  .map-page .mx-panel .mx-weather .wc-forecast > div { padding: 2px 0 !important; }
}
/* Màn thấp: dòng "Lớp bản đồ" và nút dịch vụ gọn hơn để khối thời tiết đủ chỗ hiện dự báo. */
@media (min-width: 1101px) and (max-height: 960px) {
  .map-page .mx-panel .mx-rows .mx-row { padding: 2px 6px !important; }
  .map-page .mx-panel .mx-rows .mx-ico { width: 22px; height: 22px; border-radius: 7px; }
  .map-page .mx-panel .mx-rows .mx-ico .icon { width: 13px; height: 13px; }
  .map-page .mx-panel .mx-chip { padding-top: 3px !important; padding-bottom: 3px !important; }
  .map-page .mx-panel > .mx-wx-sec { min-height: 150px; }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .mx-panel > .mx-wx-sec { min-height: 128px; }
  .map-page .mx-panel .mx-rows .mx-row { padding: 1px 6px !important; }
}
@media (min-width: 1101px) and (max-height: 820px) {
  .map-page .mx-panel > .mx-wx-sec { min-height: 114px; }
  .map-page .mx-panel .mx-weather { gap: 5px !important; }
}
/* Mọi cỡ màn hình: khối thời tiết luôn đủ chỗ cho thẻ nhiệt độ + một hàng ô dự báo (không bị cắt chữ). */
@media (min-width: 1101px) and (min-height: 961px) {
  .map-page .mx-panel > .mx-wx-sec { min-height: 168px; }
}
/* Gọn theo CHIỀU CAO THẬT của panel (container query), không theo chiều cao cửa sổ:
   panel thấp thì dòng lớp, nút dịch vụ, thời tiết gọn lại để mọi khối vừa khít, không cắt chữ. */
@media (min-width: 1101px) {
  .map-page .mx-panel { container: mxpanel / size; }
  @container mxpanel (max-height: 840px) {
    .map-page .mx-panel .mx-rows .mx-row { padding: 2px 6px !important; }
    .map-page .mx-panel .mx-rows .mx-ico { width: 22px; height: 22px; border-radius: 7px; }
    .map-page .mx-panel .mx-rows .mx-ico .icon { width: 13px; height: 13px; }
    .map-page .mx-panel .mx-chip { padding-top: 3px !important; padding-bottom: 3px !important; }
    .map-page .mx-panel > .mx-wx-sec { min-height: 150px; }
    .map-page .mx-panel > .mx-tools-sec { min-height: 58px; }
    .map-page .mx-panel .mx-weather .wx-tile-lg { width: 40px; height: 40px; border-radius: 11px; }
    .map-page .mx-panel .mx-weather .wx-tile-lg .wx { width: 24px !important; height: 24px !important; }
    .map-page .mx-panel .mx-weather .wc-head b { font-size: 22px !important; }
    .map-page .mx-panel .mx-weather .wc-forecast .wx-tile { width: 22px; height: 22px; }
    .map-page .mx-panel .mx-weather .wc-forecast .wx-tile .wx { width: 15px !important; height: 15px !important; }
  }
  @container mxpanel (max-height: 640px) {
    .map-page .mx-panel .mx-rows .mx-row { padding: 1px 6px !important; }
    .map-page .mx-panel > .mx-wx-sec { min-height: 114px; }
    .map-page .mx-panel .mx-weather .wc-forecast .wx-tile { display: none; }
  }
}
