body.global-explore {
  position: fixed;
  inset: 0;
  height: 100vh;
  overflow: hidden;
}

#global-map { position: absolute; inset: 0; background: var(--bg-3); }
.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  backdrop-filter: blur(14px);
}

#global-topbar {
  position: absolute;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 94%, transparent);
  backdrop-filter: blur(14px);
}
#global-topbar .brand { font-size: 16px; }
.product-label {
  padding-left: 9px;
  border-left: 1px solid var(--border-strong);
  color: var(--muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
#global-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 430px;
}
#global-search-wrap > svg {
  position: absolute;
  z-index: 1;
  left: 11px;
  width: 16px;
  color: var(--muted);
  pointer-events: none;
}
#global-search {
  width: 100%;
  min-width: 0;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: 0;
  background: var(--bg-2);
  color: var(--text);
  font-size: 13px;
}
#global-search:focus { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
#global-search:disabled { color: var(--muted-2); cursor: not-allowed; }
#global-search-results {
  position: absolute;
  z-index: 35;
  top: 44px;
  right: 0;
  left: 0;
  display: none;
  max-height: 330px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}
.global-search-result {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.global-search-result:hover { background: var(--control-hover); }
.global-search-result b { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result span { color: var(--muted); font-size: 11px; }
.global-top-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.icon-command svg, .panel-foot svg { width: 15px; height: 15px; }

#global-controls {
  position: absolute;
  z-index: 15;
  top: 72px;
  left: 14px;
  width: 294px;
  max-height: calc(100vh - 88px);
  padding: 17px;
  overflow-y: auto;
}
.control-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 17px; }
.control-heading .kicker { color: var(--brand-deep); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.control-heading h1 { margin: 2px 0 0; font-size: 21px; }
.mobile-controls-close.icon-btn { display: none; }
.global-field { margin-bottom: 14px; }
.global-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.global-field select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  font-size: 12px;
}
.global-field select:disabled { color: var(--muted-2); cursor: not-allowed; }
.global-result-count { min-height: 44px; padding: 12px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 1.5; }
.global-result-count b { color: var(--text); }
.tier-key { padding-top: 10px; border-top: 1px solid var(--border); }
.tier-key div { display: flex; align-items: center; gap: 8px; margin: 7px 0; color: var(--muted); font-size: 11px; }
.tier-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tier-dot.regulator { background: #0f766e; }
.tier-dot.government { background: #2563a6; }
.tier-dot.discovery { background: #c07818; }
.filter-fab { position: absolute; z-index: 14; bottom: 20px; left: 14px; display: none; }
.filter-fab svg { width: 16px; }

.map-status {
  position: absolute;
  z-index: 12;
  right: 14px;
  bottom: 14px;
  max-width: 330px;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 11px;
}
.map-status.error { color: var(--g-f); }

.icon-btn {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--control);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--control-hover); }
.icon-btn svg { width: 17px; height: 17px; }
#global-pro-badge[hidden] { display: none; }

#global-drawer,
#global-saved-panel {
  position: absolute;
  z-index: 26;
  top: 72px;
  right: 14px;
  bottom: 14px;
  display: flex;
  width: 390px;
  overflow: hidden;
  flex-direction: column;
  transform: translateX(430px);
  transition: transform .24s ease;
}
#global-drawer.open,
#global-saved-panel.open { transform: translateX(0); }
.drawer-close { position: absolute; z-index: 2; top: 12px; right: 12px; }
#global-drawer-body { padding: 22px; overflow-y: auto; }
.detail-tier { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 11px; color: var(--muted); font-size: 11px; font-weight: 700; }
.detail-name { max-width: 310px; margin: 0 0 6px; padding-right: 28px; font-size: 23px; overflow-wrap: anywhere; }
.detail-location { margin: 0 0 17px; color: var(--muted); font-size: 13px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.detail-actions svg { width: 15px; }
.detail-section { padding: 16px 0; border-top: 1px solid var(--border); }
.detail-section h3 { margin: 0 0 10px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.rating-headline { display: flex; align-items: baseline; gap: 10px; }
.rating-value { color: var(--text); font-family: var(--font-display); font-size: 27px; font-weight: 800; overflow-wrap: anywhere; }
.rating-scale { color: var(--muted); font-size: 11px; line-height: 1.5; }
.price-headline { color: var(--text); font-family: var(--font-display); font-size: 27px; font-weight: 800; }
.price-source { margin-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.price-source a { color: var(--brand-deep); font-weight: 700; }
.price-caveat { margin: 9px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.price-detail-list { margin-top: 12px; border-top: 1px solid var(--border); }
.price-detail-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.price-detail-row span { color: var(--muted); font-size: 11px; }
.price-detail-row b { flex: none; font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-metric { min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--control); }
.detail-metric b { display: block; font-size: 16px; overflow-wrap: anywhere; }
.detail-metric span { color: var(--muted); font-size: 10px; }
.pro-lock { padding: 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--control); text-align: center; }
.pro-lock svg { width: 20px; color: var(--muted); }
.pro-lock p { margin: 7px 0 11px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.provenance { color: var(--muted); font-size: 11px; line-height: 1.6; }
.provenance b { color: var(--text); }

.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 16px; }
#global-saved-list { flex: 1; padding: 8px 12px; overflow-y: auto; }
.saved-global-item { padding: 11px 8px; border-bottom: 1px solid var(--border); }
.saved-global-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.saved-global-title button:first-child { padding: 0; border: 0; background: none; color: var(--text); font-weight: 700; text-align: left; cursor: pointer; }
.saved-global-title .icon-btn { width: 27px; height: 27px; flex: none; }
.saved-global-title svg { width: 14px; }
.saved-global-meta { margin-top: 3px; color: var(--muted); font-size: 11px; }
.saved-global-item textarea { width: 100%; min-height: 54px; margin-top: 9px; padding: 8px; resize: vertical; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); color: var(--text); font-size: 12px; }
.panel-foot { display: flex; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--border); }
.panel-foot .btn { flex: 1; }
.global-empty { padding: 38px 18px; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }

#global-modal-backdrop,
#global-compare-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: none;
  background: var(--overlay);
}
#global-upgrade-modal {
  position: fixed;
  z-index: 61;
  top: 50%;
  left: 50%;
  display: none;
  width: min(440px, calc(100vw - 28px));
  padding: 27px;
  transform: translate(-50%, -50%);
}
#global-upgrade-modal.open,
#global-modal-backdrop.open { display: block; }
#global-upgrade-modal h2 { margin: 0 35px 7px 0; font-size: 22px; }
#global-upgrade-modal > p { margin: 0 0 15px; color: var(--muted); font-size: 13px; }
#global-upgrade-modal > ul { margin: 0 0 18px; padding-left: 20px; font-size: 13px; }
.modal-close { position: absolute; top: 13px; right: 13px; }
.btn.block { width: 100%; }
.key-entry { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.key-entry label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.key-row { display: flex; gap: 7px; margin-top: 7px; }
.key-row input { min-width: 0; flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); color: var(--text); }
#global-key-msg { min-height: 18px; margin-top: 7px; font-size: 11px; }
#global-key-msg.ok { color: var(--brand); }
#global-key-msg.err { color: var(--g-f); }

#global-compare-view {
  position: fixed;
  z-index: 71;
  top: 50%;
  left: 50%;
  display: none;
  width: min(940px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow: hidden;
  flex-direction: column;
  transform: translate(-50%, -50%);
}
#global-compare-view.open { display: flex; }
#global-compare-backdrop.open { display: block; z-index: 70; }
#global-compare-body { padding: 0 18px 18px; overflow: auto; }
.global-compare-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.global-compare-table th, .global-compare-table td { min-width: 150px; padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.global-compare-table th:first-child, .global-compare-table td:first-child { min-width: 125px; color: var(--muted); }

.maplibregl-popup-content { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow); font-family: var(--font); font-size: 12px; }
.maplibregl-popup-tip { border-top-color: var(--panel-solid) !important; }

@media (max-width: 760px) {
  #global-topbar {
    height: 94px;
    flex-wrap: wrap;
    align-content: center;
    gap: 7px;
    padding: 7px 8px;
  }
  #global-topbar .brand { order: 1; width: 27px; overflow: hidden; gap: 0; }
  #global-topbar .map-scope-switch { order: 2; }
  .product-label { display: none; }
  #global-search-wrap { order: 4; flex: 0 0 100%; max-width: none; min-width: 0; }
  .global-top-actions { order: 3; }
  .global-top-actions > a, #global-upgrade-btn, .icon-command span { display: none; }
  #global-controls {
    display: none;
    top: 106px;
    right: 14px;
    left: 14px;
    width: auto;
    max-height: calc(100vh - 122px);
  }
  #global-controls.open { display: block; }
  .mobile-controls-close.icon-btn { display: inline-grid; }
  .filter-fab { display: inline-flex; }
  .map-status { right: 14px; bottom: 68px; left: 14px; max-width: none; }
  #global-drawer, #global-saved-panel {
    top: 106px;
    right: 14px;
    left: 14px;
    display: none;
    width: auto;
    transform: none;
  }
  #global-drawer.open, #global-saved-panel.open { display: flex; }
  .detail-name { font-size: 20px; }
}
