* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0b1220; --panel: #111c30; --panel2: #16233c; --border: #1f3354;
  --text: #d7e3f4; --dim: #7a8db0; --accent: #3d9bff;
  --ok: #2ecc71; --warn: #f39c12; --danger: #ff4d4f;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 13px; overflow: hidden;
}
#app { height: 100vh; display: flex; flex-direction: column; }

/* 重大告警红色闪烁 */
.flash-danger::after {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 120px rgba(255, 40, 40, .55);
  animation: flash 1s infinite;
}
@keyframes flash { 50% { opacity: .15; } }

/* ---------- 顶栏 ---------- */
header {
  height: 52px; flex: none; display: flex; align-items: center;
  justify-content: space-between; padding: 0 16px;
  background: linear-gradient(90deg, #0e1a33, #12234a 50%, #0e1a33);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { color: var(--accent); font-size: 20px; }
h1 { font-size: 17px; letter-spacing: 1px; }
.tunnel-name { color: var(--dim); font-size: 12px; margin-left: 8px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.badge { padding: 3px 10px; border-radius: 3px; font-size: 12px; }
.badge-ok { background: rgba(46, 204, 113, .15); color: var(--ok); }
.badge-danger { background: rgba(255, 77, 79, .2); color: var(--danger); animation: flash 1s infinite; }
.badge-level { background: var(--danger); color: #fff; font-weight: bold; }
.badge-level.lv-L4, .badge-level.lv-L5 { background: #b91c1c; }
.badge-level.lv-L3 { background: #ea580c; }
.badge-level.lv-L2 { background: #ca8a04; color: #111; }
.badge-level.lv-L1 { background: #2563eb; }
.badge-level.lv-L0 { background: #16a34a; }
.badge-dim { background: var(--panel2); color: var(--dim); }
.clock { font-family: Consolas, monospace; font-size: 15px; color: var(--accent); }
.gear { background: none; border: 1px solid var(--border); color: var(--dim); border-radius: 4px;
  width: 28px; height: 28px; cursor: pointer; font-size: 14px; }
.gear:hover { color: var(--text); }

/* ---------- 演示控制抽屉 ---------- */
.control-drawer {
  position: fixed; top: 56px; right: 12px; z-index: 100;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px; width: 280px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.control-title { color: var(--dim); font-size: 11px; margin-bottom: 2px; }
.control-hint {
  font-size: 11px; line-height: 1.5; color: #9bb0cc; margin-top: 2px;
  border-top: 1px solid var(--border); padding-top: 8px;
}

/* ---------- 三栏布局：导航 | 中部页 | Agent（可拖宽） ---------- */
.shell { flex: 1; display: flex; gap: 10px; padding: 10px; min-height: 0; }
.side-nav {
  width: 132px; flex: none;
  background: linear-gradient(180deg, #0e1a33, #0b1528);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 8px; display: flex; flex-direction: column; gap: 4px; min-height: 0;
  position: relative; z-index: 400; /* 高于弹窗，应急时仍可点导航跳转 */
  overflow-y: auto;
}
.nav-brand {
  font-size: 12px; font-weight: bold; color: #aecbf5; padding: 8px 8px 14px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px; line-height: 1.4;
}
.nav-brand small { color: var(--dim); font-weight: normal; font-size: 10px; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: none; color: var(--dim);
  padding: 10px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; text-align: left;
}
.nav-item:hover { background: var(--panel2); color: var(--text); }
.nav-item.active { background: rgba(61,155,255,.15); color: var(--accent); }
.nav-ico { width: 16px; text-align: center; opacity: .85; }

.center { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; overflow: hidden; }
.page { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; }
.page-overview { overflow: auto; }
.right {
  flex: none; width: 400px; max-width: 55vw; min-width: 280px;
  display: flex; flex-direction: column; min-height: 0; position: relative;
}
.resize-handle {
  position: absolute; left: -4px; top: 0; bottom: 0; width: 8px;
  cursor: col-resize; z-index: 5;
}
.resize-handle:hover, .resize-handle:active {
  background: linear-gradient(90deg, transparent, rgba(61,155,255,.35), transparent);
}

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.panel-title { font-size: 13px; font-weight: bold; color: #aecbf5; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.panel-title .sub { font-weight: normal; font-size: 11px; color: var(--dim); }
.panel-title .title-link { margin-left: auto; font-weight: normal; }
.count { background: var(--danger); color: #fff; border-radius: 8px; padding: 0 7px; font-size: 11px; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { outline: 1px solid var(--accent); }

/* ---------- 隧道示意图 ---------- */
.schematic-panel { flex: none; }
.schematic { width: 100%; height: 96px; display: block; }
.tunnel-body { fill: #182a4a; stroke: #2c4a7c; stroke-width: 1.5; }
.svg-label { fill: var(--dim); font-size: 13px; }
.svg-label-side { fill: var(--dim); font-size: 12px; writing-mode: vertical-rl; }
.svg-icon { font-size: 17px; }
.svg-line { stroke: #2c4a7c; stroke-dasharray: 2 2; }
.svg-danger { filter: drop-shadow(0 0 4px red); }
.svg-fan-on { filter: drop-shadow(0 0 5px #3d9bff); }
.svg-exit-on { filter: drop-shadow(0 0 5px #2ecc71); }
.svg-fire { font-size: 24px; animation: firePulse .8s infinite; }
@keyframes firePulse { 50% { opacity: .5; } }
.dot { stroke: #0b1220; stroke-width: 1; }
.dot-ok { fill: var(--ok); }
.dot-warn { fill: var(--warn); animation: flash 1s infinite; }
.dot-danger { fill: var(--danger); animation: flash .6s infinite; }

/* ---------- 摄像头 ---------- */
.cam-grid { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cam-tile { position: relative; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  aspect-ratio: 16/9; background: #000; }
.cam-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-tile[data-cam="CAM-01"] img { filter: contrast(1.06) brightness(.98); }
.cam-tile[data-cam="CAM-02"] img { filter: contrast(1.02) brightness(1.03) saturate(1.05); }
.cam-tile[data-cam="CAM-03"] img { filter: contrast(1.1) brightness(.95) saturate(.9); }
.cam-tile[data-cam="CAM-04"] img { filter: contrast(.98) brightness(1.05) saturate(1.08); }
.cam-alert { border-color: var(--danger); box-shadow: 0 0 12px rgba(255,77,79,.5); }
.cam-label { position: absolute; left: 0; bottom: 0; right: 0; padding: 3px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.85)); font-size: 11px; }
.cam-vendor { color: var(--dim); margin-left: 6px; }
.cam-rec { position: absolute; top: 4px; right: 8px; color: #ff5b5b; font-size: 10px; font-family: Consolas, monospace; }
.cam-event-box { position: absolute; left: 28%; top: 22%; width: 44%; height: 52%;
  border: 2px solid var(--warn); border-radius: 2px; animation: flash 1s infinite; }
.lv-danger .cam-event-box { border-color: var(--danger); }
.cam-event-tag { position: absolute; left: 28%; top: 12%; background: var(--warn); color: #000;
  font-size: 10px; padding: 1px 6px; border-radius: 2px; white-space: nowrap; }
.lv-danger .cam-event-tag { background: var(--danger); color: #fff; }
.lv-info .cam-event-box, .lv-info .cam-event-tag { border-color: var(--accent); }
.lv-info .cam-event-tag { background: var(--accent); color: #fff; }

/* ---------- 图表 ---------- */
.charts-row { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 150px; }
.chart-panel { display: flex; flex-direction: column; min-height: 0; }
.chart { flex: 1; min-height: 0; }

/* ---------- 列表 ---------- */
.lists-row { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 120px; }
.list-panel { display: flex; flex-direction: column; min-height: 0; }
.list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.empty { color: var(--dim); text-align: center; padding: 20px; }
.list-item { display: flex; gap: 8px; align-items: baseline; padding: 4px 8px; border-radius: 4px;
  background: var(--panel2); font-size: 12px; }
.list-item.lv-danger { background: rgba(255,77,79,.12); }
.list-item.lv-warn { background: rgba(243,156,18,.1); }
.t { color: var(--dim); font-family: Consolas, monospace; font-size: 11px; flex: none; }
.tag { flex: none; padding: 0 6px; border-radius: 3px; font-size: 11px; }
.tag-danger { background: var(--danger); color: #fff; }
.tag-warn { background: var(--warn); color: #000; }
.tag-cam { background: var(--panel); color: var(--accent); border: 1px solid var(--border); }

/* ---------- 智能体面板 ---------- */
.agent-title { justify-content: space-between; }
.agent-feed { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.agent-hello { color: var(--dim); line-height: 2; padding: 12px; background: var(--panel2); border-radius: 8px; }
.agent-hello b { color: var(--accent); }

.msg-user { display: flex; justify-content: flex-end; }
.msg-user .bubble { background: #1d4ed8; color: #fff; padding: 8px 12px; border-radius: 10px 10px 2px 10px; max-width: 85%; }
.msg-agent .bubble { background: var(--panel2); padding: 10px 12px; border-radius: 10px 10px 10px 2px; }

.flow-block { background: var(--panel2); border-left: 3px solid var(--accent); border-radius: 6px; padding: 8px 10px; }
.flow-emergency { border-left-color: var(--danger); }
.flow-daily { border-left-color: var(--ok); }
.flow-title { font-weight: bold; font-size: 12px; margin-bottom: 6px; color: #aecbf5; }
.flow-emergency .flow-title { color: #ff8a8b; }
.flow-step { display: flex; gap: 8px; padding: 4px 0; }
.step-dot { color: var(--ok); flex: none; }
.flow-step.running .step-dot { color: var(--warn); animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.step-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.step-body { flex: 1; min-width: 0; }
.step-detail { color: var(--dim); font-size: 11px; margin-top: 2px; line-height: 1.6; }
.flow-end { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); color: var(--warn); font-size: 11px; }

/* markdown 内容 */
.md { line-height: 1.8; font-size: 12.5px; }
.md h2 { font-size: 14px; color: #aecbf5; margin: 6px 0; }
.md h3 { font-size: 13px; margin: 6px 0; }
.md ul, .md ol { padding-left: 18px; }
.md table { border-collapse: collapse; margin: 6px 0; width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 8px; font-size: 12px; }
.md th { background: var(--panel); }
.md blockquote { border-left: 3px solid var(--accent); padding: 2px 10px; color: var(--dim); margin: 6px 0; background: rgba(61,155,255,.06); }
.md strong { color: #ffd591; }

/* 输入区 */
.chat-input { flex: none; display: flex; gap: 8px; margin-top: 10px; }
.chat-input input { flex: 1; background: var(--panel2); border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 12px; color: var(--text); outline: none; font-size: 13px; }
.chat-input input:focus { border-color: var(--accent); }
.quick-row { flex: none; display: flex; gap: 6px; margin-top: 8px; }
.chip { background: none; border: 1px solid var(--border); color: var(--dim); border-radius: 20px;
  padding: 3px 12px; cursor: pointer; font-size: 11px; }
.chip:hover { color: var(--accent); border-color: var(--accent); }

/* 按钮 */
.btn { background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 7px 14px; cursor: pointer; font-size: 12px; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- 通知：停在中部左下，不挡右侧 Agent 动作卡片 ---------- */
.toast-wrap {
  position: fixed; left: 152px; bottom: 16px; right: auto; z-index: 180;
  display: flex; flex-direction: column; gap: 8px; width: min(340px, 36vw);
  max-height: 36vh; overflow: auto; pointer-events: none;
}
.toast-wrap > * { pointer-events: auto; }
.toast-clear {
  align-self: flex-start; background: var(--panel2); border: 1px solid var(--border);
  color: var(--dim); border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 11px;
}
.toast-clear:hover { color: var(--text); }
.toast { background: #1c2c4d; border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.6); animation: slideIn .3s ease; }
.toast-buzzer { border-color: var(--danger); background: #3a1520; }
@keyframes slideIn { from { transform: translateY(40px); opacity: 0; } }
.toast-head { font-weight: bold; font-size: 12px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.toast-head .t { margin-left: auto; }
.toast-x {
  background: none; border: none; color: var(--dim); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px;
}
.toast-x:hover { color: var(--text); }
.toast-to { color: var(--accent); font-size: 11px; margin-bottom: 3px; }
.toast-text { font-size: 12px; line-height: 1.6; }

/* ---------- Agent Tabs ---------- */
.agent-tabs { display: flex; gap: 4px; margin-bottom: 8px; flex: none; }
.agent-tabs button {
  flex: 1; background: var(--panel2); border: 1px solid var(--border); color: var(--dim);
  padding: 6px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.agent-tabs button.active { color: var(--accent); border-color: var(--accent); background: rgba(61,155,255,.1); }

.flow-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer; font-size: 11px; padding: 0;
  text-decoration: underline;
}
.step-summary { color: var(--dim); font-size: 11px; margin-top: 2px; line-height: 1.6; }
.step-expand {
  margin-top: 6px; padding: 8px; background: rgba(0,0,0,.25); border-radius: 6px; font-size: 11px;
}
.step-expand pre {
  white-space: pre-wrap; word-break: break-all; color: #b8c9e0; max-height: 180px; overflow: auto;
  font-family: Consolas, monospace; font-size: 10.5px; margin-top: 6px;
}
.phase-tag {
  display: inline-block; background: var(--panel); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 3px; color: var(--accent); font-size: 10px;
}
.flow-step { cursor: pointer; }
.flow-step:hover { background: rgba(61,155,255,.06); border-radius: 4px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.source-chip {
  background: rgba(61,155,255,.12); border: 1px solid var(--border); color: #9ec5ff;
  border-radius: 12px; padding: 2px 8px; font-size: 10px; cursor: pointer;
}
.source-chip:hover { border-color: var(--accent); }
.msg-tools { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 4px; }
.llm-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 3px;
  background: rgba(61,155,255,.2); color: var(--accent);
}
.llm-tag.mock { background: rgba(122,141,176,.2); color: var(--dim); }

/* 动作卡片 */
.actions-block { background: var(--panel2); border: 1px solid #8b5a00; border-radius: 8px; padding: 10px; }
.actions-title { font-weight: bold; color: #ffd591; margin-bottom: 8px; font-size: 12px; }
.action-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; margin-bottom: 8px;
}
.action-card.st-executed { opacity: .7; border-color: var(--ok); }
.action-card.st-rejected { opacity: .55; border-color: var(--dim); }
.action-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.auth-tag {
  flex: none; font-size: 10px; padding: 1px 6px; border-radius: 3px;
  background: rgba(243,156,18,.2); color: var(--warn); border: 1px solid rgba(243,156,18,.4);
}
.action-line { font-size: 11px; color: var(--text); margin: 4px 0; line-height: 1.5; }
.action-line span { color: var(--dim); margin-right: 6px; }
.action-line.risk { color: #ff8a8b; }
.action-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.action-status { margin-top: 6px; color: var(--ok); font-size: 11px; }

.tool-row, .audit-row {
  background: var(--panel2); border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; font-size: 12px;
}
.tool-head { display: flex; justify-content: space-between; gap: 8px; }
.tool-sum { color: var(--dim); margin: 4px 0; font-size: 11px; }
.tool-io {
  background: rgba(0,0,0,.25); padding: 6px; border-radius: 4px; font-size: 10px;
  white-space: pre-wrap; max-height: 100px; overflow: auto; color: #b8c9e0;
}
.audit-row { display: grid; grid-template-columns: 64px 110px 1fr; gap: 8px; align-items: start; }
.audit-act { color: var(--accent); }

/* 事件表 */
.panel.fill { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.table-wrap { flex: 1; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  position: sticky; top: 0; background: var(--panel2); text-align: left;
  padding: 8px; border-bottom: 1px solid var(--border); color: #aecbf5;
}
.data-table td { padding: 8px; border-bottom: 1px solid rgba(31,51,84,.6); }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover { background: rgba(61,155,255,.08); }
.row-L4, .row-danger { background: rgba(255,77,79,.08); }
.row-L3, .row-L2, .row-warn { background: rgba(243,156,18,.06); }
.mono { font-family: Consolas, monospace; color: var(--dim); }
.tag-L4, .tag-danger { background: var(--danger); color: #fff; }
.tag-L3 { background: #ea580c; color: #fff; }
.tag-L2, .tag-warn { background: var(--warn); color: #000; }
.tag-L1 { background: var(--accent); color: #fff; }

/* 设备页 */
.ai-suggest-bar {
  background: linear-gradient(90deg, #2a1a0a, #1a2238);
  border: 1px solid #8b5a00; border-radius: 8px; padding: 10px 12px; flex: none;
}
.ai-suggest-label { color: #ffd591; font-weight: bold; font-size: 12px; margin-bottom: 6px; }
.ai-suggest-item {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 6px 8px; border-radius: 6px; font-size: 12px; margin-bottom: 4px;
}
.ai-suggest-item.highlight { background: rgba(243,156,18,.15); outline: 1px solid rgba(243,156,18,.5); }
.ai-suggest-note { color: var(--dim); font-size: 11px; margin-top: 4px; }
.device-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px; flex: 1; align-content: start;
}
.device-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px;
}
.device-card.on { border-color: var(--accent); box-shadow: 0 0 16px rgba(61,155,255,.2); }
.device-card.fault { border-color: var(--danger); }
.device-card.focus { outline: 2px solid var(--warn); }
.device-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.device-name { font-weight: bold; color: #aecbf5; }
.device-id { color: var(--dim); font-family: Consolas, monospace; font-size: 11px; }
.device-meta { color: var(--dim); font-size: 11px; margin-bottom: 10px; }
.status-lights { display: flex; gap: 8px; margin-bottom: 12px; }
.lamp {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: #1a2233; color: var(--dim); border: 1px solid var(--border);
}
.lamp.green { background: rgba(46,204,113,.2); color: var(--ok); border-color: var(--ok); }
.lamp.red { background: rgba(255,77,79,.2); color: var(--danger); border-color: var(--danger); }
.lamp.yellow { background: rgba(243,156,18,.2); color: var(--warn); border-color: var(--warn); }
.device-actions { display: flex; gap: 8px; }
.fault-msg { margin-top: 8px; color: var(--danger); font-size: 11px; }
.placeholder-page { justify-content: flex-start; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
/* 避开左侧导航：应急时仍可点「风机/灯光」跳转 */
.modal-mask-soft {
  left: 152px; /* shell padding + side-nav 约宽 */
  background: rgba(0,0,0,.45);
  justify-content: center;
  align-items: center;
}
.modal-event { width: min(480px, 92vw); }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  width: min(640px, 96vw); max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-wide { width: min(960px, 96vw); }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 14px; overflow: auto; }
.source-file { color: var(--dim); font-size: 11px; margin-bottom: 8px; }
.source-text {
  white-space: pre-wrap; background: var(--panel2); padding: 12px; border-radius: 6px;
  font-size: 12px; line-height: 1.7; max-height: 50vh; overflow: auto;
}
.flow-graph {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; align-items: stretch;
}
.flow-node {
  position: relative; flex: none; width: 150px; background: var(--panel2);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: pointer;
}
.flow-node.active, .flow-node:hover { border-color: var(--accent); }
.fn-phase { font-size: 10px; color: var(--accent); margin-bottom: 4px; }
.fn-title { font-weight: bold; font-size: 12px; margin-bottom: 4px; }
.fn-sum { font-size: 10px; color: var(--dim); line-height: 1.4; max-height: 48px; overflow: hidden; }
.fn-arrow {
  position: absolute; right: -14px; top: 40%; color: var(--dim); font-size: 14px; z-index: 1;
}
.flow-node-detail {
  margin-top: 10px; background: rgba(0,0,0,.25); border-radius: 8px; padding: 10px;
}
.flow-node-detail pre {
  white-space: pre-wrap; font-size: 11px; color: #b8c9e0; font-family: Consolas, monospace;
}

.deep-link {
  display: inline-block; margin: 3px 4px 3px 0; background: rgba(61,155,255,.12);
  border: 1px solid var(--accent); color: #9ec5ff; border-radius: 14px;
  padding: 3px 10px; font-size: 11px; cursor: pointer; text-align: left;
}
.deep-link:hover { background: rgba(61,155,255,.25); }
.msg-links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; padding-left: 4px; }
.verify-title { color: #ffd591; font-size: 11px; margin: 6px 0 4px; }
.verify-list ol { padding-left: 18px; color: var(--dim); font-size: 11px; line-height: 1.7; }
.evidence-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }

.hl-target {
  outline: 2px solid var(--warn) !important;
  box-shadow: 0 0 18px rgba(243,156,18,.45);
  animation: hlPulse 1.2s ease infinite;
}
@keyframes hlPulse { 50% { box-shadow: 0 0 28px rgba(243,156,18,.7); } }

.sensor-grid, .person-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px; overflow: auto; padding: 4px;
}
.sensor-card, .person-card {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
}
.sensor-card.lv-warn { border-color: var(--warn); }
.sensor-card.lv-danger { border-color: var(--danger); }
.sensor-head, .person-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sensor-val { font-size: 22px; font-weight: bold; color: #aecbf5; }
.sensor-val small { font-size: 12px; color: var(--dim); font-weight: normal; }
.sensor-meta, .person-line { font-size: 11px; color: var(--dim); margin-top: 3px; line-height: 1.5; }
.sensor-tag { margin-top: 8px; font-size: 11px; color: var(--danger); }

.kb-search {
  margin-left: auto; background: var(--panel2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 4px 10px; width: 160px; font-size: 12px;
}
.kb-list { overflow: auto; display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.kb-doc-title { font-weight: bold; color: #aecbf5; margin-bottom: 8px; }
.kb-sec {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
}
.kb-sec-title { color: var(--accent); font-size: 12px; margin-bottom: 6px; }
.kb-sec-text {
  white-space: pre-wrap; font-size: 12px; line-height: 1.7; color: var(--text);
  font-family: inherit; max-height: 220px; overflow: auto;
}
.side-nav { overflow-y: auto; }
.nav-item { position: relative; }
.nav-badge {
  margin-left: auto; background: var(--warn); color: #111; border-radius: 8px;
  padding: 0 6px; font-size: 10px; font-weight: bold;
}

.jump-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.deep-jump { font-size: 12px !important; }

.todo-hint {
  background: rgba(243,156,18,.12); border: 1px dashed var(--warn); border-radius: 8px;
  padding: 10px 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  font-size: 12px; color: #ffd591;
}
.todo-list { display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.todo-card {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
}
.todo-card.prio-low { border-left: 3px solid var(--warn); }
.todo-card.st-done { opacity: .55; }
.todo-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.todo-meta { color: var(--dim); font-size: 11px; margin-bottom: 6px; }
.todo-sum { font-size: 12px; line-height: 1.6; margin-bottom: 4px; }
.faq-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; max-height: calc(100vh - 220px); overflow: auto; padding-right: 4px; }
.faq-item {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.faq-item.open { border-color: rgba(61,155,255,.4); }
.faq-q {
  width: 100%; display: flex; align-items: flex-start; gap: 10px; text-align: left;
  background: transparent; border: 0; color: var(--text); padding: 12px 14px;
  font-size: 13px; line-height: 1.55; cursor: pointer;
}
.faq-q:hover { background: rgba(61,155,255,.06); }
.faq-mark {
  flex: none; width: 22px; height: 22px; border-radius: 4px; font-size: 11px; font-weight: bold;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(61,155,255,.2); color: #7eb6ff;
}
.faq-mark.ans { background: rgba(46,204,113,.2); color: var(--ok); }
.faq-chev { margin-left: auto; color: var(--dim); flex: none; }
.faq-body { padding: 0 14px 12px 14px; border-top: 1px solid var(--border); }
.faq-a { display: flex; gap: 10px; padding-top: 12px; }
.faq-a p { margin: 0; font-size: 12px; line-height: 1.75; color: #c5d4ea; }
.faq-demo {
  margin: 10px 0 0 32px; padding: 8px 10px; border-radius: 6px;
  background: rgba(243,156,18,.08); border: 1px dashed rgba(243,156,18,.35);
  font-size: 11px; line-height: 1.6; color: #ffd591;
}
.faq-demo b { color: #ffb86b; }

.sys-legend {
  display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 0 0 10px;
  font-size: 11px; color: var(--dim);
}
.sys-legend .lg-api { color: #7eb6ff; }
.sys-legend .lg-local { color: #9bb0cc; }
.sys-legend .lg-loop { color: #ffb86b; }
.sys-legend .lg-rule { color: #7dcea0; }
.sys-node.rule {
  border-color: rgba(46,204,113,.4); background: rgba(46,204,113,.08); color: #b8e0c8;
}
.sys-node.loop {
  border-color: rgba(243,156,18,.55); background: rgba(243,156,18,.1); color: #ffd591;
}
.engine-tag.eng-intent {
  background: rgba(61,155,255,.12); color: #a8c7ef;
  border: 1px dashed rgba(61,155,255,.45);
}
.sys-loop-bar {
  margin-top: 8px; padding: 10px 12px; border-radius: 8px;
  border: 1px dashed rgba(243,156,18,.45); background: rgba(243,156,18,.06);
  font-size: 12px; color: #c5d4ea; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center;
}
.sys-loop-bar b { color: #ffb86b; font-weight: bold; }

.step-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.step-head b { flex: 1; min-width: 80px; }
.step-head .t { margin-left: auto; }
.engine-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 3px; flex: none; white-space: nowrap;
}
.engine-tag.eng-api { background: rgba(61,155,255,.22); color: #7eb6ff; }
.engine-tag.eng-mock { background: rgba(122,141,176,.22); color: var(--dim); }
.engine-tag.eng-local { background: rgba(46,204,113,.12); color: #7dcea0; }
.engine-tag.eng-loop { background: rgba(243,156,18,.2); color: #ffb86b; }
.sys-banner {
  background: linear-gradient(90deg, rgba(61,155,255,.12), rgba(243,156,18,.08));
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px;
  font-size: 12px; line-height: 1.7; color: #c5d4ea; margin-bottom: 12px;
}
.sys-banner b { color: #ffd591; }
.sys-banner em { font-style: normal; color: #9bb0cc; }
.sys-grid2 {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px; margin-top: 8px;
}
.sys-card {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
}
.sys-card-title { font-weight: bold; color: #aecbf5; font-size: 13px; margin-bottom: 8px; }
.sys-ol, .sys-ul { padding-left: 18px; font-size: 12px; line-height: 1.75; color: #c5d4ea; }
.sys-note { margin-top: 8px; font-size: 11px; color: var(--dim); line-height: 1.6; }
.tag-ok {
  display: inline-block; background: rgba(46,204,113,.2); color: var(--ok);
  border-radius: 3px; padding: 0 6px; font-size: 10px; margin-right: 4px;
}
.tag-todo {
  display: inline-block; background: rgba(243,156,18,.2); color: var(--warn);
  border-radius: 3px; padding: 0 6px; font-size: 10px; margin-right: 4px;
}
.nav-item span:last-of-type { flex: 1; }

.sys-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
}
.sys-tabs button {
  background: var(--panel2); border: 1px solid var(--border); color: var(--dim);
  border-radius: 6px; padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.sys-tabs button:hover { border-color: var(--accent); color: var(--text); }
.sys-tabs button.active {
  background: rgba(61,155,255,.15); border-color: var(--accent); color: #d6e8ff;
}
.sys-section { margin-top: 4px; }
.sys-h {
  font-size: 13px; font-weight: bold; color: #aecbf5; margin-bottom: 10px;
}
.sys-steps {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.sys-step {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
}
.sys-step b { color: #ffd591; font-size: 12px; }
.sys-step span { font-size: 11px; color: #c5d4ea; line-height: 1.5; }
.sys-step.accent { border-color: var(--accent); background: rgba(61,155,255,.08); }
.sys-card h4 {
  margin: 0 0 8px; font-size: 13px; color: #aecbf5; font-weight: bold;
}
.sys-card ul {
  margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.75; color: #c5d4ea;
}
.sys-card.ok-card { border-color: rgba(46,204,113,.35); }
.sys-card.bad-card { border-color: rgba(231,76,60,.35); }
.sys-card.ok-card h4 { color: var(--ok); }
.sys-card.bad-card h4 { color: var(--danger); }

.sys-flow {
  display: flex; gap: 8px; align-items: stretch; overflow-x: auto; padding: 8px 4px 16px;
}
.sys-col {
  flex: none; width: 168px; display: flex; flex-direction: column; gap: 8px;
}
.sys-col-title {
  font-size: 12px; font-weight: bold; color: #ffd591; margin-bottom: 2px; text-align: center;
}
.sys-arrow {
  flex: none; display: flex; align-items: center; color: var(--accent); font-size: 22px; padding: 0 2px;
}
.sys-node {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 8px; color: var(--text); font-size: 12px; text-align: left; line-height: 1.45;
  cursor: default;
}
button.sys-node { cursor: pointer; width: 100%; }
button.sys-node:hover { border-color: var(--accent); background: rgba(61,155,255,.1); }
.sys-node.accent { border-color: var(--accent); background: rgba(61,155,255,.08); }
.sys-node.mute { color: #c5d4ea; }
.sys-node small { display: block; color: var(--dim); font-size: 10px; margin-top: 4px; }
.sys-tree-wrap { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 12px; }
.sys-tree {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 12px; line-height: 1.7; color: #b8c9e0; white-space: pre; overflow: auto;
  max-height: 42vh;
}

/* FDS 讲解式展示页（非表单框） */
.page-fds {
  overflow: auto;
}
.fds-stage {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 20px 22px;
  background:
    radial-gradient(ellipse 80% 50% at 70% 20%, rgba(180,70,40,.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(40,80,120,.18), transparent 50%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 100%;
  box-sizing: border-box;
}
.fds-stage.hl-on { outline: 1px solid rgba(61,155,255,.45); }
.fds-kicker {
  margin: 0 0 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  font-size: 12px; letter-spacing: .02em; text-transform: none; color: #9bb4d0;
}
.fds-badge {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: #e8f0fa; background: linear-gradient(135deg, rgba(232,93,42,.35), rgba(61,155,255,.28));
  border: 1px solid rgba(232,160,112,.4);
}
.fds-kicker-text { color: #8fa6c0; font-size: 12px; letter-spacing: .01em; }
.fds-hero h2 {
  margin: 0 0 10px; font-size: 24px; font-weight: 650; color: #e8f0fa; letter-spacing: .01em;
}
.fds-lede {
  margin: 0; max-width: 48em; font-size: 14px; line-height: 1.7; color: #a8bdd4;
}
.fds-intro .fds-kicker {
  letter-spacing: .01em; text-transform: none; color: #8fa6c0; font-size: 12px;
}
.fds-lede em, .fds-lede strong { color: #dce8f5; font-style: normal; font-weight: 600; }
.fds-demo-note { display: block; margin-top: 6px; font-size: 12px; color: var(--dim); }
.fds-hero-actions { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 12px; }

.fds-match-strip {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px;
  padding: 8px 0; border-top: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px; color: #c5d4ea;
}
.fds-match-strip.idle { color: var(--dim); }
.fds-match-strip b { color: var(--accent); }
.fds-match-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 8px rgba(46,204,113,.6); animation: fdsPulse 1.6s ease-in-out infinite;
}
.fds-match-sub { flex: 1 1 240px; font-size: 12px; color: var(--dim); }
@keyframes fdsPulse {
  0%, 100% { opacity: 1; } 50% { opacity: .45; }
}

.fds-viz { margin-top: 4px; }
.fds-viz-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; color: var(--dim); margin-bottom: 6px;
}
.fds-viz-case { color: #9bb4d0; }
.fds-tunnel { width: 100%; height: auto; max-height: 180px; display: block; }
.fds-tunnel-body { fill: rgba(20,32,52,.9); stroke: rgba(120,150,190,.35); stroke-width: 1.5; }
.fds-fire-core { fill: #e85d2a; filter: drop-shadow(0 0 8px rgba(232,93,42,.7)); }
.fds-svg-cap { fill: #7a91ab; font-size: 11px; }
.fds-svg-note { font-size: 12px; font-weight: 600; }
.fds-svg-note.ok { fill: #6dcea0; }
.fds-svg-note.bad { fill: #e8a070; }
.fds-flow-arrow { fill: none; stroke: #6dcea0; stroke-width: 2.5; stroke-dasharray: 6 4; animation: fdsDash 1.2s linear infinite; }
.fds-flow-arrow.bad { stroke: #e8a070; }
@keyframes fdsDash { to { stroke-dashoffset: -20; } }
.fds-smoke-anim { animation: fdsDrift 3.5s ease-in-out infinite alternate; }
.fds-smoke-anim.reverse { animation-name: fdsDriftRev; }
@keyframes fdsDrift { from { opacity: .45; } to { opacity: .9; } }
@keyframes fdsDriftRev { from { opacity: .5; } to { opacity: .95; } }

.fds-takeaways {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 20px;
  align-items: end; padding: 4px 0 2px;
}
.fds-take-num {
  display: block; font-size: 28px; font-weight: 700; color: #eef4fb; letter-spacing: -.02em; line-height: 1.1;
}
.fds-take-num small { font-size: 14px; font-weight: 500; margin-left: 2px; color: #9bb4d0; }
.fds-take-lab { font-size: 11px; color: var(--dim); margin-top: 4px; display: block; }
.fds-take-story {
  grid-column: 1 / -1; margin: 8px 0 0; font-size: 14px; line-height: 1.55; color: #c5d4ea;
  padding-top: 10px; border-top: 1px solid rgba(255,255,255,.06);
}

.fds-story-rail {
  display: flex; gap: 0; overflow-x: auto; padding: 4px 0 8px;
}
.fds-story-step {
  flex: 1 1 0; min-width: 140px; padding: 8px 14px 8px 0;
  border-left: 2px solid rgba(61,155,255,.35); margin-left: 0; padding-left: 12px;
}
.fds-story-step + .fds-story-step { margin-left: 4px; }
.fds-story-t { display: block; font-size: 11px; color: var(--accent); margin-bottom: 4px; }
.fds-story-txt { font-size: 12px; color: #a8bdd4; line-height: 1.45; }

.fds-contrast {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch;
}
.fds-contrast-vs {
  display: flex; align-items: center; color: var(--dim); font-size: 11px; letter-spacing: .08em;
}
.fds-contrast-col {
  padding: 12px 14px; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.03); border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.fds-contrast-col:hover { background: rgba(255,255,255,.06); }
.fds-contrast-col.good { border-color: rgba(46,204,113,.28); }
.fds-contrast-col.bad { border-color: rgba(232,160,112,.3); }
.fds-contrast-tag { font-size: 10px; color: var(--dim); letter-spacing: .06em; }
.fds-contrast-col b { display: block; margin: 4px 0; font-size: 14px; color: #e8f0fa; }
.fds-contrast-col p { margin: 0; font-size: 12px; color: #a8bdd4; line-height: 1.45; }

.fds-chapters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.fds-chapter {
  flex: 1 1 120px; text-align: left; padding: 10px 12px;
  background: transparent; border: 1px solid rgba(120,150,190,.22);
  border-radius: 8px; color: #a8bdd4; cursor: pointer;
}
.fds-chapter:hover { border-color: rgba(61,155,255,.45); color: #dce8f5; }
.fds-chapter.active { border-color: var(--accent); background: rgba(61,155,255,.1); color: #e8f0fa; }
.fds-chapter.warn.active { border-color: rgba(232,160,112,.55); background: rgba(232,160,112,.08); }
.fds-ch-id { display: block; font-size: 11px; color: var(--accent); margin-bottom: 2px; }
.fds-chapter.warn .fds-ch-id { color: #e8a070; }
.fds-ch-title { font-size: 12px; line-height: 1.35; }

.fds-intro .fds-intro-title {
  margin: 0 0 10px; font-size: 18px; color: #e8f0fa; font-weight: 650;
}
.fds-intro-flow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  margin-top: 14px; font-size: 13px; color: #c5d4ea;
}
.fds-intro-flow span {
  padding: 6px 10px; border-bottom: 1px solid rgba(61,155,255,.35);
}
.fds-intro-flow i { color: var(--dim); font-style: normal; }

@media (max-width: 900px) {
  .fds-takeaways { grid-template-columns: 1fr; }
  .fds-contrast { grid-template-columns: 1fr; }
  .fds-contrast-vs { justify-content: center; }
}

.sys-ol { margin: 8px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.7; color: #c5d4ea; }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
