/* =========================================================================
 *  app.css — 「石墨 · 安全橙」工业控制台主题
 *  设计语言：暖灰水泥底色 + 石墨深色轨道 + 安全橙强调 + 细线分隔
 * ========================================================================= */

/* ------------------------------ 基础变量 ------------------------------ */
:root {
  --bg: #EEF0EB;
  --bg-grid: rgba(20, 24, 22, .035);
  --surface: #FFFFFF;
  --surface-2: #F7F8F5;
  --surface-3: #F1F2EE;
  --line: #DCDFD8;
  --line-2: #E9EBE5;
  --ink: #141816;
  --ink-2: #4F5752;
  --ink-3: #8B938D;
  --ink-4: #AEB5AF;

  --accent: #D8481F;
  --accent-2: #B63A16;
  --accent-soft: #FBEBE6;
  --teal: #0B6B60;
  --teal-soft: #E4F0ED;
  --amber: #B67C10;
  --amber-soft: #FBF1DC;
  --red: #B3392B;
  --red-soft: #FBE9E7;
  --blue: #2E5A7A;
  --blue-soft: #E7EFF5;

  --dark: #101416;
  --dark-2: #171C1F;
  --dark-3: #1E2427;
  --dark-line: #2A3133;

  --c1: #D8481F;
  --c2: #0B6B60;
  --c3: #B67C10;
  --c4: #3F5A63;
  --c5: #8C4A63;
  --c6: #7A8A7E;

  --r: 3px;
  --r-lg: 5px;
  --shadow: 0 1px 2px rgba(18, 24, 20, .05);
  --shadow-lg: 0 24px 60px -28px rgba(18, 24, 20, .35), 0 2px 8px rgba(18, 24, 20, .06);
  --rail-w: 210px;
  --top-h: 58px;

  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}
h1, h2, h3, h4, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

/* 滚动条 */
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: #C7CCC5 transparent; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: #C7CCC5; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
.scroll::-webkit-scrollbar-thumb:hover { background: #AEB5AD; background-clip: content-box; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------ 应用骨架 ------------------------------ */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; position: relative; z-index: 1; }

.rail {
  background: var(--dark);
  color: #C9D0CB;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid #000;
}
.rail::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, rgba(216,72,31,.55), rgba(216,72,31,0) 45%);
}
.rail-brand { padding: 18px 18px 16px; display: flex; gap: 11px; align-items: flex-start; }
.brand-mark {
  width: 30px; height: 30px; flex: 0 0 30px; position: relative;
  background: var(--accent); border-radius: 2px;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; letter-spacing: -.02em;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 4px -3px -3px 4px; border: 1px solid rgba(255,255,255,.28);
  border-radius: 2px; pointer-events: none;
}
.brand-txt { min-width: 0; }
.brand-txt b { display: block; color: #F2F4F1; font-size: 13.5px; letter-spacing: .02em; font-weight: 600; }
.brand-txt span { display: block; font-size: 10.5px; color: #79817C; letter-spacing: .16em; margin-top: 3px; text-transform: uppercase; }

.rail-nav { flex: 1; overflow-y: auto; padding: 6px 10px 10px; scrollbar-width: none; }
.rail-nav::-webkit-scrollbar { display: none; }
.rail-group { margin: 12px 0 4px; padding: 0 8px; font-size: 9.5px; letter-spacing: .18em; color: #5E6661; text-transform: uppercase; }
.rail-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: 2px; cursor: pointer; position: relative;
  color: #A9B1AC; font-size: 12.5px;
  transition: background .14s, color .14s;
  user-select: none;
}
.rail-item svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: .8; }
.rail-item:hover { background: #191E21; color: #E6EBE7; }
.rail-item.is-active { background: #1C2225; color: #FDFDFB; }
.rail-item.is-active::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 2px; background: var(--accent);
}
.rail-item.is-active svg { opacity: 1; color: var(--accent); }
.rail-item .badge-dot {
  margin-left: auto; min-width: 17px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 600;
  display: grid; place-items: center; letter-spacing: 0;
}
.rail-foot { padding: 10px 12px 14px; border-top: 1px solid #1E2427; font-size: 11px; color: #6B736E; }
.rail-foot .rf-row { display: flex; justify-content: space-between; gap: 6px; padding: 2px 0; }
.rail-foot .rf-row b { color: #A9B1AC; font-weight: 500; font-variant-numeric: tabular-nums; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--top-h); flex: 0 0 var(--top-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px; background: rgba(255,255,255,.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topbar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: repeating-linear-gradient(45deg, var(--accent) 0 6px, #171C1F 6px 12px);
  opacity: .85;
}
.tb-crumb { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.tb-crumb h1 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.tb-crumb .sep { color: var(--ink-4); }
.tb-crumb span { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-clock {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-2);
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 2px;
  background: var(--surface); font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
.tb-clock b { color: var(--ink); font-weight: 600; }
.tb-user {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer;
}
.tb-user:hover { border-color: var(--ink-4); }
.tb-user .ava {
  width: 24px; height: 24px; border-radius: 50%; background: var(--dark-3); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
}
.tb-user .nm { font-size: 12px; line-height: 1.15; }
.tb-user .nm small { display: block; color: var(--ink-3); font-size: 10px; }

.page { padding: 20px 22px 34px; flex: 1; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .ph-t { min-width: 0; }
.page-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -.015em; display: flex; align-items: center; gap: 9px; }
.page-head p { color: var(--ink-3); font-size: 12.5px; margin-top: 3px; }
.page-head .ph-act { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* 深色页面（视频墙 / 上传控制台） */
.page--dark {
  --bg: #0E1214;
  --surface: #161B1E;
  --surface-2: #1B2124;
  --surface-3: #20272A;
  --line: #262E31;
  --line-2: #1E2528;
  --ink: #E9ECE8;
  --ink-2: #A7AFA9;
  --ink-3: #79827C;
  --ink-4: #58615C;
  --accent-soft: #38201A;
  --teal-soft: #12302C;
  --amber-soft: #33280F;
  --c1: #F0633A; --c2: #35B7A4; --c3: #E0A63A; --c4: #6C93A8; --c5: #C0778F; --c6: #93A79A;
  background: var(--bg); color: var(--ink);
  background-image:
    radial-gradient(1100px 500px at 12% -10%, rgba(216,72,31,.07), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(11,107,96,.09), transparent 55%),
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: auto, auto, 40px 40px, 40px 40px;
}
.page--dark .tb-crumb h1 { color: var(--ink); }

/* ------------------------------ 卡片 ------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); min-width: 0;
  position: relative;
}
.card-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2);
  min-height: 44px;
}
.card-hd h3 {
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.card-hd h3::before {
  content: ""; width: 3px; height: 12px; background: var(--accent); border-radius: 1px; opacity: .9;
}
.card-hd .sub { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.card-hd .hd-act { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.card-bd { padding: 16px; }
.card-bd.tight { padding: 0; }
.card-bd.pad-sm { padding: 12px 14px; }
.card--flat { box-shadow: none; }
.card--dark { background: var(--surface); border-color: var(--line); }
.card--accent { border-top: 2px solid var(--accent); }

/* 角落刻度（深色面板的识别符号） */
.ticks::before, .ticks::after {
  content: ""; position: absolute; width: 9px; height: 9px; pointer-events: none;
  border-color: var(--accent); border-style: solid; opacity: .65;
}
.ticks::before { left: -1px; top: -1px; border-width: 1px 0 0 1px; }
.ticks::after { right: -1px; bottom: -1px; border-width: 0 1px 1px 0; }

/* ------------------------------ 栅格 ------------------------------ */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.split { display: grid; gap: 14px; }
.split-3-1 { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.split-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.split-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mt { margin-top: 14px; }
.mt-s { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hr { height: 1px; background: var(--line-2); margin: 14px 0; border: 0; }

/* ------------------------------ KPI ------------------------------ */
.kpi { padding: 14px 16px 13px; position: relative; overflow: hidden; }
.kpi-label {
  font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px;
  letter-spacing: .04em; white-space: nowrap;
}
.kpi-label i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: inline-block; }
.kpi-val {
  display: flex; align-items: baseline; gap: 5px; margin-top: 6px;
  font-size: 34px; line-height: 1.05; font-weight: 600; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}
.kpi-val small { font-size: 12px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }
.kpi-val .slash { color: var(--ink-4); font-weight: 300; font-size: 22px; }
.kpi-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi-gauge { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); opacity: .9; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--red); }
.delta.down { color: var(--teal); }
.delta.flat { color: var(--ink-3); }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 2px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 12.5px; cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s, transform .06s;
  user-select: none;
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { border-color: var(--ink-4); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn--dark { background: var(--dark-2); border-color: var(--dark-2); color: #F1F3EF; }
.btn--dark:hover { background: #262C2F; border-color: #262C2F; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn--sm { height: 25px; padding: 0 9px; font-size: 11.5px; }
.btn--sm svg { width: 12.5px; height: 12.5px; }
.btn--icon { width: 30px; padding: 0; }
.btn--icon.btn--sm { width: 25px; }
.btn--danger { color: var(--red); border-color: #E9CFCB; }
.btn--danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn--flat { border-color: transparent; background: var(--surface-3); }
.btn--flat:hover { background: var(--line-2); }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 2px 0 0 2px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 2px 2px 0; }
.btn-group .btn.is-active { background: var(--ink); color: var(--surface); border-color: var(--ink); z-index: 1; }

/* 分段控件 */
.seg { display: inline-flex; padding: 2px; background: var(--surface-3); border-radius: 3px; border: 1px solid var(--line-2); }
.seg button {
  border: 0; background: transparent; padding: 4px 11px; border-radius: 2px;
  font-size: 12px; color: var(--ink-2); cursor: pointer; transition: .14s;
}
.seg button:hover { color: var(--ink); }
.seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 500; }
.page--dark .seg button.is-active { background: #2A3236; }

/* ------------------------------ 表单 ------------------------------ */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.label { font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.label .req { color: var(--accent); }
.label .hint { color: var(--ink-4); font-size: 10.5px; }
.input, .select, .textarea {
  height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 2px;
  background: var(--surface); color: var(--ink); font-size: 12.5px; font-family: var(--sans);
  width: 100%; outline: none; transition: border-color .14s, box-shadow .14s;
}
.textarea { height: auto; padding: 7px 9px; line-height: 1.55; resize: vertical; min-height: 64px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:disabled { background: var(--surface-3); color: var(--ink-3); }
.input--mono { font-family: var(--mono); letter-spacing: .02em; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238B938D' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 26px; }
.form-grid { display: grid; gap: 12px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: span 3; }
.help { font-size: 11px; color: var(--ink-3); line-height: 1.5; }
.err { font-size: 11px; color: var(--red); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch i {
  width: 32px; height: 18px; border-radius: 999px; background: var(--line); position: relative; transition: .16s;
  flex: 0 0 32px;
}
.switch i::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: .16s;
}
.switch input:checked + i { background: var(--teal); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch span { font-size: 12.5px; }

.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12.5px; }
.check input { accent-color: var(--accent); width: 14px; height: 14px; }

/* ------------------------------ 标签 / 状态 ------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 2px;
  font-size: 11px; line-height: 1; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid transparent;
}
.chip svg { width: 11px; height: 11px; }
.chip--ok { background: var(--teal-soft); color: var(--teal); }
.chip--warn { background: var(--amber-soft); color: var(--amber); }
.chip--bad { background: var(--red-soft); color: var(--red); }
.chip--info { background: var(--blue-soft); color: var(--blue); }
.chip--accent { background: var(--accent-soft); color: var(--accent); }
.chip--outline { background: transparent; border-color: var(--line); color: var(--ink-2); }
.chip--mono { font-family: var(--mono); letter-spacing: 0; }

.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; font-size: 10.5px; border-radius: 2px; background: var(--surface-3); color: var(--ink-2); letter-spacing: .02em; }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: 0 0 6px; background: var(--ink-4); position: relative; }
.dot--on { background: var(--teal); box-shadow: 0 0 0 3px rgba(11,107,96,.14); }
.dot--off { background: var(--ink-4); }
.dot--warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(182,124,16,.16); }
.dot--bad { background: var(--red); box-shadow: 0 0 0 3px rgba(179,57,43,.14); }
.dot--live { background: var(--accent); }
.dot--live::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--accent);
  animation: pulse 1.8s infinite ease-out;
}
@keyframes pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }

/* ------------------------------ 表格 ------------------------------ */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tbl thead th {
  text-align: left; font-weight: 500; font-size: 11px; color: var(--ink-3);
  letter-spacing: .05em; padding: 8px 12px; white-space: nowrap;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
.tbl tbody td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr.is-select td { background: var(--accent-soft); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.tbl .mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: -.01em; }
.tbl .muted { color: var(--ink-3); }
.tbl .nowrap { white-space: nowrap; }
.tbl--zebra tbody tr:nth-child(even) td { background: rgba(0,0,0,.012); }
.tbl--zebra tbody tr:hover td { background: var(--surface-2); }

.tbl-scroll { max-height: 460px; overflow: auto; }

.pager { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-3); }
.pager .btn { height: 24px; }

/* ------------------------------ 进度 / 仪表 ------------------------------ */
.meter { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; position: relative; }
.meter i { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .5s ease; }
.meter--warn i { background: var(--amber); }
.meter--bad i { background: var(--red); }
.meter--accent i { background: var(--accent); }
.meter--thin { height: 3px; }

.bar-list { display: flex; flex-direction: column; gap: 11px; }
.bar-item .bi-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; gap: 8px; }
.bar-item .bi-top b { font-weight: 500; }
.bar-item .bi-top span { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }

/* ------------------------------ 工具栏 ------------------------------ */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.search {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 2px; background: var(--surface); min-width: 190px;
}
.search svg { width: 13px; height: 13px; color: var(--ink-4); }
.search input { border: 0; outline: 0; background: transparent; font-size: 12.5px; width: 100%; color: var(--ink); }

/* ------------------------------ 弹层 ------------------------------ */
.overlay {
  position: fixed; inset: 0; background: rgba(12,16,14,.42); backdrop-filter: blur(2px);
  z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 4px; box-shadow: var(--shadow-lg);
  width: 560px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column;
  border-top: 3px solid var(--accent); overflow: hidden;
  animation: pop .18s cubic-bezier(.2,.8,.3,1);
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-hd { padding: 15px 18px 12px; display: flex; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--line-2); }
.modal-hd h3 { font-size: 14px; font-weight: 600; }
.modal-hd p { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.modal-hd .x { margin-left: auto; }
.modal-bd { padding: 16px 18px; overflow: auto; }
.modal-ft { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }

.drawer-mask { position: fixed; inset: 0; background: rgba(12,16,14,.34); z-index: 90; animation: fadeIn .16s; }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 620px; max-width: 92vw;
  background: var(--surface); z-index: 91; box-shadow: -20px 0 50px -30px rgba(0,0,0,.5);
  display: flex; flex-direction: column; animation: slideIn .2s cubic-bezier(.2,.8,.3,1);
  border-left: 1px solid var(--line);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-hd { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 10px; }
.drawer-hd h3 { font-size: 14.5px; font-weight: 600; }
.drawer-bd { flex: 1; overflow: auto; padding: 16px 18px; }
.drawer-ft { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: flex-start; gap: 9px; min-width: 260px; max-width: 380px;
  background: var(--dark-2); color: #EDF0EC; padding: 11px 13px; border-radius: 3px;
  box-shadow: var(--shadow-lg); font-size: 12.5px; animation: toastIn .2s ease;
  border-left: 2px solid var(--teal);
}
.toast--warn { border-left-color: var(--amber); }
.toast--bad { border-left-color: var(--accent); }
.toast svg { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 1px; }
.toast .t-sub { color: #9AA39D; font-size: 11.5px; margin-top: 2px; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 告警弹窗（调度室） */
.alarm-popup {
  position: fixed; right: 24px; top: calc(var(--top-h) + 14px); z-index: 150; width: 360px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-lg); border-radius: 3px; overflow: hidden;
  animation: slideDown .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.alarm-popup .ap-hd { display: flex; align-items: center; gap: 8px; padding: 10px 13px 8px; font-size: 11px; color: var(--accent); letter-spacing: .1em; }
.alarm-popup .ap-bd { padding: 0 13px 12px; }
.alarm-popup .ap-bd b { font-size: 13.5px; display: block; }
.alarm-popup .ap-bd p { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.alarm-popup .ap-ft { display: flex; gap: 6px; padding: 9px 13px; background: var(--surface-2); border-top: 1px solid var(--line-2); }

/* ------------------------------ 终端 ------------------------------ */
.term {
  background: #0B0F10; color: #CBD5CD; font-family: var(--mono); font-size: 11.5px;
  border-radius: 3px; padding: 12px 0; overflow: hidden; border: 1px solid #1E2628;
  display: flex; flex-direction: column;
}
.term-bar { display: flex; align-items: center; gap: 7px; padding: 0 14px 9px; border-bottom: 1px solid #1A2224; margin-bottom: 6px; }
.term-bar .lamp { width: 7px; height: 7px; border-radius: 50%; background: #3A4446; }
.term-bar .lamp.r { background: #C4553A; } .term-bar .lamp.y { background: #C79A3C; } .term-bar .lamp.g { background: #3E9C74; }
.term-bar span { margin-left: 6px; color: #6B7772; font-size: 11px; letter-spacing: .04em; }
.term-body { flex: 1; overflow: auto; padding: 0 14px; line-height: 1.75; }
.term-line { display: flex; gap: 10px; white-space: pre-wrap; word-break: break-all; }
.term-line .ts { color: #5A6661; flex: 0 0 auto; }
.term-line .tag { flex: 0 0 auto; padding: 0 4px; border-radius: 2px; font-size: 10px; height: 15px; line-height: 15px; }
.term-line .msg { flex: 1; min-width: 0; }
.term-line.ok .msg { color: #7FBF9A; }
.term-line.err .msg { color: #D9765C; }
.term-line.warn .msg { color: #C9A75C; }
.term-line.info .msg { color: #8FA6B4; }
.term-line .tag.ok { background: rgba(63,156,116,.16); color: #7FBF9A; }
.term-line .tag.err { background: rgba(217,118,92,.16); color: #D9765C; }
.term-line .tag.warn { background: rgba(201,167,92,.16); color: #C9A75C; }
.term-line .tag.info { background: rgba(143,166,180,.14); color: #8FA6B4; }
.term-line .json { color: #93A7A0; }
.term-line .k { color: #7FA9C4; }
.term-line .s { color: #B8C99B; }
.term-line .n { color: #D8A47F; }

/* ------------------------------ 空态 ------------------------------ */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 42px 20px; color: var(--ink-3); gap: 8px; text-align: center; }
.empty svg { width: 28px; height: 28px; opacity: .4; }
.empty b { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.empty span { font-size: 11.5px; }

/* ------------------------------ 选项卡 ------------------------------ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; padding: 9px 14px; font-size: 12.5px; color: var(--ink-3);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: .14s; display: flex; align-items: center; gap: 6px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.tabs button .cnt { font-size: 10.5px; padding: 0 5px; height: 15px; line-height: 15px; border-radius: 8px; background: var(--surface-3); }

/* ------------------------------ 提示条 ------------------------------ */
.note {
  display: flex; gap: 9px; padding: 10px 12px; border-radius: 3px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2);
  line-height: 1.6;
}
.note svg { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 1px; color: var(--ink-3); }
.note--warn { background: var(--amber-soft); border-color: #EFDFBA; color: #7A5410; }
.note--warn svg { color: var(--amber); }
.note--bad { background: var(--red-soft); border-color: #F0D3CF; color: #8A2E22; }
.note--bad svg { color: var(--red); }
.note--ok { background: var(--teal-soft); border-color: #CBE3DD; color: #0A5A50; }
.note--ok svg { color: var(--teal); }
.note b { font-weight: 600; }

/* ------------------------------ 视频墙 ------------------------------ */
.vgrid { display: grid; gap: 10px; }
.vgrid.n1 { grid-template-columns: 1fr; }
.vgrid.n4 { grid-template-columns: repeat(2, 1fr); }
.vgrid.n9 { grid-template-columns: repeat(3, 1fr); }
.vgrid.n16 { grid-template-columns: repeat(4, 1fr); }
.vcell {
  position: relative; background: #0A0D0E; border: 1px solid #232B2E; border-radius: 2px;
  overflow: hidden; aspect-ratio: 16 / 9; cursor: pointer;
}
.vcell canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.vcell.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px -8px rgba(216,72,31,.55); }

/* 真实视频源（video.js） */
.vplayer { position: absolute; inset: 0; overflow: hidden; background: #06090A; }
.vplayer .vsrc {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  object-fit: contain; background: #06090A;
}
.vplayer .vov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.vsrc-err {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: #C9735A; font-size: 12px; line-height: 1.8; padding: 12px;
  background: repeating-linear-gradient(135deg, rgba(216,72,31,.05) 0 10px, transparent 10px 20px), #080B0C;
  z-index: 4;
}
.vsrc-err .tiny { color: #6E7872; font-family: var(--mono); font-size: 10px; word-break: break-all; }

/* 真实识别测试台播放器 */
.lab-player {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #06090A; border: 1px solid #232B2E; border-radius: 2px; overflow: hidden;
}
.lab-player .vsrc { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #06090A; }
.lab-player .vov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lab-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: #6E7872; font-size: 12.5px; line-height: 1.9; padding: 20px; gap: 4px;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.015) 0 12px, transparent 12px 24px), #080B0C;
}
.lab-empty b { display: block; color: #B9C2BB; font-size: 14px; }
.vcell-hd {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3; padding: 6px 8px;
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, rgba(0,0,0,.62), rgba(0,0,0,0));
  font-size: 11px; color: #DDE3DD; letter-spacing: .02em;
}
.vcell-hd .cn { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcell-hd .badge { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: #8C9A93; }
.vcell-ft {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 6px 8px;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(0deg, rgba(0,0,0,.66), rgba(0,0,0,0));
  font-family: var(--mono); font-size: 10.5px; color: #C3CEC6;
}
.vcell-ft .ci { color: #F0A184; }
.vcell-ft .co { color: #8FC9BB; }
.vcell-off { position: absolute; inset: 0; display: grid; place-items: center; background: #06090A; z-index: 2; }
.vcell-off .msg { text-align: center; color: #6D7772; font-size: 11.5px; line-height: 1.7; }
.vcell-off .msg b { display: block; color: #B05C42; font-size: 12.5px; letter-spacing: .06em; }

/* ------------------------------ 时间轴 ------------------------------ */
.timeline { position: relative; height: 46px; background: var(--surface-3); border-radius: 2px; overflow: hidden; border: 1px solid var(--line); }
.timeline .tl-seg { position: absolute; top: 0; bottom: 0; background: rgba(11,107,96,.30); }
.timeline .tl-now { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--accent); z-index: 3; }
.timeline .tl-now::before { content: ""; position: absolute; top: 0; left: -3px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--accent); }
.timeline .tl-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.timeline .tl-ev { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 5px; height: 12px; border-radius: 1px; background: var(--red); z-index: 2; cursor: pointer; }
.timeline .tl-lbl { position: absolute; bottom: 2px; font-size: 9.5px; color: var(--ink-4); font-family: var(--mono); transform: translateX(-50%); }

/* ------------------------------ 拓扑 ------------------------------ */
.topo { position: relative; width: 100%; }
.topo svg { display: block; width: 100%; height: auto; overflow: visible; }

/* ------------------------------ 杂项 ------------------------------ */
.hazard { height: 4px; background: repeating-linear-gradient(45deg, var(--accent) 0 7px, #191E21 7px 14px); opacity: .9; }
.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }
.c1 { color: var(--c1); } .c2 { color: var(--c2); } .c3 { color: var(--c3); }
.muted { color: var(--ink-3); }
.small { font-size: 11.5px; }
.tiny { font-size: 10.5px; }
.b { font-weight: 600; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; }
.clickable { cursor: pointer; }
.rel { position: relative; }
.flex-col { display: flex; flex-direction: column; }
.gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; }

.sk { background: linear-gradient(90deg, var(--surface-3) 25%, var(--line-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 2px; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* 数据条（横向） */
.hbar { display: flex; align-items: center; gap: 8px; }
.hbar .hbar-lbl { width: 86px; font-size: 11.5px; color: var(--ink-2); flex: 0 0 86px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .hbar-track { flex: 1; height: 14px; background: var(--surface-3); border-radius: 2px; position: relative; overflow: hidden; }
.hbar .hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c2); border-radius: 2px; }
.hbar .hbar-val { width: 52px; text-align: right; font-family: var(--mono); font-size: 11.5px; flex: 0 0 52px; }

/* 步骤条 */
.steps { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); }
.step .n { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 10.5px; background: var(--surface); }
.step.is-done .n { background: var(--teal); border-color: var(--teal); color: #fff; }
.step.is-now .n { border-color: var(--accent); color: var(--accent); }
.step.is-now { color: var(--ink); }
.step-line { width: 26px; height: 1px; background: var(--line); margin: 0 8px; }

/* 图表容器 */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-tip {
  position: fixed; z-index: 300; pointer-events: none; background: var(--dark-2); color: #EEF1EC;
  padding: 6px 9px; border-radius: 3px; font-size: 11.5px; box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity .12s; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chart-tip.on { opacity: 1; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; }
.chart-tip .tip-row i { width: 6px; height: 6px; border-radius: 50%; }
.chart-tip b { font-weight: 600; }

/* 打印 */
@media print {
  .rail, .topbar, .page-head .ph-act, .toasts { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .page { padding: 0; }
  body::before { display: none; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* 响应式 */
@media (max-width: 1500px) {
  :root { --rail-w: 66px; }
  .rail-brand { padding: 16px 0; justify-content: center; }
  .brand-txt, .rail-group, .rail-item span, .rail-foot { display: none; }
  .rail-item { justify-content: center; padding: 10px 0; }
  .rail-item .badge-dot { position: absolute; top: 4px; right: 8px; min-width: 15px; height: 14px; }
  .rail-item.is-active::before { left: -6px; }
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1240px) {
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-3-1, .split-2-1, .split-1-2 { grid-template-columns: 1fr; }
  .form-grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ---- 证据片段 / 代码块（V3 新增） ---- */
.clip-cell { background: var(--surface); border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; }
.clip-cell video { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #06090A; }
.clip-meta { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px; border-top: 1px solid var(--line-2); }
.code {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-all;
  background: var(--surface-2); border: 1px solid var(--line-2); border-left: 2px solid var(--c2);
  padding: 8px 10px; border-radius: 2px; color: var(--ink-2);
}
.code .c { color: var(--c1); }
.grid-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1180px) { .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
