/* ============================================================
 * 家庭医生电子地图系统 - 全局样式表
 * ------------------------------------------------------------
 * 适用页面: index.html（前台） / admin.html（后台） / detail.html / team.html
 * 组织顺序: 主题变量 → 基础重置 → 通用容器 → 前台组件 → 后台组件 → 响应式
 * 设计: 主色 #1a8cff（蓝）, 移动优先，桌面端居中限宽 750px
 * ============================================================ */

/* ============ 主题变量（颜色 / 阴影 / 圆角 / 尺寸） ============ */
:root {
  --primary: #1a8cff;
  --primary-2: #00b5d8;
  --primary-gradient: linear-gradient(135deg, #1a8cff 0%, #00b5d8 100%);
  --primary-gradient-v: linear-gradient(180deg, #1a8cff 0%, #00b5d8 100%);
  --success: #07c160;
  --warning: #ff9500;
  --danger: #ff4d4f;
  --text: #1f2937;
  --text-sub: #6b7280;
  --text-mute: #9ca3af;
  --bg: #f5f7fa;
  --line: #eef1f6;
  --shadow-sm: 0 2px 10px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 4px 20px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 10px 40px rgba(17, 24, 39, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --header-h: 128px;
  --nav-h: 56px;
  --maxw: 750px;
  /* 触控目标最小尺寸（符合 44×44px 交互标准） */
  --touch-min: 44px;
  --touch-btn: 48px;
  /* 安全区域变量（用于刘海屏适配） */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============ 基础重置（盒子模型 / 字体 / 链接 / 表单元素） ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; outline: none; border: none; background: transparent; }
ul, li { list-style: none; }

.page-container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  /* iOS Safari: 使用 100dvh 替代 100vh 避免地址栏伸缩问题 */
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  /* 为底部导航栏和安全区域留出空间 */
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  /* 适配刘海屏/状态栏 */
  padding-top: var(--safe-top);
}

/* 横屏时 iOS 100dvh 回退：部分旧版系统仍使用 100vh */
@supports not (height: 100dvh) {
  .page-container {
    min-height: 100vh;
  }
}

/* ============ Hero / Header 合并 ============ */
.app-hero {
  position: relative;
  padding: calc(10px + var(--safe-top)) 16px 54px;
  background: var(--primary-gradient-v);
  color: #fff;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* 确保触控区域有足够空间（至少 44px 可点击） */
  min-height: var(--touch-min);
  gap: 12px;
}

.hero-top-left,
.hero-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 图标按钮：增大到 44×44px 以符合触控标准 */
.icon-btn {
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 18px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: rgba(255,255,255,0.28);
}
.icon-btn:active { background: rgba(255,255,255,0.28); }

.hero-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.hero-brand {
  text-align: center;
  padding: 6px 0 4px;
}
.hero-brand h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 3px;
}
.hero-brand-sub {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.92;
  letter-spacing: 1px;
}
.hero-brand-tag {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  font-size: 12px;
  background: rgba(255,255,255,0.18);
  border-radius: 10px;
  opacity: 0.92;
}

/* ============ Map Card ============ */
.map-card {
  margin: -34px 16px 0;
  background: #fff;
  border-radius: var(--radius-md);
  /* overflow: visible 保证 type-pills/map-bottom 不被 map-card 圆角裁切
     地图内部 overflow:hidden 已移到 #mapContainer 上 */
  overflow: visible;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 5;
}

#mapContainer {
  width: 100%;
  height: 320px;
  background: #e8edf3;
  overflow: hidden;        /* 地图容器保持 overflow hidden 让 AMap 内部圆角生效 */
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.map-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
  /* 增大触控区域 */
  min-height: var(--touch-min);
}
.map-location {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-sub);
  font-size: 14px;
  cursor: pointer;
  min-width: 0;
  flex: 1;
  /* 保证触控目标高度不低于 44px */
  min-height: var(--touch-min);
  padding: 4px 0;
}
.map-location-icon { color: var(--primary); flex-shrink: 0; font-size: 16px; }
.map-location-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.map-location-arrow { color: var(--text-mute); margin-left: 2px; flex-shrink: 0; }

.map-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(26,140,255,0.08);
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 10px;
  /* 保证最小触控高度 44px */
  min-height: var(--touch-min);
}

/* ============ Type Pills (单选按钮组, 直接显示在地图下方) ============
   视觉设计: 胶囊按钮组, 选中项蓝色渐变背景白字, 未选中项灰色边框灰字
   5 个 pill: 全部 / 机构 / 行政村 / 小区 / 家医团队 */
.type-pills {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  /* 隐藏横向滚动条但保持滚动能力 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.type-pills::-webkit-scrollbar { display: none; }
.type-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 13px;
  color: #9aa0a6;                /* 未选中: 灰色文字 */
  background: #f1f3f5;          /* 未选中: 浅灰背景 */
  border: 1px solid #e4e6e9;
  border-radius: 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 28px;
}
.type-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.type-pill:active { transform: scale(0.95); }
.type-pill--active {
  /* 选中: 蓝色渐变 + 白字 + 阴影加深 */
  color: #fff;
  background: linear-gradient(135deg, var(--primary, #1a8cff), #0066d1);
  border-color: var(--primary, #1a8cff);
  box-shadow: 0 2px 8px rgba(26,140,255,0.4);
}
/* 类型小色点 (选中/未选中状态都显示, 但选中时被蓝色背景盖过) */
.type-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.type-dot--institution { background: linear-gradient(135deg, #1a8cff, #0056b3); }
.type-dot--village     { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.type-dot--community   { background: linear-gradient(135deg, #ff9500, #ff6b35); }
.type-dot--team        { background: linear-gradient(135deg, #07c160, #00a86b); }

/* 选中时隐藏类型色点, 只保留白色文字(保持简洁) */
.type-pill--active .type-dot { display: none; }

/* ============ Map Bottom (位置条 + 切换地区) ============ */
.search-box {
  margin: 14px 16px 0;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 14px;
  gap: 10px;
  /* 确保输入区域至少 44px 高度 */
  min-height: var(--touch-min);
}
.search-icon { color: var(--text-mute); font-size: 16px; flex-shrink: 0; }
.search-input {
  flex: 1;
  font-size: 15px;
  color: var(--text);
  width: 100%;
  /* iOS 输入框字体大小 ≥ 16px，避免自动缩放 */
  font-size: 16px;
}
.search-input::placeholder { color: #b7bec7; }

/* ============ Section Title ============ */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 10px;
}
.section-title-left { display: flex; align-items: center; gap: 8px; }
.section-title-bar {
  width: 3px; height: 14px;
  background: var(--primary-gradient-v);
  border-radius: 2px;
}
.section-title-text { font-size: 16px; font-weight: 600; color: var(--text); }
.section-title-right {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-mute); font-size: 13px; cursor: pointer;
  /* 增大触控区域 */
  min-height: var(--touch-min);
  padding: 8px 12px;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.section-title-right:active {
  background: rgba(0,0,0,0.04);
}
.refresh-icon { font-size: 14px; }

/* ============ Institution List ============ */
/* 容器 padding 略大, 和 team.html 的 detail-content 16px 对齐 */
.institution-list { padding: 4px 16px 16px; }
.institution-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px;                /* 从 14px 加大到 16px, 和 team.html team-info 对齐 */
  margin-bottom: 12px;          /* 卡片间距 */
  box-shadow: 0 2px 10px rgba(17,24,39,0.06);  /* 加深阴影, 更像 team-card 的 shadow-sm */
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  /* 增大点击区域 */
  min-height: calc(var(--touch-min) + 20px);
  -webkit-tap-highlight-color: transparent;
}
.institution-card:active {
  transform: scale(0.985);
  box-shadow: 0 2px 6px rgba(17,24,39,0.05);
}
.institution-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  background: var(--primary-gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; flex-shrink: 0;
}
.institution-info { flex: 1; min-width: 0; }
.institution-name {
  font-size: 16px; font-weight: 600; color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.institution-distance {
  font-size: 13px; color: var(--text-sub); margin-bottom: 6px;
}
.institution-actions {
  display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px;
}
.action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  /* 增大按钮触控尺寸到 44px */
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(26,140,255,0.08);
  color: var(--primary);
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s;
}
.action-btn:active {
  background: rgba(26,140,255,0.15);
  transform: scale(0.95);
}
.action-btn-phone { color: var(--success); background: rgba(7,193,96,0.08); }
.action-btn-phone:active { background: rgba(7,193,96,0.15); }
.action-btn-detail { color: var(--warning); background: rgba(255,149,0,0.08); }
.action-btn-detail:active { background: rgba(255,149,0,0.15); }

/* ============ Empty ============ */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text-mute);
}
.empty-state-icon { font-size: 44px; margin-bottom: 10px; opacity: 0.55; }
.empty-state-text { font-size: 13px; }

/* ============ Bottom Nav ============ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 50;
  max-width: var(--maxw);
  margin: 0 auto;
  /* 适配 iPhone 底部安全区域 */
  padding: 6px 0 calc(6px + var(--safe-bottom));
  /* 基础高度 + 安全区域 */
  height: calc(var(--nav-h) + var(--safe-bottom));
  /* iOS 防回弹：使用 fixed 定位时设置 padding 防止内容被键盘遮挡 */
  -webkit-overflow-scrolling: touch;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  /* 增大触控区域，确保至少 44px 高度 */
  min-height: var(--touch-min);
  font-size: 12px;
  font-weight: 500;
  gap: 3px;
  /* 增大点击区域：使用 padding 而非 margin 来扩大实际可点击范围 */
  padding: 4px 2px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.nav-item:active {
  background: rgba(26,140,255,0.08);
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 24px; line-height: 1; }

/* ============ 公安备案条 ============ */
.police-beian {
  text-align: center;
  padding: 12px 16px calc(var(--nav-h) + var(--safe-bottom) + 16px);
  font-size: 12px;
}
.police-beian a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9aa0a6;
  text-decoration: none;
  transition: color 0.15s;
}
.police-beian a:hover { color: #666; }
.police-beian-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.08));
}

/* ============ 地图标记 Markers ============
 * 类型配色分层（与 js/map.js 中 zIndexMap 一致）:
 *   institution 机构(蓝) > team 团队(绿) > community 小区(橙) > village 村(紫)
 * 标签默认隐藏淡入，hover 时高亮并提升 z-index */
.switch-area {
  position: absolute;
  top: 12px; right: 12px;
  background: #fff; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); overflow: hidden; z-index: 3;
}
.switch-area-btn { display: flex; align-items: center; gap: 4px; padding: 8px 12px; font-size: 13px; color: var(--text-sub); }
.switch-area-btn.active { color: var(--primary); background: rgba(26,140,255,0.08); }

.custom-marker {
  position: relative;
  width: 28px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  /* 缩放变换: 由 --marker-scale CSS 变量驱动（默认 1.0）
     transform-origin: bottom center 保证图钉底部尖端作为锚点，
     缩放时尖端不漂移 */
  transform-origin: bottom center;
  transform: scale(var(--marker-scale, 1));
  transition: transform 0.25s ease;
}
.marker-pin {
  width: 28px;
  height: 28px;
  background: var(--primary-gradient);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  /* box-shadow 由类型专属规则覆盖, 这里用中性灰避免蓝色污染其他类型 */
  box-shadow: 0 3px 10px rgba(0,0,0,0.22);
  position: relative;
  z-index: 2;
}
.marker-pin-inner {
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  transform: rotate(45deg);
}
.marker-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 2px 8px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  line-height: 1.4;
  /* 由 --label-opacity 驱动缩放级别显隐 (zoom>=15 显示) */
  opacity: var(--label-opacity, 1);
  transition: opacity 0.25s ease;
}
.marker-label::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(0,0,0,0.85);
}
.custom-marker:hover .marker-label {
  opacity: 1;
  filter: brightness(1.1);
  z-index: 999;
}
.custom-marker:hover .marker-pin {
  filter: brightness(1.1);
}
/* 类型专属配色: background + shadow（基础 .marker-pin 不再硬编码蓝色 shadow） */
.marker-community .marker-pin  { background: linear-gradient(135deg, #ff9500, #ff6b35); box-shadow: 0 3px 10px rgba(255,107,53,0.5); }
.marker-team .marker-pin       { background: linear-gradient(135deg, #07c160, #00a86b); box-shadow: 0 3px 10px rgba(7,193,96,0.45); }
.marker-institution .marker-pin { background: linear-gradient(135deg, #1a8cff, #0056b3); box-shadow: 0 3px 10px rgba(26,140,255,0.45); }
.marker-village .marker-pin    { background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 3px 10px rgba(139,92,246,0.5); }
/* 类型专属 label 配色 */
.marker-community .marker-label  { background: rgba(255,107,53,0.92); }
.marker-team .marker-label       { background: rgba(7,193,96,0.92); }
.marker-institution .marker-label { background: rgba(26,140,255,0.92); }
.marker-village .marker-label    { background: rgba(139,92,246,0.92); }

/* ============ 用户定位标记（脉冲蓝点 + 双扩散环） ============
   自适应屏幕尺寸 + 分辨率: 用 clamp() 根据屏幕 vmin 响应
   作为屏幕空间指示器, 不跟随地图缩放变化 (transform:none !important 覆盖 --marker-scale) */
.user-location-marker {
  position: relative;
  /* clamp(最小, 基准(vmin), 最大): 手机上约 22px, 平板/桌面约 28px, 超大屏不超过 32px */
  width: clamp(20px, 5vmin, 28px);
  height: clamp(20px, 5vmin, 28px);
  pointer-events: none;
  transform: none !important;       /* 覆盖 .custom-marker 的 transform: scale(var(--marker-scale)) */
  transform-origin: center center;
}
.user-location-dot {
  position: absolute;
  top: 50%; left: 50%;
  /* 蓝心尺寸为容器的 ~67%, 保持视觉比例一致 */
  width: 67%; height: 67%;
  background: #1a8cff;
  border: 2px solid #ffffff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(26,140,255,0.35), 0 2px 8px rgba(26,140,255,0.5);
  z-index: 2;
}
.user-location-ring {
  position: absolute;
  top: 50%; left: 50%;
  /* 扩散环初始尺寸 = 容器尺寸, 相对百分比让动画自适应 */
  width: 100%; height: 100%;
  border: 2px solid rgba(26,140,255,0.55);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: user-loc-pulse 2.2s ease-out infinite;
  z-index: 1;
}
.user-location-ring-2 { animation-delay: 1.1s; }
@keyframes user-loc-pulse {
  0%   { width: 100%; height: 100%; opacity: 0.85; }
  100% { width: 300%; height: 300%; opacity: 0; }
}
/* 近似定位（IP 级）样式: 较淡的蓝色 + 较慢脉冲 */
.user-location-marker.approximate .user-location-dot {
  background: #6ba3d9;
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(107,163,217,0.25), 0 2px 6px rgba(107,163,217,0.4);
}
.user-location-marker.approximate .user-location-ring {
  border-color: rgba(107,163,217,0.4);
  animation-duration: 3.2s;
}

/* ============ Drawer (地区选择) ============ */
.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 86%; max-width: 420px;
  background: #fff;
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 28px rgba(17,24,39,0.15);
}
.drawer.show { transform: translateX(0); }

.drawer-header {
  flex-shrink: 0;
  padding: 14px 16px;
  background: var(--primary-gradient);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.drawer-title { font-size: 16px; font-weight: 600; }
.drawer-close {
  /* 增大到 44×44px 以符合触控标准 */
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border-radius: 50%;
  background: rgba(255,255,255,0.18); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.drawer-close:active { background: rgba(255,255,255,0.28); }
.drawer-sub {
  flex-shrink: 0;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-sub);
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.drawer-current strong { color: var(--primary); font-weight: 600; }
.drawer-reset {
  font-size: 12px; color: var(--primary);
  padding: 4px 8px; border-radius: 6px;
  background: rgba(26,140,255,0.08);
  white-space: nowrap;
}

/* 面包屑（嵌入式导航条） */
.drawer-crumbs {
  flex-shrink: 0;
  padding: 10px 14px 0;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.crumb-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text-sub);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
  max-width: 100%;
}
.crumb-chip:hover { background: #e8f2ff; }
.crumb-chip.active {
  background: rgba(26,140,255,0.12);
  color: var(--primary);
  font-weight: 600;
}
.crumb-chip.placeholder {
  background: transparent; color: var(--text-mute); cursor: default; padding: 6px 6px;
}
.crumb-sep {
  color: var(--text-mute); font-size: 12px;
}

/* 分段 Tab（城市 / 区县 / 街道）— 非弹窗的嵌入式切换 */
.drawer-tabs {
  flex-shrink: 0;
  display: flex;
  padding: 12px 14px 0;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.drawer-tabs::-webkit-scrollbar { display: none; }
.drawer-tab {
  flex: 0 0 auto;
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text-sub);
  white-space: nowrap;
  position: relative;
}
.drawer-tab.active {
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(26,140,255,0.25);
}
.drawer-tab .count {
  display: inline-block;
  margin-left: 6px;
  min-width: 18px;
  padding: 0 5px;
  height: 16px;
  line-height: 16px;
  border-radius: 9px;
  font-size: 11px;
  text-align: center;
  background: rgba(255,255,255,0.25);
  color: inherit;
}
.drawer-tab:not(.active) .count {
  background: rgba(26,140,255,0.12);
  color: var(--primary);
}

/* 单级列表 */
.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.region-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.region-grid.one-col { grid-template-columns: 1fr; }
.region-pill {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid transparent;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 0;
}
.region-pill:active { background: #eef4ff; }
.region-pill.selected {
  background: rgba(26,140,255,0.1);
  border-color: rgba(26,140,255,0.25);
  color: var(--primary);
  font-weight: 600;
}
.region-pill .rp-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.region-pill .rp-arrow {
  color: var(--text-mute); font-size: 12px; flex-shrink: 0;
}
.region-pill.selected .rp-arrow { color: var(--primary); }
.region-pill .rp-count {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-mute);
  background: #eef1f6;
  padding: 1px 6px;
  border-radius: 8px;
}
.region-pill.selected .rp-count {
  background: rgba(26,140,255,0.16);
  color: var(--primary);
}

/* 无数据 */
.drawer-empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-mute);
}
.drawer-empty-icon { font-size: 42px; opacity: 0.5; margin-bottom: 8px; }
.drawer-empty-text { font-size: 13px; }

/* 选中确认栏（底部） */
.drawer-footer {
  flex-shrink: 0;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.drawer-selection {
  flex: 1; min-width: 0;
  font-size: 12.5px; color: var(--text-sub);
}
.drawer-selection strong {
  color: var(--text); font-weight: 600; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drawer-confirm {
  /* 增大按钮触控尺寸 */
  min-height: var(--touch-min);
  min-width: calc(var(--touch-min) * 2);
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(26,140,255,0.25);
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.drawer-confirm:active {
  transform: scale(0.96);
  opacity: 0.9;
}
.drawer-confirm:disabled {
  opacity: 0.45; box-shadow: none;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(17,24,39,0.88);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  z-index: 300;
  display: none;
  max-width: 80%;
  text-align: center;
}
.toast.show {
  display: block;
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -58%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* ============ 通用： detail / team / admin ============ */

/* Detail/Team 页头部导航 */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.header-right {
  display: flex;
  align-items: center;
}
.header-icon {
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  background: rgba(0,0,0,0.04);
  flex-shrink: 0;
}
.header-icon:hover {
  background: rgba(0,0,0,0.08);
}
.header-icon:active {
  background: rgba(0,0,0,0.12);
  transform: scale(0.92);
}
.header-title {
  font-size: 18px;
  font-weight: 700;               /* 加粗, 和 team.html 图2 风格对齐 */
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ 居中标题页头 ============

   两种子模式:
   A) header--centered (team-list.html): 完全居中, 左右对称 flex:1,
      标题仍在 .header-left 内部, 用 justify-content:center 居中
   B) header--with-back (team.html, detail.html): 有返回箭头但标题绝对居中,
      .header-title 独立元素, 用 position:absolute + left:50% transform 居中
      原理: header-left/right 各 flex:1 保证左右占位对称,
            title 脱离文档流 absolute 到 header 正中央, 不受左右按钮宽度影响 */

/* 模式 A: 完全居中, 无返回按钮
   原理: .header-left flex:1 独占整行, .header-right 强制 0 宽度 (空容器),
   .header 用 space-between 但 right 是空的, left 撑满,
   内部 justify-content:center 让 title 落在 header 物理正中央 */
.header--centered .header-left {
  justify-content: center;
}
.header--centered .header-right {
  flex: none;
  width: 0;
  overflow: hidden;
}

/* 模式 B: 有返回按钮但标题绝对居中 */
.header--with-back {
  position: relative;   /* 给 .header-title--center 绝对定位做基准 */
}
.header--with-back .header-left {
  /* 保持 flex:1, 但内容只有返回箭头, 占左侧空间 */
}
.header--with-back .header-right {
  flex: 1;              /* 对称占位, 和 .header-left 一样宽 */
}
.header-title--center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 50%;       /* 标题过长时截断, 避免被返回按钮挡住 */
  text-align: center;
}

.detail-content { padding: 16px; }
.hero-banner {
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
}
.hero-banner::before {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.1); border-radius: 50%;
}
.hero-banner::after {
  content: ''; position: absolute; right: 40px; bottom: -40px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.08); border-radius: 50%;
}
.hero-banner-content { position: relative; z-index: 1; }
.hero-banner-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.hero-banner-subtitle { font-size: 14px; opacity: 0.9; }

.card-section {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 16px; font-weight: 600; color: var(--text);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.card-title-bar {
  width: 3px; height: 14px;
  background: var(--primary-gradient-v);
  border-radius: 2px;
}
.tag-list {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.tag {
  padding: 6px 14px;
  background: linear-gradient(135deg, #e8f4ff, #e0f7fa);
  border-radius: 16px;
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}
.service-desc {
  font-size: 14px; color: var(--text-sub);
  line-height: 1.7; margin-bottom: 12px;
}
.info-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #f5f6f9;
}
.info-item:last-child { border-bottom: none; }
.info-label {
  min-width: 72px; font-size: 13px; color: var(--text-mute);
}
.info-value {
  flex: 1; font-size: 14px; color: var(--text); line-height: 1.6;
}
.info-value.phone {
  color: var(--success); display: flex; align-items: center; gap: 6px;
}

.team-card {
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.team-banner {
  height: 150px; background: var(--primary-gradient);
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.team-banner-avatars { display: flex; }
.team-banner-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  border: 3px solid #fff;
  margin-left: -14px;
  background: linear-gradient(135deg, #1890ff, #36cfc9);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 600;
}
.team-banner-avatar:first-child { margin-left: 0; }
.team-info { padding: 16px; }
.team-name-tag {
  display: inline-block; padding: 4px 12px;
  background: var(--primary-gradient);
  color: #fff; border-radius: 12px;
  font-size: 13px; font-weight: 500; margin-bottom: 12px;
}
.team-desc {
  font-size: 14px; color: var(--text-sub);
  line-height: 1.7; margin-bottom: 10px;
}
.team-phone {
  font-size: 14px; color: var(--success);
  display: flex; align-items: center; gap: 6px; margin-bottom: 12px;
}
.member-list { margin-top: 12px; }
.member-item {
  display: flex; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f5f6f9;
}
.member-item:last-child { border-bottom: none; }
.member-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, #1890ff, #36cfc9);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 600;
  margin-right: 12px; flex-shrink: 0;
}
.member-info { flex: 1; }
.member-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.member-role { font-size: 13px; color: var(--text-mute); }

/* ============ Admin ============ */
.admin-container {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--primary);
}
.admin-title { font-size: 22px; font-weight: 700; color: var(--text); }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-nav-btn {
  padding: 8px 18px;
  border-radius: 6px;
  background: #f3f5f8;
  color: var(--text-sub);
  font-size: 14px;
  transition: all 0.2s;
}
.admin-nav-btn.active { background: var(--primary-gradient); color: #fff; }

.admin-card {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.admin-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  flex-wrap: wrap;
}
.admin-search { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-search-input {
  padding: 8px 12px;
  border: 1px solid #e3e6ec;
  border-radius: 6px;
  font-size: 14px;
  width: 240px;
}
.admin-search-btn {
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
}
.admin-add-btn {
  padding: 8px 16px;
  background: var(--primary-gradient);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 4px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}
.admin-table thead,
.admin-table tbody { display: table; width: 100%; }
.admin-table th {
  background: #fafbfd;
  padding: 12px 14px;
  text-align: left;
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid #f5f6f9;
}
.admin-table tr:hover td { background: #fafbfd; }
.admin-action { display: flex; gap: 12px; }
.admin-action-btn { color: var(--primary); font-size: 13px; cursor: pointer; }
.admin-action-btn.danger { color: var(--danger); }

/* ============ Admin Modal ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(17,24,39,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-content {
  background: #fff;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.modal-title { font-size: 17px; font-weight: 600; color: var(--text); }
.modal-close { font-size: 22px; color: var(--text-mute); cursor: pointer; line-height: 1; }
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1; min-height: 0;
}
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 13px; color: var(--text-sub);
  margin-bottom: 6px;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e3e6ec;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
  color: var(--text);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,140,255,0.12);
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end;
  gap: 10px; flex-shrink: 0;
}
.modal-btn {
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.modal-btn-cancel { background: #f3f5f8; color: var(--text-sub); }
.modal-btn-confirm { background: var(--primary-gradient); color: #fff; }

/* ============ 旧 area-modal / area-* 类兼容（保留但不使用，隐藏即可） ============ */
.area-modal { display: none !important; }

/* ============ 地图中心点脉冲高亮（切换地区后的视觉锚点） ============ */
.map-center-pulse {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.map-center-pulse-core {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1a8cff;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(26, 140, 255, 0.6);
  position: relative;
  z-index: 3;
}
.map-center-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(26, 140, 255, 0.45);
  transform: translate(-50%, -50%);
  animation: mapPulseRing 1.6s ease-out infinite;
}
.map-center-pulse-ring-2 {
  animation-delay: 0.6s;
  background: rgba(26, 140, 255, 0.3);
}
.map-center-pulse-label {
  position: absolute;
  top: calc(50% + 18px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.map-center-pulse-label::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 6px;
  height: 6px;
  background: rgba(17, 24, 39, 0.85);
}
@keyframes mapPulseRing {
  0% {
    width: 16px;
    height: 16px;
    opacity: 0.9;
  }
  100% {
    width: 56px;
    height: 56px;
    opacity: 0;
  }
}

/* ============ 响应式设计 ============
 * 断点策略:
 *   - ≤360px: 小屏手机 (iPhone SE, 4.7英寸)  —— 最紧凑布局
 *   - 361-480px: 标准手机 (iPhone 14/15, 5.8-6.1英寸)
 *   - 481-600px: 大屏手机/平板 (iPhone 14 Pro Max, 6.7英寸; iPad mini)
 *   - ≥601px: 平板/桌面端
 */

/* ============ 横屏适配 ============
 * 横屏时视口高度变小，需要压缩垂直方向占用
 * 针对高度 ≤ 500px 的横屏设备调整
 */
@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --header-h: 90px;
  }
  .app-hero {
    padding: calc(8px + var(--safe-top)) 16px 32px;
  }
  .hero-brand {
    padding: 2px 0 0;
  }
  .hero-brand h1 {
    font-size: 18px;
    letter-spacing: 1px;
  }
  .hero-brand-sub {
    font-size: 12px;
    margin-top: 2px;
  }
  .hero-brand-tag {
    margin-top: 3px;
    font-size: 11px;
    padding: 1px 8px;
  }
  .map-card {
    margin: -20px 12px 0;
  }
  #mapContainer {
    height: 200px;
  }
  .map-bottom {
    padding: 6px 12px;
  }
  .search-box {
    margin-top: 8px;
  }
  .section-title {
    padding: 10px 16px 6px;
  }
  .institution-card {
    padding: 10px 12px;
  }
  .institution-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  .nav-item {
    font-size: 11px;
  }
  .nav-icon {
    font-size: 18px;
  }
  /* 横屏时详情/团队页头部压缩 */
  .header {
    padding: calc(8px + var(--safe-top)) 12px 8px;
  }
  .header-title {
    font-size: 15px;
  }
}

/* ============ 断点1: ≤360px 小屏手机 ============
 * 覆盖 iPhone SE (375×667)、iPhone 8 (375×667) 等小屏设备
 */
@media (max-width: 360px) {
  :root {
    --header-h: 110px;
    --nav-h: 52px;
  }
  .app-hero {
    padding: calc(8px + var(--safe-top)) 12px 42px;
  }
  .hero-brand h1 {
    font-size: 22px;
    letter-spacing: 2px;
  }
  .hero-brand-sub {
    font-size: 12px;
  }
  .hero-brand-tag {
    font-size: 11px;
    padding: 2px 8px;
  }
  /* 缩小地图高度以适配小屏 */
  #mapContainer {
    height: 260px;
  }
  .map-card {
    margin: -28px 10px 0;
  }
  .search-box {
    margin-left: 10px;
    margin-right: 10px;
  }
  .institution-list {
    padding: 0 10px;
  }
  .institution-card {
    padding: 12px;
    gap: 10px;
  }
  .institution-icon {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
  .institution-name {
    font-size: 15px;
  }
  .institution-distance {
    font-size: 12px;
  }
  .action-btn {
    min-height: 40px;
    min-width: 40px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .section-title {
    padding: 16px 12px 8px;
  }
  .section-title-text {
    font-size: 15px;
  }
  .nav-icon {
    font-size: 22px;
  }
  .nav-item {
    font-size: 11px;
  }
  /* 详情/团队页头部小屏适配 */
  .header {
    padding: calc(10px + var(--safe-top)) 12px 10px;
  }
  .header-title {
    font-size: 15px;
  }
  .header-icon {
    font-size: 18px;
  }
  /* 机构卡片操作按钮在小屏下换行更紧凑 */
  .institution-actions {
    gap: 6px;
  }
  .region-grid {
    grid-template-columns: 1fr;
  }
  /* 弹窗适配 */
  .modal-overlay {
    padding: 8px;
  }
  .modal-content {
    max-height: 90vh;
    border-radius: var(--radius-md);
  }
  .drawer {
    width: 92%;
  }
}

/* ============ 断点2: 361-480px 标准手机 ============
 * 覆盖 iPhone 14/15 (390×844)、iPhone 14 Pro (393×852) 等主流手机
 */
@media (min-width: 361px) and (max-width: 480px) {
  :root {
    --header-h: 120px;
  }
  .app-hero {
    padding: calc(10px + var(--safe-top)) 14px 48px;
  }
  .hero-brand h1 {
    font-size: 24px;
    letter-spacing: 2px;
  }
  /* 地图高度适度调整 */
  #mapContainer {
    height: 300px;
  }
  .map-card {
    margin: -30px 12px 0;
  }
  .search-box,
  .institution-list {
    margin-left: 12px;
    margin-right: 12px;
  }
  .region-grid {
    grid-template-columns: 1fr;
  }
  .drawer {
    width: 88%;
  }
}

/* ============ 断点3: 481-600px 大屏手机/小平板 ============
 * 覆盖 iPhone 14 Pro Max (430×932)、iPad mini 等设备
 */
@media (min-width: 481px) and (max-width: 600px) {
  :root {
    --header-h: 130px;
  }
  .app-hero {
    padding: calc(12px + var(--safe-top)) 18px 56px;
  }
  .hero-brand h1 {
    font-size: 26px;
  }
  /* 大屏手机可以显示更大的地图 */
  #mapContainer {
    height: 360px;
  }
  .map-card {
    margin: -34px 16px 0;
  }
  /* 在大屏手机上恢复双列显示地区 */
  .region-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .institution-icon {
    width: 52px;
    height: 52px;
  }
}

/* ============ 断点4: ≥751px 桌面端 ============
 * 桌面端：卡片柔和的居中视觉，更大的最大宽度
 */
@media (min-width: 751px) {
  .page-container {
    max-width: 900px;
  }
  .app-hero {
    padding: calc(20px + var(--safe-top)) 40px 80px;
    max-width: calc(100% - 80px);
    margin-left: auto;
    margin-right: auto;
  }
  .hero-brand h1 {
    font-size: 32px;
    letter-spacing: 4px;
  }
  .hero-brand-sub {
    font-size: 16px;
  }
  .hero-brand-tag {
    font-size: 14px;
    padding: 4px 16px;
  }
  #mapContainer {
    height: 420px;
  }
  .map-card {
    margin: -40px auto 0;
    width: calc(100% - 80px);
  }
  .search-box {
    margin: 14px auto 0;
    width: calc(100% - 80px);
  }
  .section-title {
    width: calc(100% - 80px);
    margin-left: auto;
    margin-right: auto;
  }
  .institution-list {
    width: calc(100% - 80px);
    margin-left: auto;
    margin-right: auto;
  }
  .nav-item {
    font-size: 13px;
  }
  .nav-icon {
    font-size: 26px;
  }
  /* 桌面端详情/团队页头部适配 */
  .header {
    padding: calc(16px + var(--safe-top)) 24px 16px;
  }
  .header-title {
    font-size: 20px;
  }
  .header-icon {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    font-size: 22px;
  }
  /* 桌面端机构卡片使用双列布局 */
  .institution-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .institution-card {
    margin-bottom: 0;
  }
}

/* ============ 断点5: ≥1024px 平板/大屏 ============ */
@media (min-width: 1024px) {
  .page-container {
    max-width: 1024px;
  }
  #mapContainer {
    height: 500px;
  }
  .institution-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============ 后台管理页面移动端适配 ============ */
/* 手机端后台：表格改为卡片视图，工具栏自适应 */
@media (max-width: 600px) {
  .admin-container {
    padding: 12px;
  }
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 10px;
  }
  .admin-title {
    font-size: 18px;
  }
  .admin-nav {
    gap: 6px;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar {
    display: none;
  }
  .admin-nav-btn {
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
    /* 增大触控区域 */
    min-height: var(--touch-min);
  }
  .admin-toolbar {
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .admin-search {
    flex: 1;
    width: 100%;
  }
  .admin-search-input {
    flex: 1;
    width: 100%;
    min-height: var(--touch-min);
    font-size: 15px;
  }
  .admin-search-btn,
  .admin-add-btn {
    min-height: var(--touch-min);
    padding: 8px 16px;
    font-size: 14px;
  }
  /* 表格在移动端改为卡片视图 */
  .admin-table {
    display: block;
  }
  .admin-table thead {
    display: none; /* 隐藏表头，改用卡片标题 */
  }
  .admin-table tbody {
    display: block;
    width: 100%;
  }
  .admin-table tr {
    display: block;
    background: #fff;
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    /* 增大点击区域 */
    min-height: calc(var(--touch-min) * 2);
  }
  .admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-all;
  }
  .admin-table td::before {
    /* 用 data-label 属性显示列名 */
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-sub);
    font-size: 13px;
    margin-right: 12px;
    flex-shrink: 0;
  }
  .admin-table td:last-child {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    margin-top: 6px;
  }
  .admin-table td:last-child::before {
    display: none;
  }
  .admin-action {
    gap: 16px;
  }
  .admin-action-btn {
    /* 增大操作按钮触控区域 */
    min-height: var(--touch-min);
    min-width: var(--touch-min);
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: 8px;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .admin-action-btn:active {
    background: rgba(26,140,255,0.08);
  }
  /* 弹窗适配移动端 */
  .modal-overlay {
    padding: 10px;
    align-items: flex-end; /* 移动端弹窗从底部弹出更友好 */
  }
  .modal-content {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-footer {
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
  }
  .modal-btn {
    width: 100%;
    min-height: var(--touch-min);
    padding: 12px;
    font-size: 15px;
  }
  /* 地图选点弹窗适配 */
  .map-picker-modal #mapPicker {
    height: 260px;
  }
  /* 统计卡片移动端适配 */
  .admin-stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 14px;
    border-radius: var(--radius-md);
  }
  .stat-value {
    font-size: 22px;
  }
  .stat-label {
    font-size: 12px;
  }
  .stat-icon {
    font-size: 24px;
  }
}

/* 极小屏幕（≤360px）后台适配 */
@media (max-width: 360px) {
  .admin-container {
    padding: 8px;
  }
  .admin-nav-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .admin-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-card {
    padding: 10px;
  }
  .stat-value {
    font-size: 18px;
  }
  .admin-table tr {
    padding: 12px;
  }
  .admin-table td {
    font-size: 13px;
  }
}

/* ============ 详情页与团队页移动端适配 ============ */
@media (max-width: 480px) {
  .detail-content {
    padding: 12px;
  }
  .hero-banner {
    padding: 16px 14px;
    margin-bottom: 12px;
  }
  .hero-banner-title {
    font-size: 18px;
  }
  .hero-banner-subtitle {
    font-size: 13px;
  }
  .card-section {
    padding: 14px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
  }
  .card-title {
    font-size: 15px;
  }
  .info-label {
    min-width: 64px;
    font-size: 12px;
  }
  .info-value {
    font-size: 13px;
  }
  .tag-list {
    gap: 6px;
  }
  .tag {
    padding: 5px 12px;
    font-size: 12px;
  }
  .service-desc {
    font-size: 13px;
    line-height: 1.6;
  }
  .team-banner {
    height: 120px;
  }
  .team-banner-avatar {
    width: 48px;
    height: 48px;
    font-size: 16px;
    margin-left: -12px;
  }
  .team-info {
    padding: 14px;
  }
  .team-banner-avatar:first-child {
    margin-left: 0;
  }
  .member-avatar {
    width: 40px;
    height: 40px;
    font-size: 14px;
    margin-right: 10px;
  }
  .member-name {
    font-size: 14px;
  }
  .member-role {
    font-size: 12px;
  }
}
