html, body, #cesiumContainer {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: system-ui, sans-serif;
}

/* ── Toolbar ── */
#toolbar {
  position: absolute;
  z-index: 30;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  font-size: 14px;
}
#toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#toolbar .toolbar-left strong {
  white-space: nowrap;
}
#requestLabel {
  font-size: 11px;
  color: #667085;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#backToFormLink {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  background: #eef2ff;
  color: #3730a3;
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}
#backToFormLink:hover {
  background: #e0e7ff;
}
#toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
#status { color: #333; font-size: 13px; white-space: nowrap; }
.toggle-btn {
  background: none;
  border: 1px solid #d9e0ea;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
  color: #667085;
  white-space: nowrap;
}
.toggle-btn:hover { background: #f0f4f8; }
.toggle-btn.active { background: #eff6ff; color: #2563eb; border-color: #2563eb; }

/* ── Info Panel (debug/legend) ── */
#infoPanel {
  position: absolute;
  z-index: 20;
  left: 12px;
  top: 64px;
  max-width: 300px;
  max-height: 40vh;
  overflow-y: auto;
  background: rgba(255,255,255,0.92);
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
#infoPanel.collapsed {
  transform: translateX(calc(-100% - 24px));
  opacity: 0;
  pointer-events: none;
}
#info {
  margin: 0;
  white-space: pre-wrap;
  font-size: 11px;
  line-height: 1.45;
}

/* ── Feature Properties Panel ── */
#featurePanel {
  position: absolute;
  z-index: 25;
  right: 12px;
  bottom: 12px;
  max-width: 360px;
  max-height: 45vh;
  overflow-y: auto;
  background: rgba(255,255,255,0.95);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
#featurePanel.hidden {
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}
.feature-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px 6px;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
}
.feature-header strong { font-size: 13px; }
#featurePanelClose {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #667085;
  padding: 0 4px;
  line-height: 1;
}
#featurePanelClose:hover { color: #dc2626; }
#featureProperties {
  padding: 8px 12px 12px;
}
.prop-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 12px;
  line-height: 1.4;
}
.prop-row:last-child { border-bottom: none; }
.prop-key {
  color: #667085;
  font-weight: 600;
  flex-shrink: 0;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prop-val {
  color: #1f2937;
  text-align: right;
  word-break: break-all;
}

/* ── Mobile responsive ── */
@media (max-width: 600px) {
  #toolbar {
    top: env(safe-area-inset-top, 6px);
    left: 6px;
    right: 6px;
    padding: 6px 10px;
    font-size: 12px;
    flex-wrap: wrap;
    gap: 4px;
  }
  #toolbar .toolbar-left strong { font-size: 13px; }
  #requestLabel { display: none; }
  #status { font-size: 11px; }

  #infoPanel {
    top: auto;
    bottom: 12px;
    left: 6px;
    right: 6px;
    max-width: none;
    max-height: 30vh;
    font-size: 10px;
  }
  #infoPanel.collapsed {
    transform: translateY(calc(100% + 24px));
  }

  #featurePanel {
    left: 6px;
    right: 6px;
    bottom: 6px;
    max-width: none;
    max-height: 40vh;
    border-radius: 12px 12px 6px 6px;
  }
}

/* ── Safe area support for notched phones ── */
@supports (padding: env(safe-area-inset-top)) {
  #toolbar {
    padding-top: max(8px, env(safe-area-inset-top));
  }
}

#backToFormLink {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  background: #eef2ff;
  color: #3730a3;
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
  margin-left: 12px;
}
#backToFormLink:hover {
  background: #e0e7ff;
}
