.atlas {
  margin-top: 28px;
  padding: 28px;
}

.atlas .panel-heading {
  margin-bottom: 22px;
}

.map-connection {
  font-size: 11px;
  font-weight: 500;
  color: #245844;
  background: #e4eee6;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.atlas-controls {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.atlas-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.atlas-controls select,
.atlas-controls input {
  height: 40px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  min-width: 220px;
}

.atlas-controls input:focus-visible,
.atlas-controls select:focus-visible {
  outline: 2px solid #285544;
  outline-offset: 2px;
}

.place-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.place-search input {
  width: 100%;
}

.map-filter-toggle {
  display: flex;
  align-items: center;
  height: 40px;
}

.checkbox-label {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-size: 12px !important;
  color: var(--ink) !important;
  cursor: pointer;
  font-weight: 500 !important;
}

.checkbox-label input {
  min-width: unset;
  height: 16px;
  width: 16px;
  cursor: pointer;
}

.atlas-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 380px);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: var(--white);
}

.map-canvas {
  background-color: #eaf0e8;
  background-image:
    linear-gradient(#d6e2d566 1px, transparent 1px),
    linear-gradient(90deg, #d6e2d566 1px, transparent 1px);
  background-size: 38px 38px;
  position: relative;
  overflow: hidden;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 440px;
}

.map-canvas svg {
  width: 100%;
  height: 100%;
  min-height: 440px;
  max-height: 620px;
  touch-action: pan-y;
  cursor: grab;
}

.map-canvas svg.dragging {
  cursor: grabbing;
}

.canton {
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  stroke-linejoin: round;
  transition: filter 0.15s ease, stroke-width 0.15s ease;
}

.canton:hover,
.canton:focus {
  stroke: #153327 !important;
  stroke-width: 2 !important;
  filter: brightness(0.92) drop-shadow(0 2px 6px rgba(18, 48, 38, 0.2));
  outline: none;
}

.canton.selected {
  stroke: #10261d !important;
  stroke-width: 2.4 !important;
  filter: drop-shadow(0 3px 8px rgba(18, 48, 38, 0.28));
  outline: none;
}

.canton.host-canton-active {
  stroke: #1b463a !important;
  stroke-width: 2 !important;
  filter: drop-shadow(0 2px 6px rgba(27, 70, 58, 0.25));
  outline: none;
}

.map-point {
  cursor: pointer;
}

.map-point .hit-area {
  fill: transparent;
  stroke: none;
}

.map-point .point-glow {
  pointer-events: none;
}

.map-point .point-core {
  stroke: #ffffff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  transition: transform 0.15s ease;
}

.map-point:hover .point-core,
.map-point:focus .point-core,
.map-point.selected .point-core {
  stroke: #0e241c;
  stroke-width: 3;
  transform: scale(1.25);
}

.map-point:focus {
  outline: none;
}

.map-city-label {
  font: 11px -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-weight: 600;
  fill: #153026;
  paint-order: stroke;
  stroke: #f7faf6;
  stroke-width: 3.5px;
  stroke-linejoin: round;
  pointer-events: none;
  letter-spacing: -0.2px;
}

.map-city-label.dynamic-label {
  font-size: 12px;
  font-weight: 700;
  fill: #153026;
  paint-order: stroke fill;
  stroke: #ffffff;
  stroke-width: 4.5px;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
}

.map-inspector {
  padding: 24px 22px;
  background: var(--white);
  border-left: 1px solid var(--line);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: 620px;
}

.map-inspector .eyebrow {
  font-size: 9px;
  color: #2b5545;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.inspector-lead {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.national-benchmarks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0;
}

.benchmark-card {
  background: #f4f7f3;
  border: 1px solid #dae5db;
  border-radius: 4px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}

.benchmark-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.benchmark-val {
  font-size: 24px;
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}

.benchmark-val small {
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--muted);
}

.benchmark-sub {
  font-size: 10px;
  color: var(--muted);
}

.inspector-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.inspector-header h3 {
  font: 26px var(--serif);
  font-weight: 400;
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-code {
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-weight: 700;
  background: #e4ebe5;
  color: #1e4537;
  padding: 2px 7px;
  border-radius: 3px;
  vertical-align: middle;
}

.inspector-pop {
  font-size: 11px;
  color: var(--muted);
}

.inspector-stat-hero {
  background: #f2f7f3;
  border: 1px solid #d5e3d7;
  border-radius: 4px;
  padding: 14px 16px;
}

.stat-main {
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-transform: uppercase;
}

.stat-num {
  font-size: 38px;
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
  margin: 6px 0 6px;
  font-variant-numeric: tabular-nums;
}

.stat-num small {
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--muted);
  margin-left: 6px;
}

.stat-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 3px;
  background: #e2ede5;
  color: #1a4234;
}

.stat-badge.older {
  background: #e7ede9;
  color: #1b3d32;
}

.stat-badge.younger {
  background: #edf3ee;
  color: #2c5949;
}

.longevity-comparison-box {
  background: #fafbfa;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eyebrow-small {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: #2b5545;
  text-transform: uppercase;
}

.stage-row {
  border-bottom: 1px solid #eef2ed;
  padding-bottom: 10px;
}

.stage-row:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.stage-tag {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.stage-primary {
  font-size: 18px;
  font-family: var(--serif);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stage-primary small {
  font-size: 10px;
  font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--muted);
}

.stage-breakdown {
  display: flex;
  gap: 14px;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  flex-wrap: wrap;
}

.stage-breakdown strong {
  color: var(--ink);
}

.progression-callout {
  background: #f4f6f3;
  border-left: 3px solid #376a56;
  padding: 8px 10px;
  border-radius: 0 3px 3px 0;
  margin-top: 4px;
}

.progression-pill {
  font-size: 9px;
  font-weight: 700;
  color: #235442;
  display: block;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.progression-callout p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.inspector-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: auto;
}

.source-tag {
  font-size: 9px;
  color: var(--muted);
}

.source-link {
  font-size: 10px;
  color: #2b5545;
  font-weight: 600;
}

.map-zoom {
  position: absolute;
  left: 16px;
  top: 16px;
  display: flex;
  background: var(--white);
  border: 1px solid #b2c4b5;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(22, 45, 36, 0.12);
}

.map-zoom button {
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  font-size: 18px;
  border-right: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-zoom button:last-child {
  font-size: 10px;
  font-weight: 600;
  border: 0;
  padding: 0 10px;
}

.map-north {
  position: absolute;
  right: 18px;
  top: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #4a6755;
  background: #f7faf6b3;
  padding: 2px 6px;
  border-radius: 3px;
}

.map-attribution {
  position: absolute;
  bottom: 10px;
  left: 12px;
  font-size: 9px;
  background: #eaf0e8d9;
  padding: 3px 6px;
  border-radius: 2px;
  color: var(--muted);
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 18px 0 10px;
  font-size: 11px;
  color: var(--muted);
}

.legend-scale-label {
  font-weight: 600;
  font-size: 10px;
  color: var(--ink);
}

.legend-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.map-legend-bar {
  display: block;
  width: 140px;
  height: 10px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-title {
  font-size: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.legend-separator {
  color: #cbd5cb;
}

.map-city-key {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1b463a;
  display: inline-block;
  margin-right: 6px;
  border: 1.5px solid #ffffff;
}

#map-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 500;
}

.map-caveat {
  font-size: 11px !important;
  color: var(--muted);
  line-height: 1.6 !important;
  margin-top: 6px;
}

#map-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 4px;
  background: #173328;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(15, 35, 27, 0.35);
  font-size: 12px;
  max-width: 250px;
  line-height: 1.45;
}

#map-tooltip strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 3px;
}

.tooltip-row {
  font-size: 11px;
  margin: 3px 0;
}

.tooltip-sub {
  font-size: 10px;
  color: #c4dcd0;
  margin-top: 4px;
}

#map-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(22, 45, 36, 0.15);
  max-height: 280px;
  overflow-y: auto;
  border-radius: 0 0 4px 4px;
}

#map-search-results button {
  display: flex;
  text-align: left;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 11px 14px;
  gap: 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

#map-search-results button:hover {
  background: #eaf1ea;
}

#map-search-results small {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

#map-search-results p {
  font-size: 12px;
  padding: 14px;
  color: var(--muted);
  margin: 0;
}

.search-divider {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  background: #f3f6f2;
  padding: 6px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.dynamic-pill {
  background: #eef4ee;
  color: #245743;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 600;
  border: 1px solid #d5e4d7;
}

.gde-canton {
  color: var(--muted);
  font-size: 11px;
}

.search-plz-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.search-plz-title .badge-code {
  font-size: 10px;
  padding: 1px 5px;
  background: #e6efe7;
  color: #17382d;
  border: 1px solid #c8dbc9;
}

.dynamic-loading-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f4f7f4;
  border: 1px solid #d8e5db;
  border-radius: 4px;
  padding: 16px;
  margin: 12px 0;
}

.loading-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid #d0ded3;
  border-top-color: #25473b;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-copy strong {
  font-size: 12px;
  color: var(--ink);
  display: block;
}

.loading-copy p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}



@media (max-width: 1100px) {
  .atlas-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 320px);
  }
}

@media (max-width: 820px) {
  .atlas {
    padding: 20px 14px;
  }
  .atlas-controls {
    gap: 14px;
  }
  .atlas-controls > label,
  .place-search {
    flex: 1;
    min-width: 100%;
    max-width: none;
  }
  .atlas-controls select {
    width: 100%;
  }
  .atlas-layout {
    display: flex;
    flex-direction: column;
  }
  .map-canvas,
  .map-canvas svg {
    min-height: 340px;
    height: 360px;
  }
  .map-inspector {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 20px 16px;
    max-height: none;
  }
  .map-legend {
    gap: 12px;
  }
  #map-count {
    margin-left: 0;
    width: 100%;
  }

  .map-mobile-banner {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    background: rgba(23, 56, 45, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    z-index: 10;
    gap: 10px;
  }
  .map-mobile-banner[hidden] {
    display: none !important;
  }
  .banner-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .banner-title {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .banner-subtitle {
    font-size: 11px;
    color: #c0ded2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
  }
  .banner-btn {
    background: #ffffff;
    color: #17382d;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 14px;
    flex-shrink: 0;
    cursor: pointer;
    border: none;
  }
}
