/* ==========================================================================
   赛博数字孪生 · 工业视觉 SOP 规范性检查系统前端样式库
   依据 cyber_energy_design_system_and_template.md 规范与 5161 项目标准构建
   ========================================================================== */

:root {
  /* 调色板系统 (Design Tokens) */
  --cyber-bg: #060d17;
  --cyber-bg-alt: #080d16;
  --cyber-panel: rgba(11, 22, 40, 0.72);
  --cyber-border: rgba(0, 210, 255, 0.18);
  --cyber-border-strong: rgba(0, 210, 255, 0.38);

  /* 核心语义发光色标 */
  --neon-cyan: #00d2ff;
  --neon-cyan-glow: rgba(0, 210, 255, 0.4);
  --neon-green: #00f5a0;
  --neon-green-glow: rgba(0, 245, 160, 0.45);
  --neon-amber: #ffb703;
  --neon-amber-glow: rgba(255, 183, 3, 0.45);
  --neon-purple: #00d2ff;
  --neon-purple-glow: rgba(0, 210, 255, 0.4);
  --neon-rose: #ff0055;
  --neon-rose-glow: rgba(255, 0, 85, 0.45);

  /* 文字排版色彩 */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-slate-400: #94a3b8;
  --text-muted: #64748b;
  --text-dark: #0f172a;

  /* 严控尺寸体系 (适配 Mac Retina 及各类主流显示器一屏自适应) */
  --header-height: 42px;
  --footer-height: 40px;
  --gallery-height: 84px;
}

/* 全局重置与防抖 (Zero-Layout-Shift) */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scrollbar-gutter: stable;
}

body {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background-color: var(--cyber-bg);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 210, 255, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 60%, rgba(0, 245, 160, 0.05) 0%, transparent 60%),
    linear-gradient(180deg, #091322 0%, #060d17 100%);
  background-attachment: fixed;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* 等宽字体规范 (用于所有数值、耗时、状态码与时间戳防抖) */
.font-mono, 
.time-val, 
.col-no, 
.col-time, 
#sys-datetime, 
#header-timer, 
#total-runtime {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
}

/* 极细暗色发光滚动条 (4px) */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: rgba(6, 13, 23, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 210, 255, 0.25);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 245, 160, 0.5);
}

/* ==========================================================================
   通用赛博材质卡片与三大功能区 (Surfaces & Zoning)
   ========================================================================== */

/* 基础赛博磨砂卡片 */
.cyber-card, .cyber-panel {
  background: rgba(11, 22, 40, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 210, 255, 0.18);
  box-shadow: 0 10px 30px -5px rgba(0, 5, 16, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

/* 顶部高光微细线 (0.5px~1px 渐变，构建高维立体物理悬浮感) */
.cyber-top-highlight {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 210, 255, 0.65) 50%, transparent 100%);
  pointer-events: none;
  z-index: 5;
}

/* 客观数据区 (用于 SOP 标准规范表格) */
.zone-data-center {
  background: radial-gradient(ellipse 90% 80% at 20% 0%, rgba(14, 30, 56, 0.78), rgba(8, 18, 34, 0.88));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.24);
  box-shadow: 0 10px 30px -5px rgba(0, 8, 20, 0.65), inset 0 1px rgba(56, 189, 248, 0.1);
  position: relative;
}

/* 操作控制中枢 (用于视频监控视窗与底部控制栏) */
.zone-control-panel {
  background: linear-gradient(90deg, rgba(6, 24, 44, 0.92), rgba(9, 32, 58, 0.95), rgba(6, 24, 44, 0.92));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 210, 255, 0.4);
  box-shadow: 0 10px 30px -5px rgba(0, 10, 25, 0.7), 0 0 24px -4px rgba(0, 210, 255, 0.16), inset 0 1px rgba(0, 210, 255, 0.18);
  position: relative;
}

/* AI 执行透视台 (用于多模态 VLM 复核卡片与违规沙箱注入) */
.zone-agent-console {
  background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(10, 25, 45, 0.88), rgba(6, 14, 28, 0.94));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 210, 255, 0.28);
  box-shadow: 0 10px 30px -5px rgba(2, 8, 20, 0.7), 0 0 22px -4px rgba(0, 210, 255, 0.1), inset 0 1px rgba(0, 210, 255, 0.15);
  position: relative;
}

/* 发光文字工具类 (Neon Text) */
.neon-text-green {
  color: var(--neon-green) !important;
  text-shadow: 0 0 10px rgba(0, 245, 160, 0.5);
}
.neon-text-cyan {
  color: var(--neon-cyan) !important;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}
.neon-text-amber {
  color: var(--neon-amber) !important;
  text-shadow: 0 0 10px rgba(255, 183, 3, 0.5);
}
.neon-text-purple {
  color: var(--neon-cyan) !important;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}
.neon-text-rose {
  color: var(--neon-rose) !important;
  text-shadow: 0 0 10px rgba(255, 0, 85, 0.5);
}

/* ==========================================================================
   1. 顶栏大屏品牌条 (Sys Header - 对标 5161 赛博大屏空间流光Header)
   ========================================================================== */
.sys-header {
  height: var(--header-height);
  margin: 6px 8px 0 8px;
  background: rgba(11, 22, 40, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 210, 255, 0.22);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 5, 16, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

/* 左侧：Logo Squircle + 标题 (对标 5161 品牌区) */
.header-brand-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.brand-logo-squircle {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #00f5a0 0%, #00d2ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.45);
  flex-shrink: 0;
}

.brand-bolt-icon {
  width: 14px;
  height: 14px;
  color: #060d17;
  display: block;
}

.brand-title-text {
  font-size: 1.35rem; /* 调大两个级别 (原 1.05rem) */
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.6px;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6), 0 0 14px rgba(0, 210, 255, 0.35);
}

/* Agent 引擎标识胶囊 (严格对标 5161 标杆系统截图 media_1789734238793 与 media_1789734275962) */
.agent-engine-pill {
  background: rgba(9, 21, 39, 0.75) !important;
  border: 1px solid rgba(0, 210, 255, 0.25) !important;
  color: #94a3b8 !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 20px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.72rem;
  box-shadow: none !important;
  user-select: none;
}

.agent-engine-pill .agent-chip-icon {
  color: #64748b;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.agent-engine-pill .pill-muted {
  color: #64748b;
  font-size: 0.70rem;
  font-weight: 500;
}

.agent-engine-pill .agent-name-text {
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
}

.agent-engine-pill .pill-divider {
  color: rgba(0, 210, 255, 0.25);
  font-size: 0.70rem;
  margin: 0 1px;
}

.agent-engine-pill .agent-term-tag {
  color: #64748b;
  font-family: 'JetBrains Mono', monospace, Consolas, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  transition: all 0.3s ease;
}

/* 高亮在线态 (对标截图 media_1789734275962.png 高亮时的 Agent 引擎) */
.agent-engine-pill.active,
.agent-engine-pill:hover {
  background: rgba(0, 210, 255, 0.12) !important;
  border: 1px solid #00d2ff !important;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.45), inset 0 0 8px rgba(0, 210, 255, 0.15) !important;
}

.agent-engine-pill.active .agent-chip-icon,
.agent-engine-pill:hover .agent-chip-icon {
  color: #00f5a0;
  filter: drop-shadow(0 0 4px #00f5a0);
  animation: agentChipBreathe 2.4s infinite ease-in-out;
}

.agent-engine-pill.active .pill-muted,
.agent-engine-pill:hover .pill-muted {
  color: #94a3b8;
}

.agent-engine-pill.active .agent-name-text,
.agent-engine-pill:hover .agent-name-text {
  color: #00d2ff;
  text-shadow: 0 0 8px rgba(0, 210, 255, 0.6);
}

.agent-engine-pill.active .pill-divider,
.agent-engine-pill:hover .pill-divider {
  color: rgba(0, 210, 255, 0.6);
}

.agent-engine-pill.active .agent-term-tag,
.agent-engine-pill:hover .agent-term-tag {
  color: #00d2ff;
  text-shadow: 0 0 6px rgba(0, 210, 255, 0.7);
}

@keyframes agentChipBreathe {
  0%, 100% {
    transform: scale(0.92);
    filter: drop-shadow(0 0 2px #00f5a0);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.12);
    filter: drop-shadow(0 0 7px #00f5a0);
    opacity: 1;
  }
}

/* 右侧：胶囊组件组 (Capsule Pills - 对标 5161 右侧胶囊组) */
.header-pills-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

/* 胶囊按钮 (对标 5161 胶囊按钮入口) */
.cyber-pill-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 20px;
  background: rgba(9, 21, 39, 0.75);
  border: 1px solid rgba(0, 210, 255, 0.3);
  color: #e2e8f0;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  flex-shrink: 0;
}

.cyber-pill-btn:hover {
  background: rgba(14, 33, 61, 0.95);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.35);
  color: #fff;
  transform: translateY(-1px);
}

/* 状态展示胶囊 */
.cyber-pill {
  height: 26px;
  padding: 0 8px;
  border-radius: 20px;
  background: rgba(9, 21, 39, 0.65);
  border: 1px solid rgba(0, 210, 255, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #cbd5e1;
  white-space: nowrap;
  flex-shrink: 0;
}

.cyber-pill .pill-icon {
  font-size: 0.76rem;
  display: flex;
  align-items: center;
}

.cyber-pill .pill-muted {
  color: var(--text-slate-400);
}

.cyber-pill strong {
  font-weight: 700;
}

/* 运行状态呼吸绿点 */
.status-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
  animation: pulseRec 1.8s infinite;
  flex-shrink: 0;
}

.result-capsule {
  border-color: rgba(0, 245, 160, 0.35);
  background: rgba(6, 28, 22, 0.65);
}

/* ==========================================================================
   2. 主体工作区布局 (严格 100vh 单屏自适应，杜绝全屏上下滚动)
   ========================================================================== */
.sys-body {
  height: calc(100vh - var(--header-height) - 10px);
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  gap: 6px;
  min-height: 0;
  box-sizing: border-box;
}

/* 上半区：左侧 16:9 视频视窗 + 右侧 SOP 标准规范数据表 */
.top-row {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(480px, 1fr);
  gap: 8px;
  flex: 1;
  min-height: 0; /* 允许子元素弹性适配 */
}

/* 视频视窗容器 (操作控制中枢材质) */
.video-container {
  border-radius: 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.video-player-box {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.video-player-box img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.75);
}

/* 工业级四角护角装饰 (Corner Brackets) */
.corner-bracket {
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  z-index: 6;
}
.corner-tl {
  top: 6px;
  left: 6px;
  border-top: 2px solid var(--neon-cyan);
  border-left: 2px solid var(--neon-cyan);
}
.corner-tr {
  top: 6px;
  right: 6px;
  border-top: 2px solid var(--neon-cyan);
  border-right: 2px solid var(--neon-cyan);
}
.corner-bl {
  bottom: 6px;
  left: 6px;
  border-bottom: 2px solid var(--neon-cyan);
  border-left: 2px solid var(--neon-cyan);
}
.corner-br {
  bottom: 6px;
  right: 6px;
  border-bottom: 2px solid var(--neon-cyan);
  border-right: 2px solid var(--neon-cyan);
}

/* 视频高透 HUD 标牌 */
.video-hud-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(6, 14, 28, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 210, 255, 0.35);
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #e2e8f0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  z-index: 7;
}

.rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neon-rose);
  box-shadow: 0 0 8px var(--neon-rose);
  animation: pulseRec 1.5s infinite;
}

@keyframes pulseRec {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
}

/* 视频未连接时的待机雷达占位卡片 */
.video-idle-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(14, 27, 49, 0.92) 0%, rgba(5, 12, 22, 0.98) 100%);
  color: #94a3b8;
  z-index: 8;
  text-align: center;
  padding: 16px;
}

.idle-radar-pulse {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px dashed rgba(0, 210, 255, 0.35);
  position: absolute;
  animation: radarSpin 12s linear infinite;
  pointer-events: none;
}

@keyframes radarSpin {
  0% { transform: rotate(0deg) scale(0.95); opacity: 0.45; }
  50% { transform: rotate(180deg) scale(1.08); opacity: 0.85; }
  100% { transform: rotate(360deg) scale(0.95); opacity: 0.45; }
}

.idle-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
  opacity: 0.9;
  filter: drop-shadow(0 0 12px rgba(0, 210, 255, 0.5));
  position: relative;
  z-index: 2;
}

.idle-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
  position: relative;
  z-index: 2;
}

.idle-subtitle {
  font-size: 0.78rem;
  color: #64748b;
  position: relative;
  z-index: 2;
}

.action-feature-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(6, 14, 28, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 245, 160, 0.4);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--neon-green);
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 10px rgba(0, 245, 160, 0.2);
  z-index: 7;
}

.alarm-floating-banner {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: rgba(255, 0, 85, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.84rem;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 25px rgba(255, 0, 85, 0.6);
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.alarm-floating-banner.show {
  display: flex;
  animation: pulseAlarm 0.8s infinite alternate;
}

@keyframes pulseAlarm {
  from { transform: scale(1); }
  to { transform: scale(1.015); }
}

/* ==========================================================================
   3. 右侧 SOP 数据表格 (客观数据区 zone-data-center)
      【核心改进】：table-layout: fixed + 单行不折行 + 容器高度物理锁死零跳动！
   ========================================================================== */
.step-table-container {
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.table-header-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.sop-table {
  width: 100%;
  table-layout: fixed; /* 必须：彻底锁定各列像素宽度，杜绝任何跳动 */
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

/* 锁定表头高度与固定定位 */
.sop-table th {
  height: 34px;
  line-height: 34px;
  background: rgba(9, 21, 39, 0.96);
  color: var(--neon-cyan);
  padding: 0 8px;
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 210, 255, 0.25);
  position: sticky;
  top: 0;
  z-index: 3;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 锁定表格各行物理高度：统一 34px，绝不因为文字多或少发生高低跳动 */
.sop-table tbody tr {
  height: 34px;
  max-height: 34px;
  transition: background 0.15s ease;
}

.sop-table td {
  height: 34px;
  padding: 0 8px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.10);
  vertical-align: middle;
  white-space: nowrap; /* 绝对禁止折行 */
  overflow: hidden;    /* 文本过长时截断 */
  text-overflow: ellipsis;
}

.sop-table tbody tr:hover {
  background: rgba(14, 38, 70, 0.45);
}

/* 工步激活态 (电网青蓝微发光侧边条 + 流光背景) */
.sop-table tr.row-active {
  background: linear-gradient(90deg, rgba(0, 210, 255, 0.18) 0%, rgba(9, 32, 58, 0.4) 100%) !important;
  box-shadow: inset 3px 0 0 var(--neon-cyan);
}

.col-no {
  text-align: center;
  font-weight: 700;
  color: var(--neon-cyan);
}

.col-name {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-name strong {
  font-weight: 600;
}

.col-action {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 规范动作描述文字：单行显示，杜绝折行 */
.action-desc-text {
  font-size: 0.76rem;
  color: #cbd5e1;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block;
  width: 100%;
}

.col-res {
  text-align: center;
  white-space: nowrap;
}

.col-time {
  text-align: right;
  white-space: nowrap;
}

.time-val {
  color: #f1f5f9;
  font-weight: 600;
  font-size: 0.80rem;
}

.time-limit {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.step-indicator-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  margin-left: 5px;
  box-shadow: 0 0 8px var(--neon-green);
  animation: blinkDot 1s infinite;
  vertical-align: middle;
}

@keyframes blinkDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.2; transform: scale(0.8); }
}

/* 结果药丸状态 (对标 Design Tokens) */
.res-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
}

.res-pill.pass {
  background: rgba(0, 245, 160, 0.2);
  border: 1px solid rgba(0, 245, 160, 0.4);
  color: var(--neon-green);
  box-shadow: 0 0 8px rgba(0, 245, 160, 0.25);
}

.res-pill.idle {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(71, 85, 105, 0.4);
  color: var(--text-slate-400);
}

.res-pill.fail {
  background: rgba(255, 0, 85, 0.25);
  border: 1px solid rgba(255, 0, 85, 0.45);
  color: #ff99aa;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.35);
}

/* ==========================================================================
   工艺规范与质量实时核验卡 (AI 执行透视台 zone-agent-console)
   【核心改进】：高度绝对固定 82px，文字内部滚动，绝不向上挤压抖动表格！
   ========================================================================== */
.vlm-audit-card {
  height: 82px;
  min-height: 82px;
  max-height: 82px;
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 0.76rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid rgba(0, 210, 255, 0.25);
  box-sizing: border-box;
}

.vlm-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.vlm-title {
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
}

.vlm-status-pill {
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(0, 210, 255, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(0, 210, 255, 0.35);
}

.vlm-status-pill.triggered {
  background: rgba(255, 0, 85, 0.25);
  color: #fca5a5;
  border-color: var(--neon-rose);
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.3);
}

.vlm-reasoning-body {
  color: #94a3b8;
  line-height: 1.35;
  font-size: 0.74rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ==========================================================================
   4. 下半区：步骤缩略图画廊 (5 步满屏对齐)
   ========================================================================== */
.bottom-row {
  border-radius: 8px;
  padding: 4px 8px;
  height: var(--gallery-height);
  flex-shrink: 0;
  box-sizing: border-box;
}

.steps-gallery {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  height: 100%;
}

/* 空状态卡片样式 (初始未上传 SOP 文档) */
.table-empty-row {
  height: 180px !important;
  text-align: center;
  border-bottom: none !important;
  background: transparent !important;
}

.empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 10px;
  color: #64748b;
}

.empty-state-card .empty-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
  opacity: 0.7;
}

.empty-state-card .empty-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.empty-state-card .empty-sub {
  font-size: 0.76rem;
  color: #64748b;
}

.gallery-empty-state {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  color: #64748b;
  font-size: 0.8rem;
  background: rgba(8, 18, 34, 0.45);
  border: 1px dashed rgba(0, 210, 255, 0.2);
  border-radius: 6px;
}

.gallery-empty-icon {
  font-size: 1.2rem;
  opacity: 0.8;
}


.gallery-card {
  background: rgba(8, 18, 34, 0.75);
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.2s ease;
  height: 100%;
  position: relative;
}

.gallery-card:hover {
  border-color: rgba(0, 210, 255, 0.45);
  transform: translateY(-1px);
}

.gallery-card.active {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.35);
  transform: translateY(-1px);
}

.gallery-card.pass {
  border-color: rgba(0, 245, 160, 0.45);
}

.gallery-card.fail {
  border-color: var(--neon-rose);
}

.card-title-bar {
  height: 20px;
  line-height: 20px;
  background: rgba(9, 21, 39, 0.9);
  padding: 0 4px;
  font-size: 0.70rem;
  font-weight: 600;
  color: #e2e8f0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0, 210, 255, 0.15);
}

.card-thumb {
  flex: 1;
  min-height: 0;
  background: #02060c;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-status-bar {
  height: 18px;
  line-height: 18px;
  padding: 0;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.card-status-bar.pass {
  background: rgba(0, 245, 160, 0.2);
  color: var(--neon-green);
}

.card-status-bar.idle {
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-slate-400);
}

.card-status-bar.fail {
  background: rgba(255, 0, 85, 0.3);
  color: #ff99aa;
}

/* ==========================================================================
   5. 底部操作控制栏 (Footer - 操作控制中枢材质)
   ========================================================================== */
.sys-footer {
  border-radius: 8px;
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
}

.footer-left-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* 按钮定宽定高防抖 (Pixel-Lock Controls) */
.ctrl-btn {
  height: 30px;
  min-width: 82px;
  padding: 0 12px;
  border-radius: 5px;
  border: none;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.ctrl-btn:hover {
  transform: translateY(-1px);
}
.ctrl-btn:active {
  transform: translateY(0);
}

/* 启动按钮：极光绿渐变高光 (对标 5161 启动推演高光) */
.btn-start {
  background: linear-gradient(135deg, #00f5a0 0%, #00d2b4 100%);
  color: #04291e !important;
  font-weight: 800;
  border: 1px solid #00f5a0;
  box-shadow: 0 0 12px rgba(0, 245, 160, 0.4);
}
.btn-start:hover {
  box-shadow: 0 0 18px rgba(0, 245, 160, 0.65);
}

/* 停止按钮：终止警示红高光 (对标 5161 终止推演) */
.btn-stop {
  background: linear-gradient(135deg, #ff0055 0%, #e11d48 100%);
  border: 1px solid #ff4d79;
  box-shadow: 0 0 12px rgba(255, 0, 85, 0.35);
}
.btn-stop:hover {
  box-shadow: 0 0 18px rgba(255, 0, 85, 0.55);
}

/* 待机按钮：警戒琥珀 */
.btn-pause {
  background: linear-gradient(135deg, #ffb703 0%, #d97706 100%);
  color: #2b1500 !important;
  font-weight: 800;
  border: 1px solid #fbbf24;
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.3);
}
.btn-pause:hover {
  box-shadow: 0 0 15px rgba(255, 183, 3, 0.5);
}

/* 清零按钮：电网青蓝 */
.btn-reset {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid #38bdf8;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.3);
}
.btn-reset:hover {
  box-shadow: 0 0 15px rgba(2, 132, 199, 0.5);
}

/* AI 标注切换按钮 */
.btn-overlay {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(0, 210, 255, 0.3);
  color: var(--text-secondary);
  min-width: 102px;
}
.btn-overlay:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--neon-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.25);
}

.duration-label {
  font-size: 0.76rem;
  color: var(--neon-cyan);
  margin-left: 6px;
}

/* Demo 违规模拟注入器 */
.footer-right-demo {
  display: flex;
  align-items: center;
  gap: 7px;
}

.demo-tag {
  font-size: 0.74rem;
  color: var(--text-slate-400);
}

.demo-btn {
  background: rgba(10, 25, 44, 0.75);
  border: 1px solid rgba(0, 210, 255, 0.25);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
}

.demo-btn:hover {
  background: rgba(17, 41, 74, 0.85);
  border-color: var(--neon-cyan);
  color: #fff;
}

.demo-btn.active {
  background: rgba(0, 210, 255, 0.2);
  color: #fff;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.35);
}

.demo-btn.warn {
  border-color: rgba(255, 183, 3, 0.35);
}
.demo-btn.warn:hover {
  background: rgba(120, 53, 15, 0.7);
  color: #fff;
  border-color: var(--neon-amber);
}

/* ==========================================================================
   6. 模态弹窗组件 (Modals)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-backdrop.show {
  display: flex;
}

.modal-box {
  background: rgba(11, 22, 40, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--neon-cyan);
  border-radius: 10px;
  width: 580px;
  max-width: 90vw;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(0, 210, 255, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
}

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

.upload-modal-box {
  width: 660px;
}

.modal-header {
  padding: 10px 16px;
  background: rgba(16, 36, 62, 0.9);
  border-bottom: 1px solid rgba(0, 210, 255, 0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 0.90rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-slate-400);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: #fff; }

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
}

.tab-btn {
  background: rgba(14, 30, 56, 0.6);
  border: 1px solid rgba(0, 210, 255, 0.2);
  color: #94a3b8;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover {
  background: rgba(0, 210, 255, 0.15);
  color: #fff;
}
.tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.3) 0%, rgba(14, 165, 233, 0.3) 100%);
  border-color: var(--neon-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.input-text {
  background: rgba(6, 16, 30, 0.85);
  border: 1px solid rgba(0, 210, 255, 0.25);
  color: #fff;
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 0.80rem;
  outline: none;
  transition: all 0.2s;
}
.input-text:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.35);
}

.upload-drop-area {
  border: 2px dashed rgba(0, 210, 255, 0.35);
  border-radius: 6px;
  padding: 22px 18px;
  text-align: center;
  background: rgba(8, 21, 40, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
}
.upload-drop-area:hover {
  border-color: var(--neon-cyan);
  background: rgba(12, 29, 54, 0.85);
  box-shadow: 0 0 14px rgba(0, 210, 255, 0.2);
}

.drop-icon {
  font-size: 26px;
}

.upload-drop-area h4 {
  font-size: 0.88rem;
  color: #fff;
}

.upload-drop-area p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid #38bdf8;
  color: #fff;
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover {
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.5);
}

.scenario-card-item {
  background: rgba(8, 22, 43, 0.7);
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 7px;
}

.scenario-card-item:hover, .scenario-card-item.active {
  border-color: var(--neon-cyan);
  background: rgba(14, 41, 77, 0.85);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
}

.sc-info h4 {
  font-size: 0.84rem;
  color: #fff;
  margin-bottom: 3px;
}

.sc-info p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.source-card {
  background: rgba(9, 21, 39, 0.75);
  border: 1px solid rgba(0, 210, 255, 0.18);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 14px;
  transition: all 0.2s ease;
}
.source-card:hover {
  border-color: rgba(0, 210, 255, 0.4);
  background: rgba(12, 28, 52, 0.85);
  box-shadow: 0 0 14px rgba(0, 210, 255, 0.12);
}
.source-card.highlight-card {
  border-color: rgba(0, 210, 255, 0.35);
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.08) 0%, rgba(9, 21, 39, 0.8) 100%);
}

.source-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.source-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--neon-cyan);
}
.source-icon-badge.live {
  background: rgba(0, 245, 160, 0.1);
  border-color: rgba(0, 245, 160, 0.3);
  color: #00f5a0;
}
.source-icon-badge.cam {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}
.source-icon-badge.file {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
}

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

.source-card-info h4 {
  font-size: 0.84rem;
  color: #ffffff;
  font-weight: 600;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-card-info p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}

.source-card-action {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.video-modal-box {
  width: 660px;
}

.stream-locked-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.stream-locked-wrapper .lock-icon {
  position: absolute;
  left: 9px;
  color: var(--neon-cyan);
  opacity: 0.75;
  pointer-events: none;
}

.input-stream-locked {
  width: 250px;
  height: 30px;
  padding: 0 10px 0 28px;
  font-size: 0.74rem;
  font-family: 'JetBrains Mono', Consolas, monospace;
  background: rgba(6, 14, 26, 0.9);
  border: 1px solid rgba(0, 210, 255, 0.25);
  border-radius: 5px;
  color: #7dd3fc;
  cursor: not-allowed;
  user-select: all;
  box-sizing: border-box;
}

.btn-source-action {
  background: rgba(13, 56, 104, 0.8);
  border: 1px solid rgba(0, 210, 255, 0.35);
  color: #e2e8f0;
  height: 30px;
  min-width: 96px;
  padding: 0 14px;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-source-action:hover {
  background: #0284c7;
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.35);
}
.btn-source-action.primary {
  background: linear-gradient(135deg, #0284c7 0%, #00d2ff 100%);
  border-color: #38bdf8;
  color: #04101e;
  font-weight: 700;
}
.btn-source-action.primary:hover {
  background: linear-gradient(135deg, #00d2ff 0%, #00f5a0 100%);
  box-shadow: 0 0 12px rgba(0, 245, 160, 0.4);
}

.btn-mini-source {
  background: rgba(16, 36, 62, 0.8);
  border: 1px solid rgba(0, 210, 255, 0.2);
  color: #e2e8f0;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.70rem;
  cursor: pointer;
  margin-left: 3px;
  transition: all 0.2s;
}
.btn-mini-source:hover {
  background: #0284c7;
  color: #fff;
}

.upload-status-box {
  margin-top: 7px;
  padding: 6px 10px;
  background: rgba(12, 35, 60, 0.8);
  border: 1px solid var(--neon-cyan);
  border-radius: 5px;
  font-size: 0.76rem;
  color: #38bdf8;
}

/* ==========================================================================
   7. 响应式与多分辨率自适应 (MacBook 13/14/16 / 1080P / 2K / 4K)
   ========================================================================== */

/* 紧凑高度视口 (MacBook 13寸带大 Dock 或开启调试面板，视口高度 <= 760px) */
@media (max-height: 760px) {
  :root {
    --header-height: 34px;
    --footer-height: 34px;
    --gallery-height: 68px;
  }
  .sys-header {
    margin: 3px 6px 0 6px;
    padding: 0 8px;
  }
  .brand-logo-squircle {
    width: 22px;
    height: 22px;
    border-radius: 5px;
  }
  .brand-bolt-icon {
    width: 12px;
    height: 12px;
  }
  .brand-title-text {
    font-size: 1.15rem;
  }
  .cyber-pill, .cyber-pill-btn {
    height: 22px;
    padding: 0 6px;
    font-size: 0.68rem;
    gap: 3px;
  }
  .sys-body {
    height: calc(100vh - var(--header-height) - 6px);
    padding: 3px 6px;
    gap: 4px;
  }
  .sop-table th, .sop-table td, .sop-table tbody tr {
    height: 28px;
    max-height: 28px;
    line-height: 28px;
    padding: 0 6px;
  }
  .vlm-audit-card {
    height: 66px;
    min-height: 66px;
    max-height: 66px;
    padding: 3px 6px;
  }
  .ctrl-btn {
    height: 24px;
    min-width: 66px;
    padding: 0 6px;
    font-size: 0.70rem;
  }
  .card-title-bar {
    height: 17px;
    line-height: 17px;
    font-size: 0.64rem;
  }
  .card-status-bar {
    height: 15px;
    line-height: 15px;
    font-size: 0.60rem;
  }
}

/* Mac 紧凑宽度窗口 (<= 1180px，如分屏或 13寸 MacBook 默认缩放) */
@media (max-width: 1180px) {
  .header-brand-left {
    gap: 6px;
  }
  .brand-title-text {
    font-size: 1.15rem;
  }
  .clock-pill {
    display: none !important; /* 隐藏时间戳胶囊，确保其他核心控制与状态零拥挤 */
  }
  .header-pills-right {
    gap: 4px;
  }
  .cyber-pill, .cyber-pill-btn {
    padding: 0 6px;
  }
}

/* 极限紧凑宽度窗口 (<= 980px) */
@media (max-width: 980px) {
  .timer-pill {
    display: none !important;
  }
  .brand-title-text {
    font-size: 1.05rem;
  }
}

/* 大屏视口 (MacBook Pro 16寸 / 2K / 4K / 宽屏) */
@media (min-width: 1680px) {
  :root {
    --header-height: 48px;
    --footer-height: 46px;
    --gallery-height: 98px;
  }
  .top-row {
    grid-template-columns: minmax(0, 1.42fr) minmax(520px, 1fr);
  }
  .sop-table {
    font-size: 0.84rem;
  }
  .sop-table th, .sop-table td, .sop-table tbody tr {
    height: 38px;
    max-height: 38px;
    line-height: 38px;
  }
  .action-desc-text {
    font-size: 0.82rem;
  }
  .vlm-audit-card {
    height: 92px;
    min-height: 92px;
    max-height: 92px;
  }
}