/* ============================================================
   VOD 全息中控台 ·「仪器纸面」设计系统
   ------------------------------------------------------------
   设计立场：一台被认真设计过的仪器，而不是一张科幻概念图。
     · 扁平：无发光、无切角、无扫描线、无粒子；表面靠 1px 线与留白分层
     · 排印：IBM Plex 承载拉丁与数字，中文回落系统字体；等宽数字对齐
     · 信号：唯一的强调蓝用于交互，红/黄/绿只用于状态语义
     · 动效：只做入场上移、数字滚动、悬停反馈与进度；均为低成本合成动画
   双主题：paper（纸面，默认）/ graphite（石墨暗色），均为扁平处理
   ============================================================ */

/* ---------------- 字体 ---------------- */

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('./vendor/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('./vendor/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('./vendor/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./vendor/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./vendor/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./vendor/fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------------- 令牌 · paper（默认） ---------------- */

:root {
  /* 纸面层级 */
  --void: #f4f4f0;
  --void-2: #ecece7;
  --hull: #ffffff;
  --hull-2: #fafaf7;

  /* 表面 */
  --panel-bg: #ffffff;
  --panel-flat: #ffffff;
  --panel-hi: #f2f2ee;
  --inset: #f2f2ee;

  /* 线 */
  --edge: #e0e1da;
  --edge-hi: #c6c8bd;
  --edge-soft: #e9e9e3;
  --grid: #e4e4de;

  /* 文字 */
  --ink: #191b1e;
  --ink-2: #4b5058;
  --ink-3: #83888f;

  /* 状态（语义固定） */
  --ok: #0e7a4e;
  --warn: #95580b;
  --danger: #c92a1a;
  --queued: #3b5bdb;

  /* 图表分类色（扁平，无渐变） */
  --c1: #0f62fe;
  --c2: #0e7a4e;
  --c3: #c47f00;
  --c4: #c92a1a;
  --c5: #7048a8;
  --c6: #0b7285;
  --c7: #5f6b7a;

  /* 交互强调 */
  --phos: #0f62fe;
  --phos-2: #0b4fc4;
  --phos-dim: #e9f0fe;
  --phos-line: #b7c9f7;
  --phos-glow: 0 0 0 rgba(0, 0, 0, 0);

  /* 排版 */
  --font-ui: 'IBM Plex Sans', -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;

  /* 尺寸 */
  --rail-w: 224px;
  --topbar-h: 56px;
  --radius: 6px;
  --radius-sm: 4px;
  --cut: 0px;

  color-scheme: light;
}

/* ---------------- 令牌 · graphite（暗色扁平） ---------------- */

/* graphite 与宿主环境常用的 "dark" 取值共享同一套暗色令牌 */
html[data-theme='graphite'],
html[data-theme='dark'] {
  --void: #141618;
  --void-2: #0f1113;
  --hull: #1c1f23;
  --hull-2: #191c1f;

  --panel-bg: #1c1f23;
  --panel-flat: #1c1f23;
  --panel-hi: #23262b;
  --inset: #17191c;

  --edge: #2b2f34;
  --edge-hi: #3f454c;
  --edge-soft: #24272b;
  --grid: #202327;

  --ink: #e9ebee;
  --ink-2: #b3b9c0;
  --ink-3: #7d848c;

  --ok: #45c17e;
  --warn: #e0a83c;
  --danger: #f0564a;
  --queued: #7a9eff;

  --c1: #5c9dff;
  --c2: #4cc38a;
  --c3: #e0a83c;
  --c4: #f0564a;
  --c5: #b18cff;
  --c6: #4cc3c3;
  --c7: #9aa4ae;

  --phos: #6ea8ff;
  --phos-2: #93bdff;
  --phos-dim: rgba(110, 168, 255, 0.12);
  --phos-line: rgba(110, 168, 255, 0.42);
  --phos-glow: 0 0 0 rgba(0, 0, 0, 0);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 纸面点阵：极淡的制图底纹，替代粒子与扫描线 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 110% 90% at 50% 30%, #000 20%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 110% 90% at 50% 30%, #000 20%, transparent 90%);
}

.mono,
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--phos-dim);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--edge-hi);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-3);
  background-clip: content-box;
}

/* ---------------- 布局骨架 ---------------- */

.shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
}

/* ---- 左侧导航 ---- */

.rail {
  flex: none;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  background: var(--hull);
  border-right: 1px solid var(--edge);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 13px;
  border-bottom: 1px solid var(--edge);
}

.rail-mark {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
}

.rail-mark i {
  display: block;
  width: 12px;
  height: 12px;
  background: var(--ink);
  position: relative;
}
.rail-mark i::after {
  content: '';
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 6px;
  height: 6px;
  background: var(--phos);
}

.rail-name {
  min-width: 0;
}

.rail-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.rail-sub {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--ink-3);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 10px 16px;
}

.nav-group + .nav-group {
  margin-top: 18px;
}

.nav-group-hd {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 8px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-group-hd::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--edge);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  margin-bottom: 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg {
  flex: none;
  width: 15px;
  height: 15px;
  opacity: 0.8;
}

.nav-item:hover {
  color: var(--ink);
  background: var(--panel-hi);
}

.nav-item.active {
  color: var(--ink);
  background: var(--phos-dim);
  font-weight: 500;
}

.nav-item.active svg {
  opacity: 1;
  color: var(--phos);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--phos);
}

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 0 6px;
  line-height: 16px;
  border-radius: 999px;
  background: var(--panel-hi);
  color: var(--ink-3);
  min-width: 20px;
  text-align: center;
}

.nav-item.active .nav-badge {
  background: var(--phos);
  color: #fff;
}

.nav-badge[data-tone='danger'] {
  background: var(--danger);
  color: #fff;
}

.nav-sub {
  margin: 2px 0 8px 20px;
  padding-left: 10px;
  border-left: 1px solid var(--edge);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  color: var(--ink-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.nav-sub-item:hover {
  color: var(--ink-2);
  background: var(--panel-hi);
}

.nav-sub-item.active {
  color: var(--phos);
  background: var(--phos-dim);
  font-weight: 500;
}

.nav-sub-dot {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.7;
}

.nav-sub-item .nav-sub-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.8;
}

.rail-foot {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--edge);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--ink-3);
  line-height: 1.8;
}

.rail-foot b {
  color: var(--ink-2);
  font-weight: 500;
}

/* ---- 主区 ---- */

.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--hull);
  border-bottom: 1px solid var(--edge);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.tb-left {
  min-width: 0;
  flex: 1 1 auto;
}

.tb-crumb {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.tb-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  position: relative;
}

/* ---------------- 通用控件 ---------------- */

.seg {
  display: inline-flex;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--hull);
  overflow: hidden;
}

.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  padding: 5px 11px;
  cursor: pointer;
  border-right: 1px solid var(--edge-soft);
  transition: color 0.15s, background 0.15s;
}

.seg button:last-child {
  border-right: 0;
}

.seg button:hover {
  color: var(--ink);
  background: var(--panel-hi);
}

.seg button[aria-pressed='true'] {
  color: var(--void);
  background: var(--ink);
}

.seg button .partial {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 4px;
  vertical-align: 1px;
  background: var(--warn);
  border-radius: 1px;
}

.seg button[aria-pressed='true'] .partial {
  background: #ffd7a1;
}

.iconbtn {
  appearance: none;
  flex: none;
  position: relative;
  width: 32px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--hull);
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
}

.iconbtn:hover {
  color: var(--ink);
  border-color: var(--edge-hi);
  background: var(--panel-hi);
}

.iconbtn:active {
  transform: scale(0.96);
}

.iconbtn:disabled {
  opacity: 0.4;
  cursor: default;
}

.iconbtn svg {
  width: 15px;
  height: 15px;
  display: block;
}

.iconbtn[data-attention='true'] {
  color: var(--danger);
  border-color: var(--danger);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--hull);
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--ink-2);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.chip b {
  color: var(--ink);
  font-weight: 600;
}

.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}

.chip[data-state='live'] .dot {
  background: var(--ok);
}

.chip[data-state='connecting'] .dot {
  background: var(--warn);
  animation: breathe 1.1s ease-in-out infinite;
}

.chip[data-state='down'] .dot {
  background: var(--danger);
}

@keyframes breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* 主按钮：墨面白字，扁平重按 */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--void);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
}

.btn:hover {
  opacity: 0.88;
}

.btn:active {
  transform: scale(0.98);
}

.btn svg {
  width: 13px;
  height: 13px;
}

.btn.ghost {
  background: transparent;
  border-color: var(--edge);
  color: var(--ink-2);
}

.btn.ghost:hover {
  border-color: var(--edge-hi);
  color: var(--ink);
  opacity: 1;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ---------------- 页面容器 ---------------- */

.page {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 20px 64px;
}

.page-enter {
  animation: pageIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 子元素错峰入场 */
.stagger > * {
  animation: riseIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.08s; }
.stagger > *:nth-child(4) { animation-delay: 0.11s; }
.stagger > *:nth-child(5) { animation-delay: 0.14s; }
.stagger > *:nth-child(6) { animation-delay: 0.17s; }
.stagger > *:nth-child(7) { animation-delay: 0.2s; }
.stagger > *:nth-child(8) { animation-delay: 0.23s; }

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 12 列栅格 */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.grid + .grid {
  margin-top: 12px;
}

.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-12 { grid-column: span 12; }

/* ---------------- 面板（扁平卡） ---------------- */

.panel {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, background-color 0.25s ease, box-shadow 0.15s ease;
}

.panel:hover {
  border-color: var(--edge-hi);
  box-shadow: 0 1px 3px rgba(20, 22, 26, 0.05);
}

.panel-in {
  position: relative;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.panel-hd {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px 9px;
  border-bottom: 1px solid var(--edge-soft);
}

.panel-hd-t {
  min-width: 0;
  flex: 1 1 auto;
}

.panel-t {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-t .en {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.panel-sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-bd {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px 14px;
}

.panel-bd.flush {
  padding: 0;
}

.menu-btn {
  appearance: none;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.panel:hover .menu-btn,
.menu-btn:focus-visible {
  opacity: 1;
}

.menu-btn:hover {
  color: var(--ink);
  background: var(--panel-hi);
}

.menu-btn svg {
  width: 14px;
  height: 14px;
}

.panel-menu {
  position: absolute;
  z-index: 90;
  min-width: 148px;
  padding: 5px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--hull);
  box-shadow: 0 8px 24px rgba(20, 22, 26, 0.12);
}

.panel-menu button {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  padding: 6px 9px;
  cursor: pointer;
}

.panel-menu button:hover {
  background: var(--panel-hi);
  color: var(--ink);
}

.type-select {
  display: none;
  align-items: center;
  gap: 5px;
}

.type-select.visible {
  display: inline-flex;
}

.type-select label {
  font-size: 10px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

select {
  appearance: none;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--hull);
  color: var(--ink);
  font-size: 11.5px;
  padding: 4px 24px 4px 9px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 13px) 12px, calc(100% - 9px) 12px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

select:hover {
  border-color: var(--edge-hi);
}

/* ---------------- KPI（扁平整数卡） ---------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.kpis.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpis.cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kpi {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, background-color 0.25s ease, box-shadow 0.15s ease;
}

.kpi:hover {
  border-color: var(--edge-hi);
  box-shadow: 0 1px 3px rgba(20, 22, 26, 0.05);
}

.kpi-in {
  padding: 11px 13px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
}

/* 顶部信号线：状态色的唯一直观表达 */
.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--edge-hi);
  opacity: 0.5;
}

.kpi[data-tone='accent']::before { background: var(--phos); opacity: 1; }
.kpi[data-tone='ok']::before { background: var(--ok); opacity: 1; }
.kpi[data-tone='warn']::before { background: var(--warn); opacity: 1; }
.kpi[data-tone='danger']::before { background: var(--danger); opacity: 1; }

.kpi-l {
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-v {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.kpi-v b {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.kpi-u {
  font-size: 10.5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.kpi-m {
  margin-top: auto;
  font-size: 10.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  line-height: 1.5;
}

.kpi-m b {
  color: var(--ink-2);
  font-weight: 500;
  font-family: var(--font-mono);
}

.kpi-spark {
  height: 20px;
  margin: 1px 0 0;
}

.kpi-spark svg {
  display: block;
  width: 100%;
  height: 20px;
}

.kpi-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: transparent;
  overflow: hidden;
}

.kpi-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--phos);
  opacity: 0.85;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.kpi[data-tone='ok'] .kpi-v b { color: var(--ok); }
.kpi[data-tone='warn'] .kpi-v b { color: var(--warn); }
.kpi[data-tone='danger'] .kpi-v b { color: var(--danger); }
.kpi[data-tone='accent'] .kpi-v b { color: var(--phos); }
.kpi[data-tone='ok'] .kpi-bar i { background: var(--ok); }
.kpi[data-tone='warn'] .kpi-bar i { background: var(--warn); }
.kpi[data-tone='danger'] .kpi-bar i { background: var(--danger); }

/* ---------------- 环形仪表（扁平） ---------------- */

.gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0 2px;
}

.gauge-ring {
  position: relative;
  width: 112px;
  height: 112px;
}

.gauge-ring svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-ring .track {
  fill: none;
  stroke: var(--edge);
  stroke-width: 6;
}

.gauge-ring .val {
  fill: none;
  stroke-width: 6;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.gauge-ring .ticks {
  fill: none;
  stroke: var(--edge-soft);
  stroke-width: 1;
}

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.gauge-center b {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.gauge-center span {
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.gauge-meta {
  font-size: 10.5px;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.55;
}

.gauge-meta b {
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ---------------- 图表 ---------------- */

.chart {
  width: 100%;
  height: 260px;
}

.chart[data-h='sm'] { height: 190px; }
.chart[data-h='md'] { height: 260px; }
.chart[data-h='lg'] { height: 320px; }
.chart[data-h='xl'] { height: 380px; }

/* ---------------- 表格 ---------------- */

.tbl-wrap {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel-bg);
  overflow: auto;
  max-height: 340px;
}

.tbl-wrap[data-h='lg'] { max-height: 460px; }
.tbl-wrap[data-h='sm'] { max-height: 240px; }

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

table.tbl th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--inset);
  padding: 8px 12px;
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
}

table.tbl td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--edge-soft);
  color: var(--ink-2);
  vertical-align: top;
}

table.tbl tbody tr:last-child td {
  border-bottom: 0;
}

table.tbl tbody tr {
  transition: background 0.12s;
}

table.tbl tbody tr:hover td {
  background: var(--phos-dim);
}

table.tbl td.n {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.tbl td.nowrap {
  white-space: nowrap;
}

.tid {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  cursor: pointer;
  border-bottom: 1px dashed var(--edge-hi);
  transition: color 0.12s;
}

.tid:hover {
  color: var(--phos);
  border-bottom-color: var(--phos);
}

.cell-msg {
  max-width: 520px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cell-hint {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 10.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 状态标签（扁平：浅底深字） */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--ink-2);
  background: var(--panel-hi);
  white-space: nowrap;
}

.tag .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.tag[data-s='PROCESSING'] {
  color: var(--c1);
  background: color-mix(in srgb, var(--c1) 10%, transparent);
}
.tag[data-s='WAITING'] {
  color: var(--queued);
  background: color-mix(in srgb, var(--queued) 10%, transparent);
}
.tag[data-s='FINISH'] {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}
.tag[data-s='ABORTED'] {
  color: var(--ink-3);
}
.tag[data-s='FAILED'] {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.tag[data-s='IDLE'] {
  color: var(--ink-3);
  border: 1px dashed var(--edge-hi);
  background: transparent;
}

.tag[data-s='PROCESSING'] .dot {
  animation: breathe 1.6s ease-in-out infinite;
}

/* 进度条（扁平） */
.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.progress-track {
  position: relative;
  flex: 1 1 auto;
  height: 5px;
  border-radius: 3px;
  background: var(--inset);
  overflow: hidden;
  min-width: 48px;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 3px;
  background: var(--phos);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-fill.indet {
  width: 32% !important;
  background: linear-gradient(90deg, transparent, var(--phos), transparent);
  animation: sweepX 1.5s ease-in-out infinite;
}

@keyframes sweepX {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(330%); }
}

.progress-text {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
  flex: none;
}

/* ---------------- 空态 ---------------- */

.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.7;
}

.empty b {
  display: block;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 4px;
}

.empty .glyph {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--edge-hi);
  letter-spacing: 0.3em;
  margin-bottom: 8px;
}

/* ---------------- 键值 / 代码 ---------------- */

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 11.5px;
}

.kv-k {
  color: var(--ink-3);
  white-space: nowrap;
}

.kv-v {
  color: var(--ink-2);
  word-break: break-word;
  font-family: var(--font-mono);
}

.kv-v.wide {
  font-family: var(--font-ui);
}

.code {
  position: relative;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--inset);
  overflow: hidden;
}

.code-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 11px;
  border-bottom: 1px solid var(--edge-soft);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.code pre {
  margin: 0;
  padding: 11px 13px;
  overflow: auto;
  max-height: 320px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-btn {
  appearance: none;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--hull);
  color: var(--ink-3);
  width: 24px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.copy-btn:hover {
  color: var(--ink);
  border-color: var(--edge-hi);
}

.copy-btn[data-done='true'] {
  color: var(--ok);
  border-color: var(--ok);
}

.copy-btn svg {
  width: 12px;
  height: 12px;
}

/* ---------------- 标签页 ---------------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--edge);
  margin-bottom: 12px;
}

.tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 13px;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s;
}

.tab:hover {
  color: var(--ink-2);
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--phos);
}

/* ---------------- 时间线 ---------------- */

.timeline {
  display: flex;
  align-items: flex-start;
  padding: 6px 0 2px;
}

.tl-node {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  padding-top: 18px;
}

.tl-node::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--edge);
}

.tl-node:first-child::before { left: 50%; }
.tl-node:last-child::before { right: 50%; }

.tl-node .tl-dot {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 9px;
  height: 9px;
  background: var(--panel-bg);
  border: 1px solid var(--edge-hi);
}

.tl-node.done .tl-dot {
  background: var(--phos);
  border-color: var(--phos);
}

.tl-node.fail .tl-dot {
  background: var(--danger);
  border-color: var(--danger);
}

.tl-l {
  text-align: center;
  font-size: 10px;
  color: var(--ink-3);
  white-space: nowrap;
}

.tl-t {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.tl-gap {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--phos);
  text-align: center;
}

/* ---------------- 生成能力星图（扁平卡） ---------------- */

.capgroup + .capgroup {
  margin-top: 16px;
}

.capgroup-hd {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 9px;
}

.capgroup-hd .g-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.capgroup-hd .g-en {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.capgroup-hd .g-desc {
  font-size: 10.5px;
  color: var(--ink-3);
}

.capgroup-hd .g-line {
  flex: 1 1 auto;
  height: 1px;
  background: var(--edge);
}

.capgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.capnode {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel-bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.capnode:hover {
  border-color: var(--phos-line);
  box-shadow: 0 2px 8px rgba(15, 98, 254, 0.08);
  transform: translateY(-1px);
}

.capnode[data-active='false'] {
  opacity: 0.55;
}

.capnode-ring {
  position: relative;
  flex: none;
  width: 38px;
  height: 38px;
}

.capnode-ring svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.capnode-ring .track {
  fill: none;
  stroke: var(--inset);
  stroke-width: 3.5;
}

.capnode-ring .val {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
}

.capnode-ring .inner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-2);
}

.capnode-body {
  min-width: 0;
  flex: 1 1 auto;
}

.capnode-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.capnode-meta {
  font-size: 10px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.capnode-flag {
  position: absolute;
  top: -1px;
  right: -1px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 0 var(--radius) 0 var(--radius-sm);
  color: #fff;
  background: var(--ink);
  text-transform: uppercase;
}

.capnode[data-active='true'] .capnode-flag {
  background: var(--phos);
}

.capnode[data-active='false'] .capnode-flag {
  background: var(--ink-3);
}

/* ---------------- 素材卡 ---------------- */

.assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 9px;
}

.asset-card {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel-bg);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.asset-card:hover {
  border-color: var(--edge-hi);
  box-shadow: 0 1px 3px rgba(20, 22, 26, 0.05);
}

.asset-card .a-idx {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--phos);
  letter-spacing: 0.1em;
}

.asset-card .a-url {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
  word-break: break-all;
  line-height: 1.5;
}

.asset-card .a-meta {
  font-size: 10px;
  color: var(--ink-3);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.asset-card .a-slot {
  height: 3px;
  border-radius: 2px;
  background: var(--inset);
  position: relative;
  overflow: hidden;
}

.asset-card .a-slot i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: 2px;
  background: var(--phos);
  opacity: 0.7;
  animation: sweepX 1.8s ease-in-out infinite;
}

/* ---------------- 实时脉冲条带 ---------------- */

.pulse-strip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 0 8px;
  min-height: 92px;
}

.pulse-card {
  flex: none;
  width: 196px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel-bg);
  padding: 9px 11px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pulse-card:hover {
  border-color: var(--phos-line);
  box-shadow: 0 2px 8px rgba(15, 98, 254, 0.08);
}

.pulse-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--c1);
}

.pulse-card .p-name {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 5px;
}

.pulse-card .p-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  margin-bottom: 7px;
  padding-left: 5px;
}

.pulse-card .p-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 7px;
  padding-left: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
}

/* ---------------- 告警提示条 ---------------- */

.alertstack {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 20px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 12px;
  border-left: 3px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 7%, var(--panel-bg));
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.6;
}

.alert:first-child {
  margin-top: 14px;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.alert[data-level='danger'] {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, var(--panel-bg));
}

.alert[data-level='info'] {
  border-left-color: var(--phos);
  background: var(--phos-dim);
}

.alert b {
  color: var(--ink);
  font-weight: 600;
  margin-right: 4px;
}

.alert code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--phos);
}

/* ---------------- 弹窗 ---------------- */

.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(20, 22, 26, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  animation: fadeIn 0.16s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(860px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--hull);
  box-shadow: 0 24px 64px rgba(20, 22, 26, 0.22);
  overflow: hidden;
  animation: modalIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-hd {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--edge);
}

.modal-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.modal-sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
  font-family: var(--font-mono);
  word-break: break-all;
}

.modal-bd {
  flex: 1 1 auto;
  overflow: auto;
  padding: 14px 16px 18px;
}

/* ---------------- 告警系统 ---------------- */

/* 铃铛角标 */
.bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  display: none;
}

.bell-badge.visible {
  display: block;
}

/* 右上角弹出设置 */
.popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 320;
  width: 264px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--hull);
  box-shadow: 0 16px 40px rgba(20, 22, 26, 0.16);
  animation: modalIn 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
  overflow: hidden;
}

.popover-hd {
  padding: 11px 14px 9px;
  border-bottom: 1px solid var(--edge-soft);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popover-hd .en {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.popover-bd {
  padding: 12px 14px 14px;
}

.pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
}

.pop-row + .pop-row {
  border-top: 1px solid var(--edge-soft);
}

.pop-row label {
  font-size: 11.5px;
  color: var(--ink-2);
}

.pop-row .side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pop-note {
  margin-top: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--inset);
  font-size: 10.5px;
  color: var(--ink-3);
  line-height: 1.6;
}

/* 开关 */
.switch {
  appearance: none;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--edge-hi);
  position: relative;
  cursor: pointer;
  transition: background 0.18s;
  outline: none;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 22, 26, 0.25);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.switch:checked {
  background: var(--ok);
}

.switch:checked::after {
  transform: translateX(16px);
}

/* 音量滑杆 */
input[type='range'].vol {
  appearance: none;
  width: 110px;
  height: 4px;
  border-radius: 2px;
  background: var(--edge-hi);
  outline: none;
  cursor: pointer;
}

input[type='range'].vol::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--hull);
  box-shadow: 0 1px 3px rgba(20, 22, 26, 0.3);
  cursor: pointer;
}

.vol-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
  width: 34px;
  text-align: right;
}

/* 提示音选择（紧凑） */
.pop-row select {
  font-size: 11px;
  padding: 3px 22px 3px 8px;
}

/* 轻提示 Toast */
.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 340;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 348px;
  max-width: calc(100vw - 36px);
}

.toast {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--edge));
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  background: var(--hull);
  box-shadow: 0 10px 28px rgba(20, 22, 26, 0.16);
  padding: 10px 12px 12px;
  cursor: pointer;
  animation: toastIn 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
  overflow: hidden;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}

.toast.leaving {
  animation: toastOut 0.2s ease both;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(24px); }
}

.toast-hd {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--danger);
  letter-spacing: 0.02em;
}

.toast-hd .t-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 400;
  color: var(--ink-3);
}

.toast-body {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.55;
}

.toast-body b {
  color: var(--ink);
  font-weight: 500;
}

.toast-body .mono {
  font-size: 10.5px;
  color: var(--ink-3);
}

.toast-life {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--danger);
  opacity: 0.55;
  transform-origin: left;
  animation: toastLife 12s linear forwards;
}

@keyframes toastLife {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* 阻塞式警报弹窗 */
.alarm-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(160, 24, 12, 0.28);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  animation: fadeIn 0.15s ease both;
}

.alarm-modal {
  width: min(680px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--danger);
  border-radius: 10px;
  background: var(--hull);
  box-shadow: 0 30px 80px rgba(120, 16, 8, 0.35);
  overflow: hidden;
  animation: alarmIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes alarmIn {
  0% { opacity: 0; transform: scale(0.96) translateY(10px); }
  60% { transform: scale(1.008); }
  100% { opacity: 1; transform: none; }
}

.alarm-hd {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--danger);
  color: #fff;
}

.alarm-hd .a-icon {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  animation: breathe 0.9s ease-in-out infinite;
}

.alarm-hd .a-icon svg {
  width: 17px;
  height: 17px;
}

.alarm-hd .a-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.alarm-hd .a-sub {
  font-size: 11px;
  opacity: 0.92;
  font-family: var(--font-mono);
  margin-top: 1px;
}

.alarm-bd {
  flex: 1 1 auto;
  overflow: auto;
  padding: 14px 18px;
}

.alarm-lead {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
  margin-bottom: 10px;
}

.alarm-lead b {
  color: var(--danger);
  font-family: var(--font-mono);
}

.alarm-list {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.alarm-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--edge-soft);
  font-size: 11.5px;
}

.alarm-item:last-child {
  border-bottom: 0;
}

.alarm-item .ai-time {
  flex: none;
  width: 64px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  padding-top: 1px;
}

.alarm-item .ai-main {
  min-width: 0;
  flex: 1;
}

.alarm-item .ai-name {
  color: var(--ink);
  font-weight: 500;
}

.alarm-item .ai-code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--danger);
}

.alarm-item .ai-msg {
  color: var(--ink-3);
  font-size: 10.5px;
  margin-top: 1px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.alarm-ft {
  flex: none;
  padding: 13px 18px 15px;
  border-top: 1px solid var(--edge);
  display: flex;
  align-items: center;
  gap: 12px;
}

.alarm-ft .a-note {
  flex: 1;
  font-size: 10.5px;
  color: var(--ink-3);
  line-height: 1.55;
}

.alarm-ft .btn.danger {
  flex: none;
  font-size: 12.5px;
  padding: 8px 26px;
}

/* ---------------- 通用工具类 ---------------- */

.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.phos { color: var(--phos); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.sect + .sect { margin-top: 16px; }

.sect-h {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: var(--font-mono);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sect-h::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--edge);
}

.link {
  color: var(--phos);
  cursor: pointer;
  border-bottom: 1px dashed var(--phos-line);
}

.link:hover {
  color: var(--phos-2);
}

ul.plain {
  margin: 4px 0 0;
  padding-left: 16px;
  color: var(--ink-2);
  font-size: 12px;
}

ul.plain li {
  margin-bottom: 3px;
}

/* 顶部加载细条 */
.loadbar {
  height: 2px;
  background: transparent;
  overflow: hidden;
  flex: none;
}

.loadbar i {
  display: block;
  height: 100%;
  width: 30%;
  background: var(--phos);
  animation: sweepX 1.4s linear infinite;
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 1400px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .col-3,
  .col-4,
  .col-5,
  .col-7,
  .col-8,
  .col-9 {
    grid-column: span 6;
  }
}

@media (max-width: 980px) {
  :root {
    --rail-w: 0px;
  }
  .rail {
    position: fixed;
    z-index: 350;
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    width: 240px;
    box-shadow: 0 0 40px rgba(20, 22, 26, 0.2);
  }
  .rail.open {
    transform: none;
  }
  .col-3,
  .col-4,
  .col-5,
  .col-6,
  .col-7,
  .col-8,
  .col-9,
  .col-12 {
    grid-column: span 12;
  }
  .kpis,
  .kpis.cols-4,
  .kpis.cols-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .kpis,
  .kpis.cols-4,
  .kpis.cols-5 {
    grid-template-columns: minmax(0, 1fr);
  }
  .page {
    padding: 12px 12px 48px;
  }
  .topbar {
    padding: 0 12px;
  }
  .toast-wrap {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .rail,
  .topbar,
  .panel-actions,
  .modal-bg,
  .toast-wrap,
  .popover {
    display: none !important;
  }
  body {
    overflow: visible;
    background: #fff;
    color: #000;
  }
  body::after {
    display: none;
  }
}
