/* ══════════════════════════════════════════════════════════════
   HVAC-Copilot 运维台 · 科技风专业主题（dark tech）
   ══════════════════════════════════════════════════════════════ */
:root {
  --bg-0: #060b16;
  --bg-1: #0a1220;
  --bg-2: #0e1a2c;
  --surface: rgba(16, 28, 46, 0.72);
  --surface-solid: #101d31;
  --line: rgba(56, 130, 246, 0.16);
  --line-strong: rgba(56, 130, 246, 0.34);
  --text: #dbe7f5;
  --muted: #7f95b3;
  --dim: #55698a;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --blue: #3b82f6;
  --green: #34d399;
  --green-dark: #0f9f6e;
  --amber: #fbbf24;
  --red: #f87171;
  --glow: 0 0 18px rgba(56, 189, 248, 0.22);
  --radius: 12px;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(800px 420px at -10% 110%, rgba(59, 130, 246, 0.10), transparent 55%),
    var(--bg-0);
  min-height: 100vh;
  font-size: 14px;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(56, 130, 246, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 130, 246, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
}

.app-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; position: relative; z-index: 1; }

/* ── 侧边栏 ─────────────────────────────────────────── */
.sidebar {
  background: linear-gradient(180deg, rgba(10, 18, 32, 0.96), rgba(6, 11, 22, 0.98));
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 10px;
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 16px; border-bottom: 1px solid var(--line); }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #04121f;
  background: linear-gradient(135deg, var(--accent-2), var(--blue));
  box-shadow: var(--glow);
}
.brand strong { display: block; font-size: 13px; letter-spacing: 1.5px; color: var(--text); }
.brand span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 13px; text-align: left;
  transition: all .16s ease;
}
.nav-item span { font-family: var(--mono); font-size: 10px; color: var(--dim); letter-spacing: 1px; }
.nav-item:hover { color: var(--text); background: rgba(56, 130, 246, 0.07); }
.nav-item.active {
  color: var(--accent-2); background: linear-gradient(90deg, rgba(34, 211, 238, 0.12), transparent);
  border-color: var(--line-strong); box-shadow: inset 2px 0 0 var(--accent-2);
}
.nav-item.active span { color: var(--accent-2); }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.version { font-family: var(--mono); font-size: 11px; color: var(--dim); word-break: break-all; }

/* ── 顶栏 ───────────────────────────────────────────── */
.main { padding: 20px 26px 40px; max-width: 1500px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 16px; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: .5px; background: linear-gradient(90deg, var(--text), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.connection { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.connection span { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: pulse 1.8s infinite; }
.connection.online span { background: var(--green); box-shadow: 0 0 8px var(--green); }
.connection.offline span { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
time { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.icon-button { background: var(--surface); border: 1px solid var(--line); color: var(--accent); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 15px; transition: all .15s; }
.icon-button:hover { border-color: var(--line-strong); box-shadow: var(--glow); }
.top-help-button { border-radius: 50%; font-family: var(--mono); font-weight: 800; }
.top-help-button.active { color: #04121f; background: var(--accent-2); border-color: var(--accent-2); box-shadow: var(--glow); }

/* ── 面板与卡片 ─────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 14px; color: var(--text); letter-spacing: .4px; }
.panel-head p { margin: 3px 0 0; font-size: 11px; color: var(--dim); }
.page { display: none; }
.page.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.kpi::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(180deg, var(--accent-2), transparent); opacity: .7; }
.kpi span { display: block; font-size: 11px; color: var(--dim); letter-spacing: 1px; }
.kpi strong { display: block; font-family: var(--mono); font-size: 24px; margin-top: 6px; color: var(--text); }
.kpi small { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; word-break: break-all; }
.kpi.accent strong { color: var(--accent-2); }
.kpi.good strong { color: var(--green); }
.kpi.warn strong { color: var(--amber); }
.kpi.bad strong { color: var(--red); }

.overview-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.overview-grid.lower { grid-template-columns: 1fr 1fr; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }

.chart-wrap { position: relative; height: 260px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.empty-chart { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 12px; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 10px; height: 3px; border-radius: 2px; }
.legend .baseline::before { background: var(--blue); }
.legend .candidate::before { background: var(--accent-2); }

/* 动作 / 就绪 / 原因列表 */
.action-list { display: grid; gap: 1px; background: var(--line); border-radius: 8px; overflow: hidden; }
.action-row { min-height: 46px; padding: 9px 12px; background: var(--bg-2); display: grid; grid-template-columns: minmax(0, 1fr) 60px 66px; align-items: center; gap: 8px; }
.action-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.action-row strong, .action-row em { font-style: normal; font-variant-numeric: tabular-nums; text-align: right; font-family: var(--mono); }
.action-row strong { color: var(--accent-2); }
.action-row em { color: var(--green); }

.readiness-list, .reason-list, .commission-list { display: grid; gap: 8px; }
.readiness-list .item, .reason-list .item { display: flex; justify-content: space-between; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); font-size: 12px; }
.reason-list .item { display: block; }
.reason-list .item small { display: block; color: var(--dim); margin-top: 3px; font-size: 11px; }
.commission-list label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; cursor: pointer; }
.commission-list input { accent-color: var(--accent-2); }

/* 标签 */
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tag.neutral { color: var(--muted); background: rgba(127, 149, 179, 0.12); }
.tag.good { color: var(--green); background: rgba(52, 211, 153, 0.12); }
.tag.warn { color: var(--amber); background: rgba(251, 191, 36, 0.12); }
.tag.bad { color: var(--red); background: rgba(248, 113, 113, 0.12); }
.tag.accent { color: var(--accent-2); background: rgba(34, 211, 238, 0.12); }

/* 按钮 */
.button {
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 16px;
  background: var(--bg-2); color: var(--text); font-size: 13px; cursor: pointer;
  transition: all .15s ease; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.button:hover { border-color: var(--accent); box-shadow: var(--glow); }
.button.primary { background: linear-gradient(135deg, var(--blue), var(--accent-2)); border: 0; color: #04121f; font-weight: 700; }
.button.primary:hover { box-shadow: 0 0 22px rgba(56, 189, 248, 0.5); }
.button.secondary { background: transparent; }
.button.danger { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.5); color: var(--red); }
.button.small { padding: 5px 10px; font-size: 12px; }
.button.full { width: 100%; justify-content: center; }
.button:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
.section-band { border-top: 1px solid var(--line); padding: 18px 0 22px; }
.section-band:first-child { border-top: 0; padding-top: 0; }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-title h2 { margin: 0; font-size: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 11px; color: var(--muted); }
.unit-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); overflow: hidden; }
.unit-input input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); padding: 8px 10px; font-family: var(--mono); font-size: 13px; outline: none; }
.unit-input input:focus { box-shadow: inset 0 0 0 1px var(--accent); }
.unit-input span { padding: 0 10px; font-size: 11px; color: var(--dim); }
.toggle-field { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.toggle-field input { accent-color: var(--accent-2); width: 17px; height: 17px; }
.toggle-field span { font-size: 12px; color: var(--muted); }
.form-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.form-toolbar strong { color: var(--text); }
.form-toolbar .dirty { color: var(--amber); font-size: 12px; margin-left: 10px; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field span { font-size: 11px; color: var(--muted); }
.field input, .field select {
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); color: var(--text);
  padding: 9px 11px; font-size: 13px; outline: none; font-family: var(--mono);
}
.field input:focus, .field select:focus { box-shadow: inset 0 0 0 1px var(--accent); }
.field.grow { flex: 1; }

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600; background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid rgba(56, 130, 246, 0.08); color: var(--text); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: rgba(56, 189, 248, 0.05); }

/* 模式 / 策略选择器 */
.mode-selector, .strategy-selector { display: grid; gap: 0; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.mode-selector { grid-template-columns: repeat(3, 1fr); }
.strategy-selector { grid-template-columns: repeat(2, 1fr); margin-bottom: 10px; }
.mode-selector button, .strategy-selector button { height: 40px; border: 0; border-right: 1px solid var(--line); background: var(--bg-2); color: var(--muted); cursor: pointer; font-size: 13px; transition: all .15s; }
.mode-selector button:last-child, .strategy-selector button:last-child { border-right: 0; }
.mode-selector button.active { background: linear-gradient(135deg, var(--blue), var(--accent-2)); color: #04121f; font-weight: 700; }
.strategy-selector button.active { background: linear-gradient(135deg, var(--accent-2), var(--blue)); color: #04121f; font-weight: 700; }
.strategy-hint { font-size: 12px; color: var(--muted); margin: 0 0 14px; line-height: 1.6; }
.mode-detail { margin-bottom: 18px; }

.detail-list { display: grid; gap: 8px; margin: 0; }
.detail-list div { display: flex; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.detail-list dt { font-size: 11px; color: var(--dim); }
.detail-list dd { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--text); }

/* 部署 / 检查 */
.deploy-row { display: flex; gap: 12px; align-items: flex-end; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.check-grid .item { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.code-panel pre {
  margin: 0; padding: 14px; border-radius: 8px; background: #060b16; border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px; color: var(--accent); overflow: auto; max-height: 320px;
  white-space: pre-wrap; word-break: break-all;
}

/* 测试 */
.test-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.test-item { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.test-code { font-family: var(--mono); font-size: 10px; color: var(--accent-2); letter-spacing: 1px; }
.test-item h2 { margin: 4px 0; font-size: 14px; }
.test-item p { margin: 0; font-size: 11px; color: var(--dim); }
.test-output-panel pre { margin: 0; padding: 14px; background: #060b16; border: 1px solid var(--line); border-radius: 8px; font-family: var(--mono); font-size: 11.5px; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* 结果 */
.result-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 16px; }
.result-summary div { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.result-summary span { display: block; font-size: 11px; color: var(--dim); }
.result-summary strong { font-family: var(--mono); font-size: 20px; color: var(--accent-2); }
.result-chart { margin-bottom: 16px; }

/* 安全 */
.safety-banner { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px; }
.safety-banner span { display: block; font-size: 11px; color: var(--dim); }
.safety-banner strong { font-family: var(--mono); font-size: 18px; color: var(--text); }
.safety-columns { margin-top: 0; }

/* 技术方案页（文档卡片） */
.doc-hero { padding: 20px 22px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), transparent); margin-bottom: 18px; }
.doc-hero h2 { margin: 0; font-size: 20px; }
.doc-hero p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.doc-card { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: all .15s; }
.doc-card:hover { border-color: var(--line-strong); box-shadow: var(--glow); transform: translateY(-2px); }
.doc-card h3 { margin: 0 0 8px; font-size: 14px; color: var(--accent-2); display: flex; align-items: center; gap: 8px; }
.doc-card p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.7; }
.doc-num { font-family: var(--mono); font-size: 10px; color: var(--dim); }

/* 帮助页底部特性矩阵 */
.help-features { margin-top: 18px; }
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 18px; }
.feature-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.feature-card h3 { margin: 0 0 10px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.feature-card dl { margin: 0; display: grid; gap: 6px; }
.feature-card dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 5px 0; border-bottom: 1px dashed rgba(56, 130, 246, 0.12); }
.feature-card dt { color: var(--dim); }
.feature-card dd { margin: 0; font-family: var(--mono); color: var(--text); word-break: break-all; text-align: right; }

/* 对话框 / 提示 */
dialog { width: min(400px, calc(100vw - 32px)); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0; background: var(--surface-solid); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
dialog::backdrop { background: rgba(4, 8, 15, 0.7); backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 15px; }
.dialog-head button { background: transparent; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }
#tokenForm { padding: 18px; }

.toast { position: fixed; bottom: 24px; right: 24px; z-index: 99; padding: 12px 18px; border-radius: 10px; background: var(--surface-solid); border: 1px solid var(--line-strong); color: var(--text); font-size: 13px; box-shadow: 0 14px 40px rgba(0,0,0,.5); display: none; }
.toast.show { display: block; animation: fade .2s ease; }
.toast.error { border-color: rgba(248, 113, 113, 0.5); color: var(--red); }

/* ── AI 运维助手（右侧悬浮） ─────────────────────────── */
.agent-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 90; width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: linear-gradient(135deg, var(--blue), var(--accent-2));
  color: #04121f; font-size: 24px; font-weight: 800; cursor: pointer;
  box-shadow: 0 10px 34px rgba(56, 189, 248, 0.45); transition: all .2s ease;
}
.agent-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 14px 42px rgba(56, 189, 248, 0.6); }
.agent-panel {
  position: fixed; right: 22px; bottom: 88px; z-index: 91; width: 372px; max-height: min(72vh, 640px);
  display: flex; flex-direction: column; background: var(--surface-solid);
  border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6); overflow: hidden;
  transform-origin: bottom right; transition: transform .22s ease, opacity .22s ease;
}
.agent-panel.closed { transform: scale(.5); opacity: 0; pointer-events: none; }
.agent-head { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(56, 189, 248, 0.14), transparent); }
.agent-head strong { font-size: 14px; letter-spacing: .4px; }
.agent-head span { font-size: 11px; color: var(--accent-2); margin-left: 8px; font-family: var(--mono); }
.agent-head button { background: transparent; border: 0; color: var(--muted); font-size: 17px; cursor: pointer; }
.agent-tabs { display: flex; border-bottom: 1px solid var(--line); }
.agent-tab { flex: 1; padding: 9px; background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; transition: all .15s; }
.agent-tab.active { color: var(--accent-2); border-bottom: 2px solid var(--accent-2); font-weight: 700; }
.agent-advice { padding: 10px 12px; overflow-y: auto; display: grid; gap: 8px; max-height: 320px; }
.agent-item { padding: 9px 11px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 8px; background: var(--bg-2); font-size: 12px; }
.agent-item.info { border-left-color: var(--blue); }
.agent-item.warn { border-left-color: var(--amber); }
.agent-item.danger { border-left-color: var(--red); }
.agent-item strong { display: block; }
.agent-item p { margin: 4px 0 0; color: var(--muted); line-height: 1.6; }
.agent-item small { display: block; margin-top: 4px; color: var(--dim); font-size: 11px; }
.agent-chat { display: flex; flex-direction: column; height: 320px; }
.agent-messages { flex: 1; overflow-y: auto; padding: 10px 12px; display: grid; gap: 8px; align-content: start; }
.agent-msg { max-width: 86%; padding: 8px 12px; border-radius: 10px; font-size: 12px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.agent-msg-bot { background: var(--bg-2); border: 1px solid var(--line); }
.agent-msg-user { background: linear-gradient(135deg, var(--blue), var(--accent-2)); color: #04121f; justify-self: end; font-weight: 600; }
.agent-input-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.agent-input-row input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); color: var(--text); padding: 8px 10px; outline: none; font-size: 12px; font-family: var(--sans); }
.agent-input-row input:focus { box-shadow: inset 0 0 0 1px var(--accent); }
.agent-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }
.agent-action { padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); color: var(--muted); font-size: 11px; cursor: pointer; transition: all .15s; }
.agent-action:hover { color: var(--accent-2); border-color: var(--line-strong); box-shadow: var(--glow); }
.agent-foot { padding: 7px 12px; font-size: 10px; color: var(--dim); border-top: 1px solid var(--line); text-align: center; line-height: 1.5; }

@media (max-width: 560px) {
  .agent-panel { width: calc(100vw - 32px); right: 16px; bottom: 80px; }
  .agent-fab { right: 16px; bottom: 16px; }
}
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid, .overview-grid.lower, .two-column, .feature-grid { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: repeat(2, 1fr); }
  .test-grid { grid-template-columns: 1fr; }
  .safety-banner { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 12px; }
  .brand { grid-column: 1; grid-row: 1; border-bottom: 0; padding: 0 8px; }
  .nav { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .nav-item { justify-content: center; gap: 7px; padding: 9px 8px; white-space: nowrap; }
  .sidebar-foot { grid-column: 2; grid-row: 1; border-top: 0; padding-top: 0; flex-direction: row; align-items: center; }
  .form-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .result-summary { grid-template-columns: repeat(2, 1fr); }
  .doc-grid { grid-template-columns: 1fr; }
  .topbar { align-items: center; }
}

@media (max-width: 560px) {
  .main { padding: 16px 14px 32px; }
  .sidebar-foot .version { display: none; }
  .topbar { align-items: flex-start; }
  .top-actions { gap: 8px; }
  .connection { order: 2; }
  time { order: 3; width: 100%; text-align: right; }
}

/* ── 核心控制页（参考草船监控面板布局） ─────────────── */
.scada {
  --scada-bg: #012d53; --scada-panel: rgba(1, 45, 83, 0.55); --scada-line: #0a4a7d;
  --scada-accent: #38bdf8; --scada-blue: #024a8d; --scada-teal: #7ca5a0; --scada-text: #d7e8f7;
}
#page-control.scada { color: var(--scada-text); }
.scada .scada-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 14px; }
.scada .scada-item { padding: 10px 12px; border: 1px solid var(--scada-line); border-radius: 8px; background: linear-gradient(180deg, #01325c, #012949); }
.scada .scada-item span { display: block; font-size: 10px; color: #7fa8c9; letter-spacing: 1px; }
.scada .scada-item strong { display: block; font-family: var(--mono); font-size: 17px; margin-top: 4px; color: var(--scada-accent); }
.cp-grid { display: grid; grid-template-columns: 230px 1fr 300px; gap: 14px; align-items: start; }
.scada-panel { border: 1px solid var(--scada-line); border-radius: 10px; background: var(--scada-panel); padding: 12px 14px; backdrop-filter: blur(6px); }
.scada-panel-title { font-size: 12px; font-weight: 700; color: var(--scada-accent); letter-spacing: 1px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.scada-panel-title::before { content: ""; width: 3px; height: 12px; background: var(--scada-accent); border-radius: 2px; }

/* 控制组 */
.cp-group { border: 1px solid var(--scada-line); border-radius: 8px; background: rgba(2, 74, 141, 0.12); margin-bottom: 8px; overflow: hidden; }
.cp-group-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-bottom: 1px solid var(--scada-line); }
.cp-group-head strong { font-size: 12px; flex: 1; }
.cp-group-head em { font-style: normal; font-size: 10px; color: #7fa8c9; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #4a6d8f; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: #fbbf24; }
.cp-group-members { display: grid; gap: 1px; }
.cp-group-member { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 11px; }
.cp-group-member span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-group-member em { font-style: normal; color: #7fa8c9; font-size: 10px; }
.cp-smart-state { font-size: 12px; color: #9dbad4; margin-bottom: 10px; line-height: 1.6; }
.cp-smart-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scada-btn { padding: 10px 6px; border: 1px solid var(--scada-line); border-radius: 6px; background: rgba(2, 74, 141, 0.18); color: var(--scada-text); font-size: 12px; cursor: pointer; transition: all .15s; }
.scada-btn:hover { border-color: var(--scada-accent); color: var(--scada-accent); box-shadow: 0 0 12px rgba(56, 189, 248, 0.25); }
.scada-btn.primary { background: linear-gradient(135deg, #024a8d, #0e7bb8); border: 0; color: #eaf6ff; font-weight: 700; }
.scada-btn.danger { color: #fca5a5; }
.scada-btn.danger:hover { border-color: #f87171; color: #fca5a5; }

/* 环境参数 */
.cp-env { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.cp-env-card { border: 1px solid var(--scada-line); border-radius: 8px; background: rgba(1, 45, 83, 0.4); padding: 10px 12px; }
.cp-env-title { font-size: 12px; font-weight: 700; color: var(--scada-accent); margin-bottom: 8px; }
.cp-env-row { display: flex; justify-content: space-between; font-size: 11px; padding: 3px 0; color: #9dbad4; }
.cp-env-row strong { font-family: var(--mono); color: var(--scada-text); }
.cp-chart { height: 240px; margin-bottom: 8px; }
.cp-chart canvas { width: 100%; height: 100%; }
.cp-trend-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: #9dbad4; }
.cp-trend-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cp-trend-legend i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }

/* 阀门 / 流量列表 */
.cp-list { display: grid; gap: 6px; margin-bottom: 14px; }
.cp-list-row { display: flex; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--scada-line); border-radius: 6px; background: rgba(1, 45, 83, 0.4); font-size: 12px; }
.cp-list-row span { color: #9dbad4; }
.cp-list-row strong { font-family: var(--mono); color: var(--scada-accent); }

/* 节约能耗 */
.cp-energy { display: grid; gap: 10px; }
.cp-energy-bar { display: grid; grid-template-columns: 90px 1fr 54px; gap: 8px; align-items: center; font-size: 11px; color: #9dbad4; }
.cp-energy-bar .bar { height: 14px; border-radius: 4px; background: #0a3a63; overflow: hidden; }
.cp-energy-bar .bar i { display: block; height: 100%; background: linear-gradient(90deg, #024a8d, #f87171); }
.cp-energy-bar .bar.good i { background: linear-gradient(90deg, #024a8d, #38bdf8); }
.cp-energy-bar strong { font-family: var(--mono); text-align: right; color: var(--scada-text); }
.cp-saving-big {
  margin-top: 4px; padding: 14px; border-radius: 10px; text-align: center;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.18), rgba(56, 189, 248, 0.10));
  border: 1px solid rgba(52, 211, 153, 0.4);
  font-family: var(--mono); font-size: 30px; font-weight: 800; color: var(--green);
}
.cp-saving-big small { display: block; font-size: 11px; color: #9dbad4; font-family: var(--sans); font-weight: 400; margin-top: 4px; }

@media (max-width: 1180px) {
  .scada .scada-strip { grid-template-columns: repeat(4, 1fr); }
  .cp-grid { grid-template-columns: 1fr; }
  .cp-env { grid-template-columns: 1fr; }
}
