.osm-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 960px) {
  .osm-layout { grid-template-columns: 1fr; }
}
.osm-sidebar {
  max-height: 78vh;
  overflow: auto;
}
.osm-layer-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
}
.osm-layer-item label { flex: 1; cursor: pointer; }
.osm-layer-meta { color: #64748b; font-size: 12px; margin-top: 2px; }
.osm-map-wrap {
  height: 72vh;
  min-height: 480px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.osm-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.risk-high { color: #dc2626; font-weight: 600; }
.risk-medium { color: #d97706; font-weight: 600; }
.risk-low { color: #16a34a; font-weight: 600; }
.spatial-table-wrap { max-height: 360px; overflow: auto; margin-top: 12px; }
.spatial-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.spatial-table th, .spatial-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}
.spatial-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 12px;
  line-height: 1.6;
}

/* 全屏卫星地图 + OSM 浮动面板 */
.map-fullscreen-root {
  position: fixed;
  top: var(--nav-h, 64px);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: #0f172a;
}
.satellite-map--fullscreen {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
/* 覆盖全站 label/input 规则，避免图层卡片文字错位 */
.map-float-panel label.map-ctrl-row {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.map-float-panel label.map-layer-check-row {
  display: flex;
  margin: 0;
  font-weight: inherit;
  font-size: inherit;
  color: inherit;
}
.map-float-panel input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  margin: 3px 0 0;
}

.map-float-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  width: min(380px, calc(100vw - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
  padding: 14px 16px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.map-float-panel.collapsed {
  transform: translateX(calc(-100% - 20px));
  opacity: 0;
  pointer-events: none;
}
.map-float-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.map-panel-title { display: block; font-size: 16px; line-height: 1.3; }
.map-panel-sub { margin: 4px 0 0; font-size: 12px; color: #64748b; font-weight: 400; line-height: 1.4; }
.map-panel-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  padding: 0 4px;
}
.map-panel-toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 999;
  display: none;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  font-weight: 600;
  cursor: pointer;
}
.map-float-panel.collapsed ~ .map-panel-toggle { display: block; }
.map-float-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.map-tab {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
}
.map-tab.active {
  background: #0b6bcb;
  color: #fff;
  border-color: #0b6bcb;
}
.map-tab-panel { display: none; }
.map-tab-panel.active { display: block; }
.map-float-controls {
  padding-bottom: 4px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 10px;
}
.map-ctrl-grid { display: grid; gap: 10px; margin-bottom: 10px; }
.map-ctrl-row {
  display: block;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.map-ctrl-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}
.map-ctrl-row .input-sm {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 8px;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  box-sizing: border-box;
}
.map-quick-btns { display: flex; gap: 6px; }
.map-quick-btns .btn-sm {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 600;
}
.map-osm-layers {
  max-height: 46vh;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 4px;
  padding-right: 4px;
}
.map-osm-layers::-webkit-scrollbar { width: 5px; }
.map-osm-layers::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.map-osm-status {
  font-size: 12px;
  margin: 10px 0 0;
  padding: 9px 11px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #334155;
  line-height: 1.55;
}
.map-osm-status__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.map-osm-status__spinner {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  flex-shrink: 0;
  border: 2px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: map-load-spin 0.85s linear infinite;
}
@keyframes map-load-spin {
  to { transform: rotate(360deg); }
}
.map-osm-status__text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.map-osm-status.is-loading {
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #60a5fa;
}
.map-osm-status.is-loading .map-osm-status__text {
  font-weight: 700;
}
.map-osm-status.is-prompt {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}
.map-osm-status.is-prompt .map-osm-status__text {
  color: #78350f;
  font-weight: 700;
}
.map-osm-status__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(37, 99, 235, 0.15);
}
.map-osm-status.is-prompt .map-osm-status__actions {
  border-top-color: rgba(217, 119, 6, 0.2);
}
.map-osm-status__actions .btn.primary {
  font-weight: 700;
}
.map-osm-status__stop {
  border-color: #dc2626;
  color: #dc2626;
  font-weight: 600;
}
.map-osm-status__stop:hover {
  background: #fef2f2;
}
.map-osm-props {
  margin-top: 12px;
  font-size: 13px;
  max-height: 22vh;
  overflow: auto;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #0f172a;
}
.map-osm-props strong {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  color: #0f172a;
}
.map-osm-props .spatial-table th {
  color: #475569;
  font-weight: 600;
  width: 36%;
}
.map-osm-props .spatial-table td { color: #0f172a; }
.map-layer-group { margin-bottom: 14px; }
.map-layer-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #64748b;
  margin: 0 0 8px 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid #f1f5f9;
}
.map-layer-card {
  --layer-color: #2563eb;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.map-layer-card.checked {
  background: #fafbff;
  border-color: #c7d2fe;
}
.map-layer-card.active {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
  background: #f8fafc;
}
.map-layer-card-inner {
  display: flex;
  align-items: stretch;
  min-height: 58px;
}
.map-layer-stripe {
  width: 5px;
  flex-shrink: 0;
  background: var(--layer-color);
}
.map-layer-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.map-layer-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 10px 8px;
}
.map-layer-check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  text-align: left;
}
.map-layer-check-row input[type="checkbox"] {
  margin: 3px 0 0;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
}
.map-layer-card-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.map-layer-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  word-break: break-word;
}
.map-layer-meta {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  margin-top: 3px;
  line-height: 1.4;
}
.map-layer-expand-hint {
  display: block;
  font-size: 11px;
  color: #2563eb;
  margin-top: 4px;
  cursor: pointer;
}
.map-layer-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.map-layer-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: #334155;
  padding: 0;
  flex-shrink: 0;
}
.map-layer-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.map-layer-card-body {
  display: none;
  padding: 0 12px 12px 36px;
  border-top: 1px solid #f1f5f9;
}
.map-layer-card.has-chips .map-layer-card-body { display: block; }
.map-layer-card.has-chips .map-layer-expand-hint,
.map-layer-card.has-chips [data-expand] { display: none; }
.map-layer-card.expanded .map-layer-card-body { display: block; }
.map-layer-card.expanded .map-layer-expand-hint { display: none; }
.map-building-row__county { min-width: 0; }
.leaflet-tooltip.map-feature-tooltip {
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.leaflet-tooltip.map-feature-tooltip::before {
  border-top-color: rgba(15, 23, 42, 0.94);
}
.map-feature-tooltip-inner strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #f8fafc;
}
.map-feature-tooltip-inner table {
  width: 100%;
  border-collapse: collapse;
}
.map-feature-tooltip-inner th,
.map-feature-tooltip-inner td {
  padding: 2px 0;
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}
.map-feature-tooltip-inner th {
  color: #94a3b8;
  padding-right: 8px;
  white-space: nowrap;
}
.map-feature-tooltip-inner td {
  color: #e2e8f0;
  word-break: break-all;
}
.map-layer-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.65;
  margin: 10px 0 8px;
  text-align: left;
}
.map-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.map-filter-chip {
  border: 1px solid #94a3b8;
  background: #fff;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: #1e293b;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.map-filter-chip:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}
.map-filter-chip.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.map-filter-chip--legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.map-filter-chip-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--chip-color, #84cc16);
  border: 1px solid rgba(15, 23, 42, 0.15);
  flex-shrink: 0;
}
.map-filter-chip.active .map-filter-chip-swatch {
  border-color: rgba(255, 255, 255, 0.85);
}
.map-filter-hint {
  font-size: 11px;
  color: #64748b;
  margin-top: 8px;
  line-height: 1.5;
  text-align: left;
}
.map-props-actions { margin-top: 10px; }
.map-dropzone--compact { padding: 16px; font-size: 13px; }
.map-toast-error {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 10px 16px;
  border-radius: 10px;
  max-width: 90%;
  font-size: 14px;
}
.input-sm { border: 1px solid #e2e8f0; border-radius: 8px; }
.map-building-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}
.map-building-row__city,
.map-building-row__county { flex: 1 1 120px; margin: 0 !important; min-width: 0; }
.map-scope-rect { pointer-events: none; }
.map-scope-boundary { pointer-events: none; }
.map-scope-rect--showcase { pointer-events: none; }
.map-showcase-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #f8fafc;
  pointer-events: none;
  backdrop-filter: blur(6px);
  max-width: min(92vw, 520px);
  text-align: center;
}
.map-showcase-banner__region {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.map-showcase-banner__meta {
  font-size: 13px;
  color: #cbd5e1;
}
.map-showcase-banner__topic {
  font-size: 12px;
  color: #94a3b8;
}
.map-showcase-region-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.map-showcase-region-label .map-region-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.map-showcase-region-label .map-region-tag--solar { background: rgba(245, 158, 11, 0.92); }
.map-showcase-region-label .map-region-tag--buildings { background: rgba(220, 38, 38, 0.92); }
.map-showcase-region-label .map-region-tag--religious { background: rgba(219, 39, 119, 0.92); }
.map-float-panel.is-showcase .map-float-tabs { display: none; }
.map-float-panel.is-showcase #tab-osm { display: block !important; }
.map-float-panel.is-showcase #tab-upload { display: none !important; }
.map-float-panel.is-showcase .map-layer-card .map-layer-actions { display: none; }
.map-float-panel.is-showcase .map-layer-check-row input { pointer-events: none; }
.map-region-label {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.5;
}
@media (max-width: 768px) {
  .map-float-panel { width: calc(100vw - 24px); }
  .map-showcase-banner { top: 10px; padding: 8px 14px; }
  .map-showcase-banner__region { font-size: 16px; }
}
