.salary-map {
  --map-border: #d8dee9;
  --map-ink: #172033;
  --map-muted: #5f6b7a;
  --map-surface: #ffffff;
  --map-background: #f8fafc;
  --map-focus: #0f172a;
  box-sizing: border-box;
  color: var(--map-ink);
  display: grid;
  font: inherit;
  gap: 0.75rem;
  min-width: 0;
  width: 100%;
}

.salary-map *,
.salary-map *::before,
.salary-map *::after {
  box-sizing: border-box;
}

.salary-map__stage {
  background: var(--map-surface);
  border: 1px solid var(--map-border);
  border-radius: 0.85rem;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.salary-map__viewport {
  aspect-ratio: 8 / 9;
  background: var(--map-background);
  min-height: 22rem;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
  width: 100%;
}

.salary-map__svg {
  display: block;
  height: 100%;
  max-height: 52rem;
  outline: none;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  width: 100%;
}

.salary-map__svg:focus-visible {
  box-shadow: inset 0 0 0 3px #2563eb;
}

.salary-map__background {
  fill: #f8fafc;
}

.salary-map__content {
  isolation: isolate;
}

.salary-map__region {
  cursor: pointer;
  fill-rule: evenodd;
  outline: none;
  paint-order: stroke fill;
  stroke: #64748b;
  stroke-linejoin: round;
  stroke-width: 1.1;
  transition:
    filter 120ms ease,
    stroke 120ms ease,
    stroke-width 120ms ease;
  vector-effect: non-scaling-stroke;
}

.salary-map__region:hover {
  filter: brightness(0.94) saturate(1.12);
  stroke: #1e3a8a;
  stroke-width: 2.3;
}

.salary-map__region:focus-visible {
  filter: brightness(0.94) saturate(1.12);
  stroke: #111827;
  stroke-dasharray: 4 2;
  stroke-width: 3;
}

.salary-map__region.is-selected {
  stroke: var(--map-focus);
  stroke-dasharray: 7 2.5;
  stroke-width: 3.5;
}

.salary-map__region.is-selected:focus-visible {
  stroke-width: 4.2;
}

.salary-map__region.is-focused:not(.is-selected) {
  stroke: #111827;
  stroke-dasharray: 4 2;
  stroke-width: 2.8;
}

.salary-map__labels {
  pointer-events: none;
}

.salary-map__label {
  pointer-events: none;
}

.salary-map__label-text {
  fill: #111827;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  paint-order: stroke fill;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-linejoin: round;
  stroke-width: 0.23em;
}

.salary-map__label-name,
.salary-map__label-value {
  dominant-baseline: middle;
}

.salary-map__label-value {
  font-weight: 600;
}

.salary-map__label-leader {
  fill: none;
  stroke: #475569;
  stroke-dasharray: 2 2;
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}

.salary-map__label-marker {
  fill: #334155;
  opacity: 0.78;
  pointer-events: none;
}

.salary-map__toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  z-index: 2;
}

.salary-map__control {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  color: #172033;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  height: 2.75rem;
  justify-content: center;
  line-height: 1;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.35rem;
  touch-action: manipulation;
  width: 2.75rem;
}

.salary-map__control--reset {
  font-size: 0.75rem;
  width: auto;
}

.salary-map__control:hover {
  background: #eff6ff;
  border-color: #2563eb;
}

.salary-map__control:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 2px;
}

.salary-map__control:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.salary-map__legend {
  background: var(--map-surface);
  border: 1px solid var(--map-border);
  border-radius: 0.7rem;
  color: var(--map-ink);
  min-width: 0;
  padding: 0.85rem 1rem;
}

.salary-map__legend-title {
  font-size: 0.95rem;
  line-height: 1.3;
  margin: 0 0 0.55rem;
}

.salary-map__legend-ramp {
  display: grid;
  gap: 0.2rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: 0.9rem;
}

.salary-map__legend-swatch {
  border: 1px solid rgba(30, 41, 59, 0.2);
  display: block;
  height: 0.9rem;
  min-width: 0;
}

.salary-map__legend-labels {
  align-items: start;
  color: var(--map-muted);
  display: grid;
  font-size: 0.68rem;
  gap: 0.25rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  line-height: 1.12;
  margin-top: 0.25rem;
  min-height: 3.45em;
  min-width: 0;
}

.salary-map__legend-bin {
  align-items: center;
  display: grid;
  gap: 0.08rem;
  grid-template-rows: auto auto auto;
  letter-spacing: -0.02em;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
}

.salary-map__legend-bound {
  display: block;
  max-width: 100%;
}

.salary-map__legend-separator {
  font-size: 0.72em;
  line-height: 0.8;
}

.salary-map__legend-unavailable {
  color: var(--map-muted);
  font-size: 0.8rem;
  grid-column: 1 / -1;
}

.salary-map__legend-missing {
  align-items: center;
  color: var(--map-muted);
  display: flex;
  font-size: 0.78rem;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.salary-map__legend-missing-swatch {
  background-color: #e5e7eb;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0 3px,
    #9ca3af 3px 4px,
    transparent 4px 7px
  );
  border: 1px solid #9ca3af;
  display: inline-block;
  flex: 0 0 auto;
  height: 0.95rem;
  width: 1.6rem;
}

.salary-map__legend-explanation {
  color: var(--map-muted);
  font-size: 0.78rem;
  line-height: 1.5;
  margin: 0.65rem 0 0;
}

@media (max-width: 40rem) {
  .salary-map__viewport {
    min-height: 19rem;
  }

  .salary-map__toolbar {
    right: 0.5rem;
    top: 0.5rem;
  }

  .salary-map__legend {
    padding: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .salary-map__region {
    transition: none;
  }
}
