/* ================= 无人机白名单页面样式 ================= */
.whitelist-add-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--stripe-bg);
  border: 1px solid var(--row-border);
  border-radius: 10px;
  margin-bottom: 14px;
}

.whitelist-add-bar .whitelist-sn-input {
  flex: 2;
  min-width: 220px;
  font-family: monospace;
  text-transform: uppercase;
}

.whitelist-add-bar .whitelist-name-input {
  flex: 1.2;
  min-width: 150px;
}

.whitelist-add-bar .whitelist-model-select {
  flex: 1;
  min-width: 160px;
}

.whitelist-hint {
  font-size: 13px;
  color: var(--success);
  min-height: 20px;
  margin-bottom: 10px;
}

.whitelist-hint.error {
  color: var(--danger);
}

.whitelist-table th,
.whitelist-table td {
  padding: 10px 12px;
}

/* ================= 无人机侦测平台 主页面样式（浅色主题） ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0D6EFD;
  --primary-dark: #0a58ca;
  --primary-light: #3d8bfd;
  --sidebar-width: 220px;
  --topbar-h: 56px;

  /* 浅色主题配色 */
  --content-bg: #eef2f7;
  --panel-bg: #ffffff;
  --panel-border: rgba(15, 35, 65, 0.1);
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --text-main: #1d2b3f;
  --text-dim: #5b6f8a;
  --text-mute: #93a5bd;
  --hover-bg: rgba(13, 40, 80, 0.05);
  --stripe-bg: rgba(13, 40, 80, 0.03);
  --row-border: rgba(13, 40, 80, 0.06);
  --success: #43A047;
  --warning: #ff9800;
  --danger: #E53935;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--content-bg);
  color: var(--text-main);
  min-height: 100vh;
  font-size: 14px;
  overflow: hidden;
}

/* ===== 布局 ===== */
.layout {
  display: flex;
  height: 100vh;
}

/* ===== 侧边栏（浅色） ===== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  margin-left: 0;
  background: linear-gradient(180deg, #f4f7fb, #e9eef5);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* 展开/隐藏：侧边栏整块用 transform GPU 滑动（合成器执行必有动画、绝不跳变），
     easeOutExpo 曲线：起步轻快、末端柔缓停止，流畅自然。
     will-change 提前建立 GPU 合成层；
     占位收回由 .main 的 margin-left 负值补偿完成（见 .layout.sidebar-collapsed .main）。
     z-index 高于 .main：收起时主内容区负 margin 向左扩展，不可遮挡侧边栏滑入 */
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  z-index: 30;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--panel-border);
  transition: padding 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              gap 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}

.logo-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  color: var(--text-main);
}

.logo-sub {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
}

/* 导航 */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  margin: 2px 10px;
  border-radius: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(13, 110, 253, 0.15), rgba(13, 110, 253, 0.04));
  color: var(--primary);
  font-weight: 500;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(13, 110, 253, 0.5);
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.nav-badge.live {
  background: rgba(229, 57, 53, 0.15);
  color: var(--danger);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== 底部用户区 ===== */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--panel-border);
  transition: padding 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 35, 65, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px;
  transition: padding 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              gap 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0D6EFD, #43A047);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.user-role {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.logout-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.logout-btn svg {
  width: 16px;
  height: 16px;
}

.logout-btn:hover {
  background: rgba(229, 57, 53, 0.12);
  color: var(--danger);
}

/* ===== 主内容区 ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* 侧边栏隐藏时向左补偿占位（margin-left 负值），与 transform 滑出动画同步，
     视觉上侧边栏被推出屏幕、主内容区平滑拉回铺满全屏 */
  transition: margin-left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== 顶部栏 ===== */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.sys-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(67, 160, 71, 0.1);
  border: 1px solid rgba(67, 160, 71, 0.25);
  padding: 4px 12px;
  border-radius: 20px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px rgba(67, 160, 71, 0.8);
  animation: pulse 2s infinite;
}

.topbar-time {
  font-size: 12.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ===== 内容区 ===== */
.content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ===== 页面切换动画 =====
   JS (switchPage) 切换流程：
   1. 给当前页面添加 .leaving（仍在显示中，播放退场动画 pageOut）
   2. 退场动画结束后移除所有 .active/.leaving，再给目标页面添加 .active
   3. 目标页面播放进场动画 pageIn（淡入 + 上移）
   easeOutExpo 曲线与侧边栏/面板动画一致，保持整体动效风格统一 */
.page {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.page.active {
  display: block;
  animation: pageIn 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 旧页面退场：保持显示并播放淡出 + 上移，结束后由 JS 移除该类 */
.page.leaving {
  display: block;
  animation: pageOut 0.24s ease forwards;
  pointer-events: none;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

/* ===== 实时监控页（首页全屏） ===== */
.monitor-page {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 50% 30%, rgba(13, 110, 253, 0.06), transparent 60%),
    var(--content-bg);
}

/* 高德地图容器（全屏） */
.map-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* 地图左下角工具按钮组（纵排：适飞空域开关 + 卫星/普通地图切换） */
.map-tool-buttons {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 46px;
  height: 46px;
  padding: 4px 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #4a5a6a;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.map-tool-btn svg {
  width: 20px;
  height: 20px;
}

.map-tool-btn:hover {
  background: #f0f5ff;
  color: #0D6EFD;
  box-shadow: 0 2px 12px rgba(13, 110, 253, 0.28);
}

.map-tool-btn.active {
  background: #0D6EFD;
  color: #fff;
  box-shadow: 0 2px 10px rgba(13, 110, 253, 0.45);
}

/* 雷达降级方案 */
.radar-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
}

/* 雷达演示 */
.radar {
  width: min(46vh, 380px);
  height: min(46vh, 380px);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(13, 110, 253, 0.3);
  background:
    radial-gradient(circle, rgba(13, 110, 253, 0.06) 25%, transparent 25%),
    linear-gradient(90deg, rgba(13, 110, 253, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(13, 110, 253, 0.08) 1px, transparent 1px);
  background-size: 100% 100%, 25% 25%, 25% 25%;
  box-shadow: 0 0 60px rgba(13, 110, 253, 0.15), inset 0 0 60px rgba(13, 110, 253, 0.05);
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(13, 110, 253, 0.18);
}

.radar-ring.r1 { inset: 25%; }
.radar-ring.r2 { inset: 50%; }
.radar-ring.r3 { inset: 75%; }
.radar-ring.r4 { inset: 0; border-color: rgba(13, 110, 253, 0.1); }

.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(13, 110, 253, 0.35) 0deg,
    transparent 70deg,
    transparent 360deg
  );
  animation: sweep 4s linear infinite;
}

@keyframes sweep {
  to { transform: rotate(360deg); }
}

.radar-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #0D6EFD;
  box-shadow: 0 0 12px #0D6EFD;
}

.blip {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px currentColor;
  animation: blip 1.5s ease-in-out infinite;
}

.blip:nth-child(2n) { animation-delay: 0.5s; }
.blip:nth-child(3n) { animation-delay: 1s; }

@keyframes blip {
  0%, 100% { opacity: 1; scale: 1; }
  50% { opacity: 0.5; scale: 1.3; }
}

/* 雷达信息 */
.radar-info {
  text-align: center;
}

.radar-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.radar-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.radar-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.radar-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.radar-stat .label {
  font-size: 13px;
  color: var(--text-dim);
}

.radar-stat .value {
  font-size: 28px;
  font-weight: 700;
}

.radar-stat .value.red { color: var(--danger); }
.radar-stat .value.green { color: var(--success); }

.radar-stat .unit {
  font-size: 12px;
  color: var(--text-dim);
}

/* ===== 右下角窗口堆叠容器（防撞预警 + 实时侦测，统一外观） =====
   使用普通块级布局而非 flex：flex 布局下子项宽度由 flex 算法解析，
   width 过渡动画不会触发（导致点击后瞬间收起无动画）。
   子面板改用 margin-left:auto 右对齐，宽度变化由纯 CSS width 驱动过渡。 */
.monitor-stack {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 360px;
  max-width: calc(100vw - 260px);
  z-index: 20;
  pointer-events: none;
}

.monitor-stack > * {
  pointer-events: auto;
  margin-left: auto;
}

.monitor-stack > * + * {
  margin-top: 10px;
}

/* 避免首次加载恢复折叠状态时产生过渡动画（与天气面板 no-animate 规则一致） */
.monitor-float-panel.no-animate,
.monitor-float-panel.no-animate *,
.collision-warning-panel.no-animate,
.collision-warning-panel.no-animate * {
  transition: none !important;
}

/* ===== 实时侦测悬浮窗（右下角，与防撞预警统一外观） ===== */
.monitor-float-panel {
  position: relative;
  right: auto;
  bottom: auto;
  /* 宽度为固定像素（与 .monitor-stack 一致），折叠时 360px→180px 纯像素插值可触发过渡；
     避免 width:100%(百分比) → width:180px(像素) 因单位不同无法插值而瞬间跳变。
     max-width 同样使用可插值的长度值（calc(100vw-260px) → 180px） */
  width: 360px;
  max-width: calc(100vw - 260px);
  /* 始终靠右对齐（与折叠状态一致）：宽度随动画变化时右边缘固定不动，向左展开，与天气窗口一致 */
  align-self: flex-end;
  /* 磨砂玻璃半透明效果（与右上角天气窗口一致）：透出地图背景，毛玻璃质感 */
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(13, 40, 80, 0.22);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              max-width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.5s ease,
              border-color 0.5s ease;
}

.float-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--row-border);
  cursor: pointer;
  user-select: none;
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.06), rgba(13, 110, 253, 0.02));
  transition: border-bottom-color 0.35s ease,
              padding 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              gap 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.float-panel-header > svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}

.float-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  transition: font-size 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}

.float-panel-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(13, 110, 253, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: font-size 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}

.float-panel-toggle {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background-color 0.2s ease,
              color 0.2s ease;
}

.float-panel-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.float-panel-toggle:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

  /* 折叠状态：与天气窗口动画一致（不限制面板高度，由列表内容区 max-height 收为 0 驱动面板自然收起） */
.monitor-float-panel.collapsed {
  width: 180px;
  max-width: 180px;
  margin-right: 0;
  align-self: flex-end;
  box-shadow: 0 6px 18px rgba(13, 40, 80, 0.14);
  transition: width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              max-width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.5s ease,
              border-color 0.5s ease;
}

/* 折叠时隐藏折叠箭头（淡出后再隐藏，动画结束移除显示） */
.monitor-float-panel.collapsed .float-panel-toggle {
  opacity: 0;
  transform: scale(0.6);
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.monitor-float-panel.collapsed .float-panel-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
}

.monitor-float-panel.collapsed .float-panel-title {
  font-size: 12px;
}

.monitor-float-panel.collapsed .float-panel-header {
  cursor: pointer;
  border-bottom-color: transparent;
  gap: 0;
}

/* 折叠时标题图标淡出，避免宽度收窄时被硬性裁切 */
.monitor-float-panel.collapsed .float-panel-header > svg {
  opacity: 0;
}

.monitor-float-panel.collapsed .float-panel-title {
  opacity: 0.85;
}

/* ===== 实时无人机侦测列表 ===== */
.drone-list {
  flex: 1 0 auto;
  min-height: 0;
  max-height: 46vh;
  overflow-y: auto;
  padding: 10px 12px;
  opacity: 1;
  transition: max-height 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease,
              padding-top 0.3s ease,
              padding-bottom 0.3s ease;
}

.drone-list::-webkit-scrollbar {
  width: 5px;
}

.drone-list::-webkit-scrollbar-thumb {
  background: rgba(13, 40, 80, 0.15);
  border-radius: 4px;
}

.drone-list::-webkit-scrollbar-track {
  background: transparent;
}

/* 空状态 */
.drone-list-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-mute);
  font-size: 13px;
}

.drone-list-empty svg {
  width: 40px;
  height: 40px;
  opacity: 0.4;
}

/* 无人机卡片（对齐 App 实时侦测板块样式，半透明磨砂与面板一致） */
.drone-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(238, 242, 247, 0.7);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* 新出现的无人机卡片：播放进入动画 + 短暂高亮提示（2 秒后由 JS 移除类名） */
.drone-card.enter {
  animation: droneIn 0.35s ease;
  border-color: rgba(13, 110, 253, 0.55);
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.05), rgba(13, 110, 253, 0.02));
}

@keyframes droneIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.drone-card:hover {
  border-color: rgba(13, 110, 253, 0.45);
  box-shadow: 0 4px 14px rgba(13, 40, 80, 0.1);
  transform: translateY(-1px);
}

.drone-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.drone-title-group {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.drone-model {
  font-size: 16px;
  font-weight: 700;
  color: #0288d1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drone-category {
  flex-shrink: 0;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 8px;
}

.drone-category.消费级 {
  background: rgba(67, 160, 71, 0.14);
  color: #2e7d32;
}

.drone-category.穿越机 {
  background: rgba(255, 152, 0, 0.16);
  color: #e65100;
}

.drone-category.行业级 {
  background: rgba(106, 76, 205, 0.14);
  color: #6a4ccd;
}

/* 报文类型标签：1=中国国标 2=国际标准(非国标) */
.drone-proto {
  flex-shrink: 0;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 8px;
}
.drone-proto.proto-gb {
  background: rgba(2, 136, 209, 0.14);
  color: #0277bd;
  border: 1px solid rgba(2, 136, 209, 0.3);
}
.drone-proto.proto-intl {
  background: rgba(229, 57, 53, 0.12);
  color: #c62828;
  border: 1px solid rgba(229, 57, 53, 0.28);
}
.drone-proto.proto-unknown {
  background: rgba(120, 144, 156, 0.12);
  color: #607d8b;
}

/* 白名单无人机标识（仅白名单飞机显示，非白名单不显示） */
.drone-whitelist-tag {
  flex-shrink: 0;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 8px;
  background: rgba(67, 160, 71, 0.14);
  color: #2e7d32;
  border: 1px solid rgba(67, 160, 71, 0.3);
}

.drone-sn {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 8px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

/* 本次飞行首次发现时间（相对时间，每秒刷新） */
.drone-card-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.drone-card-time svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
}

.drone-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drone-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drone-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 188, 212, 0.1);
  color: #0097a7;
  font-variant-numeric: tabular-nums;
}

.drone-chip svg {
  width: 11px;
  height: 11px;
}

.drone-chip.geo-alt {
  background: rgba(255, 152, 0, 0.12);
  color: #e65100;
}

.drone-chip.speed {
  background: rgba(13, 110, 253, 0.1);
  color: var(--primary);
}

.drone-rssi {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.drone-rssi svg {
  width: 16px;
  height: 16px;
}

.drone-rssi.strong { color: var(--success); }
.drone-rssi.medium { color: var(--warning); }
.drone-rssi.weak { color: var(--danger); }
/* 信号丢失（超过 5 秒无上报显示灰色提示，未到 120 秒归档前仍在实时列表保留） */
.drone-rssi.lost { color: #9e9e9e; }
.drone-rssi.lost svg { opacity: 0.5; }

/* 小屏幕适配：堆叠窗口缩小（面板同步为 300px，折叠 180px 仍可插值过渡；
   若不同步，360px 固定宽会溢出 300px 容器） */
@media (max-width: 1100px) {
  .monitor-stack {
    width: 300px;
  }
  .monitor-float-panel,
  .collision-warning-panel {
    width: 300px;
  }
}

/* ===== 防撞预警显示栏（右下角，与实时侦测统一外观） ===== */
.collision-warning-panel {
  position: relative;
  top: auto;
  right: auto;
  /* 固定像素宽度（与 .monitor-float-panel 一致），折叠时 360px→180px 可插值触发过渡；
     避免 width:100%(百分比) → width:180px(像素) 单位不同无法插值而瞬间跳变 */
  width: 360px;
  max-width: calc(100vw - 260px);
  /* 始终靠右对齐（与折叠状态一致）：宽度随动画变化时右边缘固定不动，向左展开，与天气窗口一致 */
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  /* 磨砂玻璃半透明效果（与右上角天气窗口一致）：透出地图背景，毛玻璃质感 */
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(13, 40, 80, 0.22);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  overflow: hidden;
  transition: width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              max-width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.5s ease,
              border-color 0.5s ease;
}

.collision-warning-panel.alert {
  border-color: rgba(229, 57, 53, 0.7);
  box-shadow: 0 0 0 1px rgba(229, 57, 53, 0.35),
    0 8px 32px rgba(229, 57, 53, 0.18);
  animation: collisionPanelPulse 1.2s ease-in-out infinite;
}

@keyframes collisionPanelPulse {
  0%, 100% {
    border-color: rgba(229, 57, 53, 0.7);
    box-shadow: 0 0 0 1px rgba(229, 57, 53, 0.35),
      0 8px 32px rgba(229, 57, 53, 0.18);
  }
  50% {
    border-color: rgba(229, 57, 53, 1);
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.6),
      0 0 42px rgba(229, 57, 53, 0.45);
  }
}

.collision-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--row-border);
  user-select: none;
  background: linear-gradient(135deg, rgba(229, 57, 53, 0.06), rgba(229, 57, 53, 0.02));
  transition: border-bottom-color 0.35s ease,
              padding 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              gap 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.collision-header > svg {
  width: 16px;
  height: 16px;
  color: #E53935;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}

.collision-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  transition: font-size 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}

.collision-status {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: font-size 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}

.collision-status.ok {
  color: var(--success);
  background: rgba(67, 160, 71, 0.12);
}

.collision-status.alert {
  color: #fff;
  background: #E53935;
  animation: collisionStatusBlink 0.8s steps(2, start) infinite;
}

/* 防撞预警功能开关（拨动开关样式） */
.collision-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 19px;
  flex-shrink: 0;
  cursor: pointer;
  margin-left: 4px;
  transition: opacity 0.25s ease,
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              margin 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 实时侦测面板内的轨迹显示开关（"轨迹"文字提示置于开关上方）：
   与面板标题保持间距，折叠时自动隐藏 */
.float-trail-switch {
  margin-left: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: auto;
  height: auto;
  padding: 0 3px;
  cursor: pointer;
  transition: opacity 0.25s ease,
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              margin 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.float-trail-label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(13, 110, 253, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
  user-select: none;
  line-height: 1.3;
}

/* 轨迹开关内滑动条：使用相对定位内联块布局（配合文字提示），
   滑块圆点 ::before 相对此元素绝对定位 */
.float-trail-switch .collision-switch-slider {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 16px;
  border-radius: 16px;
  background: #c8d2e0;
  flex-shrink: 0;
}

/* 滑块圆点使用相对定位，跟随滑动条 */
.float-trail-switch .collision-switch-slider::before {
  position: absolute;
  width: 12px;
  height: 12px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(13, 40, 80, 0.25);
  transition: transform 0.25s ease;
}

/* 开关开启时滑动条显示主题蓝色（区别于防撞预警的红色） */
.float-trail-switch input:checked + .collision-switch-slider {
  background: #0D6EFD;
}

.float-trail-switch input:checked + .collision-switch-slider::before {
  transform: translateX(14px);
}

/* 折叠时轨迹开关淡出收缩（与折叠箭头一致） */
.monitor-float-panel.collapsed .float-trail-switch {
  opacity: 0;
  transform: scale(0.6);
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.collision-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.collision-switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 19px;
  background: #c8d2e0;
  transition: all 0.25s ease;
}

.collision-switch-slider::before {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(13, 40, 80, 0.25);
  transition: transform 0.25s ease;
}

.collision-switch input:checked + .collision-switch-slider {
  background: #E53935;
}

.collision-switch input:checked + .collision-switch-slider::before {
  transform: translateX(15px);
}

/* 折叠/展开按钮 */
.collision-toggle {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background-color 0.2s ease,
              color 0.2s ease,
              opacity 0.25s ease,
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              margin 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.collision-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.collision-toggle:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}

/* 折叠状态：只显示标题栏，靠右侧边缘（与实时侦测一致），完整显示状态信息 */
.collision-warning-panel.collapsed {
  width: 180px;
  max-width: 180px;
  margin-right: 0;
  align-self: flex-end;
  box-shadow: 0 6px 18px rgba(13, 40, 80, 0.14);
  transition: width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              max-width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.5s ease,
              border-color 0.5s ease;
}

.collision-warning-panel.collapsed .collision-title {
  font-size: 12px;
}

/* 折叠时防撞预警功能开关淡出收缩 */
.collision-warning-panel.collapsed .collision-switch {
  opacity: 0;
  transform: scale(0.6);
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

/* 折叠时隐藏折叠箭头（淡出收缩，与实时侦测一致） */
.collision-warning-panel.collapsed .collision-toggle {
  opacity: 0;
  transform: scale(0.6);
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

/* 折叠时保持状态标签突出显示 */
.collision-warning-panel.collapsed .collision-status {
  font-size: 10px;
  padding: 2px 8px;
}

/* 折叠时隐藏 header 底部边框，避免折叠后标题栏下方残留边框（与天气窗口一致） */
.collision-warning-panel.collapsed .collision-header {
  cursor: pointer;
  border-bottom-color: transparent;
  gap: 0;
}

/* 折叠时标题图标淡出，避免宽度收窄时被硬性裁切 */
.collision-warning-panel.collapsed .collision-header > svg {
  opacity: 0;
}

.collision-warning-panel.collapsed .collision-title {
  opacity: 0.85;
}

/* 折叠时列表内容淡出收起（与天气窗口 body 效果一致） */
.monitor-float-panel.collapsed .drone-list {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}
/* 折叠时列表内容淡出收起（与天气窗口 body 效果一致） */
.collision-warning-panel.collapsed .collision-list {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

@keyframes collisionStatusBlink {
  to { visibility: hidden; }
}

.collision-list {
  flex: 1 0 auto;
  min-height: 0;
  max-height: 40vh;
  overflow-y: auto;
  padding: 8px 12px;
  opacity: 1;
  transition: max-height 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease,
              padding-top 0.3s ease,
              padding-bottom 0.3s ease;
}

.collision-list::-webkit-scrollbar {
  width: 5px;
}

.collision-list::-webkit-scrollbar-thumb {
  background: rgba(13, 40, 80, 0.15);
  border-radius: 4px;
}

.collision-empty {
  padding: 18px 8px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}

/* 单条碰撞预警卡片（半透明磨砂与面板一致，红色调保持预警辨识度） */
.collision-item {
  background: rgba(255, 246, 246, 0.74);
  border: 1px solid rgba(229, 57, 53, 0.3);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: all 0.2s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.collision-item:last-child {
  margin-bottom: 0;
}

.collision-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.collision-item-sn {
  font-size: 11px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-weight: 600;
  color: #c62828;
  background: rgba(229, 57, 53, 0.1);
  padding: 2px 7px;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collision-item-sn.narrow {
  max-width: 100px;
}

.collision-item-vs {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #E53935;
  padding: 2px 8px;
  border-radius: 9px;
  flex-shrink: 0;
}

.collision-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
}

.collision-item-model {
  font-size: 13px;
  font-weight: 600;
  color: #0288d1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collision-item-dist {
  font-size: 12px;
  font-weight: 700;
  color: #c62828;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.collision-item-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.collision-item-alt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.collision-item-alt.warn {
  color: #c62828;
  font-weight: 700;
}

.collision-item-alt svg {
  width: 11px;
  height: 11px;
  opacity: 0.7;
}

/* 碰撞警报边缘红色闪烁光效 */
.collision-alert-edge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 18;
  border: 5px solid rgba(229, 57, 53, 0);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.collision-alert-edge.active {
  opacity: 1;
  animation: collisionEdgeFlash 0.7s ease-in-out infinite;
}

@keyframes collisionEdgeFlash {
  0%, 100% {
    border-color: rgba(229, 57, 53, 0);
    box-shadow:
      inset 0 0 40px rgba(229, 57, 53, 0),
      inset 0 0 40px rgba(229, 57, 53, 0);
  }
  50% {
    border-color: rgba(229, 57, 53, 0.85);
    box-shadow:
      inset 0 0 46px rgba(229, 57, 53, 0.5),
      inset 0 0 120px rgba(229, 57, 53, 0.22);
  }
}

/* ===== 面板 ===== */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  margin: 20px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(13, 40, 80, 0.06);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
}

.panel-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.panel-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.panel-body {
  padding: 20px;
}

/* ===== 历史记录筛选工具栏 ===== */
.history-filter-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--stripe-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
}

.history-filter-bar:empty {
  display: none;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.filter-group.filter-sn {
  flex: 1;
  min-width: 160px;
  max-width: 280px;
}

.filter-group.filter-alt {
  min-width: 120px;
  max-width: 160px;
}

.filter-group.filter-whitelist {
  min-width: 110px;
  max-width: 140px;
}

/* ===== 分页栏 ===== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.page-info {
  font-size: 12px;
  color: var(--text-dim);
  margin-right: 12px;
}

.page-current {
  font-size: 12px;
  color: var(--text-main);
  font-weight: 600;
  padding: 0 8px;
}

.page-btn {
  padding: 5px 12px;
  font-size: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== 每页条数下拉栏 ===== */
.page-size-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.page-size-label {
  font-size: 12px;
  color: var(--text-dim);
}

.page-size-select {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--text-main);
  outline: none;
}

.page-size-unit {
  font-size: 12px;
  color: var(--text-dim);
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.filter-input {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: var(--panel-bg);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
  font-variant-numeric: tabular-nums;
}

.filter-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
}

.filter-input::placeholder {
  color: var(--text-mute);
}

.history-filter-bar .btn {
  white-space: nowrap;
}

/* ===== 数据表格 ===== */
/* 表格横向滚动容器（移动端窄屏时避免撑破布局） */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap .data-table {
  min-width: 720px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
  background: var(--stripe-bg);
}

.data-table td {
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--row-border);
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--hover-bg);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* 信号强度 */
.rssi {
  font-weight: 600;
}

.rssi.strong { color: var(--success); }
.rssi.medium { color: var(--warning); }
.rssi.weak { color: var(--danger); }

/* 标签 */
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.tag.green {
  background: rgba(67, 160, 71, 0.12);
  color: #2e7d32;
}

.tag.orange {
  background: rgba(255, 152, 0, 0.12);
  color: #e65100;
}

.tag.red {
  background: rgba(229, 57, 53, 0.12);
  color: #c62828;
}

.tag.gray {
  background: var(--stripe-bg);
  color: var(--text-mute);
}

/* ===== 设备管理 ===== */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* ===== 固件管理（OTA，置于设备列表下方） ===== */
.firmware-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  margin-bottom: 12px;
}
.firmware-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.firmware-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.firmware-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* 固件管理操作提示条（独立于固件列表表格，显示在列表上方）：
   OTA 下发/上传成功等提示显示在此，不再覆盖固件版本列表内容 */
.firmware-hint {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px 10px 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(76, 175, 80, 0.28);
  border-left: 4px solid #4CAF50;
  border-radius: 6px;
  background: rgba(76, 175, 80, 0.08);
  color: #4CAF50;
  animation: firmwareHintIn 0.25s ease-out;
}
@keyframes firmwareHintIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.firmware-list-wrap {
  margin-bottom: 24px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: auto;
}
.firmware-table {
  min-width: 860px;
}
.firmware-table th {
  background: var(--stripe-bg);
  font-size: 12px;
  white-space: nowrap;
}
.firmware-table td {
  font-size: 12px;
  white-space: nowrap;
}

/* ===== 添加设备弹窗 ===== */
.device-add-box {
  max-width: 640px;
}

.device-form-row {
  margin-bottom: 14px;
}

.device-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.device-form-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
}

.device-form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
}

.deploy-search-row {
  position: relative;
  display: flex;
  gap: 8px;
}

.deploy-search-row .device-form-input {
  flex: 1;
}

/* 地址联想下拉 */
.deploy-suggest {
  display: none;
  margin-top: 4px;
  margin-bottom: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(13, 40, 80, 0.15);
  z-index: 999;
  max-height: 220px;
  overflow-y: auto;
}

.deploy-suggest-item {
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.deploy-suggest-item:hover {
  background: var(--hover-bg);
}

.deploy-suggest-item + .deploy-suggest-item {
  border-top: 1px solid var(--row-border);
}

.deploy-suggest-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.deploy-suggest-address {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.deploy-suggest-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* 手动输入经纬度定位行 */
.deploy-manual-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.deploy-manual-row .device-form-input {
  flex: 1;
  font-variant-numeric: tabular-nums;
}

.deploy-map {
  width: 100%;
  height: 260px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  margin-bottom: 10px;
}

.deploy-info {
  background: var(--stripe-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

.deploy-info-row {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  padding: 2px 0;
  word-break: break-all;
}

.deploy-info-label {
  flex-shrink: 0;
  color: var(--text-mute);
}

.device-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.device-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--row-border);
  display: flex;
  justify-content: flex-end;
}

/* 通用按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-danger {
  background: rgba(229, 57, 53, 0.12);
  color: #c62828;
}

.btn-danger:hover {
  background: rgba(229, 57, 53, 0.22);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ===== 详情弹窗（二级菜单） ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 40, 80, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  overflow-y: auto;
  animation: modalFade 0.25s ease;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  width: 100%;
  max-width: 560px;
  background: var(--panel-bg);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(13, 40, 80, 0.3);
  overflow: hidden;
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-border);
  background: var(--stripe-bg);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--hover-bg);
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(229, 57, 53, 0.15);
  color: var(--danger);
}

.modal-body {
  padding: 16px 18px;
  max-height: 70vh;
  overflow-y: auto;
}

/* 地图容器：相对定位，承载边缘浮动的播放控制按钮 */
.modal-map-wrap {
  position: relative;
  margin-bottom: 8px;
}

.modal-map {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

/* ===== 二级详情弹窗：桌面端左右布局（地图左 / 信息右） =====
   仅在真实详情弹窗生效（.modal-box-detail），不影响设备/固件等其它弹窗。
   移动端（≤640px）在媒体查询中恢复上下布局，与手机端现有展示一致。 */
.modal-box-detail {
  max-width: 1100px;
  height: calc(100vh - 120px);
  height: calc(100dvh - 120px);
  max-height: 760px;
  display: flex;
  flex-direction: column;
}

.modal-box-detail .modal-body {
  flex: 1;
  max-height: none;
  overflow: hidden;
  padding: 14px 18px;
  display: flex;
}

.modal-layout {
  flex: 1;
  display: flex;
  gap: 16px;
  min-height: 0;
  width: 100%;
}

.modal-map-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-map-side .modal-map-wrap {
  flex: 1;
  min-height: 0;
  margin-bottom: 8px;
}

.modal-map-side .modal-map {
  height: 100%;
  min-height: 280px;
}

.modal-map-side .modal-map-legend {
  margin-bottom: 0;
  margin-top: 2px;
  flex-shrink: 0;
}

.modal-info-side {
  width: 320px;
  min-width: 320px;
  max-width: 360px;
  overflow-y: auto;
  padding-right: 2px;
}

.modal-info-side .modal-section:last-child {
  margin-bottom: 0;
}

/* 二级弹窗地图左下角工具按钮（空域 + 卫星切换，纵排小按钮） */
.modal-map-tool-buttons {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-map-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 40px;
  height: 40px;
  padding: 3px 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #4a5a6a;
  font-size: 10px;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.modal-map-tool-btn svg {
  width: 18px;
  height: 18px;
}

.modal-map-tool-btn:hover {
  background: #f0f5ff;
  color: #0D6EFD;
  box-shadow: 0 2px 10px rgba(13, 110, 253, 0.28);
}

.modal-map-tool-btn.active {
  background: #0D6EFD;
  color: #fff;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.45);
}

/* 轨迹播放控制：浮动在地图右下角边缘（仅重播 / 跳过） */
.traj-player-overlay {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.modal-map-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-dim);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* 轨迹播放控制条按钮（浮动在地图边缘，半透明底色便于看清地图） */
.traj-player-overlay .btn {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(13, 40, 80, 0.15);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.traj-player-overlay .btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 轨迹播放控制按钮：仅符号（紧凑圆形，悬浮提示文字） */
.traj-player-overlay .traj-btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.modal-section {
  margin-bottom: 14px;
}

.modal-section-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.modal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.modal-section-body {
  background: var(--stripe-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 14px;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 5px 0;
  gap: 16px;
}

.modal-row-label {
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
  min-width: 76px;
  width: auto;
  white-space: nowrap;
}

.modal-row-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  text-align: right;
  word-break: break-all;
}

/* ===== 二级页面：高德导航二维码（可点击跳转高德导航） ===== */
.modal-nav-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px dashed var(--panel-border);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.modal-nav-qr:hover {
  background: rgba(13, 110, 253, 0.04);
  border-radius: 10px;
}

.modal-nav-qr-code {
  width: 92px;
  height: 92px;
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 6px;
  box-sizing: border-box;
}

.modal-nav-qr-code svg {
  display: block;
  width: 100%;
  height: 100%;
}

.modal-nav-qr-text {
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.modal-nav-qr-text::before {
  content: "";
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  flex-shrink: 0;
}

.device-card {
  background: var(--stripe-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 16px;
  transition: all 0.2s;
}

.device-card:hover {
  border-color: rgba(13, 110, 253, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(13, 40, 80, 0.12);
}

.device-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.device-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-icon svg {
  width: 20px;
  height: 20px;
}

.device-icon.blue { background: rgba(13, 110, 253, 0.12); color: var(--primary); }
.device-icon.green { background: rgba(67, 160, 71, 0.12); color: #2e7d32; }
.device-icon.gray { background: var(--stripe-bg); color: var(--text-mute); }

.device-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.device-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.device-status {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--hover-bg);
  padding: 6px 10px;
  border-radius: 6px;
}

/* 设备位置：标签 + 逆地理编码地点名称展示 */
.device-pos-label {
  color: var(--text-mute);
  font-weight: 500;
  margin-right: 2px;
}

.device-pos-placeholder {
  color: var(--text-dim);
}

/* ===== 平台设置 ===== */
.setting-group {
  max-width: 720px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px;
  border-bottom: 1px solid var(--row-border);
  gap: 16px;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 3px;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-dim);
}

.setting-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.setting-input {
  width: 130px;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.setting-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
}

.setting-unit {
  font-size: 13px;
  color: var(--text-dim);
  min-width: 36px;
}

.setting-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
  margin-top: 4px;
}

.setting-save-hint {
  margin-right: auto;
  font-size: 12.5px;
  color: var(--success);
}

.setting-save-hint.error {
  color: var(--danger);
}

/* ===== 平台设置：二级菜单（机型列表） ===== */
.setting-submenu {
  max-width: 720px;
  margin-top: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(15, 35, 65, 0.02);
  overflow: hidden;
}

.setting-submenu-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.2s;
  font-family: inherit;
}

.setting-submenu-toggle:hover {
  background: var(--hover-bg);
}

.setting-submenu-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.setting-submenu-title svg {
  width: 17px;
  height: 17px;
  color: var(--primary);
  flex-shrink: 0;
}

.setting-submenu-count {
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(13, 110, 253, 0.08);
  padding: 2px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.setting-submenu-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.setting-submenu.open .setting-submenu-arrow {
  transform: rotate(180deg);
}

.setting-submenu-body {
  border-top: 1px solid var(--panel-border);
  padding: 14px 16px 18px;
}

.model-mapping-add-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.model-mapping-prefix {
  width: 150px !important;
  font-family: monospace;
  text-transform: uppercase;
}

.model-mapping-name {
  flex: 1;
  min-width: 160px;
}

.model-mapping-table th:first-child,
.model-mapping-table td:first-child {
  font-family: monospace;
}

/* ===== 侧边栏展开/隐藏（桌面端：GPU 滑动 + 主内容区补偿，完全收起） =====
   隐藏：侧边栏 transform 滑出屏幕（GPU 合成器执行，不触发布局、绝不跳变），
         主内容区 margin-left 负值同步收回占位，平滑拉回铺满全屏；
   展开：侧边栏从左侧平滑滑入，主内容区同步让位。
   注意：不可在侧边栏上同时用 margin-left 收回占位，否则 transform + margin
   双重位移 440px 会错位且动画不稳。 */
.layout.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.layout.sidebar-collapsed .main {
  margin-left: calc(-1 * var(--sidebar-width));
}

/* 展开/隐藏箭头旋转，提示切换方向 */
.sidebar-toggle svg {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.layout.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .layout.sidebar-collapsed .sidebar {
    transform: translateX(0);
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    margin-left: 0;
    opacity: 1;
    visibility: visible;
    overflow: visible;
    border-right: 1px solid var(--panel-border);
    transition: transform 0.3s ease, opacity 0.25s ease;
  }

  /* 移动端抽屉为 fixed 覆盖层，主内容区不参与补偿 */
  .layout.sidebar-collapsed .main {
    margin-left: 0;
  }

  .layout.sidebar-collapsed .logo-text,
  .layout.sidebar-collapsed .nav-item span:not(.nav-badge),
  .layout.sidebar-collapsed .user-info {
    display: block;
    opacity: 1;
    width: auto;
    pointer-events: auto;
  }

  /* 移动端不受桌面折叠样式影响：恢复完整文字与间距 */
  .layout.sidebar-collapsed .user-info {
    flex: 1;
  }

  .layout.sidebar-collapsed .sidebar-logo {
    justify-content: flex-start;
    padding: 18px 16px;
    gap: 12px;
  }

  .layout.sidebar-collapsed .nav-item {
    justify-content: flex-start;
    padding: 12px 18px;
    margin: 2px 10px;
    gap: 12px;
  }

  .layout.sidebar-collapsed .nav-item.active::before {
    left: -10px;
  }

  .layout.sidebar-collapsed .user-card {
    justify-content: flex-start;
    padding: 10px;
    gap: 10px;
  }

  .layout.sidebar-collapsed .nav-badge {
    display: inline-block;
  }

  .layout.sidebar-collapsed .logout-btn {
    position: static;
    display: flex;
  }

  .layout.sidebar-collapsed .sidebar-footer {
    padding: 14px;
  }

  .device-grid {
    grid-template-columns: 1fr;
  }
}

/* ================= 手机竖屏适配（≤ 640px） ================= */
@media (max-width: 640px) {
  /* 页面允许整体滚动 */
  body {
    overflow: auto;
  }

  .layout {
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* 侧边栏抽屉：默认隐藏（translateX 移出屏幕），仅在 .sidebar-open 时展开。
     手机端不再使用 .sidebar-collapsed 控制抽屉（桌面折叠状态在手机端保持隐藏） */
  .sidebar {
    width: 78vw;
    max-width: 280px;
    min-width: 0;
  }

  .layout.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    width: 78vw;
    max-width: 280px;
    min-width: 0;
    margin-left: 0;
  }

  .layout.sidebar-open .sidebar {
    transform: translateX(0);
    width: 78vw;
    max-width: 280px;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    overflow: visible;
    border-right: 1px solid var(--panel-border);
    box-shadow: 8px 0 30px rgba(13, 40, 80, 0.18);
  }

  /* 顶部栏紧凑化：隐藏系统状态文字，仅保留状态圆点与时间 */
  .topbar {
    padding: 0 10px;
    gap: 10px;
  }

  .sys-status span:not(.status-dot) {
    display: none;
  }

  .sys-status {
    padding: 4px 8px;
  }

  .topbar-time {
    display: none;
  }

  .topbar-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-right {
    gap: 8px;
  }

  /* 内容区：由页面自身滚动，而非容器滚动 */
  .content {
    overflow: visible;
  }

  .page {
    height: auto;
    overflow-y: visible;
  }

  /* 实时监控页保持全屏（减去顶部栏高度） */
  .monitor-page {
    height: calc(100vh - var(--topbar-h));
    height: calc(100dvh - var(--topbar-h));
  }

  /* 面板边距缩小 */
  .panel {
    margin: 10px;
    border-radius: 10px;
  }

  .panel-header {
    padding: 12px 14px;
  }

  .panel-body {
    padding: 12px 14px;
  }

  /* 历史筛选工具栏：控件纵向铺满 */
  .history-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-group,
  .filter-group.filter-sn,
  .filter-group.filter-alt {
    flex: none;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .filter-input {
    width: 100%;
  }

  .history-filter-bar .btn {
    width: 100%;
    justify-content: center;
  }

  /* 分页与每页条数栏贴合窄屏 */
  .pagination-bar,
  .page-size-bar {
    justify-content: center;
  }

  /* 地图工具按钮：手机端移至左上角，避免与底部全宽的实时侦测/防撞预警堆叠窗口重叠 */
  .map-tool-buttons {
    left: 10px;
    top: 10px;
    bottom: auto;
    gap: 8px;
  }

  .map-tool-btn {
    width: 42px;
    height: 42px;
  }

  /* 右下角窗口堆叠：底部贴边全宽，悬浮在地图上 */
  .monitor-stack {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    padding: 0 10px 10px;
    gap: 8px;
  }

  /* 手机端：面板与堆叠容器同为 100% 宽度（覆盖桌面端 360/300px 固定宽，
     避免超出屏宽；两侧同为 100%，折叠无宽度动画为移动端原设计） */
  .monitor-float-panel,
  .collision-warning-panel {
    width: 100%;
    max-width: none;
  }

  /* 手机端：面板高度由列表 max-height 驱动（与天气窗口一致，不单独限制面板） */
  .monitor-float-panel .drone-list,
  .collision-warning-panel .collision-list {
    max-height: 38vh;
  }

  .monitor-float-panel.collapsed,
  .collision-warning-panel.collapsed {
    max-width: none;
    width: 100%;
    align-self: stretch;
  }

  /* 手机端：块级布局下 .monitor-stack > * + * 的 margin-top 覆盖为 8px
     （原 flex gap:8px 在块级容器不生效，margin 兜底并统一间距） */
  .monitor-stack > * + * {
    margin-top: 8px;
  }

  /* 雷达降级方案适配竖屏 */
  .radar-wrap {
    gap: 20px;
  }

  .radar {
    width: min(52vw, 300px);
    height: min(52vw, 300px);
  }

  .radar-title {
    font-size: 18px;
  }

  .radar-stats {
    gap: 20px;
  }

  .radar-stat .value {
    font-size: 24px;
  }

  /* 弹窗全屏化 */
  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  /* 导航二维码链接：手机端触屏按压反馈 */
  .modal-nav-qr:active {
    background: rgba(13, 110, 253, 0.08);
    border-radius: 10px;
  }

  .modal-box {
    max-width: none;
    min-height: 92vh;
    min-height: 92dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    flex: 1;
    max-height: none;
  }

  /* ===== 详情弹窗：手机端恢复上下布局（地图在上 / 信息在下） =====
     覆盖桌面端左右布局样式，与原有手机端展示完全一致 */
  .modal-box-detail {
    height: auto;
    max-height: none;
    display: flex;
    flex-direction: column;
    max-width: none;
  }

  .modal-box-detail .modal-body {
    flex: 1;
    max-height: none;
    overflow-y: visible;
    padding: 12px;
    display: block;
  }

  .modal-layout {
    display: block;
    width: 100%;
  }

  .modal-map-side {
    display: block;
    min-height: 0;
    margin-bottom: 2px;
  }

  .modal-map-side .modal-map-wrap {
    margin-bottom: 8px;
  }

  .modal-map-side .modal-map {
    height: 300px;
    min-height: 0;
  }

  .modal-map-side .modal-map-legend {
    margin-bottom: 14px;
    margin-top: 0;
  }

  .modal-info-side {
    width: auto;
    min-width: 0;
    max-width: none;
    overflow-y: visible;
    padding-right: 0;
  }

  /* 设置页：纵向排布 */
  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .setting-control {
    width: 100%;
    flex-wrap: wrap;
  }

  .setting-input {
    flex: 1;
    width: auto;
    min-width: 90px;
  }

  .setting-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .setting-save-hint {
    margin-right: 0;
    text-align: center;
  }

  /* 添加白名单栏：控件纵向铺满 */
  .whitelist-add-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .whitelist-add-bar .whitelist-sn-input,
  .whitelist-add-bar .whitelist-name-input,
  .whitelist-add-bar .whitelist-model-select {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .whitelist-add-bar .btn {
    width: 100%;
    justify-content: center;
  }

  /* 设备卡片列表单列 */
  .device-grid {
    grid-template-columns: 1fr;
  }

  /* 添加设备弹窗表单：地址搜索与经纬度行纵向排布 */
  .deploy-search-row,
  .deploy-manual-row {
    flex-direction: column;
    align-items: stretch;
  }

  .deploy-map {
    height: 200px;
  }

  /* 无人机卡片信息更紧凑 */
  .drone-card {
    padding: 10px;
  }

  .drone-model {
    font-size: 14px;
  }

  .drone-meta {
    flex-wrap: wrap;
  }

  .drone-rssi {
    font-size: 11px;
  }

  /* 防撞预警大头针/状态文字紧凑化 */
  .collision-item-sn.narrow {
    max-width: 80px;
  }

  /* 手机竖屏：右上角天气预报窗口不显示（直接隐藏） */
  .weather-panel {
    display: none !important;
  }
}

/* ===== 右上角天气预报窗口（天气 App 风格：亮色卡片 + 实况 + 未来预报，可折叠） =====
   位置：实时监控页右上角，悬浮在地图上；
   折叠：仅保留标题栏，点击标题栏/箭头展开或折叠；手机端（≤640px）不显示。 */
.weather-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 15;
  width: 320px;
  max-width: calc(100vw - 280px);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(13, 40, 80, 0.22);
  overflow: hidden;
  transition: width 0.35s ease, max-width 0.35s ease, box-shadow 0.3s ease,
    border-radius 0.3s ease, background-color 0.5s ease, border-color 0.5s ease;
  /* 磨砂玻璃半透明效果：透出地图背景，毛玻璃质感 */
  background: var(--wc-bg);
  border: 1px solid var(--wc-border);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);

  /* 场景主题变量（默认 = 晴天：现在的亮色样式）
     夜间 / 阴雨时由 JS 切换 .weather-theme-night / .weather-theme-gray 覆盖 */
  --wc-bg: rgba(255, 255, 255, 0.62);
  --wc-border: rgba(255, 255, 255, 0.55);
  --wc-header-bg: rgba(245, 247, 250, 0.55);
  --wc-header-border: rgba(229, 234, 241, 0.5);
  --wc-card-bg: rgba(255, 255, 255, 0.7);
  --wc-card-border: rgba(238, 242, 247, 0.7);
  --wc-card-hover: rgba(245, 248, 252, 0.82);
  --wc-icon-bg: rgba(13, 110, 253, 0.18);
  --wc-icon-color: #0b63d6;
  --wc-text-main: rgba(29, 43, 63, 1);
  --wc-text-dim: rgba(29, 43, 63, 0.65);
  --wc-text-mute: rgba(29, 43, 63, 0.55);
  --wc-divider: rgba(13, 40, 80, 0.08);
}

/* 场景主题：白天阴/雨/雪/雾/霾 → 浅灰色磨砂 */
.weather-panel.weather-theme-gray {
  --wc-bg: rgba(214, 222, 233, 0.75);
  --wc-border: rgba(188, 199, 214, 0.6);
  --wc-header-bg: rgba(203, 212, 225, 0.65);
  --wc-header-border: rgba(168, 180, 198, 0.5);
  --wc-card-bg: rgba(255, 255, 255, 0.72);
  --wc-card-border: rgba(173, 185, 202, 0.55);
  --wc-card-hover: rgba(255, 255, 255, 0.82);
  --wc-icon-bg: rgba(120, 140, 165, 0.3);
  --wc-icon-color: #5a6f8a;
  --wc-divider: rgba(90, 105, 125, 0.16);
}

/* 场景主题：夜间（天黑）→ 统一为浅灰色磨砂（与白天阴雨一致，不用深色），
   文字保持深色以保证浅灰背景上的可读性 */
.weather-panel.weather-theme-night {
  --wc-bg: rgba(214, 222, 233, 0.75);
  --wc-border: rgba(188, 199, 214, 0.6);
  --wc-header-bg: rgba(203, 212, 225, 0.65);
  --wc-header-border: rgba(168, 180, 198, 0.5);
  --wc-card-bg: rgba(255, 255, 255, 0.72);
  --wc-card-border: rgba(173, 185, 202, 0.55);
  --wc-card-hover: rgba(255, 255, 255, 0.82);
  --wc-icon-bg: rgba(120, 140, 165, 0.3);
  --wc-icon-color: #5a6f8a;
  --wc-text-main: rgba(29, 43, 63, 1);
  --wc-text-dim: rgba(29, 43, 63, 0.65);
  --wc-text-mute: rgba(29, 43, 63, 0.55);
  --wc-divider: rgba(90, 105, 125, 0.16);
}

/* 文字颜色随场景平滑过渡 */
.weather-panel .weather-title,
.weather-panel .weather-now-temp,
.weather-panel .weather-now-text,
.weather-panel .weather-wind-label,
.weather-panel .weather-wind-value,
.weather-panel .weather-wind-dir,
.weather-panel .weather-stat-label,
.weather-panel .weather-stat-value,
.weather-panel .weather-fc-title,
.weather-panel .weather-fc-time,
.weather-panel .weather-fc-text,
.weather-panel .weather-fc-temp,
.weather-panel .weather-fc-wind,
.weather-panel .weather-update-time {
  transition: color 0.5s ease, background-color 0.5s ease, border-color 0.5s ease;
}

/* 浅灰场景（阴雨/夜间）折叠按钮悬停反馈：与白天主题一致 */
.weather-panel.weather-theme-night .weather-toggle:hover,
.weather-panel.weather-theme-gray .weather-toggle:hover {
  background: rgba(13, 40, 80, 0.08);
  color: var(--primary);
}

/* 避免首次加载恢复折叠状态时产生过渡动画 */
.weather-panel.no-animate,
.weather-panel.no-animate * {
  transition: none !important;
}

/* 天气背景动画画布（iPhone 风格高保真粒子：雨滴/雪花/云朵/雾/雷暴）。
   置于内容层之下（z-index 1 < header/body 的 2），仅作背景氛围。 */
.weather-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  display: block;
}

/* 场景主题：雨/雪/雷（iPhone 天气 App 深蓝灰雨景背景）→ 深蓝灰磨砂，
   白色雨滴/雪花在深色背景下清晰可见，营造真实下雨氛围 */
.weather-panel.weather-theme-rain {
  --wc-bg: rgba(30, 48, 72, 0.66);
  --wc-border: rgba(16, 30, 50, 0.5);
  --wc-header-bg: rgba(22, 38, 60, 0.55);
  --wc-header-border: rgba(14, 28, 48, 0.45);
  --wc-card-bg: rgba(20, 36, 58, 0.55);
  --wc-card-border: rgba(14, 28, 48, 0.45);
  --wc-card-hover: rgba(42, 64, 94, 0.55);
  --wc-icon-bg: rgba(160, 190, 235, 0.3);
  --wc-icon-color: #cfe0ff;
  --wc-text-main: rgba(240, 246, 255, 1);
  --wc-text-dim: rgba(210, 224, 245, 0.82);
  --wc-text-mute: rgba(198, 215, 240, 0.66);
  --wc-divider: rgba(210, 224, 245, 0.14);
}

/* 深色雨景场景折叠按钮悬停反馈 */
.weather-panel.weather-theme-rain .weather-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #cfe0ff;
}


/* ===== 头部 ===== */
.weather-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
  background: var(--wc-header-bg);
  border-bottom: 1px solid var(--wc-header-border);
  transition: border-bottom-color 0.35s ease, background-color 0.5s ease;
}

/* 折叠时隐藏 header 底部边框，避免折叠后标题栏下方残留下划线 */
.weather-panel.collapsed .weather-header {
  border-bottom-color: transparent;
}

.weather-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--wc-icon-bg);
  color: var(--wc-icon-color);
  flex-shrink: 0;
  transition: background-color 0.5s ease, color 0.5s ease;
}
.weather-header-icon svg {
  width: 16px;
  height: 16px;
}

.weather-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--wc-text-main);
  white-space: nowrap;
}

/* 折叠时显示的天气摘要文字（如"小雨 26°"） */
.weather-collapsed-text {
  display: none;
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--wc-text-dim);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 2px;
}
.weather-panel.collapsed .weather-collapsed-text {
  display: block;
}

.weather-toggle {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--wc-text-dim);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
}

.weather-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.weather-toggle:hover {
  background: rgba(13, 40, 80, 0.08);
  color: var(--primary);
}

/* 折叠状态：仅保留标题栏 */
.weather-panel.collapsed {
  width: 180px;
  max-width: 180px;
  box-shadow: 0 6px 18px rgba(13, 40, 80, 0.14);
}

.weather-panel.collapsed .weather-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* 折叠时隐藏折叠箭头（与其它面板一致） */
.weather-panel.collapsed .weather-toggle {
  display: none;
}

/* ===== 内容区 ===== */
.weather-body {
  position: relative;
  z-index: 2;
  padding: 14px 16px 12px;
  max-height: 620px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease,
              padding-top 0.35s ease,
              padding-bottom 0.35s ease;
}

.weather-loading {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 12px 0;
  position: relative;
  z-index: 2;
}

.weather-error {
  font-size: 12px;
  color: var(--danger);
  text-align: center;
  padding: 12px 0;
  position: relative;
  z-index: 2;
}

/* ===== 实况区（天气 App 大卡片风格） ===== */
.weather-now {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 3;
}

.weather-condition {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.weather-condition-main {
  min-width: 0;
}

.weather-icon-wrap {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wc-card-bg);
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(13, 40, 80, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
  transition: background-color 0.5s ease, border-color 0.5s ease;
}
.weather-icon-wrap svg {
  color: var(--wc-icon-color);
  transition: color 0.5s ease;
}

.weather-big-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.weather-big-icon svg {
  width: 34px;
  height: 34px;
  color: var(--wc-icon-color);
}

.weather-now-temp {
  font-size: 24px;
  font-weight: 700;
  color: var(--wc-text-main);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: -1px;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.35);
}
/* 深色雨景场景：去除文字白色光晕 */
.weather-panel.weather-theme-rain .weather-now-temp {
  text-shadow: none;
}

.weather-now-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--wc-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 风向风速卡片（醒目展示） */
.weather-wind-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 96px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--wc-card-bg);
  border: 1px solid var(--wc-card-border);
  box-shadow: 0 4px 14px rgba(13, 40, 80, 0.1);
  flex-shrink: 0;
  transition: background-color 0.5s ease, border-color 0.5s ease;
}
.weather-wind-card > svg {
  width: 22px;
  height: 22px;
  color: var(--wc-icon-color);
  opacity: 0.85;
  transition: color 0.5s ease;
}
.weather-wind-label {
  font-size: 10px;
  color: var(--wc-text-dim);
  white-space: nowrap;
}
.weather-wind-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--wc-text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 风向（在风速下方） */
.weather-wind-dir {
  font-size: 12px;
  font-weight: 600;
  color: var(--wc-text-dim);
  white-space: nowrap;
}

/* ===== 更多实况指标（湿度/能见度/降水） ===== */
.weather-stats {
  display: flex;
  margin-top: 14px;
  border-radius: 14px;
  background: var(--wc-card-bg);
  border: 1px solid var(--wc-card-border);
  padding: 10px 6px;
  position: relative;
  z-index: 3;
  transition: background-color 0.5s ease, border-color 0.5s ease;
}

.weather-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-right: 1px solid var(--wc-divider);
}
.weather-stat:last-child {
  border-right: none;
}

.weather-stat-label {
  font-size: 10px;
  color: var(--wc-text-dim);
  white-space: nowrap;
}

.weather-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--wc-text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ===== 未来预报时间线 ===== */
.weather-forecast {
  margin-top: 12px;
  position: relative;
  z-index: 3;
}

.weather-fc-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--wc-text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.weather-fc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.weather-fc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  transition: background-color 0.2s ease, border-color 0.5s ease;
  background: var(--wc-card-bg);
}
.weather-fc-row:hover {
  background: var(--wc-card-hover);
}

.weather-fc-time {
  width: 52px;
  font-size: 12px;
  color: var(--wc-text-dim);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.weather-fc-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.weather-fc-icon svg {
  width: 18px;
  height: 18px;
  color: var(--wc-icon-color);
}

.weather-fc-text {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--wc-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-fc-temp {
  font-size: 13px;
  font-weight: 700;
  color: var(--wc-text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.weather-fc-wind {
  width: 58px;
  font-size: 11px;
  color: var(--wc-text-mute);
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 更新时间 */
.weather-update-time {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--wc-card-border);
  font-size: 10px;
  color: var(--wc-text-mute);
  text-align: center;
  position: relative;
  z-index: 3;
}

/* ===== 自绘提示条（替代浏览器 alert，网页内显示） ===== */
.app-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 2000;
  max-width: 80vw;
  background: #1d2b3f;
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 8px 30px rgba(13, 40, 80, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  text-align: center;
  line-height: 1.5;
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.app-toast.error {
  background: #E53935;
}

/* ===== 自绘确认弹窗（替代浏览器 confirm，二级页面弹窗） ===== */
.confirm-modal-overlay {
  z-index: 1500;
}
.confirm-box {
  max-width: 440px;
}
.confirm-message {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.7;
  white-space: pre-line;
  margin-bottom: 20px;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
