/* 空间助手。z-index 40–48：高于图例(~9)、低于导出遮罩(~60) 和加载层(50)。 */
.gm-chat-fab {
  position: fixed;
  z-index: 45;
  right: 68px;
  bottom: calc(150px + env(safe-area-inset-bottom));
  height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: 22px;
  background: #16181d;
  color: #fff;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  letter-spacing: .5px;
  box-shadow: 0 2px 12px rgba(22, 28, 38, .22);
  cursor: pointer;
}
.gm-chat-fab:active { background: #2a2e35; }
.gm-chat-fab[hidden] { display: none !important; }

.gm-chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(12, 16, 24, .18);
  pointer-events: none;
}
.gm-chat-backdrop[hidden] { display: none !important; }

.gm-chat-panel {
  position: fixed;
  z-index: 45;
  right: 68px;
  bottom: calc(150px + env(safe-area-inset-bottom));
  width: 360px;
  max-height: min(560px, calc(100dvh - 210px));
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #1d232b;
  border-radius: 16px;
  box-shadow: 0 10px 36px rgba(22, 28, 38, .22);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.gm-chat-panel[hidden] { display: none !important; }

.gm-chat-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 8px 14px;
  border-bottom: 1px solid #eceef1;
}
.gm-chat-head b { flex: 1; font-size: 15px; }
.gm-icon {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #414b57;
  font-size: 16px;
  cursor: pointer;
}
.gm-icon:hover { background: #f3f5f7; }

.gm-chat-settings {
  flex: none;
  padding: 10px 12px 12px;
  background: #f7f8fa;
  border-bottom: 1px solid #eceef1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gm-chat-settings[hidden] { display: none !important; }
.gm-chat-settings label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 700; color: #66707c; }
.gm-chat-settings input {
  height: 34px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 13px;
  color: #1d232b;
  background: #fff;
}
.gm-chat-settings .gm-note { margin: 0; font-size: 11px; line-height: 1.55; color: #66707c; font-weight: 400; }
.gm-chat-settings .gm-row { display: flex; gap: 8px; }
.gm-chat-settings button, .gm-send, .gm-confirm button, .gm-presets button {
  font-family: inherit;
  cursor: pointer;
}
.gm-chat-settings .gm-row button, .gm-send {
  height: 34px;
  border: none;
  border-radius: 8px;
  padding: 0 12px;
  background: #16181d;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.gm-chat-settings .gm-row button.gm-ghost {
  background: #fff;
  color: #16181d;
  border: 1px solid #d0d7de;
}

.gm-chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 12px;
  min-height: 120px;
}
.gm-msg { margin: 0 0 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.gm-msg-user { align-items: flex-end; }
.gm-bubble {
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.gm-msg-user .gm-bubble { background: #16181d; color: #fff; border-bottom-right-radius: 4px; }
.gm-msg-bot .gm-bubble { background: #f3f5f7; color: #1d232b; border-bottom-left-radius: 4px; }
.gm-msg-bot .gm-bubble:empty { display: none; }
.gm-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.gm-tool {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 8px;
  background: #eaf1fb;
  color: #1f5fa8;
  font-size: 11px;
  font-weight: 700;
}
.gm-tool.bad { background: #fde8e8; color: #b42318; }

.gm-confirm {
  flex: none;
  margin: 0 12px 8px;
  padding: 8px;
  border-radius: 12px;
  background: #fdf2e3;
  color: #7a4b00;
}
.gm-confirm[hidden] { display: none !important; }
.gm-confirm p { margin: 0 0 8px; font-size: 12px; line-height: 1.5; }
.gm-confirm .gm-row { display: flex; gap: 8px; }
.gm-confirm button {
  height: 32px;
  border: none;
  border-radius: 8px;
  padding: 0 12px;
  background: #16181d;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.gm-confirm button.gm-ghost { background: #fff; color: #16181d; }

.gm-presets {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
}
.gm-presets[hidden] { display: none !important; }
.gm-presets button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(22, 28, 38, .14);
  border-radius: 999px;
  background: #fff;
  color: #16181d;
  font-size: 12px;
  font-weight: 650;
}
.gm-presets button:disabled { opacity: .45; }

.gm-compose {
  flex: none;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #eceef1;
}
.gm-compose textarea {
  flex: 1;
  resize: none;
  height: 38px;
  max-height: 96px;
  border: 1px solid #d0d7de;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: #1d232b;
}
.gm-send { flex: none; height: 38px; }
.gm-send:disabled, .gm-compose textarea:disabled { opacity: .5; }

/* 打开时把缩放/导出/影像按钮和哨兵弹窗抬到面板之上，仍低于导出遮罩和 50。 */
body.gm-chat-open #zoomCtrl { z-index: 48; }
body.gm-chat-open .maplibregl-popup.s2-pop { z-index: 48; }

@media (max-width: 720px) {
  .gm-chat-panel {
    left: 0;
    right: 64px;
    width: auto;
    bottom: 0;
    max-height: 55vh;
    border-radius: 16px 16px 0 0;
  }
}
