/* ============================================================
   MES 视频监控指挥中心（现场实景 · MediaMTX · WebRTC）
   深蓝科技风：深色顶栏 + 深色监控墙，左右面板同色系
   ============================================================ */
.vm-root {
  --vm-bg: #0b1220;
  --vm-panel: #111c2e;
  --vm-panel-2: #16243a;
  --vm-line: #1e3252;
  --vm-text: #e6eefc;
  --vm-text-dim: #8aa0c0;
  --vm-accent: #2f7bff;
  --vm-ok: #22c55e;
  --vm-err: #ef4444;
  --vm-warn: #f59e0b;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 96px);
  min-height: 560px;
  background: radial-gradient(1200px 600px at 70% -10%, #14264a 0%, var(--vm-bg) 55%);
  border: 1px solid var(--vm-line);
  border-radius: 10px;
  overflow: hidden;
  color: var(--vm-text);
  font-size: 13px;
}

/* ---------- 顶栏 ---------- */
.vm-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  height: 52px;
  background: linear-gradient(90deg, #0d1830 0%, #132344 60%, #0d1830 100%);
  border-bottom: 1px solid var(--vm-line);
  flex-wrap: nowrap;
}
.vm-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; letter-spacing: 1px; white-space: nowrap; }
.vm-logo { font-size: 18px; }
.vm-platform-tag {
  font-size: 11px; color: #9cc2ff; background: #1d3a6b; border: 1px solid #2f5db0;
  padding: 2px 8px; border-radius: 4px; font-weight: 400;
}
.vm-clock { font-variant-numeric: tabular-nums; color: #b9cdec; font-size: 15px; font-weight: 600; white-space: nowrap; }
.vm-top-stats { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.vm-stat { color: var(--vm-text-dim); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.vm-stat b { color: var(--vm-text); font-size: 14px; }
.vm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--vm-err); display: inline-block; }
.vm-stat.vm-ok .vm-dot { background: var(--vm-ok); box-shadow: 0 0 8px var(--vm-ok); }
.vm-stat.vm-err .vm-dot { background: var(--vm-err); box-shadow: 0 0 8px var(--vm-err); }

.vm-top-actions { display: flex; align-items: center; gap: 8px; }
.vm-btn {
  background: #1b2d4d; color: var(--vm-text);   border: 1px solid #2c4774; border-radius: 5px; padding: 6px 12px; font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.vm-btn:hover { background: #24406e; border-color: var(--vm-accent); }
.vm-btn:disabled { opacity: .5; cursor: not-allowed; }
.vm-btn-primary { background: linear-gradient(180deg, #2f7bff, #1f5fd6); border-color: #2f7bff; color: #fff; }
.vm-btn-primary:hover { background: linear-gradient(180deg, #3d86ff, #2a6be6); }
.vm-mini-btn { background: #1b2d4d; color: var(--vm-text); border: 1px solid #2c4774; border-radius: 4px; padding: 3px 8px; font-size: 12px; cursor: pointer; }
.vm-mini-btn:hover { background: #24406e; }

.vm-layout-switch { display: inline-flex; border: 1px solid #2c4774; border-radius: 5px; overflow: hidden; }
.vm-layout-switch button { background: #16263f; color: var(--vm-text-dim); border: none; padding: 6px 11px; cursor: pointer; font-size: 12px; }
.vm-layout-switch button + button { border-left: 1px solid #2c4774; }
.vm-layout-switch button.on { background: var(--vm-accent); color: #fff; }

/* ---------- 主体三栏 ---------- */
.vm-body { flex: 1; display: flex; min-height: 0; }
.vm-left { width: 220px; flex-shrink: 0; background: var(--vm-panel); border-right: 1px solid var(--vm-line); display: flex; flex-direction: column; min-height: 0; }
.vm-right { width: 230px; flex-shrink: 0; background: var(--vm-panel); border-left: 1px solid var(--vm-line); padding: 12px; overflow-y: auto; }
.vm-center { flex: 1; min-width: 0; position: relative; background: #060a14; display: flex; }
.vm-panel-head { font-size: 13px; font-weight: 600; padding: 10px 12px; color: #cfe0fb; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--vm-line); }

/* 左栏 */
.vm-search-box { padding: 8px 10px; }
.vm-search-box input { width: 100%; box-sizing: border-box; background: #0d1830; border: 1px solid #2c4774; border-radius: 5px; padding: 6px 9px; color: var(--vm-text); font-size: 12px; outline: none; }
.vm-search-box input:focus { border-color: var(--vm-accent); }
.vm-online-rate { padding: 0 12px 8px; }
.vm-rate-bar { height: 6px; background: #0d1830; border-radius: 3px; overflow: hidden; }
.vm-rate-fill { height: 100%; background: linear-gradient(90deg, #19c37d, #22c55e); border-radius: 3px; transition: width .4s; }
.vm-rate-text { font-size: 11px; color: var(--vm-text-dim); margin-top: 4px; }
.vm-channel-list { flex: 1; overflow-y: auto; padding: 0 8px 10px; }
.vm-list-empty { text-align: center; color: var(--vm-text-dim); padding: 30px 0; font-size: 12px; }
.vm-channel-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; margin-bottom: 4px; border: 1px solid transparent; }
.vm-channel-item:hover { background: #1a2c4c; }
.vm-channel-item.is-online { background: rgba(34, 197, 94, .08); }
.vm-ch-dot { width: 8px; height: 8px; border-radius: 50%; background: #475b80; flex-shrink: 0; }
.vm-ch-dot.on { background: var(--vm-ok); box-shadow: 0 0 6px var(--vm-ok); }
.vm-ch-name { flex: 1; font-size: 12px; color: var(--vm-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vm-ch-path { font-size: 10px; color: var(--vm-text-dim); font-family: monospace; }

/* 中央监控墙 */
.vm-wall { flex: 1; display: grid; gap: 4px; padding: 4px; background: #060a14; }
.vm-cell { position: relative; background: #05080f; border: 1px solid #13203a; border-radius: 4px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.vm-cell.active { border-color: var(--vm-accent); box-shadow: 0 0 0 1px var(--vm-accent) inset; }
.vm-video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.vm-cell-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #3d5278; pointer-events: none; }
.vm-cell-placeholder span { font-size: 34px; font-weight: 200; line-height: 1; }
.vm-cell-placeholder label { font-size: 12px; }
.vm-cell-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; display: flex; align-items: center; gap: 8px; padding: 0 8px; background: linear-gradient(transparent, rgba(0,0,0,.72)); font-size: 12px; color: #dce8ff; opacity: 0; transition: opacity .15s; }
.vm-cell.filled .vm-cell-bar { opacity: 1; }
.vm-cell-name { font-weight: 600; text-shadow: 0 1px 2px #000; }
.vm-cell-status { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #b9cdec; }
.vm-live { width: 7px; height: 7px; border-radius: 50%; background: var(--vm-ok); display: inline-block; animation: vm-blink 1.4s infinite; }
.vm-live.off { background: var(--vm-err); animation: none; }
@keyframes vm-blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.vm-cell-close { margin-left: auto; cursor: pointer; color: #9fb6dd; padding: 2px 6px; border-radius: 4px; }
.vm-cell-close:hover { background: rgba(239,68,68,.8); color: #fff; }
.vm-wall.vm-no-grid .vm-cell { border-color: transparent; }

/* 空状态引导 */
.vm-empty-guide { position: absolute; inset: 0; align-items: center; justify-content: center; background: #060a14; }
.vm-guide-card { width: 460px; max-width: 90%; background: var(--vm-panel); border: 1px solid var(--vm-line); border-radius: 12px; padding: 30px 34px; text-align: center; }
.vm-guide-icon { font-size: 44px; }
.vm-guide-title { font-size: 19px; font-weight: 700; margin: 12px 0 6px; }
.vm-guide-sub { font-size: 13px; color: var(--vm-text-dim); margin-bottom: 20px; }
.vm-guide-steps { text-align: left; margin: 0 auto 22px; max-width: 380px; }
.vm-step { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; font-size: 13px; color: #cdddf6; border-bottom: 1px dashed #1e3252; }
.vm-step:last-child { border-bottom: none; }
.vm-step-no { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; background: #1d3a6b; color: #9cc2ff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.vm-guide-btn { padding: 9px 22px; font-size: 14px; }

/* 右栏云台 */
.vm-ptz { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.vm-ptz-off { text-align: center; color: var(--vm-text-dim); font-size: 13px; padding: 30px 0; line-height: 1.8; }
.vm-ptz-pad { display: grid; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); gap: 6px; }
.vm-dir { background: #1b2d4d; border: 1px solid #2c4774; border-radius: 6px; color: var(--vm-text); font-size: 17px; cursor: pointer; }
.vm-dir:hover { background: var(--vm-accent); border-color: var(--vm-accent); }
.vm-dir-home { font-size: 13px; color: #9cc2ff; }
.vm-zoom-row, .vm-speed-row, .vm-preset-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--vm-text-dim); width: 100%; justify-content: center; }
.vm-speed-row input[type=range] { flex: 1; max-width: 120px; }
.vm-preset-row select { background: #0d1830; color: var(--vm-text); border: 1px solid #2c4774; border-radius: 4px; padding: 4px; }
.vm-flow-stats { display: flex; flex-direction: column; gap: 10px; }
.vm-flow-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--vm-text-dim); }
.vm-flow-item b { margin-left: auto; color: var(--vm-text); font-size: 14px; }
.vm-flow-dot { width: 8px; height: 8px; border-radius: 50%; background: #475b80; }
.vm-flow-dot.on { background: var(--vm-ok); }
.vm-flow-dot.off { background: var(--vm-err); }
.vm-flow-dot.wall { background: var(--vm-accent); }
.vm-flow-note { margin-top: 6px; font-size: 11px; color: var(--vm-text-dim); border-top: 1px solid var(--vm-line); padding-top: 8px; }

/* ---------- 弹窗内表单（浅色 Modal，沿用 MES 风格） ---------- */
.vm-form-section { font-weight: 700; font-size: 13px; color: #1e3a6b; margin: 14px 0 10px; padding-left: 8px; border-left: 3px solid #2f7bff; }
.vm-form-section:first-child { margin-top: 0; }
.vm-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.vm-form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #556; }
.vm-form-grid label.vm-full { grid-column: 1 / -1; }
.vm-form-grid input, .vm-form-grid select {
  border: 1px solid #d4dce8; border-radius: 5px; padding: 7px 9px; font-size: 13px; outline: none; background: #fff; color: #223;
}
.vm-form-grid input:focus, .vm-form-grid select:focus { border-color: #2f7bff; }
.vm-check-label { flex-direction: row !important; align-items: center; gap: 6px; justify-content: flex-start; }
.vm-check-label input { width: auto; }
.vm-form-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.vm-form-actions .vm-btn { color: #1e3a6b; background: #eef4ff; border-color: #c3d6f7; }
.vm-form-actions .vm-btn:hover { background: #dce8ff; }

/* 通道管理弹窗 */
.vm-chmgr-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.vm-chmgr-bar .vm-btn { color: #1e3a6b; background: #eef4ff; border-color: #c3d6f7; }
.vm-chmgr-bar .vm-btn-primary { color: #fff; background: linear-gradient(180deg, #2f7bff, #1f5fd6); border-color: #2f7bff; }
.vm-chmgr-tip { font-size: 11px; color: #99a; }
.vm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.vm-table th { background: #f2f6fc; color: #445; text-align: left; padding: 8px; font-weight: 600; border-bottom: 1px solid #e0e7f2; }
.vm-table td { padding: 6px 8px; border-bottom: 1px solid #eef1f6; }
.vm-table input, .vm-table select { border: 1px solid #d4dce8; border-radius: 4px; padding: 4px 6px; font-size: 12px; width: 100%; box-sizing: border-box; }
.vm-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; background: #eee; color: #888; }
.vm-tag.ok { background: rgba(34,197,94,.14); color: #15803d; }


/* 通道管理表格内按钮（浅色弹窗，覆盖深色主题） */
.vm-table .vm-mini-btn { background:#eef4ff; color:#1e3a6b; border:1px solid #c3d6f7; }
.vm-table .vm-mini-btn:hover { background:#dce8ff; }
.vm-table .vm-mini-btn.vcm-del { color:#c0392b; background:#fdf0f0; border-color:#f3c9c9; }
.vm-table .vm-mini-btn.vcm-del:hover { background:#fbdcdc; }


/* 云台变焦行紧凑，避免窄屏换行 */
.vm-zoom-row { gap: 6px; flex-wrap: nowrap; }
.vm-zoom-row .vm-mini-btn { padding: 3px 7px; font-size: 11px; white-space: nowrap; }
.vm-preset-row { gap: 6px; flex-wrap: nowrap; }
.vm-preset-row .vm-mini-btn { padding: 3px 7px; font-size: 11px; white-space: nowrap; }


/* 多格布局占位文字自适应，避免遮挡 */
.vm-grid-9 .vm-cell-placeholder span { font-size: 26px; }
.vm-grid-16 .vm-cell-placeholder span { font-size: 20px; }
.vm-grid-16 .vm-cell-placeholder label { display: none; }
.vm-grid-16 .vm-cell-bar { font-size: 10px; height: 22px; }
.vm-grid-16 .vm-cell-status { display: none; }

/* 滚动条 */
.vm-channel-list::-webkit-scrollbar, .vm-right::-webkit-scrollbar { width: 6px; }
.vm-channel-list::-webkit-scrollbar-thumb, .vm-right::-webkit-scrollbar-thumb { background: #24406e; border-radius: 3px; }

/* 小屏适配 */
@media (max-width: 1280px) {
  .vm-left { width: 180px; }
  .vm-right { width: 200px; }
  .vm-top-stats .vm-stat { font-size: 11px; }
}

/* ============================================================
   浅色主题适配（data-theme="light"）
   顶栏/左右面板/云台/表单跟随 MES 浅色；中央监控墙、视频格、
   空态引导保持黑底，保证视频画面与监控墙的标准呈现。
   ============================================================ */
[data-theme="light"] .vm-root {
  --vm-bg: #f0f2f5;
  --vm-panel: #ffffff;
  --vm-panel-2: #f8fafc;
  --vm-line: #e4e7ed;
  --vm-text: #1f2937;
  --vm-text-dim: #6b7280;
  --vm-accent: #2563eb;
  --vm-ok: #16a34a;
  --vm-err: #dc2626;
  --vm-warn: #d97706;
  background: radial-gradient(1200px 600px at 70% -10%, #e8f0fe 0%, #f0f2f5 55%);
  border-color: #e4e7ed;
}
[data-theme="light"] .vm-topbar { background: linear-gradient(90deg,#ffffff 0%,#f4f8ff 60%,#ffffff 100%); }
[data-theme="light"] .vm-stat b { color: #1f2937; }
[data-theme="light"] .vm-platform-tag { color: #1e40af; background: #e8f0fe; border-color: #c3d6f7; }
[data-theme="light"] .vm-clock { color: #334155; }
[data-theme="light"] .vm-btn { background: #f1f5f9; color: #1f2937; border-color: #cbd5e1; }
[data-theme="light"] .vm-btn:hover { background: #e2e8f0; border-color: #2563eb; }
[data-theme="light"] .vm-btn-primary { background: linear-gradient(180deg,#3b82f6,#2563eb); border-color: #2563eb; color: #fff; }
[data-theme="light"] .vm-btn-primary:hover { background: linear-gradient(180deg,#3d86ff,#2a6be6); }
[data-theme="light"] .vm-mini-btn { background: #f1f5f9; color: #1f2937; border-color: #cbd5e1; }
[data-theme="light"] .vm-mini-btn:hover { background: #e2e8f0; }
[data-theme="light"] .vm-layout-switch { border-color: #cbd5e1; }
[data-theme="light"] .vm-layout-switch button { background: #f1f5f9; color: #6b7280; }
[data-theme="light"] .vm-layout-switch button + button { border-left-color: #cbd5e1; }
[data-theme="light"] .vm-layout-switch button.on { background: #2563eb; color: #fff; }
[data-theme="light"] .vm-panel-head { color: #1f2937; }
[data-theme="light"] .vm-search-box input { background: #fff; border-color: #cbd5e1; color: #1f2937; }
[data-theme="light"] .vm-rate-bar { background: #e2e8f0; }
[data-theme="light"] .vm-rate-text { color: #6b7280; }
[data-theme="light"] .vm-list-empty { color: #6b7280; }
[data-theme="light"] .vm-channel-item:hover { background: #f1f5f9; }
[data-theme="light"] .vm-channel-item.is-online { background: rgba(22,163,74,.08); }
[data-theme="light"] .vm-ch-dot { background: #cbd5e1; }
[data-theme="light"] .vm-ch-name { color: #1f2937; }
[data-theme="light"] .vm-ch-path { color: #6b7280; }
[data-theme="light"] .vm-guide-card { background: #fff; }
[data-theme="light"] .vm-guide-sub { color: #6b7280; }
[data-theme="light"] .vm-step { color: #475569; border-bottom-color: #e4e7ed; }
[data-theme="light"] .vm-step-no { background: #e8f0fe; color: #1e40af; }
[data-theme="light"] .vm-dir { background: #f1f5f9; border-color: #cbd5e1; color: #1f2937; }
[data-theme="light"] .vm-dir:hover { background: #2563eb; border-color: #2563eb; color: #fff; }
[data-theme="light"] .vm-dir-home { color: #2563eb; }
[data-theme="light"] .vm-zoom-row,
[data-theme="light"] .vm-speed-row,
[data-theme="light"] .vm-preset-row,
[data-theme="light"] .vm-flow-item { color: #6b7280; }
[data-theme="light"] .vm-flow-item b { color: #1f2937; }
[data-theme="light"] .vm-flow-dot { background: #cbd5e1; }
[data-theme="light"] .vm-flow-note { color: #6b7280; border-top-color: #e4e7ed; }
[data-theme="light"] .vm-preset-row select { background: #fff; color: #1f2937; border-color: #cbd5e1; }
[data-theme="light"] .vm-ptz-off { color: #6b7280; }
[data-theme="light"] .vm-channel-list::-webkit-scrollbar-thumb,
[data-theme="light"] .vm-right::-webkit-scrollbar-thumb { background: #cbd5e1; }
/* 中央监控墙 / 视频格 / 空态引导保持黑底（视频画面标准呈现） */
