/* V57: ruhige, responsive Kartenansicht ohne horizontales Aufziehen. */
.map-header {
  flex: none;
  background: #fff;
}
.map-header > div:first-child {
  min-width: 0;
}
.map-header > div:first-child strong,
.map-header > div:first-child span {
  max-width: 100%;
}
.map-layout {
  grid-template-columns: minmax(0, 1fr) clamp(340px, 29vw, 400px);
  overflow: hidden;
}
.map-canvas-wrap {
  min-width: 0;
  overflow: hidden;
}
.map-canvas,
.map-canvas.leaflet-active {
  width: 100%;
  min-width: 0;
}
.map-canvas:not(.leaflet-active) {
  padding: 14px;
}
.map-canvas:not(.leaflet-active) > .channel-plan-svg {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.map-line,
.map-hit {
  vector-effect: non-scaling-stroke;
}
.map-sidebar {
  min-width: 0;
}
.selection-card {
  display: block;
  padding: 12px 13px;
}
.selection-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.selection-card-head span {
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.selection-card-head b {
  grid-row: auto;
  grid-column: auto;
  color: #9b2727;
  white-space: nowrap;
}
.selection-card > strong {
  display: block;
  grid-row: auto;
  margin-top: 5px;
  font-size: .86rem;
  line-height: 1.4;
}

@media (max-width: 850px) {
  .map-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 52dvh) minmax(0, 1fr);
    height: 100%;
  }
  .map-canvas,
  .map-canvas.leaflet-active {
    min-width: 0 !important;
    min-height: 0;
    height: 100%;
  }
  .map-sidebar {
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .line-list {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .map-header {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
    padding: 9px 10px;
  }
  .map-header > div:first-child {
    display: grid;
    gap: 3px;
    padding-right: 48px;
  }
  .map-header > div:first-child strong {
    max-width: 100%;
    font-size: .93rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .map-header > div:first-child span {
    display: block;
    font-size: .72rem;
    line-height: 1.3;
  }
  .map-header > div:last-child {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .map-header .button {
    min-width: 0;
    min-height: 40px;
    padding: 8px 10px;
    font-size: .8rem;
    white-space: nowrap;
  }
  #closeMap {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 40px;
    height: 40px;
  }
  .map-layout {
    grid-template-rows: minmax(260px, 47dvh) minmax(0, 1fr);
  }
  .map-canvas-wrap {
    overflow: hidden;
  }
  .map-canvas,
  .map-canvas.leaflet-active {
    width: 100%;
    min-width: 0 !important;
    min-height: 0;
    height: 100%;
    padding: 0;
  }
  .map-canvas:not(.leaflet-active) {
    padding: 8px;
  }
  .map-canvas:not(.leaflet-active) > .channel-plan-svg {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-radius: 10px;
  }
  .map-sidebar {
    max-height: none;
    padding: 10px;
  }
  .selection-card {
    top: -10px;
    margin: 0 -2px;
    padding: 10px 11px;
  }
  .selection-card > strong {
    font-size: .81rem;
  }
  .search-label {
    margin-top: 10px;
  }
  .section-label {
    margin-top: 12px;
  }
  .list-toolbar {
    margin-top: 14px;
  }
  .line-row {
    grid-template-columns: 26px minmax(0, 1fr) auto;
    gap: 7px;
    min-height: 52px;
    padding: 8px;
  }
  .row-actions {
    flex-direction: row;
    align-items: center;
  }
  .mini-button {
    max-width: 74px;
    min-height: 34px;
    padding: 6px 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .clean-toggle {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 370px) {
  .map-header .button {
    font-size: .75rem;
    padding-inline: 7px;
  }
  .selection-card > strong {
    font-size: .77rem;
  }
  .mini-button {
    max-width: 66px;
    font-size: .68rem;
  }
}
