/* ==================== 南能智慧AI控制系统 ==================== */
:root {
  --green-900: #1B5E20;
  --green-800: #2E7D32;
  --green-700: #388E3C;
  --green-600: #43A047;
  --green-500: #66BB6A;
  --green-400: #81C784;
  --green-300: #A5D6A7;
  --green-100: #E8F5E9;
  --green-50:  #F1F8E9;

  --bg-dark: #0A1F12;
  --bg-panel: #0D2818;
  --bg-card: #11301C;
  --bg-card-hover: #163821;
  --border: #1A4028;
  --border-light: #234E32;

  --text-primary: #E8F5E9;
  --text-secondary: #A5D6A7;
  --text-muted: #6B9368;

  --accent: #00E676;
  --accent-dim: #00C853;
  --warning: #FFB74D;
  --danger: #FF5252;
  --info: #40C4FF;
  --purple: #B388FF;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  overflow-x: hidden;
  font-size: 14px;
}

/* ==================== 顶部导航 ==================== */
.top-bar {
  height: 60px;
  background: linear-gradient(135deg, var(--bg-panel), var(--bg-card));
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.top-bar-logo { display: flex; align-items: center; gap: 10px; }
.top-bar-logo img { height: 36px; width: auto; object-fit: contain; }
.top-bar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.top-bar-title .accent { color: var(--accent); }
.top-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.top-bar-time {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: "Consolas", monospace;
}
.top-bar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--accent);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent); }
  50% { opacity: 0.5; box-shadow: 0 0 16px var(--accent); }
}

/* ==================== 侧边导航 ==================== */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: 200px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
  z-index: 900;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--bg-card);
  color: var(--accent);
  border-left-color: var(--accent);
}
.nav-item svg {
  flex-shrink: 0;
  width: 18px; height: 18px;
}

.nav-section-title {
  font-size: 11px;
  color: var(--text-muted);
  padding: 16px 20px 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ==================== 主内容区 ==================== */
.main-content {
  margin-left: 200px;
  margin-top: 60px;
  padding: 20px;
  min-height: calc(100vh - 60px);
}

/* ==================== 页面面板 ==================== */
.panel { display: none; animation: fadeIn 0.4s ease; }
.panel.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.panel-title .accent { color: var(--accent); }
.panel-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==================== 卡片网格 ==================== */
.card-grid {
  display: grid;
  gap: 16px;
}
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: var(--transition);
}
.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

/* ==================== 统计卡片 ==================== */
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.green { background: rgba(0,230,118,0.12); color: var(--accent); }
.stat-icon.blue  { background: rgba(64,196,255,0.12); color: var(--info); }
.stat-icon.orange{ background: rgba(255,183,77,0.12); color: var(--warning); }
.stat-icon.purple{ background: rgba(179,136,255,0.12); color: var(--purple); }
.stat-icon svg { width: 24px; height: 24px; }
.stat-info { flex: 1; min-width: 0; }
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: "Consolas", monospace;
}
.stat-unit {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: 4px;
}
.stat-trend {
  font-size: 11px;
  margin-top: 2px;
}
.stat-trend.up { color: var(--accent); }
.stat-trend.down { color: var(--danger); }

/* ==================== 图表容器 ==================== */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.chart-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(0,230,118,0.15);
  color: var(--accent);
}
.chart-body {
  position: relative;
  height: 200px;
}

/* ==================== 设备状态网格 ==================== */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: var(--transition);
  cursor: pointer;
}
.device-card:hover {
  border-color: var(--green-600);
  transform: translateY(-2px);
}
.device-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.device-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.device-status {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.device-status.online { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.device-status.offline { background: var(--text-muted); }
.device-status.warning { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.device-status.error { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.device-metrics {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.device-metric {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.device-metric .label { color: var(--text-muted); }
.device-metric .value { color: var(--text-secondary); font-family: "Consolas", monospace; }

/* ==================== 告警列表 ==================== */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.alert-item.danger {
  background: rgba(255,82,82,0.08);
  border: 1px solid rgba(255,82,82,0.2);
}
.alert-item.warning {
  background: rgba(255,183,77,0.08);
  border: 1px solid rgba(255,183,77,0.2);
}
.alert-item.info {
  background: rgba(64,196,255,0.08);
  border: 1px solid rgba(64,196,255,0.2);
}
.alert-item.success {
  background: rgba(0,230,118,0.08);
  border: 1px solid rgba(0,230,118,0.2);
}
.alert-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
}
.alert-content { flex: 1; }
.alert-title { font-weight: 600; }
.alert-time { font-size: 11px; color: var(--text-muted); }

/* ==================== 仪表盘 ==================== */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.gauge {
  position: relative;
  width: 120px;
  height: 120px;
}
.gauge svg {
  transform: rotate(-90deg);
}
.gauge-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}
.gauge-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
}
.gauge-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.gauge-value {
  font-size: 22px;
  font-weight: 700;
  font-family: "Consolas", monospace;
}
.gauge-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==================== 数据表格 ==================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-panel);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.data-table tr:hover td {
  background: var(--bg-card-hover);
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.tag.green { background: rgba(0,230,118,0.15); color: var(--accent); }
.tag.blue  { background: rgba(64,196,255,0.15); color: var(--info); }
.tag.orange{ background: rgba(255,183,77,0.15); color: var(--warning); }
.tag.red   { background: rgba(255,82,82,0.15); color: var(--danger); }
.tag.purple{ background: rgba(179,136,255,0.15); color: var(--purple); }

/* ==================== AI分析面板 ==================== */
.ai-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.ai-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.ai-panel-header svg { width: 18px; height: 18px; color: var(--accent); }
.ai-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.ai-analysis-text {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
}
.ai-analysis-text .highlight { color: var(--accent); }
.ai-analysis-text .warning-text { color: var(--warning); }

/* ==================== 进度条 ==================== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}
.progress-fill.green { background: linear-gradient(90deg, var(--green-600), var(--accent)); }
.progress-fill.blue  { background: linear-gradient(90deg, #1565C0, var(--info)); }
.progress-fill.orange{ background: linear-gradient(90deg, #E65100, var(--warning)); }
.progress-fill.purple{ background: linear-gradient(90deg, #6A1B9A, var(--purple)); }

/* ==================== 数字孪生视图 ==================== */
.twin-view {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  position: relative;
}
.twin-canvas {
  width: 100%;
  height: 320px;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* ==================== 系统矩阵 ==================== */
.system-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.matrix-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
}
.matrix-cell:hover {
  border-color: var(--green-600);
  transform: translateY(-2px);
}
.matrix-icon {
  width: 40px; height: 40px;
  margin: 0 auto 8px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.matrix-icon svg { width: 20px; height: 20px; }
.matrix-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.matrix-status {
  font-size: 11px;
  color: var(--text-muted);
}
.matrix-status .active { color: var(--accent); }

/* ==================== 车辆迷你卡片 ==================== */
.vehicle-mini-card {
  cursor: pointer;
  border-left: 3px solid var(--border-light);
  transition: var(--transition);
}
.vehicle-mini-card:hover {
  border-left-color: var(--accent);
  transform: translateY(-2px);
}
.vehicle-mini-card[data-jump="classification"] { border-left-color: var(--accent); }
.vehicle-mini-card[data-jump="incineration"] { border-left-color: var(--warning); }
.vehicle-mini-card[data-jump="power-gen"] { border-left-color: var(--info); }
.vehicle-mini-card[data-jump="energy-storage"] { border-left-color: var(--purple); }
.vmc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.vmc-id {
  font-size: 11px;
  font-weight: 700;
  font-family: "Consolas", monospace;
  color: var(--text-muted);
}
.vmc-status {
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 8px;
  background: rgba(0,230,118,0.15);
  color: var(--accent);
}
.vmc-status.online { background: rgba(0,230,118,0.15); color: var(--accent); }
.vmc-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.vmc-metrics {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vmc-metrics > div {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.vmc-metrics .label { color: var(--text-muted); }
.vmc-metrics .value { color: var(--text-secondary); font-family: "Consolas", monospace; }

/* ==================== 车辆徽章 ==================== */
.vehicle-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.vehicle-badge.green { background: rgba(0,230,118,0.08); border-color: var(--accent); }
.vehicle-badge.orange { background: rgba(255,183,77,0.08); border-color: var(--warning); }
.vehicle-badge.blue { background: rgba(64,196,255,0.08); border-color: var(--info); }
.vehicle-badge.purple { background: rgba(179,136,255,0.08); border-color: var(--purple); }
.vb-id {
  font-size: 14px;
  font-weight: 700;
  font-family: "Consolas", monospace;
  color: var(--text-primary);
}
.vb-status {
  font-size: 12px;
  color: var(--accent);
}
.vehicle-badge.orange .vb-status { color: var(--warning); }
.vehicle-badge.blue .vb-status { color: var(--info); }
.vehicle-badge.purple .vb-status { color: var(--purple); }

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
  .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .system-matrix { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .nav-item span { display: none; }
  .sidebar .nav-section-title { display: none; }
  .main-content { margin-left: 60px; }
  .card-grid.cols-4, .card-grid.cols-3, .card-grid.cols-2 { grid-template-columns: 1fr; }
  .system-matrix { grid-template-columns: repeat(2, 1fr); }
  .top-bar-title { font-size: 14px; }
  .top-bar-title .subtitle { display: none; }
}

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-600); }

/* ==================== 南能小子·AI助手 ==================== */
.ai-mascot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  cursor: pointer;
}

.ai-mascot-img-wrap {
  position: relative;
  width: 144px;
  height: 144px;
  flex-shrink: 0;
}

.ai-mascot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: mascotFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 4px 14px rgba(0,230,118,.2));
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}

.ai-mascot:hover .ai-mascot-img {
  transform: scale(1.08) translateY(-4px);
}

.ai-mascot-dot {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-dark);
  animation: mascotDot 2.5s ease-in-out infinite;
}

@keyframes mascotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes mascotDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,230,118,.5); }
  50% { opacity: .8; box-shadow: 0 0 0 5px rgba(0,230,118,0); }
}

/* 对话气泡 */
.ai-mascot-bubble {
  background: rgba(13,40,24,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0,230,118,.25);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 16px;
  max-width: 220px;
  opacity: 0;
  transform: translateX(12px) scale(.95);
  transition: opacity .5s ease, transform .5s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}

.ai-mascot-bubble.show {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.ai-mascot-bubble span {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: nowrap;
}

.ai-mascot-bubble span .hl { color: var(--accent); }

/* 响应式 */
@media (max-width: 768px) {
  .ai-mascot {
    bottom: 14px;
    right: 14px;
  }
  .ai-mascot-img-wrap {
    width: 28px;
    height: 28px;
  }
  .ai-mascot-bubble {
    max-width: 160px;
    padding: 8px 12px;
    margin-bottom: 16px;
  }
  .ai-mascot-bubble span {
    font-size: 12px;
  }
}

/* ==================== 密码登录门禁 ==================== */
.login-gate {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, #0D2818 0%, #050F08 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
.login-gate.hidden {
  opacity: 0;
  pointer-events: none;
}
.login-gate-box {
  text-align: center;
  padding: 48px 56px;
  background: linear-gradient(135deg, var(--bg-panel), var(--bg-card));
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,230,118,0.08);
  max-width: 400px;
  width: 90%;
}
.login-gate-logo {
  margin-bottom: 20px;
}
.login-gate-logo img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
}
.login-gate-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.login-gate-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.login-gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-gate-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
  text-align: center;
  letter-spacing: 2px;
}
.login-gate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,230,118,0.12);
}
.login-gate-input::placeholder {
  color: var(--text-muted);
  letter-spacing: 0;
}
.login-gate-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  border: none;
  border-radius: 8px;
  color: #052012;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 2px;
}
.login-gate-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,230,118,0.3);
}
.login-gate-btn:active {
  transform: translateY(0);
}
.login-gate-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
  transition: var(--transition);
}
.login-gate-footer {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.6;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.sim-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 160px; /* 防止AI助手遮挡底部内容 */
}

/* 输入参数控制面板 */
.sim-input-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  position: relative;
  z-index: 1;
}
.sim-input-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sim-input-title svg { width: 18px; height: 18px; color: var(--accent); }
.sim-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  align-items: start;
}
.sim-input-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sim-input-label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sim-input-label .sim-input-val {
  font-size: 14px;
  font-weight: 700;
  font-family: "Consolas", monospace;
  color: var(--accent);
}
.sim-input-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.sim-input-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-dark);
  cursor: grab;
  box-shadow: 0 0 6px rgba(0,230,118,0.4);
}
.sim-input-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.sim-input-select {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
}
.sim-input-select:focus { border-color: var(--accent); }

/* 工艺流程 SVG 容器 */
.sim-flow-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  overflow: visible;
  position: relative;
}
.sim-flow-svg {
  width: 100%;
  height: auto;
  display: block;
}
.sim-flow-container svg {
  width: 100% !important;
  height: auto !important;
}
/* 工艺阶段节点 */
.sim-stage-node {
  cursor: pointer;
  transition: filter 0.3s ease;
}
.sim-stage-node:hover { filter: brightness(1.3); }
.sim-stage-node rect {
  transition: stroke-width 0.3s ease, fill 0.3s ease;
}
.sim-stage-node.active rect {
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px currentColor);
}
/* 粒子流动动画 */
.sim-particle {
  fill: var(--accent);
  opacity: 0.8;
}
@keyframes particle-flow {
  0% { offset-distance: 0%; opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.7; }
  100% { offset-distance: 100%; opacity: 0; }
}
/* 连接管路 */
.sim-pipe {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  opacity: 0.3;
}
.sim-pipe.gas { stroke: var(--warning); }
.sim-pipe.solid { stroke: var(--text-muted); }
.sim-pipe.liquid { stroke: var(--info); }
/* 阶段标签 */
.sim-stage-label {
  font-size: 12px;
  font-weight: 700;
  fill: var(--text-primary);
  text-anchor: middle;
}
.sim-stage-temp {
  font-size: 14px;
  font-weight: 700;
  font-family: "Consolas", monospace;
  text-anchor: middle;
}
.sim-stage-sub {
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
}

/* 阶段计算结果卡片 — 固定5列，两排均匀排列 */
.sim-stages-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  align-items: stretch;
  position: relative;
  z-index: 1;
}
.sim-stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.sim-stage-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}
.sim-stage-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  border-radius: 3px 0 0 3px;
}
.sim-stage-card.s1::before { background: var(--warning); }
.sim-stage-card.s2::before { background: var(--danger); }
.sim-stage-card.s3::before { background: var(--info); }
.sim-stage-card.s4::before { background: var(--purple); }
.sim-stage-card.s5::before { background: var(--accent); }
.sim-stage-card.s6::before { background: var(--info); }
.sim-stage-card.s7::before { background: var(--accent); }
.sim-stage-card.s8::before { background: var(--text-muted); }
.sim-stage-card.s9::before { background: var(--warning); }

.sim-stage-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.sim-stage-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sim-stage-card-num {
  font-size: 10px;
  font-family: "Consolas", monospace;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
}
.sim-stage-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: start;
}
.sim-stage-card-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sim-stage-card-metric-label {
  font-size: 10px;
  color: var(--text-muted);
}
.sim-stage-card-metric-value {
  font-size: 15px;
  font-weight: 700;
  font-family: "Consolas", monospace;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sim-stage-card-metric-unit {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 2px;
}
.sim-stage-card-formula {
  margin-top: auto;
  padding: 4px 6px;
  background: rgba(0,0,0,0.15);
  border-radius: 4px;
  font-size: 9px;
  font-family: "Consolas", monospace;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  word-break: break-all;
}

/* 质量平衡表 */
.sim-balance-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  position: relative;
  z-index: 1;
}
.sim-balance-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sim-balance-title svg { width: 18px; height: 18px; color: var(--info); }
.sim-balance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.sim-balance-table th {
  text-align: left;
  padding: 6px 10px;
  background: rgba(0,0,0,0.2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
.sim-balance-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sim-balance-table td.num {
  font-family: "Consolas", monospace;
  font-weight: 600;
  text-align: right;
}
.sim-balance-table td.num.in { color: var(--accent); }
.sim-balance-table td.num.out { color: var(--info); }
.sim-balance-table tr.total td {
  font-weight: 700;
  color: var(--text-primary);
  border-top: 2px solid var(--border-light);
}
.sim-balance-table tr td .bal-tag {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}
.sim-balance-table tr td .bal-tag.in { background: rgba(0,230,118,0.15); color: var(--accent); }
.sim-balance-table tr td .bal-tag.out { background: rgba(64,196,255,0.15); color: var(--info); }

/* 能量平衡条 */
.sim-energy-bar-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.sim-energy-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sim-energy-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  width: 110px;
  flex-shrink: 0;
}
.sim-energy-bar-track {
  flex: 1;
  height: 20px;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  min-width: 0;
}
.sim-energy-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 11px;
  font-weight: 700;
  font-family: "Consolas", monospace;
  color: var(--bg-dark);
  white-space: nowrap;
}
.sim-energy-bar-fill.useful { background: linear-gradient(90deg, var(--green-600), var(--accent)); }
.sim-energy-bar-fill.loss { background: linear-gradient(90deg, var(--warning), var(--danger)); }
.sim-energy-bar-fill.unburned { background: linear-gradient(90deg, var(--purple), #e040fb); }

/* 演算控制按钮 */
.sim-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
.sim-btn {
  padding: 8px 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sim-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.sim-btn.primary {
  background: var(--accent);
  color: var(--bg-dark);
  border-color: var(--accent);
}
.sim-btn.primary:hover {
  background: var(--green-600);
  border-color: var(--green-600);
}
.sim-btn svg { width: 14px; height: 14px; }

/* 排放达标指示 — 固定3列，两排均匀 */
.sim-emission-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
  align-items: stretch;
}
.sim-emission-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(0,0,0,0.15);
  border-radius: 4px;
  border-left: 3px solid var(--accent);
  min-width: 0;
}
.sim-emission-item.over { border-left-color: var(--danger); }
.sim-emission-name {
  font-size: 11px;
  color: var(--text-muted);
}
.sim-emission-val {
  font-size: 13px;
  font-weight: 700;
  font-family: "Consolas", monospace;
  color: var(--accent);
}
.sim-emission-item.over .sim-emission-val { color: var(--danger); }
.sim-emission-limit {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==================== 演算结论报告 ==================== */
.sim-report {
  margin-top: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(0,230,118,0.2);
  border-radius: 10px;
  padding: 14px;
}
.sim-report-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sim-report-header svg { width: 20px; height: 20px; }
.sim-report-section {
  margin-bottom: 14px;
}
.sim-report-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--green-400);
  margin-bottom: 6px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}
.sim-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.sim-report-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sim-report-table td:first-child {
  color: var(--text-muted);
  width: 40%;
}
.sim-report-table td:last-child {
  color: var(--text-primary);
  font-family: Consolas, monospace;
  font-weight: 600;
}
.sim-report-summary {
  background: rgba(0,230,118,0.06);
  border: 1px solid rgba(0,230,118,0.15);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-secondary);
}
.sim-report-summary .pass { color: var(--accent); font-weight: 700; }
.sim-report-summary .fail { color: var(--danger); font-weight: 700; }
.sim-report-summary .warn { color: var(--warning); font-weight: 700; }
.sim-report-ai {
  background: rgba(255,183,77,0.06);
  border: 1px solid rgba(255,183,77,0.15);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-secondary);
}
.sim-report-ai-title {
  color: var(--warning);
  font-weight: 700;
  margin-bottom: 4px;
}

/* 响应式 */
@media (max-width: 1200px) {
  .sim-stages-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .sim-input-grid { grid-template-columns: 1fr 1fr; }
  .sim-stages-grid { grid-template-columns: 1fr 1fr; }
  .sim-stage-card-metrics { grid-template-columns: 1fr; }
  .sim-emission-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  /* SVG auto-scales, no fixed height needed */
}
