/* ============================================================
   Demo 仿真模块 - 灯塔工厂级共享样式 v3 (2026-07-13)
   设计语言: SCADA/MES 大屏风 + 多级导航 + 数据密度
   ============================================================ */

/* --- 全局 --- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.demo-body {
  background: #050810;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- 整体布局: 顶栏 + 主体(侧栏 + 内容) --- */
.demo-layout {
  display: grid;
  grid-template-rows: 48px 1fr;
  min-height: 100vh;
}
.demo-layout-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 48px);
}

/* --- 顶栏 (顶部) --- */
.demo-topbar {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.95) 0%, rgba(13, 17, 23, 0.95) 100%);
  border-bottom: 1px solid var(--border-muted);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.demo-topbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 1px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  margin-right: 24px;
}
.demo-topbar-logo svg { color: var(--accent-fg); }
.demo-topbar-factory {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 6px;
  font-size: 12px;
  color: var(--accent-fg);
  cursor: pointer;
  font-family: inherit;
}
.demo-topbar-factory:hover { background: rgba(88, 166, 255, 0.15); }
.demo-topbar-search {
  margin-left: 16px;
  display: inline-flex;
  align-items: center;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 4px 10px;
  width: 280px;
  transition: all 0.15s ease;
}
.demo-topbar-search:focus-within {
  border-color: var(--accent-fg);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}
.demo-topbar-search input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  flex: 1;
  outline: none;
  font-family: inherit;
}
.demo-topbar-search input::placeholder { color: var(--text-tertiary); }
.demo-topbar-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.demo-topbar-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}
.demo-topbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  font-family: inherit;
}
.demo-topbar-icon:hover {
  background: var(--bg-secondary);
  border-color: var(--border-muted);
  color: var(--text-primary);
}
.demo-topbar-icon .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--accent-red);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.demo-topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-primary);
}
.demo-topbar-user:hover { border-color: var(--accent-fg); }
.demo-topbar-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-fg), var(--accent-purple));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
}

/* --- 侧栏 (左侧多级导航) --- */
.demo-sidebar {
  background: rgba(13, 17, 23, 0.85);
  border-right: 1px solid var(--border-muted);
  padding: 16px 0;
  overflow-y: auto;
  max-height: calc(100vh - 48px);
  position: sticky;
  top: 48px;
}
.demo-sidebar-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 2px;
  padding: 0 16px;
  margin: 12px 0 8px;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}
.demo-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.12s ease;
  position: relative;
}
.demo-sidebar-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.demo-sidebar-item.is-active {
  background: rgba(88, 166, 255, 0.08);
  color: var(--accent-fg);
  border-left-color: var(--accent-fg);
  font-weight: 600;
}
.demo-sidebar-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-fg);
  box-shadow: 0 0 8px var(--accent-fg);
}
.demo-sidebar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.demo-sidebar-label { flex: 1; }
.demo-sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--bg-canvas);
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}
.demo-sidebar-item.is-active .demo-sidebar-badge {
  background: var(--accent-fg);
  color: white;
}
.demo-sidebar-badge.is-red {
  background: var(--accent-red);
  color: white;
  animation: uc-pulse 2s ease-in-out infinite;
}
.demo-sidebar-subgroup {
  padding-left: 28px;
}

/* --- 侧栏 v3 多级导航 (Siemens/Honeywell 工业风) --- */
.demo-sidebar {
  width: 240px;
  background: linear-gradient(180deg, #0b1018 0%, #0e141c 100%);
  border-right: 1px solid var(--border-muted, #1f2937);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  display: flex;
  flex-direction: column;
}
.demo-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-muted, #1f2937);
  background: linear-gradient(180deg, rgba(46, 204, 113, 0.05), transparent);
}
.demo-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  box-shadow: 0 0 8px #2ecc71;
  animation: uc-pulse 2s ease-in-out infinite;
}
.demo-brand-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary, #e6edf3);
}
.demo-brand-version {
  margin-left: auto;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-tertiary, #6b7785);
  padding: 2px 5px;
  border: 1px solid var(--border-muted, #1f2937);
  border-radius: 3px;
  background: var(--bg-canvas, #050a0e);
}
.demo-sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-muted, #1f2937);
  background: rgba(7, 13, 16, 0.4);
}
.demo-sidebar-search svg {
  flex-shrink: 0;
  color: var(--text-tertiary, #6b7785);
}
.demo-sidebar-search input.demo-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary, #e6edf3);
  font-size: 12px;
  font-family: inherit;
}
.demo-sidebar-search input.demo-search-input::placeholder {
  color: var(--text-tertiary, #6b7785);
}
.demo-sidebar-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-tertiary, #6b7785);
  font-family: 'JetBrains Mono', monospace;
}
.demo-group-bar {
  width: 3px;
  height: 11px;
  background: linear-gradient(180deg, #2ecc71, #27ae60);
  border-radius: 2px;
}
.demo-sidebar-group {
  display: flex;
  flex-direction: column;
  padding: 0 8px;
}
.demo-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-secondary, #adbac7);
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  border: 1px solid transparent;
}
.demo-nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary, #e6edf3);
  border-color: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
  /* 2026-07-24: 覆盖 style.css 全局 a:hover 下划线 (所有 demo nav 都需要) */
  text-decoration: none;
}
.demo-nav-item.is-active {
  background: linear-gradient(90deg, rgba(46, 204, 113, 0.12), rgba(46, 204, 113, 0.02));
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.25);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.08), 0 4px 8px -4px rgba(46, 204, 113, 0.2);
}
.demo-nav-item.is-active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: linear-gradient(180deg, #2ecc71, #27ae60);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 6px #2ecc71;
}
.demo-nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.demo-nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--bg-canvas, #050a0e);
  color: var(--text-tertiary, #6b7785);
  font-family: 'JetBrains Mono', monospace;
}
.demo-nav-item.is-active .demo-nav-badge {
  background: #2ecc71;
  color: #0b1018;
}
.demo-nav-badge.is-red {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  animation: uc-pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.5);
}
.demo-nav-badge.is-cyan { background: linear-gradient(135deg, #00b8d4, #006978); color: white; }
.demo-nav-badge.is-green { background: linear-gradient(135deg, #2ecc71, #1e8449); color: white; }
.demo-nav-badge.is-amber { background: linear-gradient(135deg, #f39c12, #b9770e); color: white; }
.demo-nav-badge.is-blue { background: linear-gradient(135deg, #3498db, #1f618d); color: white; }
.demo-nav-chevron {
  transition: transform 0.2s ease;
  color: var(--text-tertiary, #6b7785);
  flex-shrink: 0;
}
.demo-nav-item.is-expanded .demo-nav-chevron {
  transform: rotate(180deg);
}
.demo-nav-sub-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
  margin-left: 22px;
  border-left: 1px dashed rgba(46, 204, 113, 0.2);
  padding: 0 0 0 6px;
}
.demo-nav-parent.is-open > .demo-nav-sub-list {
  max-height: 400px;
  padding: 4px 0 6px 6px;
}
.demo-nav-item.demo-nav-sub {
  font-size: 12px;
  padding: 6px 10px;
  color: var(--text-tertiary, #6b7785);
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  margin-bottom: 0;
  position: relative;
}
.demo-nav-item.demo-nav-sub::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 1px;
  background: rgba(46, 204, 113, 0.3);
}
.demo-nav-item.demo-nav-sub:hover {
  background: rgba(46, 204, 113, 0.05);
  color: #2ecc71;
  border-left-color: rgba(46, 204, 113, 0.3);
  transform: none;
}
.demo-nav-item.is-hidden-by-search,
.demo-nav-parent.is-hidden-by-search {
  display: none !important;
}

/* --- 侧栏底部实时状态条 (SCADA HMI) --- */
.demo-sidebar-status {
  margin-top: auto;
  padding: 14px 14px 16px;
  border-top: 1px solid var(--border-muted, #1f2937);
  background: linear-gradient(180deg, transparent, rgba(7, 13, 16, 0.6));
  font-family: 'JetBrains Mono', monospace;
}
.demo-status-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary, #e6edf3);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.demo-status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 8px #2ecc71;
  animation: uc-pulse 1.6s ease-in-out infinite;
}
.demo-status-time {
  margin-left: auto;
  font-size: 11px;
  color: #2ecc71;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}
.demo-status-line {
  font-size: 11px;
  color: var(--text-primary, #e6edf3);
  margin-bottom: 2px;
  font-weight: 600;
}
.demo-status-line b {
  color: #2ecc71;
  font-weight: 700;
}
.demo-status-line-meta {
  font-size: 10px;
  color: var(--text-tertiary, #6b7785);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}
.demo-status-metric {
  display: grid;
  grid-template-columns: 28px 1fr 38px;
  gap: 6px;
  align-items: center;
  margin: 10px 0;
}
.demo-status-metric-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary, #6b7785);
  letter-spacing: 1px;
}
.demo-status-metric-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border-muted, #1f2937);
}
.demo-status-metric-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2ecc71, #27ae60);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.demo-status-metric-fill.is-good {
  background: linear-gradient(90deg, #2ecc71, #27ae60);
  box-shadow: 0 0 6px rgba(46, 204, 113, 0.4);
}
.demo-status-metric-fill.is-ok {
  background: linear-gradient(90deg, #f39c12, #d68910);
  box-shadow: 0 0 6px rgba(243, 156, 18, 0.4);
}
.demo-status-metric-fill.is-bad {
  background: linear-gradient(90deg, #e74c3c, #c0392b);
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.5);
}
.demo-status-metric-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary, #e6edf3);
  text-align: right;
}
.demo-status-units {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 10px 0;
}
.demo-unit-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-muted, #1f2937);
  border-radius: 4px;
  transition: all 0.15s ease;
}
.demo-unit-tile b {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-tertiary, #6b7785);
  line-height: 1;
  font-family: 'JetBrains Mono', monospace;
}
.demo-unit-tile span {
  font-size: 9px;
  color: var(--text-tertiary, #6b7785);
  margin-top: 2px;
  letter-spacing: 0.5px;
}
.demo-unit-tile.is-on {
  background: rgba(46, 204, 113, 0.1);
  border-color: rgba(46, 204, 113, 0.3);
}
.demo-unit-tile.is-on b { color: #2ecc71; text-shadow: 0 0 4px rgba(46, 204, 113, 0.4); }
.demo-unit-tile.is-charge {
  background: rgba(243, 156, 18, 0.08);
  border-color: rgba(243, 156, 18, 0.25);
}
.demo-unit-tile.is-charge b { color: #f39c12; }
.demo-unit-tile.is-idle {
  background: rgba(149, 165, 166, 0.08);
  border-color: rgba(149, 165, 166, 0.25);
}
.demo-unit-tile.is-err {
  background: rgba(231, 76, 60, 0.1);
  border-color: rgba(231, 76, 60, 0.3);
}
.demo-unit-tile.is-err b { color: #e74c3c; animation: uc-pulse 1s ease-in-out infinite; }
.demo-status-env {
  margin-top: 8px;
  font-size: 9px;
  color: var(--text-tertiary, #6b7785);
  text-align: center;
  letter-spacing: 0.5px;
}
.demo-env-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 1px;
}
.demo-env-badge.env-dev {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.3);
}
.demo-env-badge.env-prod,
.demo-env-badge.env-production {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
}
.demo-env-badge.env-test,
.demo-env-badge.env-staging {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.3);
}

/* demo-main 留出 sidebar 空间 (240px) */
.demo-main {
  margin-left: 240px !important;
  padding: 20px 24px;
  background: var(--bg-canvas, #0c1418);
  min-height: calc(100vh - 100px);
}

/* --- 面包屑 --- */
.demo-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-muted);
}
.demo-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}
.demo-breadcrumb a:hover { color: var(--accent-fg); }
.demo-breadcrumb-sep { color: var(--text-tertiary); }
.demo-breadcrumb-current { color: var(--text-primary); font-weight: 600; }

/* --- 主区 --- */
.demo-main {
  padding: 20px 24px;
  background: var(--bg-canvas);
  min-height: calc(100vh - 100px);
}

/* --- 页面标题区 --- */
.demo-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.demo-page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}
.demo-page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.demo-page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- Tab 切换 --- */
.demo-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: 20px;
  gap: 4px;
}
.demo-tab {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
  position: relative;
}
.demo-tab:hover { color: var(--text-secondary); }
.demo-tab.is-active {
  color: var(--accent-fg);
  border-bottom-color: var(--accent-fg);
}
.demo-tab-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
}
.demo-tab.is-active .demo-tab-badge {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-fg);
}

/* --- 仪表盘布局 --- */
.demo-dashboard {
  display: grid;
  gap: 16px;
}
.demo-row {
  display: grid;
  gap: 16px;
}
.demo-row-4 { grid-template-columns: repeat(4, 1fr); }
.demo-row-3 { grid-template-columns: repeat(3, 1fr); }
.demo-row-2 { grid-template-columns: repeat(2, 1fr); }
.demo-row-1-2 { grid-template-columns: 1fr 2fr; }
.demo-row-2-1 { grid-template-columns: 2fr 1fr; }
.demo-row-3-1 { grid-template-columns: 3fr 1fr; }

/* --- 卡片 --- */
.demo-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 16px;
  position: relative;
}
.demo-card.is-accent {
  border-color: rgba(88, 166, 255, 0.4);
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.06) 0%, rgba(163, 113, 247, 0.03) 100%), var(--bg-primary);
}
.demo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-muted);
}
.demo-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.demo-card-title-icon { color: var(--accent-fg); }
.demo-card-subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}

/* --- KPI --- */
.demo-kpi {
  text-align: center;
  padding: 14px 8px;
}
.demo-kpi-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}
.demo-kpi-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  background: linear-gradient(135deg, #58a6ff 0%, #a371f7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.demo-kpi-value.is-orange { background: linear-gradient(135deg, #f0883e 0%, #f85149 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.demo-kpi-value.is-green { background: linear-gradient(135deg, #3fb950 0%, #58a6ff 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.demo-kpi-value.is-purple { background: linear-gradient(135deg, #a371f7 0%, #f0883e 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.demo-kpi-value.is-red { background: linear-gradient(135deg, #f85149 0%, #d29922 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.demo-kpi-unit {
  font-size: 13px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}
.demo-kpi-label {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}
.demo-kpi-delta {
  font-size: 11px;
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.demo-kpi-delta.is-up { color: var(--accent-green); }
.demo-kpi-delta.is-down { color: var(--accent-red); }
.demo-kpi-mini-spark {
  height: 24px;
  margin-top: 6px;
}

/* --- 设备状态卡片 --- */
.demo-device {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border-left: 3px solid var(--accent-green);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.demo-device:hover {
  background: var(--bg-overlay);
  transform: translateX(2px);
}
.demo-device.is-warning { border-left-color: var(--accent-orange); }
.demo-device.is-error { border-left-color: var(--accent-red); }
.demo-device.is-idle { border-left-color: var(--text-tertiary); }
.demo-device.is-maintenance { border-left-color: var(--accent-purple); }
.demo-device-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--accent-green);
}
.demo-device.is-warning .demo-device-status {
  background: var(--accent-orange);
  box-shadow: 0 0 6px var(--accent-orange);
  animation: uc-pulse 1s ease-in-out infinite;
}
.demo-device.is-error .demo-device-status {
  background: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red);
  animation: uc-pulse 0.5s ease-in-out infinite;
}
.demo-device.is-idle .demo-device-status { background: var(--text-tertiary); box-shadow: none; }
.demo-device.is-maintenance .demo-device-status { background: var(--accent-purple); box-shadow: 0 0 6px var(--accent-purple); }
.demo-device-info { flex: 1; min-width: 0; }
.demo-device-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-device-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}
.demo-device-actions {
  display: inline-flex;
  gap: 4px;
}
.demo-device-btn {
  width: 22px;
  height: 22px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}
.demo-device-btn:hover { color: var(--accent-fg); border-color: var(--accent-fg); }

/* --- 报警 --- */
.demo-alert-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}
.demo-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border-left: 3px solid var(--accent-orange);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.demo-alert:hover { background: var(--bg-overlay); }
.demo-alert.is-critical { border-left-color: var(--accent-red); }
.demo-alert.is-major { border-left-color: var(--accent-orange); }
.demo-alert.is-minor { border-left-color: var(--accent-fg); }
.demo-alert.is-info { border-left-color: var(--accent-purple); }
.demo-alert.is-resolved { opacity: 0.5; border-left-color: var(--accent-green); }
.demo-alert-time {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-tertiary);
  font-size: 11px;
  flex-shrink: 0;
  width: 60px;
}
.demo-alert-body { flex: 1; min-width: 0; }
.demo-alert-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.demo-alert-msg {
  color: var(--text-secondary);
  line-height: 1.4;
  font-size: 11px;
}
.demo-alert-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}
.demo-alert-level {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.demo-alert-level.is-critical { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }
.demo-alert-level.is-major { background: rgba(240, 136, 62, 0.15); color: var(--accent-orange); }
.demo-alert-level.is-minor { background: rgba(88, 166, 255, 0.15); color: var(--accent-fg); }
.demo-alert-level.is-info { background: rgba(163, 113, 247, 0.15); color: var(--accent-purple); }

/* --- 表格 --- */
.demo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.demo-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  border-bottom: 1px solid var(--border-muted);
  background: var(--bg-secondary);
}
.demo-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-muted);
  color: var(--text-primary);
}
.demo-table tr:last-child td { border-bottom: none; }
.demo-table tr:hover td { background: var(--bg-secondary); }
.demo-table tr.is-warning td { background: rgba(240, 136, 62, 0.06); }
.demo-table tr.is-error td { background: rgba(248, 81, 73, 0.08); }
.demo-table tr.is-success td { background: rgba(63, 185, 80, 0.04); }
.demo-table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}
.demo-table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-muted);
  font-size: 12px;
  color: var(--text-tertiary);
}

/* --- 按钮 --- */
.demo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--border-muted);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}
.demo-btn:hover {
  border-color: var(--accent-fg);
  background: rgba(88, 166, 255, 0.06);
}
.demo-btn.is-primary {
  background: linear-gradient(135deg, var(--accent-fg), var(--accent-purple));
  border-color: transparent;
  color: white;
  font-weight: 600;
}
.demo-btn.is-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}
.demo-btn.is-danger {
  border-color: var(--accent-red);
  color: var(--accent-red);
}
.demo-btn.is-danger:hover { background: rgba(248, 81, 73, 0.1); }
.demo-btn.is-success {
  border-color: var(--accent-green);
  color: var(--accent-green);
}
.demo-btn.is-success:hover { background: rgba(63, 185, 80, 0.1); }
.demo-btn.is-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.demo-btn.is-ghost:hover { color: var(--accent-fg); background: var(--bg-secondary); }
.demo-btn.is-sm { padding: 4px 8px; font-size: 12px; }
.demo-btn-group {
  display: inline-flex;
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  overflow: hidden;
}
.demo-btn-group .demo-btn {
  border-radius: 0;
  border-right: 1px solid var(--border-muted);
}
.demo-btn-group .demo-btn:last-child { border-right: none; }
.demo-btn-group .demo-btn.is-active {
  background: var(--accent-fg);
  color: white;
  border-color: var(--accent-fg);
}
.demo-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- 表单 --- */
.demo-input,
.demo-select,
.demo-textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
  width: 100%;
}
.demo-input:focus,
.demo-select:focus,
.demo-textarea:focus {
  border-color: var(--accent-fg);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}
.demo-textarea { resize: vertical; min-height: 80px; }
.demo-range {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-overlay);
  border-radius: 999px;
  cursor: pointer;
  outline: none;
}
.demo-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-fg);
  box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.15);
  cursor: pointer;
}
.demo-range::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(90deg, var(--accent-fg) var(--pct, 50%), var(--bg-overlay) var(--pct, 50%));
  border-radius: 999px;
}
.demo-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-fg);
  border: none;
  box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.15);
  cursor: pointer;
}
.demo-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.demo-form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.demo-form-label-value { color: var(--accent-fg); font-family: 'JetBrains Mono', monospace; }
.demo-form-help { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.demo-form-inline { display: flex; gap: 12px; align-items: center; }
.demo-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.demo-checkbox input { cursor: pointer; }
.demo-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}
.demo-switch-track {
  width: 32px;
  height: 18px;
  background: var(--bg-overlay);
  border-radius: 999px;
  position: relative;
  transition: background 0.15s ease;
}
.demo-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-tertiary);
  border-radius: 50%;
  transition: all 0.15s ease;
}
.demo-switch.is-on .demo-switch-track {
  background: var(--accent-fg);
}
.demo-switch.is-on .demo-switch-track::after {
  background: white;
  left: 16px;
  box-shadow: 0 0 6px rgba(88, 166, 255, 0.5);
}

/* --- 标签/徽章 --- */
.demo-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}
.demo-badge.is-blue { background: rgba(88, 166, 255, 0.15); color: var(--accent-fg); }
.demo-badge.is-green { background: rgba(63, 185, 80, 0.15); color: var(--accent-green); }
.demo-badge.is-orange { background: rgba(240, 136, 62, 0.15); color: var(--accent-orange); }
.demo-badge.is-red { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }
.demo-badge.is-purple { background: rgba(163, 113, 247, 0.15); color: var(--accent-purple); }
.demo-badge.is-yellow { background: rgba(210, 153, 34, 0.15); color: var(--accent-yellow); }
.demo-badge.is-muted { background: var(--bg-overlay); color: var(--text-tertiary); }

/* --- 状态点 --- */
.demo-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  margin-right: 4px;
}
.demo-dot.is-green { background: var(--accent-green); box-shadow: 0 0 4px var(--accent-green); }
.demo-dot.is-orange { background: var(--accent-orange); box-shadow: 0 0 4px var(--accent-orange); }
.demo-dot.is-red { background: var(--accent-red); box-shadow: 0 0 4px var(--accent-red); animation: uc-pulse 1s ease-in-out infinite; }
.demo-dot.is-blue { background: var(--accent-fg); box-shadow: 0 0 4px var(--accent-fg); }

/* --- SVG 图 --- */
.demo-chart {
  width: 100%;
  height: 200px;
  display: block;
}
.demo-chart-tall { height: 280px; }
.demo-chart-short { height: 140px; }

/* --- 设备拓扑图 --- */
.demo-topology {
  position: relative;
  width: 100%;
  height: 320px;
  background: var(--bg-secondary);
  border-radius: 8px;
  background-image:
    linear-gradient(rgba(88, 166, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 166, 255, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
  overflow: hidden;
}
.demo-topology-node {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--bg-primary);
  border: 2px solid var(--accent-fg);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 100px;
  text-align: center;
  z-index: 2;
}
.demo-topology-node:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 4px 16px rgba(88, 166, 255, 0.3);
  z-index: 3;
}
.demo-topology-node.is-warning { border-color: var(--accent-orange); }
.demo-topology-node.is-error { border-color: var(--accent-red); animation: uc-pulse 1s ease-in-out infinite; }
.demo-topology-node-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 12px;
}
.demo-topology-node-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

/* --- 数据列表 (滚动列表) --- */
.demo-data-list {
  max-height: 360px;
  overflow-y: auto;
}
.demo-data-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-muted);
  font-size: 12px;
}
.demo-data-list-row:last-child { border-bottom: none; }
.demo-data-list-row:hover { background: var(--bg-secondary); }

/* --- 抽屉 (从右侧滑出) --- */
.demo-drawer {
  position: fixed;
  top: 48px;
  right: -480px;
  width: 480px;
  height: calc(100vh - 48px);
  background: var(--bg-primary);
  border-left: 1px solid var(--border-muted);
  z-index: 200;
  transition: right 0.25s ease;
  overflow-y: auto;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
}
.demo-drawer.is-open { right: 0; }
.demo-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-muted);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 1;
}
.demo-drawer-title { font-size: 15px; font-weight: 700; }
.demo-drawer-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  font-family: inherit;
}
.demo-drawer-close:hover { color: var(--accent-red); background: var(--bg-secondary); }
.demo-drawer-body { padding: 20px; }
.demo-drawer-overlay {
  position: fixed;
  inset: 48px 0 0 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.demo-drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

/* --- 模态框 --- */
.demo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.demo-modal-overlay.is-open { display: flex; }
.demo-modal {
  background: var(--bg-primary);
  border: 1px solid var(--border-muted);
  border-radius: 10px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.demo-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-muted);
}
.demo-modal-title { font-size: 16px; font-weight: 700; }
.demo-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.demo-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-muted);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- 进度条 --- */
.demo-progress {
  height: 6px;
  background: var(--bg-overlay);
  border-radius: 999px;
  overflow: hidden;
}
.demo-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-fg), var(--accent-purple));
  border-radius: 999px;
  transition: width 0.3s ease;
}
.demo-progress.is-success .demo-progress-bar { background: linear-gradient(90deg, var(--accent-green), var(--accent-fg)); }
.demo-progress.is-warning .demo-progress-bar { background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow)); }
.demo-progress.is-danger .demo-progress-bar { background: linear-gradient(90deg, var(--accent-red), var(--accent-orange)); }

/* --- 时间线 --- */
.demo-timeline {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 22px;
}
.demo-timeline-cell {
  flex: 1;
  height: 100%;
  background: var(--bg-overlay);
  border-radius: 2px;
  transition: background 0.15s ease;
  position: relative;
}
.demo-timeline-cell.is-running { background: var(--accent-green); box-shadow: 0 0 4px rgba(63, 185, 80, 0.4); }
.demo-timeline-cell.is-warning { background: var(--accent-orange); }
.demo-timeline-cell.is-error { background: var(--accent-red); }
.demo-timeline-cell.is-idle { background: var(--text-tertiary); opacity: 0.4; }
.demo-timeline-cell.is-maintenance { background: var(--accent-purple); }
.demo-timeline-cell:hover::after {
  content: attr(data-time);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-canvas);
  border: 1px solid var(--border-muted);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  z-index: 10;
}

/* --- 通知 --- */
.demo-toast-container {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.demo-toast {
  background: var(--bg-primary);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  gap: 10px;
  pointer-events: auto;
  animation: toast-in 0.3s ease;
  border-left: 3px solid var(--accent-fg);
}
.demo-toast.is-success { border-left-color: var(--accent-green); }
.demo-toast.is-warning { border-left-color: var(--accent-orange); }
.demo-toast.is-error { border-left-color: var(--accent-red); }
.demo-toast.is-info { border-left-color: var(--accent-fg); }
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.demo-toast-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.demo-toast-msg { font-size: 12px; color: var(--text-secondary); }

/* --- 缺口占位 --- */
.demo-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.demo-empty-icon { font-size: 36px; opacity: 0.4; margin-bottom: 12px; }

/* --- 响应式 --- */
@media (max-width: 1280px) {
  .demo-row-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1023px) {
  .demo-layout-body { grid-template-columns: 200px 1fr; }
  .demo-topbar-search { width: 200px; }
  .demo-row-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .demo-layout-body { grid-template-columns: 1fr; }
  .demo-sidebar { display: none; }
  .demo-topbar-search { display: none; }
  .demo-row-4, .demo-row-3, .demo-row-2 { grid-template-columns: 1fr; }
  .demo-main { padding: 16px; }
}


/* ============================================================
   2026-07-24: 全局覆盖 style.css 的 a:hover 下划线规则
   (style.css:55 有 a:hover { text-decoration: underline; } 通用规则,
    所有 demo 内的 <a> 标签 hover 都会触发, 包括 nav-item 之外的设备/报警等)
   用 !important + 后置规则确保优先级, 在所有 demo 共用
   ============================================================ */
.demo-layout a:hover,
.demo-layout a:focus { text-decoration: none !important; }
