.wiresx-status-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.wiresx-status-grid + .filter-disclosure,
.feed-details { margin-top: 20px; }
.feed-details + .filter-disclosure { margin-top: 10px; }

.wiresx-status-grid .ops-metric {
  min-height: 112px;
  padding: 17px;
  background: linear-gradient(145deg, rgba(16, 31, 43, .94), rgba(9, 21, 30, .9));
}

.wiresx-users-map-panel { overflow: hidden; }
.wiresx-users-map-panel + .filter-disclosure { margin-top: 14px; }
.wiresx-users-map-panel ~ .filter-disclosure + .filter-disclosure { margin-top: 10px; }
.wiresx-map-actions { justify-content: flex-end; }
.wiresx-map-actions > .muted { white-space: nowrap; }
.wiresx-users-map-stage {
  position: relative;
  min-height: 390px;
  height: clamp(390px, 48vh, 560px);
  background: #d6e0e6;
}
.wiresx-users-map { width: 100%; height: 100%; }
.wiresx-map-interaction-toggle {
  position: absolute;
  z-index: 750;
  top: 10px;
  right: 10px;
  min-height: 36px;
  color: #fff;
  border-color: #087fc2;
  background: #087fc2;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.wiresx-map-tile-status {
  position: absolute;
  z-index: 760;
  top: 58px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 8px 10px;
  border: 1px solid rgba(36, 57, 75, .3);
  border-radius: 10px;
  color: #243b48;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 5px 20px rgba(0, 0, 0, .16);
  font-size: .68rem;
  font-weight: 700;
  transform: translateX(-50%);
}
.wiresx-map-tile-status[hidden] { display: none; }
.wiresx-map-state {
  position: absolute;
  z-index: 500;
  top: 50%;
  left: 50%;
  width: min(430px, calc(100% - 32px));
  padding: 15px 18px;
  border: 1px solid rgba(36, 57, 75, .28);
  border-radius: 11px;
  color: #294553;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  transform: translate(-50%, -50%);
}
.wiresx-map-state.is-error { color: #9f2338; }
.wiresx-map-state[hidden] { display: none; }
.wiresx-users-map-legend {
  position: absolute;
  z-index: 500;
  right: 12px;
  bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  max-width: calc(100% - 24px);
  padding: 9px 11px;
  border: 1px solid rgba(36, 57, 75, .35);
  border-radius: 10px;
  color: #172c3a;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 5px 20px rgba(0, 0, 0, .15);
  font-size: .66rem;
}
.wiresx-users-map-legend strong { width: 100%; font-size: .69rem; }
.wiresx-users-map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.wiresx-map-key { width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #55636c; }
.wiresx-map-key.is-rf { background: #0ba88f; box-shadow: 0 0 0 1px #087665; }
.wiresx-map-key.is-network { background: #168fd4; box-shadow: 0 0 0 1px #0d669b; }
.wiresx-map-key.is-other { background: #7b8992; }
.wiresx-user-marker { border: 0; background: transparent; }
.wiresx-user-marker span {
  display: block;
  position: relative;
  width: 28px;
  height: 28px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: #7b8992;
  box-shadow: 0 3px 9px rgba(0, 0, 0, .38);
  transform: rotate(-45deg);
}
.wiresx-user-marker span::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #fff;
}
.wiresx-user-marker.is-rf span { background: #0ba88f; }
.wiresx-user-marker.is-network span { background: #168fd4; }
.wiresx-user-marker.is-selected span { box-shadow: 0 0 0 5px rgba(255, 199, 102, .72), 0 3px 9px rgba(0, 0, 0, .42); }
.wiresx-user-popup { min-width: 230px; color: #172c3a; }
.wiresx-user-popup > small { color: #087cc1; font-size: .62rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.wiresx-user-popup h3 { margin: 7px 0 10px; font-size: 1.12rem; }
.wiresx-user-popup-details > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 5px 0; border-top: 1px solid #d5e0e7; font-size: .7rem; }
.wiresx-user-popup-details span { color: #647b89; }
.wiresx-user-popup-details strong { overflow-wrap: anywhere; }
.wiresx-user-popup-actions { display: flex; gap: 8px; margin-top: 11px; }
.leaflet-container .wiresx-user-popup-actions a,
.leaflet-container .wiresx-user-popup-actions a:hover,
.leaflet-container .wiresx-user-popup-actions a:focus {
  padding: 7px 10px;
  border-radius: 8px;
  color: #fff;
  background: #087cc1;
  font-size: .68rem;
  font-weight: 800;
}
.wiresx-map-mobile-note { display: none; }
.wiresx-map-selection { display: none; }
.wiresx-map-selection[hidden] { display: none; }

:root[data-theme="light"] .wiresx-status-grid .ops-metric {
  background: linear-gradient(145deg, #fff, #edf5f9);
}

@media (max-width: 1100px) {
  .wiresx-status-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .wiresx-status-grid .ops-metric { grid-column: span 2; }
  .wiresx-status-grid .ops-metric:nth-last-child(-n+2) { grid-column: span 3; }
}

@media (max-width: 760px) {
  .wiresx-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .wiresx-status-grid .ops-metric,
  .wiresx-status-grid .ops-metric:nth-last-child(-n+2) { grid-column: auto; min-height: 100px; padding: 14px; }
  .wiresx-status-grid .ops-metric:last-child { grid-column: 1 / -1; }
  .wiresx-users-map-stage, .wiresx-users-map { min-height: 360px; height: 52vh; }
  .wiresx-users-map { touch-action: pan-y !important; }
  .wiresx-users-map-panel.is-map-interactive .wiresx-users-map { touch-action: none !important; }
  .wiresx-map-interaction-toggle { right: 8px; }
  .wiresx-map-mobile-note {
    display: block;
    position: absolute;
    z-index: 500;
    top: 10px;
    right: 104px;
    left: 52px;
    margin: 0;
    padding: 6px 9px;
    border: 1px solid rgba(36, 57, 75, .25);
    border-radius: 8px;
    color: #294553;
    background: rgba(255, 255, 255, .9);
    font-size: .61rem;
    line-height: 1.35;
    pointer-events: none;
  }
  .wiresx-users-map-legend { right: 8px; bottom: 24px; left: 8px; }
  .wiresx-map-selection:not([hidden]) {
    display: block;
    position: absolute;
    z-index: 850;
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-height: calc(100% - 64px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    background: var(--panel);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .32);
    overscroll-behavior: contain;
  }
  .wiresx-map-selection-heading {
    display: flex;
    position: sticky;
    z-index: 1;
    top: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-2);
  }
  .wiresx-map-selection-close {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    background: var(--panel);
    font: inherit;
    font-size: .68rem;
    font-weight: 800;
    cursor: pointer;
  }
  .wiresx-map-selection-content { padding: 12px; }
  .wiresx-map-selection .wiresx-user-popup { min-width: 0; color: var(--text); }
  .wiresx-map-selection .wiresx-user-popup-details > div { border-color: var(--line); }
  .wiresx-map-selection .wiresx-user-popup-details span { color: var(--muted); }
  .wiresx-map-selection .wiresx-user-popup-actions { flex-wrap: wrap; }
  .wiresx-map-selection .wiresx-user-popup-actions a,
  .wiresx-map-selection .wiresx-user-popup-actions a:hover,
  .wiresx-map-selection .wiresx-user-popup-actions a:focus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 11px;
    border-radius: 8px;
    color: #fff;
    background: #087cc1;
    font-size: .72rem;
    font-weight: 800;
  }
  .wiresx-users-map-panel.has-selection .wiresx-users-map-legend,
  .wiresx-users-map-panel.has-selection .wiresx-map-mobile-note { display: none; }
}

@media (max-width: 580px) {
  .wiresx-map-actions { align-items: flex-start; }
  .wiresx-map-actions > .muted { white-space: normal; }
  .wiresx-map-actions .button { width: auto; }
}

@media (max-width: 420px) {
  .wiresx-status-grid .ops-metric { min-height: 94px; padding: 12px; }
  .wiresx-status-grid .ops-metric strong { font-size: 1.04rem; }
  .wiresx-users-map-stage, .wiresx-users-map { min-height: 330px; height: 50vh; }
}
