.mas-locations {
  --mas-surface: #1f2023;
  --mas-surface-soft: #27292d;
  --mas-surface-strong: #111214;
  --mas-border: rgba(255, 255, 255, 0.13);
  --mas-border-strong: rgba(255, 255, 255, 0.24);
  --mas-text: #ffffff;
  --mas-muted: rgba(255, 255, 255, 0.72);
  --mas-subtle: rgba(255, 255, 255, 0.52);
  --mas-accent: #dd0000;
  --mas-accent-dark: #9f0b0b;
  --mas-focus: rgba(221, 0, 0, 0.38);
  color: var(--mas-text);
  margin: 22px 0 58px;
  width: 100%;
}

.mas-locations,
.mas-locations * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.mas-locations__grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(420px, 1.22fr);
  gap: 20px;
  align-items: start;
}

.mas-locations__header {
  margin-bottom: 14px;
}

.mas-locations__title {
  color: var(--mas-text);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.16;
  margin: 0 0 8px;
}

.mas-locations__copy {
  color: var(--mas-muted);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
}

.mas-locations__controls {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 158px);
  gap: 8px;
  margin: 16px 0 10px;
}

.mas-locations__search,
.mas-locations__select {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  background-color: var(--mas-surface-strong);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-sizing: border-box !important;
  color: var(--mas-text);
  display: block;
  font-family: inherit;
  font-size: 14px;
  height: 48px;
  line-height: 1.2;
  min-height: 48px;
  outline: none;
  padding: 0 12px;
  position: relative;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
  width: 100%;
}

.mas-locations__select {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.75) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.75) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px;
  background-repeat: no-repeat;
  background-size: 6px 6px;
  border-radius: 8px !important;
  cursor: pointer;
  overflow: hidden;
  padding-right: 34px;
  text-overflow: ellipsis;
}

.mas-locations__search:focus,
.mas-locations__select:focus,
.mas-location-card:focus-visible,
.mas-location-action:focus-visible,
.mas-popup-action:focus-visible {
  border-color: var(--mas-accent);
  box-shadow: 0 0 0 2px var(--mas-focus);
  z-index: 2;
}

.mas-locations__meta {
  color: var(--mas-subtle);
  font-size: 13px;
  margin: 0 0 14px;
}

.mas-locations__list {
  display: grid;
  gap: 10px;
  max-height: 632px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-color: var(--mas-accent) rgba(255, 255, 255, 0.12);
  scrollbar-width: thin;
}

.mas-location-card {
  background: linear-gradient(180deg, var(--mas-surface-soft), var(--mas-surface));
  border: 1px solid var(--mas-border);
  border-radius: 8px;
  color: var(--mas-text);
  outline: none;
  padding: 15px;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.mas-location-card:hover,
.mas-location-card.is-active {
  border-color: rgba(221, 0, 0, 0.72);
  background: linear-gradient(180deg, #303136, #202124);
}

.mas-location-card.is-active {
  box-shadow: inset 3px 0 0 var(--mas-accent);
}

.mas-location-card__top {
  align-items: flex-start;
  display: flex;
  gap: 11px;
}

.mas-location-card__number {
  align-items: center;
  background: linear-gradient(135deg, var(--mas-accent), var(--mas-accent-dark));
  border-radius: 7px;
  color: #ffffff;
  display: inline-flex;
  flex: 0 0 34px;
  font-size: 14px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  line-height: 1;
}

.mas-location-card__number--approx {
  background: linear-gradient(135deg, #62666d, #373a40);
}

.mas-location-card__heading {
  color: var(--mas-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.24;
  margin: 0 0 4px;
}

.mas-location-card__leader,
.mas-location-card__address,
.mas-location-card__note {
  color: var(--mas-muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
}

.mas-location-card__note {
  color: rgba(255, 255, 255, 0.62);
  margin-top: 6px;
}

.mas-location-card__actions {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.mas-location-action,
.mas-popup-action {
  align-items: center;
  border-radius: 7px;
  box-sizing: border-box !important;
  display: inline-flex;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
  height: 44px !important;
  justify-content: center;
  line-height: 1;
  margin: 0 !important;
  max-height: 44px !important;
  min-height: 44px !important;
  padding: 0 14px !important;
  text-decoration: none;
  transform-origin: center;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  vertical-align: top;
}

.mas-location-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--mas-border);
  color: var(--mas-text);
  cursor: pointer;
  position: relative;
}

.mas-location-action--primary {
  background: var(--mas-accent);
  border-color: var(--mas-accent);
  color: #ffffff;
}

.mas-location-action--compact {
  flex: 0 0 44px;
  gap: 0;
  overflow: hidden;
  padding: 0 !important;
  width: 44px !important;
}

.mas-location-action__label {
  white-space: nowrap;
}

.mas-location-action--compact .mas-location-action__label {
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.mas-location-action:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #161719;
  text-decoration: none;
}

.mas-location-action--primary:hover {
  background: #f00000;
  border-color: #f00000;
  color: #ffffff;
}

.mas-location-action svg,
.mas-popup-action svg {
  flex: 0 0 15px;
  height: 15px;
  width: 15px;
}

.mas-locations__empty {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--mas-border);
  border-radius: 8px;
  color: var(--mas-muted);
  font-size: 14px;
  line-height: 1.45;
  padding: 16px;
}

.mas-locations__map-shell {
  position: sticky;
  top: 112px;
}

.mas-locations__map {
  background: var(--mas-surface-strong);
  border: 1px solid var(--mas-border-strong);
  border-radius: 8px;
  height: min(68vh, 640px);
  min-height: 540px;
  overflow: hidden;
  width: 100%;
}

.mas-locations__map-fallback {
  align-items: center;
  color: var(--mas-muted);
  display: flex;
  font-size: 15px;
  height: 100%;
  justify-content: center;
  line-height: 1.5;
  padding: 24px;
  text-align: center;
}

.mas-locations .maplibregl-map {
  background: var(--mas-surface-strong);
  color: #161719;
  font-family: inherit;
}

.mas-locations .maplibregl-ctrl-attrib {
  font-size: 11px;
}

.mas-locations .maplibregl-ctrl button {
  border-radius: 0;
}

.mas-locations .maplibregl-popup {
  max-width: min(430px, calc(100vw - 48px)) !important;
}

.mas-locations .maplibregl-popup-content {
  background: #1f2023;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.36);
  color: var(--mas-text);
  padding: 18px 54px 18px 20px;
}

.mas-locations .maplibregl-popup-tip {
  border-top-color: #1f2023;
}

.mas-locations .maplibregl-popup-anchor-top .maplibregl-popup-tip,
.mas-locations .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.mas-locations .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: #1f2023;
}

.mas-locations .maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: #1f2023;
}

.mas-locations .maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: #1f2023;
}

.mas-locations .maplibregl-popup-close-button {
  align-items: center;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  font-size: 24px;
  height: 32px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 12px !important;
  top: 10px !important;
  width: 32px;
}

.mas-locations .maplibregl-popup-close-button:hover,
.mas-locations .maplibregl-popup-close-button:focus {
  background: transparent;
  color: #ffffff;
}

.mas-map-pin {
  --mas-pin-fill: #dd0000;
  display: block;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.32));
  height: 58px;
  left: 5px;
  position: absolute;
  top: 0;
  transform: none;
  transition: transform 150ms ease, filter 150ms ease;
  width: 48px;
}

.mas-map-pin-wrap {
  appearance: none;
  -webkit-appearance: none;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  cursor: pointer;
  display: block;
  height: 58px !important;
  margin: 0 !important;
  outline: 0;
  overflow: visible !important;
  padding: 0 !important;
  width: 58px !important;
}

.mas-map-pin-wrap:hover,
.mas-map-pin-wrap:focus,
.mas-map-pin-wrap:active {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.mas-map-pin__shape {
  fill: var(--mas-pin-fill);
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 4px;
}

.mas-map-pin__label {
  fill: #ffffff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  text-anchor: middle;
}

.mas-map-pin__label {
  dominant-baseline: middle;
}

.mas-map-pin--approx {
  --mas-pin-fill: #565b64;
}

.mas-map-pin--active {
  filter: drop-shadow(0 0 10px rgba(221, 0, 0, 0.65));
  transform: scale(1.12);
}

.mas-map-popup {
  color: var(--mas-text);
  min-width: 330px;
}

.mas-map-popup h3 {
  color: var(--mas-text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.22;
  margin: 0 0 7px;
}

.mas-map-popup p {
  color: var(--mas-muted);
  font-size: 13px;
  line-height: 1.42;
  margin: 0 0 7px;
}

.mas-map-popup__actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  margin-top: 10px;
}

.mas-popup-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--mas-border-strong);
  color: var(--mas-text);
}

.mas-popup-action--primary {
  background: var(--mas-accent);
  border-color: var(--mas-accent);
  color: #ffffff;
}

.mas-locations .maplibregl-popup .mas-popup-action {
  color: var(--mas-text);
}

.mas-locations .maplibregl-popup .mas-popup-action--primary {
  color: #ffffff;
}

.mas-locations .maplibregl-popup .mas-popup-action:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #161719;
  text-decoration: none;
}

.mas-locations .maplibregl-popup .mas-popup-action--primary:hover {
  background: #f00000;
  border-color: #f00000;
  color: #ffffff;
}

.mas-sr-only {
  clip: rect(0, 0, 0, 0);
  border: 0;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

@media (max-width: 980px) {
  .mas-locations__grid {
    grid-template-columns: 1fr;
  }

  .mas-locations__map-shell {
    order: -1;
    position: static;
  }

  .mas-locations__map {
    height: 450px;
    min-height: 450px;
  }

  .mas-locations__list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 640px) {
  .mas-locations {
    margin-bottom: 42px;
  }

  .mas-locations__title {
    font-size: 24px;
  }

  .mas-locations__controls {
    grid-template-columns: 1fr;
  }

  .mas-locations__map {
    height: 360px;
    min-height: 360px;
  }

  .mas-map-popup {
    min-width: 260px;
  }

  .mas-map-popup__actions {
    flex-wrap: wrap;
  }

  .mas-location-card {
    padding: 13px;
  }

  .mas-location-card__heading {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mas-location-card,
  .mas-location-action,
  .mas-popup-action,
  .mas-map-pin {
    transition: none;
  }
}
