.panel-map-host {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0d1117;
}

.map-panel {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.map-canvas {
  position: absolute;
  inset: 0;
  background: #121820;
}

.map-service-status {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 50px;
  max-width: min(420px, calc(100% - 110px));
  margin: 0;
  overflow: hidden;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: rgba(22, 27, 34, 0.92);
  padding: 5px 8px;
  color: #8b949e;
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-service-status.is-error { border-color: #f8514966; color: #ff7b72; }

.map-search-control {
  position: absolute;
  z-index: 6;
  top: 10px;
  left: 10px;
  width: min(260px, calc(100% - 20px));
  color: #c9d1d9;
  font: 12px/1.35 system-ui, sans-serif;
}

.map-search-field {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 22px;
  align-items: center;
  min-height: 38px;
  border: 1px solid #30363d;
  border-radius: 9px;
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 8px 24px #0008;
}

.map-search-control:focus-within .map-search-field,
.map-search-control.is-open .map-search-field {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px #58a6ff33, 0 8px 24px #0009;
}

.map-search-icon { text-align: center; color: #8b949e; font-size: 20px; transform: rotate(-15deg); }

.map-search-input {
  min-width: 0;
  height: 36px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f0f6fc;
  font: inherit;
}

.map-search-input::placeholder { color: #8b949e; }
.map-search-input::-webkit-search-cancel-button { filter: invert(1); opacity: 0.6; }

.map-search-spinner {
  display: none;
  width: 10px;
  height: 10px;
  border: 2px solid #30363d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: map-search-spin 0.8s linear infinite;
}

.map-search-spinner.is-active { display: block; }
@keyframes map-search-spin { to { transform: rotate(360deg); } }

.map-search-results {
  max-height: min(360px, calc(100vh - 160px));
  margin-top: 5px;
  overflow: auto;
  border: 1px solid #30363d;
  border-radius: 9px;
  background: rgba(13, 17, 23, 0.98);
  box-shadow: 0 12px 32px #000a;
}

.map-search-results:empty { display: none; }

.map-search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #21262d;
  background: transparent;
  padding: 9px 10px;
  color: #c9d1d9;
  text-align: left;
  cursor: pointer;
}

.map-search-result:last-child { border-bottom: 0; }
.map-search-result:hover,
.map-search-result:focus-visible,
.map-search-result.is-active { background: #1f2937; outline: 0; }
.map-search-result-text { min-width: 0; }
.map-search-result strong,
.map-search-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-search-result strong { color: #f0f6fc; font-size: 12px; }
.map-search-result small { margin-top: 2px; color: #8b949e; font-size: 10px; }
.map-search-result-type { border-radius: 999px; background: #21262d; padding: 2px 6px; color: #8b949e; font-size: 9px; white-space: nowrap; }

.map-search-status {
  display: none;
  margin: 5px 2px 0;
  border-radius: 5px;
  background: rgba(13, 17, 23, 0.9);
  padding: 4px 7px;
  color: #8b949e;
  font-size: 10px;
}

.map-search-status:not(:empty) { display: block; }
.map-search-status.is-error { color: #ff7b72; }

.map-context-menu {
  position: absolute;
  z-index: 60;
  width: min(280px, calc(100% - 8px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 5px;
  border: 1px solid #3d444d;
  border-radius: 7px;
  background: rgba(22, 27, 34, 0.98);
  box-shadow: 0 12px 32px #000b;
  color: #c9d1d9;
  font: 12px/1.35 system-ui, sans-serif;
}

.map-context-menu[hidden] { display: none; }
.map-context-menu [hidden] { display: none; }
.map-context-submenu { z-index: 61; }
.map-context-menu button[aria-expanded="true"] { background: #263545; color: #f0f6fc; }
.map-context-heading {
  padding: 6px 9px;
  color: #8b949e;
  font-size: 10px;
  font-weight: 600;
}
.map-context-objects:not([hidden]) {
  margin-bottom: 4px;
  border-bottom: 1px solid #30363d;
  padding-bottom: 5px;
}
.map-context-object-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 5px 9px;
}
.map-context-menu button.map-context-object-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-context-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 23px;
  height: 22px;
  margin-right: 5px;
  border-radius: 4px;
  background: #59616a;
  padding: 0 4px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.map-context-badge.is-resource { border-radius: 50%; background: #2d6cdf; }
.map-context-badge.is-place { background: #39755b; }
.map-context-object-label { flex: 1; min-width: 0; }
.map-context-object-label strong,
.map-context-object-label small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-context-object-label strong { color: #f0f6fc; font-size: 12px; }
.map-context-object-label small { color: #8b949e; font-size: 9px; }
.map-context-chevron { color: #8b949e; font-size: 18px; }
.map-context-description {
  margin: 0;
  padding: 3px 9px 7px;
  color: #aeb9c4;
  font-size: 10px;
  overflow-wrap: anywhere;
}
.map-context-details {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 8px;
  margin: 0;
  padding: 3px 9px 8px;
  font-size: 10px;
}
.map-context-details dt { color: #8b949e; }
.map-context-details dd { margin: 0; overflow-wrap: anywhere; }
.map-context-address {
  display: grid;
  gap: 1px;
  min-width: 0;
  border-top: 1px solid #30363d;
  padding: 6px 10px 1px;
  color: #b8c2cc;
  font-size: 9px;
  line-height: 1.3;
  transition: opacity .16s ease;
}
.map-context-address.is-loading { opacity: .55; }
.map-context-address:not(.is-loading) { cursor: crosshair; }
.map-context-address span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-context-address span:first-child { color: #e0e6ec; }
.map-context-coordinates {
  margin: 0;
  overflow: hidden;
  padding: 1px 10px 6px;
  color: #8b949e;
  font: 9px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-context-menu button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
  padding: 7px 9px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.map-context-menu button:hover,
.map-context-menu button:focus-visible { background: #263545; outline: 0; color: #f0f6fc; }
.map-context-menu button:focus-visible { box-shadow: inset 0 0 0 1px #58a6ff; }
.map-context-menu button:disabled { cursor: default; opacity: .55; }
.map-context-action-status { margin: 0; padding: 5px 10px; color: #8b949e; font-size: 9px; }
.map-context-action-status:empty { display: none; }
.map-context-action-status.is-error { color: #ff7b72; }

.map-required-attribution {
  position: absolute;
  z-index: 5;
  bottom: 4px;
  left: 4px;
  max-width: calc(100% - 8px);
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.9);
  color: #24292f;
  font: 11px/1.35 system-ui, sans-serif;
}

.map-required-attribution a { color: #0969da; }

.map-layer-control {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  color: #c9d1d9;
  font-size: 0.7rem;
}

.map-layer-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  border: 1px solid #30363d;
  border-radius: 7px;
  background: rgba(22, 27, 34, 0.94);
  padding: 0;
  box-shadow: 0 4px 16px #0006;
  color: #c9d1d9;
  font-weight: 650;
  cursor: pointer;
}

.map-layer-toggle:hover,
.map-layer-toggle:focus-visible,
.map-layer-control.is-open .map-layer-toggle {
  border-color: #58a6ff;
  color: #f0f6fc;
}

.map-layers-icon {
  position: relative;
  width: 14px;
  height: 14px;
}

.map-layers-icon i {
  position: absolute;
  left: 2px;
  width: 10px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: #161b22;
  transform: rotate(45deg) skew(-8deg, -8deg);
}

.map-layers-icon i:nth-child(1) { top: 0; }
.map-layers-icon i:nth-child(2) { top: 3px; }
.map-layers-icon i:nth-child(3) { top: 6px; }

.map-layer-menu {
  display: none;
  width: min(230px, calc(100vw - 28px));
  max-height: min(430px, calc(100vh - 88px));
  margin-top: 6px;
  overflow: auto;
  border: 1px solid #30363d;
  border-radius: 9px;
  background: rgba(13, 17, 23, 0.97);
  box-shadow: 0 12px 32px #0009;
}

.map-layer-control.is-open .map-layer-menu { display: block; }

.map-layer-heading {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #21262d;
  background: rgba(22, 27, 34, 0.98);
  padding: 8px 8px 8px 11px;
}

.map-layer-heading strong { font-size: 0.72rem; }

.map-layer-close {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 0 0 2px;
  color: #8b949e;
  font-size: 1.1rem;
  cursor: pointer;
}

.map-layer-close:hover,
.map-layer-close:focus-visible { background: #30363d; color: #f0f6fc; }

.map-layer-menu fieldset {
  margin: 0;
  border: 0;
  border-bottom: 1px solid #21262d;
  padding: 7px;
}

.map-layer-menu fieldset:last-child { border-bottom: 0; }

.map-layer-menu legend {
  width: 100%;
  padding: 2px 4px 5px;
  color: #8b949e;
  font: 700 0.56rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.map-layer-option {
  display: grid;
  grid-template-columns: 16px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
}

.map-layer-option:hover { background: #161b22; }
.map-layer-option input { position: absolute; opacity: 0; pointer-events: none; }

.map-layer-indicator {
  position: relative;
  width: 14px;
  height: 14px;
  border: 1px solid #484f58;
  border-radius: 4px;
  background: #0d1117;
}

.map-layer-option input[type="radio"] + .map-layer-indicator { border-radius: 50%; }

.map-layer-option input:checked + .map-layer-indicator {
  border-color: #58a6ff;
  background: #1f6feb;
}

.map-layer-option input:checked + .map-layer-indicator::after {
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background: #fff;
  content: "";
}

.map-layer-option input[type="checkbox"]:checked + .map-layer-indicator::after {
  inset: 2px 4px 4px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  border-radius: 0;
  background: transparent;
  transform: rotate(45deg);
}

.map-layer-option input:focus-visible + .map-layer-indicator { outline: 2px solid #58a6ff; outline-offset: 2px; }

.map-panel .ol-control button {
  background-color: rgba(22, 27, 34, 0.92);
  color: #e6edf3;
}

.map-panel .ol-control button:hover,
.map-panel .ol-control button:focus { background-color: #1f6feb; }

.map-panel .ol-zoom {
  top: auto;
  right: 10px;
  bottom: 34px;
  left: auto;
}

.map-panel .ol-attribution {
  max-width: calc(100% - 12px);
  background: rgba(22, 27, 34, 0.84);
  color: #8b949e;
  font-size: 0.58rem;
}

.map-panel .ol-attribution a { color: #58a6ff; }
.map-3d-button { position: absolute; top: 10px; right: 52px; z-index: 4; border: 1px solid #30363d; border-radius: 5px; padding: 6px 10px; background: rgba(13,17,23,.9); color: #f0f6fc; cursor: pointer; }
.map-3d-button:hover, .map-3d-button:focus { background: #1f6feb; }

@media (max-width: 640px) {
  .map-service-status { display: none; }
}
.map-incident-filters { position: absolute; left: 10px; bottom: 36px; z-index: 50; max-width: 320px; max-height: 65%; overflow: auto; padding: 8px; color: #e6edf3; background: #161b22ee; border: 1px solid #30363d; border-radius: 6px; font-size: 12px; }
.map-incident-filters summary { cursor: pointer; }
.map-incident-filters fieldset { margin: 8px 0; border: 1px solid #30363d; }
.map-incident-filters label { display: flex; align-items: center; gap: 6px; padding: 3px; }
.map-marker-legend div { display: flex; align-items: center; gap: 6px; }
.map-feed-status:empty { display: none; }
.map-resource-status { position: absolute; left: 10px; bottom: 8px; z-index: 45; margin: 0; padding: 4px 8px; color: #e6edf3; background: #161b22ee; border-radius: 4px; font-size: 12px; pointer-events: none; }
.map-incident-filters button { display: block; width: 100%; margin-top: 4px; text-align: left; color: inherit; background: #21262d; border: 1px solid #30363d; padding: 5px; }
.map-incident-tooltip, .map-marker-chooser { position: absolute; top: 70px; left: 10px; z-index: 55; max-width: 80%; padding: 8px; background: #161b22ee; color: #e6edf3; border: 1px solid #30363d; border-radius: 6px; white-space: pre-line; font-size: 12px; }
.map-incident-tooltip { pointer-events: none; }
.map-marker-chooser button { display: block; color: inherit; background: #21262d; border: 1px solid #30363d; padding: 6px; margin: 3px; }

.map-layer-menu {
  max-height: calc(100% - 40px);
  width: min(320px, calc(100vw - 28px));
}
.map-layer-control {
  max-width: calc(100% - 20px);
  max-height: calc(100% - 60px);
}
.map-layer-control.is-open {
  height: calc(100% - 60px);
}
.map-marker-settings {
  padding: 6px;
}
.map-marker-settings label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
}
.map-marker-settings select,
.map-marker-settings input[type="search"] {
  max-width: 100%;
  background: #161b22;
  color: #e6edf3;
  border: 1px solid #484f58;
  padding: 5px;
  border-radius: 4px;
}
.map-marker-settings button {
  display: block;
  width: 100%;
  padding: 6px;
  margin: 4px 0;
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #484f58;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
}
.map-marker-settings button:focus-visible,
.map-marker-chooser button:focus-visible {
  outline: 2px solid #58a6ff;
}
.map-incident-filters.is-consolidated {
  position: static;
  max-height: none;
  padding: 6px 0;
  border: 0;
  background: transparent;
}
.map-marker-settings details > summary {
  cursor: pointer;
  padding: 6px 0;
}
.map-marker-chooser {
  max-height: calc(100% - 90px);
  overflow: auto;
  width: min(360px, calc(100% - 30px));
}
.map-marker-chooser section {
  border-bottom: 1px solid #484f58;
  padding: 6px;
}
.map-viewport-markers > div {
  max-height: 220px;
  overflow: auto;
}
.map-marker-settings .map-marker-legend {
  padding: 4px;
}
.map-marker-legend p {
  color: #9da7b3;
}
.map-marker-settings .map-urgency-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.map-urgency-legend span {
  border: 3px solid;
  border-radius: 4px;
  padding: 2px 5px;
  color: #ffffff;
  background: #161b22;
  font-weight: 600;
}
