/* ── MAP LAYOUT ─────────────────────────────────────────── */
.kanban--map {
  display: block;
  padding-bottom: 0;
}

.map-explorer-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

.map-explorer-heading h2 {
  font-size: clamp(20px, 2vw, 27px);
  letter-spacing: -.6px;
  line-height: 1.3;
  margin: 8px 0;
}

.map-explorer-heading p {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.7;
}

.map-total {
  flex-shrink: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.map-explorer {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 20px;
  min-width: 0;
}

.map-job-list {
  min-width: 0;
  max-height: 76vh;
  overflow-y: auto;
  padding: 0 6px 6px 0;
  scrollbar-width: thin;
}

.map-job-list h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  margin: 4px 0 14px;
}

.map-job-list h3:not(:first-child) {
  margin-top: 24px;
}

.map-job-list h3 span {
  border-radius: 6px;
  background: var(--card);
  padding: 3px 8px;
  color: var(--text);
}

.map-job {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color .2s, background .2s;
}

.map-job.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  box-shadow: inset 3px 0 var(--accent);
}

.map-job-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.map-job-meta .fit-badge {
  margin-left: auto;
}

.map-job-focus {
  display: block;
  text-align: left;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.map-job-focus:hover {
  color: var(--accent);
}

.map-job p {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.map-job-location {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.map-job-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.map-job-actions span {
  font-size: 10px;
  color: var(--text-muted);
}

.map-job-actions button {
  font-size: 11px;
  padding: 4px 0;
  white-space: nowrap;
  color: var(--accent);
}

.map-canvas-panel {
  min-width: 0;
}

.map-canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.map-explorer .map-wrap {
  height: 62vh;
  min-height: 360px;
  isolation: isolate;
}

.map-explorer .map-status {
  white-space: normal;
  width: max-content;
  max-width: calc(100% - 30px);
  text-align: center;
}

.map-popup-details {
  font-size: 11px;
  color: var(--text-muted);
  margin: 10px 0;
}

.map-list-empty {
  padding: 24px;
  color: var(--text-muted);
  line-height: 1.7;
}

@media (max-width: 1000px) {
  .map-explorer {
    grid-template-columns: minmax(0, 1fr);
  }

  .map-canvas-panel {
    grid-row: 1;
  }

  .map-explorer .map-wrap {
    height: 45vh;
    min-height: 300px;
  }

  .map-job-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 600px) {
  .map-explorer-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .map-canvas-toolbar {
    flex-wrap: wrap;
  }
}

.map-wrap {
  position: relative;
  width: 100%;
  height: 68vh;
  min-height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

#pt-map {
  width: 100%;
  height: 100%;
  background: var(--surface);
}

/* Override Leaflet tiles to not conflict with dark themes */
.leaflet-container {
  font-family: inherit;
  background: var(--surface);
}

/* Map loading / empty state */
.map-status {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-muted);
  z-index: 500;
  pointer-events: none;
  white-space: nowrap;
}

.map-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.map-empty-icon {
  font-size: 36px;
  opacity: 0.4;
}

/* Legend */
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.map-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Custom pin popup */
.leaflet-popup-content-wrapper {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
  color: var(--text) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
}

.leaflet-popup-tip {
  background: var(--card) !important;
}

.map-popup {
  padding: 12px 14px;
  min-width: 180px;
  cursor: pointer;
}

.map-popup:hover {
  background: var(--surface);
}

.map-popup-role {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.map-popup-company {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.map-popup-stage {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  color: #fff;
}

.map-popup-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0.7;
}

/* Remote badge in legend */
.map-remote-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}