/* ===================================================================
   煤矿顶板孪生预警演示大屏 — 深色 16:9 无滚动
   视觉规范唯一来源: static/js/legend.js(CSS 变量仅承载色值)
   原则(§8.1/§11.2): 颜色只表物理风险;覆盖/不确定用纹理与线型表达;
   时间线语义: 历史实测实线 / 当前估计虚线 / 未来区间半透明带,禁止混画。
   =================================================================== */
:root {
  --bg: #0B1220;
  --panel: #0F1826;
  --panel-2: #12203A;
  --line: #1D2C44;
  --line-2: #27405F;
  --ink: #DCE6F5;
  --ink-dim: #8FA3C0;
  --ink-faint: #5B7294;
  --accent: #4FC3F7;

  /* 风险四级(仅物理风险,面填充只用于风险区) */
  --h-red: #E53935;   --h-red-bg: rgba(229, 57, 53, .16);
  --h-orange: #FB8C00;--h-orange-bg: rgba(251, 140, 0, .14);
  --h-yellow: #FFC107;--h-yellow-bg: rgba(255, 193, 7, .12);
  --h-blue: #2196F3;  --h-blue-bg: rgba(33, 150, 243, .10);

  /* 数据状态 */
  --d-healthy: #66BB6A;
  --d-degraded: #F9A825;
  --d-unavail: #9E9E9E;

  /* 处置徽章 */
  --w-pub: #90A4AE; --w-ack: #90A4AE; --w-proc: #42A5F5; --w-review: #AB47BC;
  --w-overdue: #EF5350; --w-closed: #78909C;

  /* 时间语义线 */
  --t-hist: #F0F4FA; --t-est: #82B1FF; --t-future: rgba(130, 177, 255, .18);
  --t-t1: #607D8B; --t-t2: #607D8B; --t-h: #C62828;

  --mono: "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background: var(--bg); color: var(--ink);
  font: 13px/1.5 "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 布局骨架: 顶 auto(≥54) / 中 1fr / 底 auto(≥88) ----------
   顶/底用 minmax 自适应高度:窄窗口(缩放/小屏)允许内容折行而不出界 */
#app { display: grid; grid-template-rows: minmax(54px, auto) 1fr minmax(88px, auto);
       width: 100vw; height: 100vh; }

#topbar { display: flex; align-items: center; flex-wrap: wrap; row-gap: 6px; gap: 14px;
  padding: 4px 14px; background: linear-gradient(180deg, #101D33, #0D1729);
  border-bottom: 1px solid var(--line); }
#topbar .sys { font-size: 17px; font-weight: 600; letter-spacing: 1px;
  white-space: nowrap; }
#topbar .sys small { color: var(--ink-faint); font-weight: 400; margin-left: 6px; }
#topbar .sep { width: 1px; height: 22px; background: var(--line-2); }
#clock { font-family: var(--mono); font-size: 20px; color: #EAF2FF; }
#clock .day { color: var(--ink-faint); font-size: 11px; margin-right: 8px; }
#clock .chip { font-size: 11px; color: var(--accent); margin-left: 6px; }
.ctrl { display: flex; align-items: center; gap: 8px; }
.ctrl label { color: var(--ink-dim); font-size: 12px; white-space: nowrap; }
.ctrl select, .ctrl input, .ctrl button, #sceneDesc select {
  background: #16263F; border: 1px solid var(--line-2); border-radius: 4px;
  padding: 3px 8px; height: 26px; color: var(--ink); }
.ctrl select:hover, .ctrl input:hover, .ctrl button:hover { border-color: #3E5E8A; }
.ctrl input[type=text] { width: 96px; font-family: var(--mono); }
#btnPause { min-width: 64px; }
.demo-badge { margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 12px; white-space: nowrap; }
.demo-badge .dotp { width: 8px; height: 8px; border-radius: 50%; background: #2ECC71;
  box-shadow: 0 0 6px #2ECC71; }
.demo-badge.off .dotp { background: #E67E22; box-shadow: 0 0 6px #E67E22; }
.demo-badge .tag {
  border: 1px solid rgba(255, 220, 120, .55); color: #FFE082; border-radius: 3px;
  padding: 1px 7px; letter-spacing: 1px; }

/* ---------- 主区三栏(列宽可收缩:缩放/小窗口时右栏保留在视口内不出界;
             列边界有拖拽条 panelsize.js 手动调宽) ---------- */
#main { position: relative; display: grid;
  grid-template-columns: minmax(290px, 330px) minmax(0, 1fr) minmax(310px, 396px);
  gap: 8px; padding: 8px; min-height: 0; min-width: 0; }
#main > * { min-width: 0; }
.col { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 8px; }
/* 列边界拖拽条(panelsize.js):仅细条自身可交互,不挡其余点击 */
.spl { position: absolute; top: 0; bottom: 0; width: 9px; margin-left: -4px;
  z-index: 7; cursor: col-resize; touch-action: none; user-select: none;
  -webkit-user-select: none; }
.spl::after { content: ""; position: absolute; left: 4px; top: 0; bottom: 0;
  width: 1px; background: rgba(140, 170, 215, .15); transition: background .15s, width .15s; }
.spl:hover::after, .spl.drag::after { background: var(--accent); width: 2px; left: 3.5px; }
.spl.maxed::after { background: #4FC3F7; width: 2px; left: 3.5px; }
.spl.maxed { cursor: zoom-out; }

.panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; display: flex; flex-direction: column;
  min-width: 0; min-height: 0; }
.panel > .ph { display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-bottom: 1px solid var(--line); font-size: 12px;
  color: var(--ink-dim); flex: none; }
.panel > .ph b { color: var(--ink); font-size: 13px; font-weight: 600; }
.panel > .ph .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel .body { flex: 1; min-height: 0; position: relative; }

/* 左: 态势 */
#regionCard { height: 236px; flex: none; }
#regionList { padding: 6px 10px; overflow: auto; }
.region-row { display: flex; align-items: center; gap: 8px; padding: 3px 2px;
  border-bottom: 1px dashed #15233B; }
.region-row:last-child { border-bottom: none; }
.region-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.region-row .nm { color: var(--ink); }
.region-row .cnt { color: var(--ink-faint); font-size: 11px; }
.region-row .haz { margin-left: auto; font-size: 11px; border-radius: 3px;
  padding: 0 6px; border: 1px solid currentColor; }

/* 左: 事件流 */
#eventCard { flex: 1; }
#eventList { overflow: auto; }
.ev-row { display: grid; grid-template-columns: 54px 10px 1fr auto; gap: 8px;
  align-items: start; padding: 6px 10px; cursor: pointer; border-bottom: 1px solid #14233C; }
.ev-row:hover, .ev-row.sel { background: #13233F; }
.ev-row .tm { font-family: var(--mono); color: var(--ink-dim); font-size: 11px; }
.ev-row .bar { width: 4px; height: 26px; border-radius: 2px; justify-self: center; }
.ev-row .t { overflow: hidden; }
.ev-row .t .tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-row .badges { display: flex; gap: 4px; font-size: 10px; }
.ev-row .badges span { border: 1px solid; border-radius: 2px; padding: 0 4px; white-space: nowrap; }
.ev-row .arc { color: var(--ink-faint); font-size: 10px; align-self: center; }

/* 中: 平面 */
#main > .col { position: relative; z-index: 3; }   /* 左/右栏永远压在中间图之上 */
#topbar { position: relative; z-index: 4; }
#healthbar { position: relative; z-index: 4; }
#mapCard { position: relative; z-index: 1; min-height: 0; min-width: 0;
  overflow: hidden; }       /* 卡片自成层叠上下文并裁切,内部任何元素不可能溢出盖住它栏 */
#btnChans { background: #16263F; border: 1px solid var(--line-2); border-radius: 4px;
  color: #A9C4E8; font-size: 11px; padding: 2px 8px; height: 22px; white-space: nowrap; }
#btnChans:hover { border-color: #3E5E8A; color: #DCE6F5; }
#mapLayers { position: relative; z-index: 2; display: flex; flex-wrap: wrap;
  gap: 2px 10px; font-size: 11px; color: var(--ink-dim); }
#mapLayers label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer;
  white-space: nowrap; }
#mapLayers label input { accent-color: var(--accent); }
/* #planBox 是 #mapCard 的 .body(flex 撑满);不得 absolute 到非定位祖先,
   否则 SVG 以视口为包含块铺满全屏,盖住左/中栏并截获图层开关点击 */
#planBox { position: relative; z-index: 0; min-height: 0; overflow: hidden;
  padding: 4px 6px 6px; }
#planBox svg { width: 100%; height: 100%; display: block;
  border: 1px solid var(--line); border-radius: 4px; background: #0C1524; }
#planBox svg text { user-select: none; }
/* 平面拾取白名单:整张画布(空白、巷道、图例文字等)点击穿透;
   仅 data-oid / data-evid 要素(测点、风险圈、台站…)可点选 */
#planBox svg, #planBox svg * { pointer-events: none; }
#planBox svg [data-oid], #planBox svg [data-evid] { pointer-events: auto; cursor: pointer; }
#mapFoot { position: absolute; left: 8px; bottom: 4px; font-size: 11px;
  color: var(--ink-faint); z-index: 3; pointer-events: none; }

/* SVG 通用 */
.plan text { font-family: "Microsoft YaHei", sans-serif; }
.lbl-mini { fill: var(--ink-faint); font-size: 10px; }
.lbl-sec { fill: #AEBFD9; font-size: 10px; }
.halo { animation: pulse 1.6s ease-out infinite; transform-origin: center;
  transform-box: fill-box; }
@keyframes pulse { 0% { opacity: .7; } 70% { opacity: .15; } 100% { opacity: .7; } }
.sel-ring { stroke: #FFF; stroke-width: 1.6; fill: none; }

/* 右: 分析卡 */
#chartCol .panel { flex: 1; }
#chartTabs { display: flex; gap: 2px; padding: 4px 6px 0; }
#chartTabs button { background: transparent; border: 1px solid transparent;
  border-radius: 4px 4px 0 0; padding: 4px 10px; color: var(--ink-dim); }
#chartTabs button.on { background: var(--panel-2); color: var(--ink);
  border-color: var(--line-2); border-bottom: 2px solid var(--accent); }
/* #chartPane: 顶部图注条(cap-zone,流内固定) + 画布区(echbox,flex 撑满) 分层,
   图注文字不可能压在图表内容上 */
#chartPane { position: relative; display: flex; flex-direction: column;
  min-height: 0; }
#chartPane > .cap-zone { flex: none; display: flex; align-items: center;
  gap: 8px; min-height: 21px; padding: 2px 8px 1px 10px;
  border-bottom: 1px dashed #1B2C48; }
#chartPane > .cap-zone .cap-txt { flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: #5B7294; font-size: 10px;
  line-height: 1.3; }
#chartPane > .cap-zone .cap-right { flex: none; display: flex; gap: 4px;
  align-items: center; }
#chartPane > .echbox { position: relative; flex: 1; min-height: 0; }
/* 画布比图注条再低 10px:图表顶部文字/标注与说明文字留出呼吸间距 */
#chartPane > .echbox > .ech-stage { position: absolute; left: 0; right: 0;
  top: 10px; bottom: 0; }
#chartPane > .echbox .cplaceholder { position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: var(--ink-faint);
  font-size: 12px; text-align: center; line-height: 2; }
#chartPane > .echbox .cplaceholder code { color: var(--accent); }
.gauge-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* 通用弱说明文字(ref:小字灰) */
.ref { color: var(--ink-faint); font-weight: 400; font-size: 10px; }

/* 底: 健康栏(自适应列宽,内容超宽时可折行增高,不出界) */
#healthbar { display: grid;
  grid-template-columns: minmax(270px, 400px) minmax(480px, 1fr) minmax(230px, 280px);
  gap: 8px 14px; padding: 8px 14px 18px; min-width: 0;
  background: linear-gradient(0deg, #101D33, #0D1729);
  border-top: 1px solid var(--line); align-items: center; }
  /* 底 padding 18px: 底部 18px 区间预留给贴底水印细条,任何内容不与水印文字重叠 */
#edges, #edgeRows { min-width: 0; }
#edges { display: flex; flex-direction: column; gap: 2px; }
#edges .cap { font-size: 9.5px; line-height: 1.3; color: var(--ink-faint); letter-spacing: .5px; }
#edgeRows { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.edge-row { display: flex; gap: 8px; align-items: center; font-size: 11.5px;
  line-height: 1.45; min-width: 0; }
.edge-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.edge-row .en { width: 88px; color: var(--ink-dim); flex: none; }
.edge-row .note { color: var(--ink-faint); font-size: 10px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
#hbCenter { display: flex; gap: 6px 10px; align-items: stretch; justify-content: center;
  font-size: 12px; color: var(--ink-dim); flex-wrap: wrap; min-width: 0; }
#hbCenter b { color: var(--ink); font-family: var(--mono); }
.kpi { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; padding: 1px 10px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: none; }
.kpi .v { font-size: 17px; font-family: var(--mono); color: #EAF2FF; line-height: 1.2; }
.kpi .k { font-size: 9.5px; color: var(--ink-faint); white-space: nowrap; }
.kpi .d { font-size: 8.5px; color: var(--ink-faint); opacity: .8; white-space: nowrap; }
.kpi.cand { align-items: flex-start; border-left: 1px solid var(--line); }
.kpi.cand .cand-h { white-space: normal; font-size: 9.5px; line-height: 1.3; }
.kpi.cand .cand-row { font-family: var(--mono); font-size: 10px; color: #BFD3EE;
  white-space: nowrap; line-height: 1.5; }
.kpi.cand .cand-row .ref { font-family: inherit; }
#hbVersions { font-size: 10.5px; color: var(--ink-faint); text-align: right;
  line-height: 1.4; min-width: 0; }
#hbVersions .cap { font-size: 9.5px; line-height: 1.3; letter-spacing: .5px; }
#hbVersions .ref { font-size: 9px; line-height: 1.35; }

/* 提示 toast */
#toasts { position: fixed; top: 62px; right: 16px; z-index: 60; width: 340px;
  display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: #12203A; border: 1px solid var(--line-2); border-left-width: 3px;
  border-radius: 4px; padding: 6px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.4);
  animation: tin .25s ease; }
.toast.info { border-left-color: var(--accent); }
.toast.warn { border-left-color: var(--h-orange); }
.toast.error { border-left-color: var(--h-red); }
.toast.risk { border-left-color: var(--h-red); background: #1A1526; }
@keyframes tin { from { transform: translateX(20px); opacity: 0; } }

/* 六要素弹层 */
#overlay { position: fixed; inset: 0; background: rgba(4, 9, 18, .55); z-index: 50;
  display: none; }
#overlay.show { display: flex; align-items: center; justify-content: center; }
#pop { width: 860px; max-height: 82vh; overflow: auto; background: #0E192B;
  border: 1px solid #2B4A78; border-radius: 8px; box-shadow: 0 10px 50px rgba(0,0,0,.6);
  padding: 14px 18px 12px; }
#pop h3 { display: flex; align-items: center; gap: 10px; font-size: 16px; }
#pop h3 .badge { font-size: 11px; border-radius: 3px; padding: 0 7px; border: 1px solid currentColor; }
#pop .x { margin-left: auto; background: none; border: 1px solid var(--line-2);
  border-radius: 4px; color: var(--ink-dim); width: 26px; height: 26px; }
#pop .grid6 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 10px; }
.el { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: #101D33; }
.el h4 { font-size: 12px; color: var(--accent); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px; }
.el h4 small { color: var(--ink-faint); font-weight: 400; }
.el p, .el li { font-size: 12px; color: #C7D5EA; }
.el ul { list-style: none; }
.el li { padding: 1px 0; border-bottom: 1px dashed #1B2C48; }
.el .ref { color: var(--ink-faint); font-size: 11px; }
.el.sp { grid-column: 1 / -1; }
#popOps { display: flex; gap: 8px; align-items: center; margin-top: 12px;
  flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
#popOps .who { color: var(--ink-faint); font-size: 11px; }
#popOps input { flex: 1; min-width: 200px; background: #16263F; border: 1px solid var(--line-2);
  border-radius: 4px; padding: 5px 8px; }
#popOps button { background: #1B3357; border: 1px solid #2E5588; border-radius: 4px;
  padding: 5px 12px; color: #D7E6F8; }
#popOps button.primary { background: #2E5588; }
#popOps button:disabled { opacity: .35; cursor: not-allowed; }
#reviewWrap { display: none; gap: 6px; align-items: center; width: 100%; }
#reviewWrap.show { display: flex; }
#reviewWrap input { flex: 1; }
#pop .time-line { font-family: var(--mono); color: var(--ink-dim); font-size: 11px; }

/* 水印:贴底细条小字,居于底栏下缘预留区(pointer-events:none,不与任何数值重叠) */
#wm { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 16px 3px; text-align: center; pointer-events: none; height: auto;
  font-size: 9px; letter-spacing: 1px; color: rgba(190, 205, 230, .34);
  text-shadow: 0 0 6px rgba(0, 0, 0, .8); }
#wm::before { content: "◆ "; opacity: .6; }
#wm::after { content: " ◆"; opacity: .6; }

/* 测点参数总览弹层 */
#tblOver { position: fixed; inset: 0; background: rgba(4, 9, 18, .6); z-index: 49;
  display: none; }
#tblOver.show { display: flex; align-items: center; justify-content: center; }
.tblPanel { width: min(1240px, 95vw); max-height: 90vh; background: #0E192B;
  border: 1px solid #2B4A78; border-radius: 8px; box-shadow: 0 10px 50px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden; }
.tblHead { display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  border-bottom: 1px solid var(--line); }
.tblHead b { font-size: 14px; color: #DCE6F5; }
.tblHead .ref { color: var(--ink-faint); font-size: 10px; }
.tblHead .x { background: none; border: 1px solid var(--line-2); border-radius: 4px;
  color: var(--ink-dim); width: 26px; height: 26px; cursor: pointer; margin-left: 4px; }
.tblBar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  padding: 7px 14px; border-bottom: 1px solid var(--line); font-size: 11px; }
.tblBar select, .tblBar input, .tblBar button { background: #16263F;
  border: 1px solid var(--line-2); border-radius: 4px; color: var(--ink);
  font-size: 11px; padding: 3px 8px; height: 24px; }
.tblBar #tblSearch { flex: 1; min-width: 160px; }
.tblBar #tblStat b { font-family: var(--mono); color: #EAF2FF; }
.tblBody { overflow: auto; flex: 1; min-height: 200px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.tbl th { position: sticky; top: 0; background: #16263F; color: #8FA3C0;
  font-weight: 500; text-align: left; padding: 6px 10px; white-space: nowrap;
  border-bottom: 1px solid var(--line-2); z-index: 1; }
table.tbl td { padding: 4px 10px; border-bottom: 1px dashed #16263F;
  color: #C7D5EA; white-space: nowrap; }
table.tbl tbody tr:hover { background: #13233F; }
table.tbl td.oid { color: #82B1FF; cursor: pointer; font-family: var(--mono);
  font-size: 11px; }
table.tbl td.oid:hover { text-decoration: underline; }
table.tbl td .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 5px; vertical-align: baseline; }
table.tbl td.val { font-family: var(--mono); color: #BFD3EE; }
table.tbl td .late { color: #F9A825; font-size: 10px; }
.tblFoot { padding: 6px 14px; border-top: 1px solid var(--line); }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #24405F; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }
