/* =============================================================================
 * Volcengine 深色主题 — 桌面监控台
 * 基于 index新界面/screen-monitor.html + styles.css 的设计规范，
 * 并完整覆盖原 index.html 全部功能所需类名（app.js 无需改动）。
 * ===========================================================================*/

:root {
  /* === Brand Primary (Volcengine Blue 火山蓝) === */
  --volc-brand: #3370FF;
  --volc-brand-hover: #4080FF;
  --volc-brand-active: #2860E0;
  --volc-brand-foreground: #FFFFFF;
  --volc-brand-dim: rgba(51, 112, 255, 0.15);
  --volc-brand-glow: rgba(51, 112, 255, 0.25);

  /* === Neutral Scale (Dark B2B Console) === */
  --volc-bg: #0D1017;
  --volc-surface: #141821;
  --volc-surface-elevated: #1A1F2C;
  --volc-surface-hover: #212738;
  --volc-surface-active: #262D40;

  /* === Text === */
  --volc-foreground: #E6E8EF;
  --volc-foreground-secondary: #A0A6B8;
  /* UX-20：tertiary 从 #6B7285 提亮到 #7A8299，提升小字号辅助文本的可读性与对比度 */
  --volc-foreground-tertiary: #7A8299;
  --volc-foreground-muted: #4E5566;

  /* === Border & Divider === */
  --volc-border: rgba(255, 255, 255, 0.08);
  --volc-border-strong: rgba(255, 255, 255, 0.14);
  --volc-divider: rgba(255, 255, 255, 0.06);

  /* === Semantic States === */
  --volc-state-success: #00B578;
  --volc-state-success-dim: rgba(0, 181, 120, 0.15);
  --volc-state-warning: #FF8800;
  --volc-state-warning-dim: rgba(255, 136, 0, 0.15);
  --volc-state-error: #F53F3F;
  --volc-state-error-dim: rgba(245, 63, 63, 0.15);
  --volc-state-info: #3370FF;
  --volc-state-info-dim: rgba(51, 112, 255, 0.15);
  --volc-state-offline: #5F667D;

  /* === Overlay === */
  --volc-overlay: rgba(0, 0, 0, 0.25);
  --volc-overlay-strong: rgba(0, 0, 0, 0.55);
  --volc-backdrop: rgba(0, 0, 0, 0.50);
  /* F-12：毛玻璃模糊值统一收敛到该变量，避免各层用不同 blur 参数、
     也方便整体调节；滚动/高频重绘区域不启用 backdrop-filter（见 .data-table th）。 */
  --volc-glass-blur: 8px;

  /* === Radius Scale === */
  --volc-radius-sm: 4px;
  --volc-radius-md: 6px;
  --volc-radius-lg: 8px;
  --volc-radius-pill: 999px;

  /* === Shadow === */
  --volc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --volc-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --volc-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --volc-shadow-glow: 0 0 16px rgba(51, 112, 255, 0.20);

  /* === Spacing (8pt grid) === */
  --volc-space-1: 4px;
  --volc-space-2: 8px;
  --volc-space-3: 12px;
  --volc-space-4: 16px;
  --volc-space-5: 20px;
  --volc-space-6: 24px;
  --volc-space-7: 32px;
  --volc-space-8: 40px;

  /* === Typography === */
  --volc-font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --volc-font-mono: "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono",
    Menlo, monospace;
}

/* === Global base === */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--volc-bg);
  color: var(--volc-foreground);
  font-family: var(--volc-font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { display: flex; flex-direction: column; }

a { color: var(--volc-brand); text-decoration: none; }
a:hover { color: var(--volc-brand-hover); }

/* === Scrollbar (dark console style) === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); }

/* === App-shell 固定布局 === */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  margin: 0;
}

/* === 顶部导航栏 === */
.top-nav {
  height: 56px;
  flex-shrink: 0;
  background: var(--volc-surface);
  border-bottom: 1px solid var(--volc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}
.nav-left { display: flex; align-items: center; gap: 12px; }
.logo-box {
  width: 28px; height: 28px;
  background: var(--volc-brand);
  border-radius: var(--volc-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  box-shadow: var(--volc-shadow-glow);
}
.nav-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--volc-foreground);
  letter-spacing: 0.2px;
}
/* 顶栏居中设备信息区（蓝框位置）：第一行=设备名+级别+ID，第二行=帧率/码率/延迟/丢包率 */
.nav-center {
  position: relative; /* 作为硬件浮窗的定位锚点 */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  user-select: none;
  max-width: 50%;
  overflow: visible; /* 浮窗需要溢出 */
}
.nc-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.nc-line-1 {
  font-size: 14px;
  line-height: 1.4;
  pointer-events: auto; /* 设备名/ⓘ按钮需要接收鼠标事件 */
}
.nc-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--volc-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.nav-center .vtb-level {
  margin-left: 0;
  flex-shrink: 0;
}
.nc-id {
  font-size: 12px;
  color: var(--volc-foreground-secondary);
  font-family: var(--volc-font-mono);
}
.nc-line-2 {
  font-size: 12px;
  color: var(--volc-foreground-secondary);
  font-variant-numeric: tabular-nums;
  gap: 16px;
}
.nc-item { display: inline-flex; align-items: center; gap: 2px; }
.nc-k { color: var(--volc-foreground-tertiary); }
.nc-v { color: var(--volc-foreground); font-weight: 500; }
.nav-right { display: flex; align-items: center; gap: 12px; position: relative; }
.user-name {
  font-size: 13px;
  color: var(--volc-foreground-secondary);
  font-weight: 500;
}

/* 多开模式开关 */
.multi-open-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}
.multi-open-label {
  font-size: 12px;
  color: var(--volc-foreground-secondary);
  font-weight: 500;
  user-select: none;
}
.multi-open-toggle .switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  cursor: pointer;
}
.multi-open-toggle .switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.multi-open-toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--volc-border);
  border-radius: 999px;
  transition: background 0.2s;
}
.multi-open-toggle .slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.multi-open-toggle .switch input:checked + .slider {
  background: var(--volc-brand);
}
.multi-open-toggle .switch input:checked + .slider::before {
  transform: translateX(16px);
}

/* 有效期徽标 */
.expiry-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--volc-radius-pill);
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
}
.expiry-badge.normal { background: var(--volc-state-success-dim); color: var(--volc-state-success); }
.expiry-badge.warning { background: var(--volc-state-warning-dim); color: var(--volc-state-warning); }
.expiry-badge.expired { background: var(--volc-state-error-dim); color: var(--volc-state-error); }

/* 用户菜单 */
.user-menu-wrap { position: relative; }
.user-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--volc-foreground-secondary);
  transition: background 0.15s;
  outline: none;
}
.user-btn:hover { background: var(--volc-surface-hover); }
.user-btn:focus-visible { box-shadow: 0 0 0 2px var(--volc-brand-glow); }
.user-btn-icon { font-size: 18px; line-height: 1; font-style: normal; }
.user-menu-wrap:focus-within .dropdown-menu { opacity: 1; visibility: visible; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 160px;
  background: var(--volc-surface-elevated);
  border: 1px solid var(--volc-border);
  border-radius: var(--volc-radius-md);
  box-shadow: var(--volc-shadow-md);
  padding: 4px 0;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
}
.dropdown-item {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 14px;
  color: var(--volc-foreground);
  cursor: pointer;
  transition: background 0.15s;
  gap: 10px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  outline: none;
  font-family: inherit;
}
.dropdown-item:hover { background: var(--volc-surface-hover); }
.dropdown-item:focus-visible { box-shadow: inset 0 0 0 2px var(--volc-brand-glow); }
.dropdown-item .di { font-size: 15px; font-style: normal; flex-shrink: 0; }
.dropdown-item.danger { color: var(--volc-state-error); }
.dropdown-divider { height: 1px; background: var(--volc-divider); margin: 4px 0; }

/* === 视频主体区 === */
.video-main {
  flex: 1;
  position: relative;
  min-height: 0;
  background: #07090E;
  overflow: hidden;
  padding: 0; /* 视频区四周不留空隙 */
}
.video-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 0; /* 无圆角，贴满四边 */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 连接等待态：首帧到达前隐藏 video/canvas（它们在无帧时会渲染黑色矩形），
   让预览截图完整显示，避免黑块/小块/漏底问题。 */
.video-container.connecting video,
.video-container.connecting canvas#turboCanvas {
  display: none !important;
}
.video-container video {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
}
/* 桌面预览铺垫图：绝对定位重叠在 video 正上方（z-index:2），用 margin:auto 强制居中。
   max-width/height 100% + 保留原始比例（agent 已按推流分辨率缩放），
   与 video 的 object-fit:contain 适配规则一致，画面位置完全重合。 */
.video-container .preview-img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  z-index: 2;
  display: none;
  pointer-events: none;
}
/* 1:1 原始比例：按视频原始尺寸居中，不拉伸放大 */
.video-container video.raw-size {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: none;
}
/* 1:1 原始比例：预览图跟随视频的 raw-size 规则（去掉最大约束，显示原始像素） */
.video-container .preview-img.raw-size {
  max-width: none;
  max-height: none;
}

/* 急速模式渲染画布：与 video 同尺寸规则，默认铺满(contain)，1:1 时 raw-size */
.video-container canvas#turboCanvas {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
}
.video-container canvas#turboCanvas.raw-size {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: none;
}

/* 远程光标指示层：光标 / 键鼠开关打开时显示被控端鼠标位置 */
.video-container .remote-cursor {
  position: absolute;
  top: 0;
  left: 0;
  margin: -2px 0 0 -2px; /* 让箭头尖端对齐定位点 */
  pointer-events: none;   /* 不拦截鼠标事件 */
  z-index: 60;            /* 覆盖视频与控制栏之上 */
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}
.video-container .remote-cursor.hidden {
  display: none;
}

/* 状态占位层 */
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}
.video-placeholder.hidden { display: none; }
.ph-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--volc-foreground-muted);
  opacity: 0.5;
  transition: all 0.2s;
}
.ph-icon-svg {
  display: block;
}
/* 暂停态：与播放按钮同款蓝色圆形风格 */
.ph-icon-wrap.paused {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(22, 119, 255, 0.9);
  color: #fff;
  opacity: 1;
  box-shadow: 0 4px 20px rgba(22, 119, 255, 0.4);
}
.video-placeholder-text {
  margin-top: 16px;
  font-size: 14px;
  color: var(--volc-foreground-tertiary);
}
/* #优化2：连接断开后的「重试连接」按钮。
   父容器 video-placeholder 是 pointer-events:none，按钮需恢复 auto 才能点击；
   与播放按钮同款蓝色风格，保持遮罩视觉统一。 */
.ph-retry-btn {
  margin-top: 20px;
  padding: 8px 28px;
  border-radius: 8px;
  border: none;
  background: rgba(22, 119, 255, 0.9);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.2s;
}
.ph-retry-btn:hover { background: rgba(22, 119, 255, 1); }

/* 播放按钮层：选中设备后居中显示，点击开始推流。
   Q5：遮罩铺满整个视频容器（bottom:0），实现「全部遮上」；
   底部工具栏 control-bar(z-index:5) 高于本层(z-index:4)，仍保持可见可操作（不遮到工具栏）。 */
.video-play-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 4;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}
.video-play-layer.hidden { display: none; }

.play-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(22, 119, 255, 0.9);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(22, 119, 255, 0.4);
}
.play-btn:hover {
  background: rgba(22, 119, 255, 1);
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(22, 119, 255, 0.55);
}
.play-btn:active {
  transform: scale(0.96);
}
.play-hint {
  margin-top: 20px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* 上层覆盖层 */
.video-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* 必须高于 .video-play-layer(z-index:4)：否则选中设备显示播放按钮层时，
     从控制栏弹出的下拉菜单（链路/工具/设备）主体落入播放层覆盖区，
     点击菜单项会被播放层拦截（菜单能弹出但点不动）。 */
  z-index: 5;
}

/* 左上角标题栏 */
.video-title-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 12px 16px;
  border-radius: var(--volc-radius-md);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  pointer-events: none;
  min-width: 220px;
}
.vtb-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 实时帧率/码率：与设备名同一行，前面留两空格间距 */
.vtb-live {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  font-variant-numeric: tabular-nums;
}
/* 当前传输级别徽标：直连(L1) / 中转·直连(L2) / 中转·TURN(L3) */
.vtb-level {
  margin-left: 8px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  border-radius: 3px;
  color: #fff;
  background: var(--volc-brand);
  vertical-align: 1px;
}
.vtb-level[data-level="0"] { opacity: 0.7; border: 1px dashed rgba(255,255,255,0.5); background: transparent; padding: 0 5px; }
.vtb-level[data-level="1"] { background: var(--volc-state-success, #2e7d32); }
.vtb-level[data-level="2"] { background: var(--volc-brand); }
.vtb-level[data-level="3"] { background: var(--volc-state-warning, #b26a00); }
.vtb-level[data-level="4"] { background: #7b5cbf; }
/* 标题栏默认隐藏，鼠标悬停视频区时显示（与控制栏保持一致的显隐逻辑） */
.video-title-bar.hidden { display: none; }
.vtb-id {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
  font-family: var(--volc-font-mono);
}
.vtb-id.hidden { display: none; }
.vtb-stats {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* 底部居中控制栏 */
.control-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 6px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: var(--volc-radius-md);
  backdrop-filter: blur(var(--volc-glass-blur));
  -webkit-backdrop-filter: blur(var(--volc-glass-blur));
  pointer-events: auto;
  z-index: 5;
}
.control-bar.hidden { display: none; }
.ctrl-btn, .control-bar .vc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--volc-radius-sm);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  outline: none;
  font-family: inherit;
  line-height: 1;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}
.ctrl-btn:last-child { border-right: none; }
.ctrl-btn:hover, .control-bar .vc-btn:hover { background: rgba(255, 255, 255, 0.12); }
.ctrl-btn:focus-visible, .control-bar .vc-btn:focus-visible { box-shadow: 0 0 0 2px var(--volc-brand-glow); }
.ctrl-btn.close-btn i { color: var(--volc-state-error); }
.ctrl-btn.close-btn { border-right: none; }
.ctrl-btn.close-btn:hover { background: var(--volc-state-error-dim); }
.ctrl-text { font-size: 13px; }

/* 声音/麦克风开关按钮：开启时高亮（品牌色） */
.ctrl-btn.active { background: var(--volc-brand); color: #fff; }
.ctrl-btn.active:hover { background: var(--volc-brand-hover); }

/* 工具栏 hover 菜单（路径/设备/管理） */
.ctrl-menu-wrap { position: relative; }
.ctrl-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  flex-direction: column;
  padding: 8px;
  background: var(--volc-surface-elevated);
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-md);
  box-shadow: var(--volc-shadow-lg);
  z-index: 60;
  backdrop-filter: blur(var(--volc-glass-blur));
  -webkit-backdrop-filter: blur(var(--volc-glass-blur));
}
.ctrl-menu-wrap:hover .ctrl-menu { display: flex; }
/* 点击菜单项后钉住：菜单保持显示，直到点击外部收起 */
.ctrl-menu-wrap.ctrl-menu-open .ctrl-menu { display: flex; }
/* 透明桥接层：覆盖菜单与按钮之间的 10px 间隙，避免鼠标移动时 hover 丢失导致菜单消失 */
.ctrl-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 12px;
}
.ctrl-menu-title {
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
  padding: 2px 10px 6px;
  border-bottom: 1px solid var(--volc-divider);
  margin-bottom: 6px;
  white-space: nowrap;
}
.ctrl-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--volc-foreground);
  cursor: pointer;
  border-radius: var(--volc-radius-sm);
  white-space: nowrap;
  line-height: 1.2;
}
.ctrl-menu-item:hover { background: var(--volc-surface-hover); }
.ctrl-menu-item input[type="radio"], .ctrl-menu-item input[type="checkbox"] {
  margin: 0;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--volc-brand);
}
.ctrl-menu-divider { height: 1px; background: var(--volc-divider); margin: 6px 0; }
/* 「通道」菜单当前数据通道只读展示（协议维度，与编码/链路解耦） */
.ctrl-menu-status {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--volc-foreground-secondary);
  white-space: nowrap;
  line-height: 1.4;
}
.ctrl-menu-action {
  background: none;
  border: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--volc-foreground);
  cursor: pointer;
  border-radius: var(--volc-radius-sm);
  line-height: 1.2;
  font-family: inherit;
}
.ctrl-menu-action:hover { background: var(--volc-surface-hover); }
.ctrl-menu-action:disabled { color: var(--volc-foreground-tertiary); cursor: not-allowed; }
.ctrl-menu-icon {
  flex-shrink: 0;
  color: var(--volc-foreground-tertiary);
}
.ctrl-menu-action:hover .ctrl-menu-icon { color: var(--volc-foreground); }

/* 屏幕切换按钮组 */
.vc-screen-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 6px;
  margin-right: 2px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}
.vc-screen-btn { padding: 0 10px; border-right: none !important; }
.vc-screen-btn.active {
  background: var(--volc-brand);
  color: #fff;
}
.vc-screen-btn.active:hover { background: var(--volc-brand-hover); }

/* === 右侧设备列表（深色覆盖层） === */
.device-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 80px;
  width: 350px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--volc-radius-md);
  backdrop-filter: blur(var(--volc-glass-blur));
  -webkit-backdrop-filter: blur(var(--volc-glass-blur));
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  overflow: hidden;
  z-index: 6;
  transition: transform 0.28s ease;
}
/* 收起状态：向右平移出视口 */
.device-panel.drawer-hidden { transform: translateX(110%); }
/* 固定状态：轻微阴影 */
.device-panel.drawer-pinned { box-shadow: var(--volc-shadow-md); }

.device-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.device-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex: 1;
}
.device-count-badge {
  background: var(--volc-brand);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--volc-radius-pill);
  line-height: 1.5;
}
.panel-tools { display: inline-flex; align-items: center; gap: 6px; }
.pin-btn, .drawer-close {
  border: none;
  background: transparent;
  color: var(--volc-foreground-tertiary);
  width: 28px; height: 28px;
  border-radius: var(--volc-radius-sm);
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.pin-btn:hover, .drawer-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--volc-foreground); }
.pin-btn:active, .drawer-close:active { background: rgba(255, 255, 255, 0.14); }
.pin-btn.active { color: var(--volc-brand); background: var(--volc-brand-dim); }

.device-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.device-list::-webkit-scrollbar { width: 6px; }
.device-list::-webkit-scrollbar-track { background: transparent; }
.device-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
.device-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* 来源分组 */
.source-group { margin-bottom: 4px; }
.source-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 4px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  line-height: 1.4;
  transition: background 0.15s;
}
.source-group-header:hover { background: rgba(255, 255, 255, 0.04); }
.collapse-icon {
  width: 12px; height: 12px;
  position: relative;
  flex-shrink: 0;
  color: var(--volc-foreground-tertiary);
}
/* 精致 chevron-down：展开态 */
.collapse-icon::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translate(-55%, -25%) rotate(45deg);
  transition: transform 0.2s ease;
}
/* 折叠态：旋转为 chevron-right */
.collapse-icon.collapsed::before {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.source-id {
  flex: 1;
  color: var(--volc-brand);
  font-family: var(--volc-font-mono);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-group-header .source-label {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
  line-height: 16px;
  flex-shrink: 0;
  display: inline-block;
  border: none;
}
.source-group-header .source-label.label-authorized { background: var(--volc-state-success-dim); color: var(--volc-state-success); }
.source-group-header .source-label.label-unauthorized { background: var(--volc-state-error-dim); color: var(--volc-state-error); }
.source-stats { font-size: 11px; color: var(--volc-foreground-tertiary); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.source-stats .s-online { color: var(--volc-state-success); font-weight: 600; font-style: normal; }
.source-stats .s-total { color: var(--volc-foreground-tertiary); font-style: normal; }
.source-stats .stat-sep { margin: 0 2px; color: var(--volc-foreground-muted); }
.source-group-body { padding: 2px 0; }

/* 设备项 */
.device-item {
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
  position: relative;
  display: block;
}
.device-item:hover { background: rgba(255, 255, 255, 0.06); }
.device-item.active {
  background: var(--volc-brand-dim);
  border-left: 3px solid var(--volc-brand);
  padding-left: 13px;
}
.device-item .device-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 40px; /* 为右侧操作列（关闭按钮/观看数字）预留空间 */
}
.device-item.active .device-name { color: #fff; font-weight: 600; }
/* 设备备注编辑按钮（仅管理员显示）：悬停设备时淡入，置于名称右侧 */
.device-remark-btn {
  flex-shrink: 0;
  margin-left: 2px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.device-item:hover .device-remark-btn,
.device-remark-btn:hover { opacity: 1; }
.device-remark-btn:hover { color: #4db6ac; }
/* 来源分组名称备注按钮（分组头常显，所有登录用户可用） */
.source-remark-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.source-remark-btn:hover { color: #4db6ac; opacity: 1; }
.device-item .device-meta {
  padding-left: 16px;
  padding-right: 40px; /* 为右侧操作列预留空间，避免文本与之重叠 */
  margin-top: 2px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--volc-font-mono);
}
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online {
  background: var(--volc-state-success);
  box-shadow: 0 0 6px var(--volc-state-success);
}
.status-dot.offline { background: var(--volc-state-offline); }
.status-dot.streaming { background: var(--volc-brand); animation: pulse 1.2s ease infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(51,112,255,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(51,112,255,0); }
}

/* 来源标签（行内） */
.source-label-inline {
  display: inline-block;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 18px;
}
.source-label-inline.label-authorized { background: var(--volc-state-success-dim); color: var(--volc-state-success); }
.source-label-inline.label-unauthorized { background: var(--volc-state-error-dim); color: var(--volc-state-error); }
.source-label-inline.label-remote { background: rgba(123,92,191,0.18); color: #a992e0; }

/* 观看人数徽章 */
.viewer-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--volc-radius-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}
.viewer-count.online { background: var(--volc-state-success-dim); color: var(--volc-state-success); }
.viewer-count.offline { background: var(--volc-surface-hover); color: var(--volc-foreground-tertiary); }
.viewer-count.large { border-radius: 9px; }

/* 设备项右侧操作列：关闭按钮在上、观看数字紧贴其正下方，垂直排列，相对行垂直居中 */
.device-actions {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none; /* 事件穿透到设备项，仅关闭按钮可点击 */
}
.device-actions .viewer-count {
  margin-left: 0; /* 覆盖原 margin-left:auto，改为垂直列内居中 */
}

/* 设备项关闭按钮 */
.device-close {
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--volc-foreground-tertiary);
  border-radius: var(--volc-radius-sm);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  display: none;
  pointer-events: auto; /* 允许点击关闭按钮 */
}
/* 悬停显示关闭按钮时，隐藏其正下方的观看数字，关闭按钮原位呈现 */
.device-item:hover .device-actions .device-close { display: inline-flex; align-items: center; justify-content: center; }
.device-item:hover .device-actions .viewer-count { display: none; }
.device-close:hover { background: var(--volc-state-error); color: #fff; }

/* 推拉式把手 / 收起触发器 */
.drawer-handle {
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: var(--volc-foreground-secondary);
  border: 1px solid var(--volc-border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  cursor: pointer;
  z-index: 12;
  box-shadow: var(--volc-shadow-sm);
  backdrop-filter: blur(var(--volc-glass-blur));
  -webkit-backdrop-filter: blur(var(--volc-glass-blur));
  transition: all 0.2s;
  padding: 0;
}
.drawer-handle:hover { color: var(--volc-brand); background: rgba(0, 0, 0, 0.6); }
.drawer-handle.panel-hidden { display: none; }
.panel-reopen {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 54px;
  padding: 14px 0;
  background: rgba(0, 0, 0, 0.45);
  color: var(--volc-foreground-secondary);
  border: 1px solid var(--volc-border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  z-index: 9;
  font-size: 12px;
  box-shadow: var(--volc-shadow-sm);
  backdrop-filter: blur(var(--volc-glass-blur));
  -webkit-backdrop-filter: blur(var(--volc-glass-blur));
  transition: all 0.2s;
  pointer-events: auto;
}
.panel-reopen svg { pointer-events: none; }
.panel-reopen:hover { color: var(--volc-brand); border-color: var(--volc-brand); background: rgba(0, 0, 0, 0.6); }
/* 弹出按钮：visible 表示「允许显示」，但实际仅当鼠标悬停视频区时才显示（兜底规则） */
.panel-reopen.visible { display: none; }
.video-container:hover .panel-reopen.visible { display: flex; }

/* 空态提示 */
.empty-hint {
  text-align: center;
  padding: 40px 20px;
  color: var(--volc-foreground-tertiary);
  font-size: 13px;
}
.empty-hint::before {
  content: "∅";
  display: block;
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.2;
  color: var(--volc-foreground-muted);
}

/* === 页脚 === */
.app-footer {
  height: 36px;
  flex-shrink: 0;
  background: var(--volc-surface);
  border-top: 1px solid var(--volc-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 20px;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-link svg { flex-shrink: 0; }
.footer-link:hover { color: var(--volc-brand); }
.footer-link:focus-visible {
  box-shadow: 0 0 0 2px var(--volc-brand-glow);
  border-radius: 2px;
  outline: none;
}
.footer-brand {
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
}

/* === 按钮（深色） === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--volc-radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--volc-foreground);
  transition: all 0.2s ease;
  font-family: inherit;
  user-select: none;
  white-space: nowrap;
}
.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: 16px; }
.btn-primary { background: var(--volc-brand); color: #fff; border-color: var(--volc-brand); }
.btn-primary:hover { background: var(--volc-brand-hover); border-color: var(--volc-brand-hover); }
.btn-primary:active { background: var(--volc-brand-active); border-color: var(--volc-brand-active); }
.btn-primary:disabled { background: #2A4A99; border-color: #2A4A99; color: rgba(255,255,255,0.5); cursor: not-allowed; }
.btn-secondary { background: var(--volc-surface-elevated); color: var(--volc-foreground); border-color: var(--volc-border-strong); }
.btn-secondary:hover { color: var(--volc-brand); border-color: var(--volc-brand); background: var(--volc-brand-dim); }
.btn-outline { background: transparent; color: var(--volc-brand); border-color: var(--volc-border-strong); }
.btn-outline:hover { border-color: var(--volc-brand); background: var(--volc-brand-dim); }
.btn-danger { background: var(--volc-state-error); color: #fff; border-color: var(--volc-state-error); }
.btn-danger:hover { background: #FF6B5B; border-color: #FF6B5B; }
.btn-danger-light { background: var(--volc-state-error-dim); color: var(--volc-state-error); border-color: transparent; }
.btn-danger-light:hover { background: rgba(245,63,63,0.25); }
.btn-danger:disabled,
.btn-danger:disabled:hover {
  background: var(--volc-state-error-dim);
  border-color: transparent;
  color: rgba(255,255,255,0.5);
  cursor: not-allowed;
}

/* === 表单控件 === */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--volc-foreground-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  background: var(--volc-surface);
  color: var(--volc-foreground);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}
.form-group input:hover, .form-group select:hover { border-color: var(--volc-brand-hover); }
.form-group input:focus, .form-group select:focus { border-color: var(--volc-brand); box-shadow: 0 0 0 2px var(--volc-brand-glow); }
.form-group select option { background: var(--volc-surface-elevated); color: var(--volc-foreground); }

/* 帧率按钮组（替代原下拉框 #fps） */
.fps-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fps-btn {
  flex: 1;
  min-width: 40px;
  height: 34px;
  padding: 0 6px;
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  background: var(--volc-surface);
  color: var(--volc-foreground);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1;
}
.fps-btn:hover { border-color: var(--volc-brand-hover); }
.fps-btn.active {
  background: var(--volc-brand);
  border-color: var(--volc-brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 0 2px var(--volc-brand-glow);
}
.fps-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--volc-border-strong);
}
.fps-btn:disabled:hover { border-color: var(--volc-border-strong); }
/* 高帧率档（60/120）右侧加小竖条提示 */
.fps-btn.fps-btn-high { position: relative; }
.fps-btn.fps-btn-high::after {
  content: '';
  position: absolute;
  top: 6px; right: 6px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--volc-brand);
}
.fps-btn.fps-btn-high.active::after { background: rgba(255,255,255,0.85); }
.fps-btn.fps-btn-high:disabled::after { background: var(--volc-foreground-tertiary); }

.form-group input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--volc-border-strong);
  border-radius: 2px;
  border: none;
  padding: 0;
  outline: none;
}
.form-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--volc-brand);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(51,112,255,0.3);
  cursor: pointer;
  transition: transform 0.15s;
}
.form-group input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.1); }
.form-group input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--volc-brand);
  border: 2px solid #fff;
  cursor: pointer;
}

.form-hint { font-size: 12px; color: var(--volc-foreground-tertiary); margin-top: 4px; line-height: 1.5; }
.audio-toggle-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 4px;
}
.audio-toggle-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--volc-brand); margin: 0; cursor: pointer; }
.audio-toggle-label span { font-size: 13px; color: var(--volc-foreground); font-weight: 500; }

.btn-save {
  width: 100%;
  height: 36px;
  border-radius: var(--volc-radius-sm);
  background: var(--volc-brand);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.btn-save:hover { background: var(--volc-brand-hover); }
.btn-save:disabled { background: #2A4A99; cursor: not-allowed; }

/* 当前生效参数 */
.current-params {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--volc-border-strong);
}
.param-row {
  font-size: 13px;
  color: var(--volc-foreground-tertiary);
  padding: 3px 0;
  display: flex;
  justify-content: space-between;
}
.param-row:first-child { color: var(--volc-foreground-secondary); font-weight: 600; }
.param-row span:last-child { color: var(--volc-foreground); font-variant-numeric: tabular-nums; }
.param-content.disabled { opacity: 0.4; pointer-events: none; }

/* === 弹窗 (Modal) === */
.modal {
  position: fixed;
  inset: 0;
  background: var(--volc-backdrop);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  background: var(--volc-surface-elevated);
  border-radius: var(--volc-radius-lg);
  box-shadow: var(--volc-shadow-lg);
  max-height: 90vh;
  /* 不能 overflow:hidden：会让 Chrome 裁剪原生 <select> 展开的下拉列表，
     表现为"点击下拉框无下拉"。内部滚动由 .modal-body 的 overflow-y:auto 负责。 */
  overflow: visible;
  display: flex;
  flex-direction: column;
  /* 不能用 slideUp 动画：其 transform 会创建 stacking context，导致 Chrome 的
     <select> 下拉列表被限制在弹窗内、被下层终端覆盖。改用纯 opacity 的 fadeIn。 */
  animation: fadeIn 0.18s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-lg { width: 1100px; max-width: 96vw; }
.modal-sm { width: 420px; max-width: 90vw; }
/* 端口代理弹窗：中等宽度 */
.modal-md { width: 620px; max-width: 92vw; }
/* 摄像头弹窗：大尺寸观看窗口 */
.modal-camera { width: 920px; max-width: 94vw; }
/* 高级管理弹窗：宽度为当前页面 60% */
.modal-lg-wide { width: 60vw; max-width: 60vw; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--volc-divider);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; color: var(--volc-foreground); font-weight: 600; }
.modal-close {
  background: transparent;
  border: 1px solid transparent;
  color: var(--volc-foreground-tertiary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--volc-radius-sm);
  transition: all 0.15s;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { color: var(--volc-foreground); background: var(--volc-surface-hover); border-color: var(--volc-border); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.modal-toolbar select {
  margin-left: auto;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  background: var(--volc-surface);
  color: var(--volc-foreground);
  font-size: 13px;
  outline: none;
}
.modal-toolbar select:hover { border-color: var(--volc-brand); }
.modal-toolbar select option { background: var(--volc-surface-elevated); }
.modal-hint {
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
  flex: 1;
  min-width: 300px;
  padding: 8px 12px;
  background: var(--volc-brand-dim);
  border-radius: var(--volc-radius-sm);
  border: 1px solid rgba(51,112,255,0.15);
}

/* ========== 摄像头弹窗 ========== */
/* 标题栏右侧按钮组：最小化 + 关闭 并排（两按钮共用 .modal-close 样式，仅符号不同） */
.cam-header-btns { display: flex; align-items: center; gap: 8px; }

/* 视频框：相对定位，仅承载 canvas / 占位层，状态栏移出框外不再遮挡画面 */
.cam-stage {
  position: relative;
  width: 100%;
  background: #0a0f1a;
  border: 1px solid var(--volc-border);
  border-radius: var(--volc-radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  /* 保持 16:9 宽高比，避免 canvas 加载前高度塌陷 */
  aspect-ratio: 16 / 9;
}
#cameraCanvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.cam-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--volc-foreground-tertiary);
  font-size: 14px;
  background: #0a0f1a;
}
/* 状态栏（视频框外、正常文档流）：分隔线 + 左右分布，不遮挡画面 */
.cam-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 6px 4px 0;
  border-top: 1px solid var(--volc-divider);
}
.cam-info {
  font-size: 13px;
  color: var(--volc-foreground-secondary);
}
/* 连接状态徽章：右下角 */
.cam-status {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}
.cam-status--connecting {
  color: #ffd666;
  background: rgba(255,180,0,0.18);
  border: 1px solid rgba(255,180,0,0.4);
}
.cam-status--connected {
  color: #73d13d;
  background: rgba(82,196,26,0.15);
  border: 1px solid rgba(82,196,26,0.4);
}
.cam-status--disconnected {
  color: #ff7875;
  background: rgba(255,77,79,0.15);
  border: 1px solid rgba(255,77,79,0.4);
}

/* 摄像头最小化浮条：吸附在视频区底部（「设备」按钮下方区域），点击恢复弹窗 */
.camera-mini {
  position: absolute;
  bottom: 78px; /* 高于底部控制栏，紧贴「设备」按钮附近 */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(10, 15, 26, 0.92);
  border: 1px solid var(--volc-border-strong);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: background 0.15s;
  z-index: 6;
  pointer-events: auto;
  white-space: nowrap;
}
.camera-mini:hover { background: rgba(33, 39, 56, 0.95); }
.camera-mini-icon { color: var(--volc-brand); flex-shrink: 0; }
.camera-mini-name {
  font-size: 12px;
  color: var(--volc-foreground);
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.camera-mini-status {
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.camera-mini-status::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--volc-state-offline);
}
.camera-mini[data-state="connecting"] .camera-mini-status::before { background: #ffd666; }
.camera-mini[data-state="connected"] .camera-mini-status::before { background: #73d13d; }
.camera-mini[data-state="disconnected"] .camera-mini-status::before { background: #ff7875; }


/* 数据表格 */
.table-wrap { overflow-x: auto; margin-bottom: 20px; border: 1px solid var(--volc-divider); border-radius: var(--volc-radius-md); }
.user-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.user-table thead th {
  position: sticky; top: 0;
  background: var(--volc-surface);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--volc-foreground-secondary);
  border-bottom: 1px solid var(--volc-border);
  font-size: 12px;
  white-space: nowrap;
  z-index: 1;
  letter-spacing: 0.3px;
}
.user-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--volc-divider);
  color: var(--volc-foreground-secondary);
  vertical-align: middle;
  font-size: 13px;
}
.user-table tbody tr:hover td { background: var(--volc-surface-hover); }
.user-table tbody tr:last-child td { border-bottom: none; }
.user-table .source-cell {
  font-family: var(--volc-font-mono);
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--volc-foreground-tertiary);
}
.source-id-cell {
  font-family: var(--volc-font-mono);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--volc-brand);
  font-weight: 500;
}
.source-id-cell:hover { color: var(--volc-brand-hover); text-decoration: underline; }
.copy-icon { font-size: 11px; opacity: 0.7; margin-left: 4px; }
/* 来源列表安装部署跳转链接 */
.install-jump {
  display: inline-block;
  margin-top: 3px;
  font-family: var(--volc-font-mono);
  font-size: 11px;
  color: var(--volc-state-success);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.install-jump:hover { color: var(--volc-state-success); text-decoration: underline; }
.source-note {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--volc-foreground-tertiary);
}

/* 进程表 */
/* 高级管理弹窗内部 tab 导航（进程管理 / 终端） */
.proc-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 24px 0;
  border-bottom: 1px solid var(--volc-divider);
  background: var(--volc-surface);
  flex-shrink: 0;
}
.proc-tab {
  padding: 8px 18px;
  font-size: 13px;
  font-family: inherit;
  color: var(--volc-foreground-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.proc-tab:hover { color: var(--volc-foreground); }
.proc-tab.active {
  color: var(--volc-brand);
  border-bottom-color: var(--volc-brand);
  font-weight: 600;
}
.proc-tab-pane { display: block; }
.proc-tab-pane.hidden { display: none !important; }

/* 终端 tab：工具栏 + 容器 */
.term-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--volc-divider);
  background: var(--volc-surface);
  flex-shrink: 0;
  /* 提升 layering：xterm 的 .xterm-helpers(canvas 层) z-index:5 可能向下溢出，
     若不提升，终端画布会覆盖工具栏导致 cmd/powershell 下拉框无法点击 */
  position: relative;
  z-index: 20;
}
/* 自定义下拉框（cmd/powershell 切换）：选项列表 z-index 极高，不被终端画布覆盖 */
.custom-dropdown {
  position: relative;
  display: inline-block;
}
.custom-dropdown-trigger {
  height: 30px;
  min-width: 96px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--volc-foreground);
  background: var(--volc-surface-elevated);
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  cursor: pointer;
  user-select: none;
}
.custom-dropdown-trigger:hover { border-color: var(--volc-brand); }
.custom-dropdown-trigger .arrow { font-size: 10px; color: var(--volc-foreground-muted); }
.custom-dropdown-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: var(--volc-surface-elevated);
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  box-shadow: var(--volc-shadow-lg);
  z-index: 9999;
  overflow: hidden;
}
.custom-option {
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--volc-foreground);
  cursor: pointer;
  white-space: nowrap;
}
.custom-option:hover { background: var(--volc-surface-hover); }
.custom-option:active { background: var(--volc-brand-glow); }
.term-reconnect {
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--volc-foreground);
  background: var(--volc-surface-elevated);
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.term-reconnect:hover { border-color: var(--volc-brand); color: var(--volc-brand); }
.term-status {
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
  margin-left: auto;
}
/* 终端容器：固定高度，xterm 由 fit 插件自适应 */
.term-container {
  height: 420px;
  padding: 8px;
  background: #111418;
  overflow: hidden;
  /* 建立定位上下文，将 xterm 的绝对定位子元素(canvas/helpers)约束在容器内，
     避免它们溢出覆盖上方工具栏的下拉框 */
  position: relative;
}
.term-container .xterm { height: 100%; }
.term-container .xterm-viewport {
  background-color: #111418;
  overflow-y: auto !important; /* 强制显示垂直滚动条 */
}

.process-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
  border-bottom: 1px solid var(--volc-divider);
  flex-shrink: 0;
  background: var(--volc-surface);
}
/* 左侧按钮组：全选/反选 */
.process-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* 右侧信息区：结束按钮 + 进程数 + 更新时间 */
.process-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}
.process-search {
  /* 绝对定位水平居中，保证搜索框始终位于头部中间 */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: 360px;
  max-width: 44%;
  flex: none;
  padding: 0 10px;
  height: 30px;
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  background: var(--volc-surface-elevated);
  color: var(--volc-foreground-tertiary);
  transition: all 0.2s;
}
.process-search:focus-within { border-color: var(--volc-brand); box-shadow: 0 0 0 2px var(--volc-brand-glow); }
.process-search svg { flex-shrink: 0; }
.process-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--volc-foreground);
  font-size: 13px;
  font-family: inherit;
}
.process-search input::placeholder { color: var(--volc-foreground-tertiary); }
/* 搜索框清除按钮：默认隐藏，有内容时由 JS 显示 */
.search-clear {
  display: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--volc-foreground-quaternary, rgba(128,128,128,0.4));
  color: var(--volc-foreground-inverse, #fff);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.search-clear:hover { background: var(--volc-foreground-tertiary, rgba(128,128,128,0.7)); }
.process-count { color: var(--volc-foreground-secondary); font-weight: 600; white-space: nowrap; }
.process-update { white-space: nowrap; }
.process-table-wrap { flex: 1; overflow-y: auto; min-height: 0; }
.process-table { width: 100%; table-layout: auto; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.process-table thead th {
  position: sticky; top: 0;
  background: var(--volc-surface);
  padding: 8px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--volc-foreground-secondary);
  border-bottom: 1px solid var(--volc-border);
  font-size: 12px;
  z-index: 1;
  white-space: nowrap;
}
/* 可排序列头：可点击、悬停高亮，当前排序列加粗并显示箭头 */
.process-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.process-table thead th.sortable:hover { color: var(--volc-brand); }
.process-table thead th.sortable.sorted { color: var(--volc-brand); }
.sort-ind { margin-left: 4px; font-size: 10px; }
.process-table tbody td {
  padding: 3px 16px;
  border-bottom: 1px solid var(--volc-divider);
  color: var(--volc-foreground-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}
.process-table tbody tr:hover td { background: var(--volc-surface-hover); }
.process-table tbody tr:last-child td { border-bottom: none; }
/* F-2 虚拟渲染：进程可能成百上千行，屏外行由浏览器跳过布局/绘制，
   contain-intrinsic-size 提供未渲染行的预估高度，保证滚动条连续稳定。 */
.process-table tbody tr.process-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 28px;
}
/* 复选框列：固定窄列居中；进程名/命令行自适应宽，超长省略；PID/内存固定窄列；操作列居中 */
.process-table th:nth-child(1), .process-table td:nth-child(1) { width: 40px; text-align: center; }
.process-table th:nth-child(2), .process-table td:nth-child(2) { width: 30%; }
.process-table th:nth-child(3), .process-table td:nth-child(3) { width: 90px; text-align: right; font-family: var(--volc-font-mono); }
.process-table th:nth-child(4), .process-table td:nth-child(4) { width: 90px; text-align: right; font-family: var(--volc-font-mono); }
.process-table th:nth-child(5), .process-table td:nth-child(5) { width: 40%; font-family: var(--volc-font-mono); font-size: 12px; color: var(--volc-foreground-tertiary); }
/* 操作列：固定窄列，居中显示关闭按钮 */
.process-table th:nth-child(6), .process-table td:nth-child(6) { width: 80px; text-align: center; }
/* 进程多选复选框（含表头全选框） */
.proc-chk-col input[type="checkbox"] {
  cursor: pointer;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  accent-color: var(--volc-brand, #4b7bec);
}
/* 命令行单元格：单击复制该行进程详细信息 */
.process-table .cmd-cell {
  cursor: pointer;
  user-select: text;
}
.process-table .cmd-cell:hover { color: var(--volc-brand); text-decoration: underline; }
/* 命令行不可读的降级文案（系统进程/受保护进程）：灰色斜体弱化提示 */
.process-table .cmd-unreadable {
  color: #999;
  font-style: italic;
  cursor: default;
}
.btn-kill {
  padding: 4px 12px;
  font-size: 12px;
  line-height: 1;
  color: #fff;
  background: var(--volc-danger, #e5484d);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-kill:hover { opacity: 0.85; }
.btn-kill:active { opacity: 0.7; }
.process-empty {
  text-align: center !important;
  color: var(--volc-foreground-tertiary) !important;
  padding: 60px 0 !important;
  font-size: 13px;
}
.process-empty::before {
  content: "Ø";
  display: block;
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.25;
  color: var(--volc-foreground-muted);
}

/* 来源标签（表格中） */
.source-label {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--volc-radius-sm);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  border: 1px solid transparent;
}
.source-label.label-authorized { background: var(--volc-state-success-dim); color: var(--volc-state-success); border-color: rgba(0,181,120,0.2); }
.source-label.label-unauthorized { background: var(--volc-state-error-dim); color: var(--volc-state-error); border-color: rgba(245,63,63,0.2); }

/* 状态文字 */
.status-normal { color: var(--volc-state-success); font-weight: 500; }
.status-expired { color: var(--volc-state-error); font-weight: 500; }
.status-warn { color: var(--volc-state-warning); font-weight: 500; }

/* 内嵌编辑表单 */
.user-edit-form {
  background: var(--volc-surface);
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-md);
  padding: 24px;
  margin-top: 20px;
  position: relative;
}
.user-edit-form::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--volc-brand);
  border-radius: var(--volc-radius-md) 0 0 var(--volc-radius-md);
}
.user-edit-form h3 { font-size: 16px; color: var(--volc-foreground); margin-bottom: 20px; font-weight: 600; }
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 13px;
  color: var(--volc-foreground-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}
.form-row input, .form-row select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  background: var(--volc-surface-elevated);
  color: var(--volc-foreground);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}
.form-row input:hover, .form-row select:hover { border-color: var(--volc-brand-hover); }
.form-row input:focus, .form-row select:focus { border-color: var(--volc-brand); box-shadow: 0 0 0 2px var(--volc-brand-glow); }
.form-row input:disabled { background: var(--volc-surface); color: var(--volc-foreground-tertiary); cursor: not-allowed; }
.form-row select option { background: var(--volc-surface-elevated); }
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--volc-border-strong);
}

/* === 工具类 === */
.hidden { display: none !important; }
.text-muted { color: var(--volc-foreground-tertiary); font-size: 12px; }

/* Toast 提示 */
#toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--volc-surface-elevated);
  color: var(--volc-brand);
  padding: 8px 16px;
  border-radius: var(--volc-radius-sm);
  border: 1px solid var(--volc-brand);
  z-index: 9999;
  font-size: 13px;
  box-shadow: var(--volc-shadow-md);
}

/* === 响应式 === */
@media (max-width: 1100px) {
  .device-panel { width: 300px; bottom: 80px; }
}
@media (max-width: 900px) {
  /* UX-17：移动端设备面板改为抽屉——默认收起（右移出屏），
     点击「设备」按钮展开；避免小屏被常驻面板遮挡视频主体 */
  .device-panel {
    display: flex;
    width: 325px;
    max-width: 78vw;
    bottom: 80px;
    transform: translateX(110%); /* 初始收起 */
  }
  .device-panel.drawer-hidden { transform: translateX(110%); }
  .device-panel:not(.drawer-hidden) { transform: translateX(0); }
  /* 收起态的「设备」按钮在移动端常驻显示（无 hover 场景） */
  .panel-reopen.visible { display: flex; }
  .ctrl-btn span { display: none; }
  .ctrl-btn { padding: 8px 10px; }
  .modal-lg { width: 92vw; }
}

/* === 快捷任务 === */
/* 高级管理「快捷任务」tab：表头 + 表格 */
.task-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--volc-divider);
  background: var(--volc-surface);
  flex-shrink: 0;
}
.task-pane-tip { font-size: 12px; color: var(--volc-foreground-tertiary); }
.task-table-wrap { flex: 1; overflow: auto; min-height: 0; }
.task-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.task-table thead th {
  position: sticky; top: 0;
  background: var(--volc-surface);
  padding: 8px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--volc-foreground-secondary);
  border-bottom: 1px solid var(--volc-border);
  font-size: 12px;
  z-index: 1;
  white-space: nowrap;
}
.task-table tbody td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--volc-divider);
  color: var(--volc-foreground-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}
.task-table tbody tr:hover td { background: var(--volc-surface-hover); }
.task-table tbody tr:last-child td { border-bottom: none; }
.task-table th:nth-child(1), .task-table td:nth-child(1) { width: 16%; }
.task-table th:nth-child(2), .task-table td:nth-child(2) { width: 22%; }
.task-table th:nth-child(3), .task-table td:nth-child(3) { width: 20%; font-family: var(--volc-font-mono); font-size: 12px; color: var(--volc-foreground-tertiary); }
.task-table th:nth-child(4), .task-table td:nth-child(4) { width: 22%; }
.task-table th:nth-child(5), .task-table td:nth-child(5) { width: 18%; }
.task-table th:nth-child(6), .task-table td:nth-child(6) { width: 90px; text-align: center; }
.task-empty {
  text-align: center !important;
  color: var(--volc-foreground-tertiary) !important;
  padding: 40px 0 !important;
  font-size: 13px;
}
.task-desc { color: var(--volc-foreground-secondary); }
.task-cmd { font-family: var(--volc-font-mono); }
.task-result { color: var(--volc-foreground-secondary); }
/* 结果单元格：整列可点击，弹窗查看完整结果；单元格内仅显示几行预览 */
.task-table td:nth-child(4) { white-space: normal; overflow: hidden; cursor: pointer; }
.task-table td:nth-child(4):hover .task-result-scroll { color: var(--volc-accent); }
.task-result-scroll {
  max-height: 52px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: var(--volc-font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--volc-foreground-secondary);
}
/* 弹窗：任务执行结果完整展示 */
.task-result-info { margin-bottom: 12px; font-size: 14px; }
.task-result-modal-body {
  margin: 0;
  padding: 12px 14px;
  background: var(--volc-surface-subtle);
  border: 1px solid var(--volc-border);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: var(--volc-font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--volc-foreground-primary);
  max-height: 60vh;
  overflow: auto;
}
.task-time { color: var(--volc-foreground-tertiary); font-size: 12px; font-variant-numeric: tabular-nums; }

/* 任务状态徽章 */
.task-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 18px;
  margin-right: 6px;
  vertical-align: middle;
}
.badge-running { color: #1d6ff2; background: rgba(29,111,242,0.12); }
.badge-success { color: #0f9d58; background: rgba(15,157,88,0.12); }
.badge-failed  { color: #e5484d; background: rgba(229,72,77,0.12); }
.badge-unknown { color: #b8860b; background: rgba(184,134,11,0.12); }
.badge-builtin { color: #8b5cf6; background: rgba(139,92,246,0.12); }

/* 任务管理弹窗：任务组筛选条 */
.task-group-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
}
.task-group-label { font-size: 13px; color: var(--volc-foreground-secondary); }
.task-group-bar select {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  background: var(--volc-surface-elevated);
  color: var(--volc-foreground);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.task-group-bar select:focus { border-color: var(--volc-brand); }

/* 我的任务组列表 */
.task-group-list {
  margin-top: 20px;
  border-top: 1px solid var(--volc-divider);
  padding-top: 12px;
}
.task-group-title { font-size: 13px; font-weight: 600; color: var(--volc-foreground-secondary); margin-bottom: 8px; }
.task-group-list-body { display: flex; flex-direction: column; gap: 8px; }
.task-group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--volc-surface);
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
}
.task-group-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.task-group-name { font-size: 14px; color: var(--volc-foreground); font-weight: 500; }
.task-group-id {
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
  font-family: var(--volc-font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-group-empty { padding: 16px; text-align: center; color: var(--volc-foreground-tertiary); font-size: 13px; }

/* === 远程文件管理（仿 Windows 资源管理器）=== */
/* 弹窗尺寸：70% 页面宽、75% 页高，居中 */
.modal-filemgr {
  width: 70vw;
  max-width: 70vw;
  height: 75vh;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
}
.modal-filemgr .modal-body { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.modal-filemgr .modal-header { flex-shrink: 0; }
/* 工具栏 */
.fm-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--volc-divider);
  background: var(--volc-surface);
  flex-shrink: 0;
}
.fm-toolbar-spacer { flex: 1; }
.fm-clip-status { font-size: 12px; color: var(--volc-brand); white-space: nowrap; }
/* 主体：左目录树 + 右列表 */
.fm-main { display: flex; flex: 1; min-height: 0; position: relative; }
.fm-tree {
  width: 240px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: none; /* 分割条由 fm-splitter 承担 */
  background: var(--volc-surface);
  padding: 8px 0;
  min-width: 160px;
  max-width: 600px;
}
/* 左右分栏拖拽条 */
.fm-splitter {
  width: 5px;
  flex-shrink: 0;
  background: transparent;
  cursor: col-resize;
  position: relative;
  z-index: 5;
  transition: background 0.15s;
  user-select: none;
}
.fm-splitter::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 2px;
  width: 1px;
  background: var(--volc-divider);
  transition: background 0.15s, width 0.15s, left 0.15s;
}
.fm-splitter:hover,
.fm-splitter.fm-dragging {
  background: var(--volc-brand-dim);
}
.fm-splitter:hover::after,
.fm-splitter.fm-dragging::after {
  background: var(--volc-brand);
  width: 3px;
  left: 1px;
}
/* 拖拽进行中全局禁用选择/文字高亮 */
body.fm-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.fm-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
.fm-tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  font-size: 13px;
  color: var(--volc-foreground-secondary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  border-radius: 4px;
  margin: 1px 6px;
}
.fm-tree-item:hover { background: var(--volc-surface-hover); color: var(--volc-foreground); }
.fm-tree-item.fm-tree-active { background: var(--volc-brand-dim); color: var(--volc-brand); font-weight: 600; }
.fm-tree-icon { flex-shrink: 0; width: 18px; text-align: center; font-size: 14px; line-height: 1; }
.fm-tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
/* 分组标题（快速访问 / 此电脑）*/
.fm-tree-group {
  padding: 10px 14px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--volc-foreground-tertiary);
  letter-spacing: 0.3px;
  text-transform: none;
  user-select: none;
}
.fm-list-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.fm-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--volc-divider);
  flex-shrink: 0;
}
.fm-list-title { font-size: 13px; font-weight: 600; color: var(--volc-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 路径面包屑（可点击导航） */
.fm-crumb {
  color: var(--volc-brand);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
  white-space: nowrap;
}
.fm-crumb:hover { background: var(--volc-brand-dim); text-decoration: underline; }
.fm-crumb-cur { color: var(--volc-foreground); font-weight: 600; cursor: default; }
.fm-crumb-cur:hover { background: transparent; text-decoration: none; }
.fm-crumb-sep { color: var(--volc-foreground-tertiary); padding: 0 2px; user-select: none; }
/* 顶部 Win11 风格地址栏 */
.fm-addressbar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0 12px;
  padding: 4px 8px;
  background: var(--volc-surface);
  border: 1px solid var(--volc-divider);
  border-radius: 6px;
  scrollbar-width: thin;
  height: 32px;
  line-height: 1;
}
.fm-addressbar::-webkit-scrollbar { height: 4px; }
.fm-addressbar::-webkit-scrollbar-thumb { background: var(--volc-divider); border-radius: 2px; }
.fm-addr-item {
  background: transparent;
  border: none;
  outline: none;
  color: var(--volc-foreground-secondary);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.2;
  transition: background 0.12s, color 0.12s;
}
.fm-addr-item:hover { background: var(--volc-surface-hover); color: var(--volc-foreground); }
.fm-addr-item.fm-addr-cur {
  color: var(--volc-foreground);
  font-weight: 600;
}
.fm-addr-item.fm-addr-cur:hover { background: transparent; }
.fm-addr-sep {
  color: var(--volc-foreground-tertiary);
  font-size: 12px;
  padding: 0 2px;
  user-select: none;
  line-height: 1;
}
.fm-addr-more {
  background: transparent;
  border: none;
  outline: none;
  color: var(--volc-brand);
  font-size: 16px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
  font-family: inherit;
  transition: background 0.12s;
}
.fm-addr-more:hover { background: var(--volc-brand-dim); }
.fm-list { flex: 1; overflow-y: auto; min-height: 0; }
.fm-empty { padding: 60px 0; text-align: center; color: var(--volc-foreground-tertiary); font-size: 13px; }
/* 文件列表项 */
.fm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--volc-divider);
  font-size: 13px;
  color: var(--volc-foreground-secondary);
  cursor: default;
}
.fm-item:hover { background: var(--volc-surface-hover); }
.fm-item.fm-item-selected { background: var(--volc-brand-dim); }
.fm-item-check { display: flex; align-items: center; flex-shrink: 0; }
.fm-item-check input { cursor: pointer; }
.fm-item-icon { flex-shrink: 0; font-size: 15px; }
.fm-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--volc-foreground); }
.fm-item-size { width: 90px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--volc-foreground-tertiary); }
.fm-item-time { width: 130px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--volc-foreground-tertiary); }
/* 状态栏 */
.fm-statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--volc-divider);
  background: var(--volc-surface);
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
  flex-shrink: 0;
}
.fm-status-path {
  flex-shrink: 0;
  white-space: nowrap;
}
/* 选中文件绝对路径显示区（中间） */
.fm-status-selected {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--volc-foreground-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 0 8px;
}
#fmStatusInfo {
  flex-shrink: 0;
  white-space: nowrap;
}

/* === 通用间距/文本工具（规范化弹窗内联样式，替代硬编码 style） === */
.mono { font-family: var(--volc-font-mono); }
.fw600 { font-weight: 600; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-10 { margin-bottom: 10px; }
.ml-10 { margin-left: 10px; }
.col-w120 { width: 120px; }

/* === 端口代理 Token 展示区 === */
.tunnel-token-label {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--volc-foreground);
}
#tunnelTokenText {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--volc-divider);
  border-radius: 8px;
  background: var(--volc-surface);
  color: var(--volc-foreground);
  font-family: var(--volc-font-mono);
  font-size: 12px;
  line-height: 1.6;
  resize: none;
  word-break: break-all;
}

/* === TURN 服务器卡片（系统配置弹窗）=== */
.turn-server-card {
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-md);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--volc-surface);
  position: relative;
}
.turn-server-card:last-child { margin-bottom: 0; }
/* 「删除此服务器」按钮改为危险色轻量按钮，更符合语义 */
/* F-13：选择器特异性已高于 .btn/.btn-outline（定义顺序也更靠后），无需 !important */
.btn-remove-turn {
  color: var(--volc-state-error);
  border-color: rgba(245,63,63,0.3);
  background: transparent;
  padding: 0 12px;
}
.btn-remove-turn:hover {
  background: var(--volc-state-error-dim);
  border-color: var(--volc-state-error);
  color: var(--volc-state-error);
}
/* 关联来源复选框容器：用更高优先级覆盖 .form-row label 的 display:block 和 input 的 width:100% */
.form-row .turn-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding-top: 2px;
}
/* F-13：.form-row label.turn-source-label（特异性 0,2,1）高于 .form-row label（0,1,1），
   checkbox 选择器（0,3,2）高于 .form-row input（0,2,1），!important 均冗余，已移除 */
.form-row label.turn-source-label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--volc-foreground-secondary);
  cursor: pointer;
  user-select: none;
  width: auto;
}
.form-row label.turn-source-label input[type="checkbox"].turn-source {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0 6px 0 0;
  padding: 0;
  accent-color: var(--volc-brand);
  cursor: pointer;
  border: none;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
}
.turn-empty-hint {
  color: var(--volc-foreground-tertiary);
  font-size: 12px;
}

/* === 账户管理：功能授权勾选 / 来源多选（复用 checkbox 样式模式） === */
.form-row .perm-checkbox-group,
.form-row .source-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding-top: 2px;
}
.form-row label.perm-item,
.form-row label.source-item {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--volc-foreground-secondary);
  cursor: pointer;
  user-select: none;
  width: auto;
}
.form-row label.perm-item input[type="checkbox"],
.form-row label.source-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0 6px 0 0;
  padding: 0;
  accent-color: var(--volc-brand);
  cursor: pointer;
  border: none;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
}
.form-row label.perm-item input[type="checkbox"]:disabled,
.form-row label.source-item input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
/* 功能授权批量操作按钮行（全选/反选/取消） */
.form-row .perm-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
}
.form-row .perm-toolbar .perm-toolbar-tip {
  font-size: 12px;
  color: var(--volc-foreground-tertiary);
  margin-right: 2px;
}
.form-row .perm-toolbar .btn {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

/* === 文件选择框（OTA 上传等）深色统一 === */
.form-row input[type="file"] {
  height: auto;
  padding: 8px 0;
  background: transparent;
  border: none;
  color: var(--volc-foreground-secondary);
  font-size: 13px;
  cursor: pointer;
}
.form-row input[type="file"]::file-selector-button {
  height: 32px;
  padding: 0 16px;
  margin-right: 12px;
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  background: var(--volc-surface-elevated);
  color: var(--volc-foreground);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.form-row input[type="file"]::file-selector-button:hover {
  border-color: var(--volc-brand);
  color: var(--volc-brand);
  background: var(--volc-brand-dim);
}

/* === 设备详情浮窗 === */
.vtb-info-btn {
  display: inline-block;
  margin-left: 6px;
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: color 0.2s;
  vertical-align: 1px;
}
.vtb-info-btn:hover {
  color: var(--volc-brand);
}
/* 设备详情浮窗：顶部导航栏居中区域（nav-center）正下方弹出 */
.device-info-popup {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #1e2329;
  border: 1px solid rgba(77,182,172,0.3);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 340px;
  max-width: 420px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  pointer-events: auto;
  animation: dipFadeIn 0.15s ease-out;
}
.device-info-popup.hidden {
  display: none;
}
.device-info-popup.locked {
  border-color: var(--volc-brand);
  box-shadow: 0 8px 24px rgba(77,182,172,0.25);
}
@keyframes dipFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.dip-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
/* 分组标题（CPU/内存/系统/网络 之间的小分隔） */
.dip-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--volc-brand);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 8px 0 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.dip-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.dip-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 3px 0;
  font-size: 12px;
  line-height: 1.6;
}
.dip-k {
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
  margin-right: 16px;
}
.dip-v {
  color: rgba(255,255,255,0.9);
  text-align: right;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}
.dip-v.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
}
/* 进度条行（CPU/内存 使用率）：key → value + bar */
.dip-bar-row {
  padding: 4px 0;
}
.dip-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  margin-bottom: 3px;
}
.dip-bar-k { color: rgba(255,255,255,0.5); }
.dip-bar-v {
  color: rgba(255,255,255,0.95);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.dip-bar-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-weight: 400;
  margin-left: 6px;
}
.dip-bar {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.dip-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #2ecc71 0%, #2ecc71 60%, #f39c12 80%, #e74c3c 95%);
  transition: width 0.4s ease;
}
/* 长文本字段（CPU型号/GPU名）允许换行 */
.dip-v.wrap {
  word-break: break-word;
  text-align: right;
  max-width: 220px;
  line-height: 1.4;
}

/* === 数据统计页 === */
.stats-date-range {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: 12px;
}
.stats-date-range label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}
.stats-date-range input[type="date"] {
  background: var(--volc-surface-elevated);
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  color: var(--volc-foreground);
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  color-scheme: dark;
}
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.stats-card {
  background: var(--volc-surface-elevated);
  border: 1px solid var(--volc-border);
  border-radius: var(--volc-radius);
  padding: 14px 16px;
}
.sc-label {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}
.sc-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--volc-brand);
  font-variant-numeric: tabular-nums;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  border-bottom: 1px solid var(--volc-border);
}
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.85);
}
.data-table tr:hover td {
  background: rgba(77,182,172,0.06);
}
.mt-20 { margin-top: 20px; }
.ml-10 { margin-left: 10px; }
.mb-10 { margin-bottom: 10px; }
.mb-16 { margin-bottom: 16px; }
.fw600 { font-weight: 600; }
.mono { font-family: 'Consolas', 'Monaco', 'Courier New', monospace; }

/* === 数据统计 Tab 导航 === */
.stats-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--volc-border);
  margin-bottom: 16px;
}
.stats-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,0.55);
  padding: 8px 18px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.stats-tab:hover {
  color: rgba(255,255,255,0.85);
}
.stats-tab.active {
  color: var(--volc-brand);
  border-bottom-color: var(--volc-brand);
  font-weight: 600;
}
.stats-tab-pane {
  display: none;
}
.stats-tab-pane.active {
  display: block;
}

/* === 统计页筛选器 === */
.stats-log-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.stats-filter-input {
  background: var(--volc-surface-elevated);
  border: 1px solid var(--volc-border-strong);
  border-radius: var(--volc-radius-sm);
  color: var(--volc-foreground);
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.stats-filter-input:focus {
  border-color: var(--volc-brand);
}
.stats-filter-input::placeholder {
  color: rgba(255,255,255,0.35);
}

/* === 统计表格滚动容器 === */
.table-wrap {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--volc-border);
  border-radius: var(--volc-radius-sm);
}
.table-wrap .data-table {
  border-collapse: collapse;
}
.table-wrap .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(30, 34, 42, 0.98);
  /* F-12：移除滚动表头的 backdrop-filter——粘性表头滚动时每帧重采样模糊成本高，
     且背景已近不透明(0.98)，视觉差异可忽略，直接省掉 GPU 开销 */
}

/* UX-14：用户偏好减弱动效时，关闭动画/过渡（减少前庭不适与低端机渲染负担） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
