/* ============================================================
   邕安系统 · 值守工作台布局（workbench.html）
   四页签：预警处置 / 点位档案 / 情景管理 / 数据说明
   ============================================================ */
html, body { overflow: clip; }
/* 26px = .decl-bar 高度；同 dashboard：视口精确占满，防聚焦滚动顶出声明条 */
.wb { display: flex; flex-direction: column; height: calc(100vh - 26px); }
.wb-header { display: flex; align-items: center; gap: 16px; height: 54px; padding: 0 18px; flex: none;
  background: linear-gradient(180deg, #0e1524, #0a0e17); border-bottom: 1px solid var(--line-strong); }
.wb-header .logo { font-size: 19px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(90deg, #35c6e6, #4da3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wb-header .full { font-size: 13px; color: var(--ink-2); }
.wb-header .spacer { flex: 1; }
.wb-header .navlink { font-size: 13px; color: var(--ink-2); padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; }
.wb-header .navlink:hover { background: var(--bg-hover); }

.tabs { display: flex; gap: 4px; padding: 8px 18px 0; flex: none; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 18px; font-size: 14px; color: var(--ink-2); border: 1px solid transparent; border-bottom: none;
  border-radius: 8px 8px 0 0; cursor: pointer; }
.tab:hover { color: var(--ink-1); }
.tab.active { color: var(--ink-1); background: var(--bg-panel); border-color: var(--line); font-weight: 600; }
.tab .count { font-size: 11px; color: var(--ink-invert); background: var(--lv-orange); border-radius: 999px; padding: 0 6px; margin-left: 6px; }

.tab-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar input[type=text], .toolbar select { background: var(--bg-elevated); color: var(--ink-1);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.filters { display: flex; gap: 6px; }

.card { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card + .card { margin-top: 14px; }
.card-hd { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-hd .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.card-bd { padding: 14px 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.stat-tile { background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.stat-tile .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-tile .k { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stat-tile.real .v { color: #57d9a3; }
.stat-tile.syn .v { color: var(--synthetic); }

.wb-table-wrap { max-height: calc(100vh - 240px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

/* 详情抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(4,7,12,0.6); opacity: 0; pointer-events: none;
  transition: opacity .2s; z-index: 800; }
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; width: 560px; max-width: 92vw; height: 100vh;
  background: var(--bg-panel); border-left: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .25s; z-index: 801; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex: none; }
.drawer-hd .x { margin-left: auto; cursor: pointer; color: var(--ink-3); font-size: 20px; line-height: 1; }
.drawer-bd { flex: 1; overflow: auto; padding: 16px; }
.drawer-bd h4 { font-size: 13px; color: var(--ink-3); margin: 16px 0 8px; font-weight: 500; }
.drawer-bd h4:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; }
.kv .row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv .row span { color: var(--ink-3); }
.kv .row b { font-variant-numeric: tabular-nums; }
.drawer-chart { height: 220px; }

/* 情景表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--ink-3); }
.field select, .field input { background: var(--bg-elevated); color: var(--ink-1); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 7px 10px; font-size: 13px; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; }
.checks label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.checks input { accent-color: var(--accent); }

.scenario-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg-elevated); }
.scenario-item + .scenario-item { margin-top: 8px; }
.scenario-item .meta { flex: 1; }
.scenario-item .nm { font-weight: 600; }
.scenario-item .ds { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.scenario-item .type { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--accent-dim); color: var(--accent); }
.scenario-item.current { border-color: var(--accent); }
.scenario-item .run-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.scenario-item .run-badge.on { color: #57d9a3; border: 1px solid #57d9a366; background: #57d9a31a; }
.scenario-item .run-badge.off { color: var(--ink-3); border: 1px solid var(--line); }

.long-text { font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.long-text p { margin: 0 0 10px; }
.long-text b { color: var(--ink-1); }
.nowrap { white-space: nowrap; }
.tag-real { color: #57d9a3; }
.tag-syn { color: var(--synthetic); }

/* —— 分灾种标签 —— */
.hz-tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.hz-rain { background: rgba(58,155,255,0.18); color: var(--lv-blue); }
.hz-flood { background: rgba(53,198,230,0.18); color: var(--accent); }
.hz-mountain { background: rgba(255,152,56,0.18); color: var(--lv-orange); }
.hz-geo { background: rgba(155,140,255,0.18); color: var(--synthetic); }

/* —— 发布徽标 —— */
.pub-badge { padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pub-issued { background: rgba(58,155,255,0.18); color: var(--lv-blue); }
.pub-updated { background: rgba(255,152,56,0.18); color: var(--lv-orange); }
.pub-cancelled { background: rgba(107,120,144,0.2); color: var(--ink-3); }

/* —— 触发规则/事件标签 —— */
.pop-rules { margin: 0; padding-left: 16px; font-size: 12px; color: var(--ink-2); list-style: disc; }
.pop-rules li { margin: 3px 0; }
.ev-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ev-tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--lv-red-bg);
  color: var(--lv-red); border: 1px solid var(--lv-red-line); }

/* —— 叫应五级链条 —— */
.callout-chain { display: flex; flex-direction: column; gap: 10px; }
.chain-level { display: flex; gap: 12px; align-items: flex-start; }
.chain-tier { display: flex; align-items: center; gap: 8px; width: 150px; flex: none; font-weight: 600;
  color: var(--accent); padding-top: 6px; }
.chain-tier .tier-no { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--ink-invert); font-size: 12px; font-weight: 800; }
.chain-items { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.chain-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  background: var(--bg-elevated); border: 1px solid var(--line); border-left: 3px solid var(--ink-3); font-size: 13px; }
.chain-item.st-doing { border-left-color: var(--lv-blue); }
.chain-item.st-pending { border-left-color: var(--lv-orange); }
.chain-item.st-done { border-left-color: #57d9a3; }
.chain-item .ci-pt { font-weight: 600; min-width: 120px; }
.chain-item .ci-act { flex: 1; color: var(--ink-2); }
.chain-item .ci-dl { color: var(--lv-orange); white-space: nowrap; }
.chain-item .ci-night { color: var(--synthetic); white-space: nowrap; font-size: 12px; }
.chain-item .ci-st { font-size: 11px; padding: 1px 8px; border-radius: 4px; white-space: nowrap; }
.ci-st.st-doing { background: rgba(58,155,255,0.16); color: var(--lv-blue); }
.ci-st.st-pending { background: rgba(255,152,56,0.16); color: var(--lv-orange); }
.ci-st.st-done { background: rgba(87,217,163,0.16); color: #57d9a3; }

/* —— 智能体页签布局 —— */
.agent-split { display: grid; grid-template-columns: 420px 1fr; gap: 14px; align-items: start; }
.agent-card { display: flex; flex-direction: column; overflow: hidden; }
.agent-mount { height: calc(100vh - 260px); min-height: 380px; display: flex; }
.agent-mount .agent-chat { background: transparent; }
code { background: var(--bg-hover); padding: 1px 6px; border-radius: 4px; color: var(--accent); font-size: 12px; }

/* —— 资源调配账（R1 一本账）—— */
.stat-tile.stat-tile-accent .v { color: var(--accent); }
.stat-tile.stat-tile-ok .v { color: #57d9a3; }
.stat-tile.stat-tile-warn .v { color: var(--lv-yellow); }
.res-note { margin-top: 12px; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.res-note-tag { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; background: rgba(255,152,56,0.18); color: var(--lv-orange); }
.res-phases { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.res-phase { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.res-phase .rp-k { width: 120px; flex: none; color: var(--ink-2); }
.res-phase .rp-bar { flex: 1; height: 12px; background: rgba(255,255,255,0.08); border-radius: 6px; overflow: hidden; }
.res-phase .rp-bar em { display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #35c6e6, #4da3ff); transition: width .4s ease; }
.res-phase:last-child .rp-bar em { background: linear-gradient(90deg, #ff9838, #ff5566); }
.res-phase b { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.res-coord { cursor: pointer; color: var(--accent); font-variant-numeric: tabular-nums;
  border-bottom: 1px dashed var(--accent); }
.res-coord:hover { background: var(--accent-dim); }
tr.res-gap-row td { background: rgba(255,85,102,0.10); }
tr.res-gap-row td:last-child { color: var(--lv-red); }
.res-aid { border: 1px solid var(--lv-red-line); background: var(--lv-red-bg);
  border-radius: 8px; padding: 12px 14px; }
.res-aid .ra-hd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.res-aid .ra-badge { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 4px;
  background: var(--lv-red); color: #fff; }
.res-aid .ra-meta { font-size: 12px; color: var(--ink-2); }
.res-aid .ra-items { margin: 8px 0 0; padding-left: 18px; list-style: disc; font-size: 13px; color: var(--ink-1); }
.res-aid .ra-items li { margin: 3px 0; }
.res-aid .ra-items b { color: var(--lv-red); font-variant-numeric: tabular-nums; }
.res-aid .ra-note { margin-top: 8px; font-size: 12px; color: var(--ink-3); }

/* —— 窄视口（媒体查询置于文件末尾）—— */
@media (max-width: 1100px) {
  .agent-split { grid-template-columns: 1fr; }
  .agent-mount { height: 460px; }
}
