.samband-map-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(210px, 0.7fr);
  gap: 12px;
  width: 100%;
}

.samband-map-stage {
  min-height: 280px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 20%, rgba(77, 163, 255, 0.18), transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(74, 222, 128, 0.10), transparent 28%),
    linear-gradient(145deg, rgba(20, 24, 33, 0.98), rgba(9, 13, 20, 0.98));
  overflow: hidden;
  position: relative;
}

.samband-map-stage-leaflet {
  min-height: clamp(320px, 55vh, 620px);
  background: #0b1119;
}

.samband-map-leaflet {
  position: absolute;
  inset: 0;
  min-height: 320px;
  z-index: 1;
}

.samband-map-toolbar {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 460;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.samband-map-fit-button-bottom {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 465;
  min-height: 32px;
  padding: 0 12px;
  pointer-events: auto;
  cursor: pointer;
}

.samband-map-badge,
.samband-map-layer-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 12, 18, 0.78);
  color: #f4f7fb;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}

.samband-map-layer-label {
  color: #c9d4e5;
  font-weight: 600;
}

.samband-map-svg {
  display: block;
  width: 100%;
  min-height: 280px;
}

.samband-map-grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.samband-map-point {
  fill: rgba(77, 163, 255, 0.92);
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(77, 163, 255, 0.38));
}

.samband-map-point.disabled {
  fill: rgba(154, 167, 187, 0.55);
  stroke: rgba(255, 255, 255, 0.45);
  filter: none;
}

.samband-map-label {
  fill: #f4f7fb;
  font: 600 13px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  paint-order: stroke;
  stroke: rgba(6, 9, 14, 0.95);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.samband-map-sub-label {
  fill: #bac6d7;
  font: 500 11px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  paint-order: stroke;
  stroke: rgba(6, 9, 14, 0.95);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.samband-map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  color: #bac6d7;
  z-index: 430;
  pointer-events: none;
}

.samband-map-empty.hidden {
  display: none;
}

.samband-map-empty strong {
  display: block;
  color: #fff;
  margin-bottom: 6px;
}

.samband-map-offline-note {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  border-radius: 12px;
  padding: 7px 10px;
  background: rgba(8, 12, 18, 0.78);
  color: #c9d4e5;
  font-size: 0.78rem;
  text-align: center;
}

.samband-map-list {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  background: rgba(8, 12, 18, 0.64);
  padding: 10px;
  overflow: auto;
  max-height: clamp(320px, 55vh, 620px);
}

.samband-map-list h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.samband-map-list-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 9px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.samband-map-list-item strong {
  display: block;
  color: #fff;
  font-size: 0.95rem;
}

.samband-map-list-item span {
  display: block;
  color: #aebbd0;
  font-size: 0.82rem;
  margin-top: 2px;
}

.samband-map-meta {
  color: #93a4b8;
  font-size: 0.8rem;
  margin-top: 8px;
}

.samband-map-popup {
  min-width: 190px;
}

.samband-map-popup strong {
  display: block;
  color: #0f172a;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.samband-map-popup span {
  display: block;
  color: #475569;
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.samband-map-popup dl {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  gap: 3px 8px;
  margin: 0;
  font-size: 0.78rem;
}

.samband-map-popup dt {
  color: #64748b;
  font-weight: 700;
}

.samband-map-popup dd {
  margin: 0;
  color: #0f172a;
  word-break: break-word;
}

.samband-map-stage .leaflet-container {
  background: #dfe5e9;
  color: #0f172a;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.samband-map-stage .leaflet-control-layers,
.samband-map-stage .leaflet-control-zoom a,
.samband-map-stage .leaflet-popup-content-wrapper,
.samband-map-stage .leaflet-popup-tip {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.samband-map-stage .leaflet-control-layers {
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 12px;
  overflow: hidden;
}

.samband-map-stage .leaflet-control-layers-expanded {
  padding: 8px 10px;
}

.samband-map-stage .leaflet-control-layers label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
  color: #0f172a;
  font-size: 0.82rem;
  line-height: 1.25;
}

.samband-map-stage .leaflet-control-layers-selector {
  flex: 0 0 auto;
  width: 0.95em !important;
  height: 0.95em !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: -0.1em;
}

.samband-map-stage .leaflet-control-layers label span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.25;
}

.samband-map-stage .leaflet-control-attribution {
  font-size: 0.64rem;
}

.samband-map-terminal-marker {
  filter: drop-shadow(0 0 5px rgba(20, 99, 255, 0.34));
}

.samband-map-node-marker,
.samband-map-site-marker,
.samband-map-generic-marker {
  filter: drop-shadow(0 0 4px rgba(15, 23, 42, 0.22));
}

@media (max-width: 1020px) {
  .samband-map-shell {
    grid-template-columns: 1fr;
  }

  .samband-map-list {
    max-height: 180px;
  }
}

@media (max-width: 640px) {
  .samband-map-stage-leaflet {
    min-height: 360px;
  }

  .samband-map-toolbar {
    left: 8px;
    top: 8px;
    max-width: calc(100% - 64px);
    flex-wrap: wrap;
  }

  .samband-map-badge,
  .samband-map-layer-label {
    min-height: 24px;
    padding: 0 8px;
    font-size: 0.72rem;
  }
}

/* Fas 3: kortnamn visas direkt vid kartpunkten; detaljer finns i popup vid klick. */
.samband-map-permanent-label {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(10, 14, 18, 0.72);
  color: #f7fbff;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.samband-map-permanent-label::before {
  display: none;
}

/* Patch 76B: användaren får panorera/zooma fritt efter första inpassning. */
.samband-map-fit-button {
  pointer-events: auto;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  min-height: 26px;
  border-radius: 999px;
}

.samband-map-fit-button:hover,
.samband-map-fit-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(16, 24, 38, 0.92);
  outline: 2px solid rgba(125, 186, 255, 0.45);
  outline-offset: 2px;
}

.samband-map-permanent-label {
  white-space: nowrap;
  pointer-events: none;
}

/* Patch 77B: Desktop Tactical Shell använder egna sidopaneler. I desktopens
   stora karta och lägesbild ska därför Leaflets interna mörka lista döljas så
   kartytan får hela bredden och inga tomma högerfält uppstår. Mobilkartan och
   fallback-vyn utanför dessa containers påverkas inte. */
@media (min-width: 701px) {
  .desktop-map-canvas .samband-map-shell,
  .desktop-situation-map-canvas .samband-map-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .desktop-map-canvas .samband-map-list,
  .desktop-situation-map-canvas .samband-map-list {
    display: none;
  }

  .desktop-map-canvas .samband-map-stage-leaflet,
  .desktop-situation-map-canvas .samband-map-stage-leaflet {
    min-height: 100%;
    height: 100%;
  }
}

/* Patch 104A2 - gör terminal-listan klickbar utan att ändra visuell stil. */
.samband-map-list-button {
  display: block;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.samband-map-list-button:hover,
.samband-map-list-button:focus-visible {
  background: rgba(255, 255, 255, 0.075);
  outline: 1px solid rgba(86, 164, 255, 0.65);
}
