/* ============================================================
   Rollcall — 监控控制台样式
   设计原则：克制的工程风，单一强调色，信息密度优先，
             全部自绘（无外部字体/图标/图表库依赖）
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --line: #e4e7ec;
  --line-2: #d3d8e0;
  --fg: #111827;
  --fg-2: #4b5563;
  --fg-3: #9aa3af;
  --accent: #2f5d8a;
  --accent-2: #3d76ab;
  --accent-soft: rgba(47, 93, 138, 0.09);
  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.1);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.1);
  --crit: #b91c1c;
  --crit-soft: rgba(185, 28, 28, 0.1);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.08);
  --r: 10px;
  --sidebar-w: 232px;
}

html[data-theme="dark"] {
  --bg: #0d1117;
  --panel: #141a22;
  --panel-2: #1a212b;
  --line: #232c38;
  --line-2: #2f3a49;
  --fg: #e6edf3;
  --fg-2: #9ba7b4;
  --fg-3: #6b7785;
  --accent: #6ea8d8;
  --accent-2: #8bbce5;
  --accent-soft: rgba(110, 168, 216, 0.12);
  --ok: #3fb950;
  --ok-soft: rgba(63, 185, 80, 0.12);
  --warn: #d29922;
  --warn-soft: rgba(210, 153, 34, 0.12);
  --crit: #f85149;
  --crit-soft: rgba(248, 81, 73, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

/* 文档自身作为唯一滚动容器并始终预留滚动条位置：
   body 上的 overflow-x:hidden 会额外创建滚动容器，令 gutter 失效，
   长短页面切换时居中的内容会相差半个滚动条宽度。 */
html {
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  overflow-x: clip;
  /* 与公开状态页保持同一套中文回退顺序：Linux 上没有雅黑/苹方，
   * 需要显式落到 Noto/思源黑体，避免中文使用替代字形。 */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC",
               sans-serif;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------- 布局 ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark svg { width: 15px; height: 15px; }
.brand-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 10.5px;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* 侧栏分组是中文（监控/资产/配置），不能套英文标签的大写与宽字距。 */
.nav-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg-3);
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--fg-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-item svg { width: 15px; height: 15px; flex: none; opacity: 0.75; }
.nav-item:hover { background: var(--panel-2); color: var(--fg); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 18%, transparent);
}
.nav-item.active svg { opacity: 1; }
.nav-count {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--crit-soft);
  color: var(--crit);
  font-weight: 600;
}
/* 移动端 .nav-item span 的 display:block 会盖掉 UA 的 [hidden]，需显式隐藏 */
.nav-count[hidden] { display: none; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-foot .icon-btn {
  width: 100%;
  height: auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
/* 与 .view 使用同一宽度容器，宽屏下标题/操作与正文左右边缘对齐 */
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 26px;
}

.page-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
  margin: 0;
}
.page-sub {
  font-size: 12px;
  color: var(--fg-3);
  margin: 1px 0 0;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  position: relative;
}
.search input {
  width: 210px;
  padding: 7px 10px 7px 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--fg-3);
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover { color: var(--fg); border-color: var(--line-2); }
.icon-btn svg { width: 15px; height: 15px; }

.live {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--fg-3);
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 var(--ok);
  animation: pulse 2.4s infinite;
}
.live-time { font-variant-numeric: tabular-nums; color: var(--fg-3); }
.live.live-off .live-dot { background: var(--crit); animation: none; box-shadow: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* 顶栏账号菜单 */
.user-menu { position: relative; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--fg-2);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.user-btn:hover { border-color: var(--line-2); color: var(--fg); }
.user-avatar {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 650;
}
.user-name {
  font-size: 12px;
  font-weight: 550;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-caret { width: 12px; height: 12px; opacity: 0.6; }
.user-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: 210px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  display: none;
}
.user-pop.open { display: block; }
.user-pop-head {
  padding: 8px 10px 10px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.user-pop-name { font-size: 13px; font-weight: 600; }
.user-pop-mail {
  font-size: 11.5px;
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--fg-2);
  font-size: 12.5px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.user-item:hover { background: var(--panel-2); color: var(--fg); }
.user-item.danger:hover { background: var(--crit-soft); color: var(--crit); }

/* 设置页账号卡片 */
.account-panel { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.account-avatar {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
}
.account-info { min-width: 0; }
.account-name { font-size: 13.5px; font-weight: 600; }
.account-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.view {
  padding: 22px 26px 60px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto; /* 宽屏居中，避免右侧留下大片空白 */
  min-width: 0; /* 允许在窄屏收缩，避免表格撑破布局 */
}

/* 通用块 */
.section {
  margin-bottom: 26px;
  min-width: 0;
}
.panel { min-width: 0; }
.panel-stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.section-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 8px;
  gap: 10px;
  margin-bottom: 12px;
}
.section-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0;
}
.section-meta {
  font-size: 11.5px;
  color: var(--fg-3);
  margin-left: auto;
}
/* 区块右侧的说明与操作按钮作为一个整体，避免标题、说明、按钮基线错位 */
.section-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.section-actions .section-meta { margin-left: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.panel-pad { padding: 16px; }

/* ---------- KPI ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  min-width: 0;
  gap: 12px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 15px 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.kpi:hover { border-color: var(--line-2); }
.kpi-label {
  font-size: 11.5px;
  color: var(--fg-3);
  font-weight: 500;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-value {
  font-size: 23px;
  font-weight: 620;
  letter-spacing: -0.03em;
  margin-top: 5px;
  line-height: 1.15;
}
.kpi-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-3);
  margin-left: 2px;
  letter-spacing: 0;
}
.kpi-foot {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 3px;
}

/* ---------- 节点卡片 ---------- */

.node-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 12px;
}

.node-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 15px 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}
.node-card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.node-card.offline { opacity: 0.62; }
.node-card.stale { opacity: 0.82; }
.node-card.alerting { border-left: 2px solid var(--crit); }

.nc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}
.nc-name {
  font-size: 13px;
  font-weight: 620;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.nc-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--fg-3);
  white-space: nowrap;
  flex: none;
}
.nc-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--fg-3);
  flex: none;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.dot.ok { background: var(--ok); }
.dot.off { background: var(--fg-3); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.state-text { font-size: 11.5px; color: var(--fg-3); }

.nc-bars {
  display: grid;
  gap: 7px;
  margin-bottom: 11px;
}
.nb-row {
  display: grid;
  grid-template-columns: 34px 1fr 52px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.nb-label { color: var(--fg-3); }
.nb-track {
  display: block;
  height: 4px;
  border-radius: 3px;
  background: var(--panel-2);
  overflow: hidden;
  border: 1px solid var(--line);
}
.nb-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.nb-val {
  text-align: right;
  color: var(--fg-2);
  font-size: 11px;
}

.nc-spark {
  height: 34px;
  margin: 0 -4px -2px;
}
.nc-spark svg { display: block; width: 100%; height: 34px; }

.nc-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--fg-3);
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.nc-foot .sep { opacity: 0.4; }

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

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg-3);
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-2);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--panel-2); }
td.strong { color: var(--fg); font-weight: 550; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 550;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.mute { background: var(--panel-2); color: var(--fg-3); border: 1px solid var(--line); }

/* ---------- 详情页 ---------- */

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--fg-2);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.back-btn:hover { color: var(--fg); border-color: var(--line-2); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 268px;
  gap: 14px;
  align-items: start;
}

.chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 16px 8px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.chart-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
}
.chart-val {
  margin-left: auto;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.02em;
}
.range-tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--panel);
}
.range-tabs button {
  border: none;
  background: transparent;
  color: var(--fg-3);
  font-size: 11.5px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.14s ease;
  font-family: inherit;
}
.range-tabs button:hover { color: var(--fg); }
.range-tabs button.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.info-list {
  display: grid;
  gap: 0;
}
.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-k { color: var(--fg-3); flex: none; }
.info-v {
  color: var(--fg);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 告警列表 ---------- */

.alert-item {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.alert-item:hover { background: var(--panel-2); }
.alert-item:last-child { border-bottom: none; }
.alert-bar {
  width: 3px;
  border-radius: 2px;
  flex: none;
}
.alert-bar.critical { background: var(--crit); }
.alert-bar.warn { background: var(--warn); }
.alert-bar.info { background: var(--accent); }
.alert-main { min-width: 0; flex: 1; }
.alert-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.alert-msg {
  font-size: 12px;
  color: var(--fg-2);
  margin-top: 2px;
}
.alert-time {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 4px;
}

/* ---------- 空状态 / 骨架 ---------- */

.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--fg-3);
  font-size: 12.5px;
}
.empty svg {
  width: 30px;
  height: 30px;
  opacity: 0.35;
  margin-bottom: 10px;
}

.skel {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--line) 50%, var(--panel-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

@media (max-width: 1080px) {
  :root { --sidebar-w: 66px; }
  .brand-name, .brand-sub, .nav-label, .nav-item span, .nav-count { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .brand { justify-content: center; padding: 4px 0 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .sidebar-foot .btn-text { display: none; }
  .sidebar-foot .icon-btn { justify-content: center; padding: 8px; }
}

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    padding: 6px 8px;
    border-right: none;
    border-top: 1px solid var(--line);
    z-index: 50;
    justify-content: space-around;
  }
  .brand, .sidebar-foot, .nav-label { display: none; }
  .nav-item {
    position: relative;
    flex-direction: column;
    gap: 2px;
    /* 底部 8 个中文标签在 375px 下要放得下，字号不能再小于 10px。 */
    font-size: 10px;
    padding: 6px 4px;
    flex: 1;
  }
  .nav-item span { display: block; }
  .nav-count {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(2px);
    margin: 0;
    padding: 0 4px;
    min-width: 13px;
    font-size: 9px;
    line-height: 1.45;
    text-align: center;
  }
  .view { padding: 16px 14px 84px; }
  .topbar-inner { padding: 11px 14px; gap: 8px; flex-wrap: nowrap; }
  .topbar-inner > div:first-child { min-width: 0; flex: 1; }
  .page-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search { display: none; }
  .live { padding: 4px 8px; font-size: 11px; }
  .live-time { display: none; }
  .user-name, .user-caret { display: none; }
  .user-btn { padding: 2px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 11px 12px; }
  .kpi-value { font-size: 19px; }
  .node-grid { grid-template-columns: minmax(0, 1fr); }
  .page-sub { display: none; }
  .detail-head { flex-wrap: wrap; gap: 8px; }
  table { font-size: 11.5px; }
  thead th, tbody td { padding: 8px 10px; }
}

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

/* ============================================================
   表单 / 按钮 / 弹窗（设置页用）
   ============================================================ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 12px 14px;
  align-items: start;
}

/* 两列紧凑布局（状态页配置等表单） */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 14px;
  align-items: start;
}

/* 实例健康卡片：内容偏宽，窄屏时整块堆叠，而不是把两组数字硬挤成两列 */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  align-items: start;
}
/* 「9 / 预期 6」这类组合在窄屏会被拆到两行，禁止折行 */
.health-stat { white-space: nowrap; }

/* 多选框网格：状态页字段开关、维护窗口/事件的影响范围选择。   .check 自带 padding-top:18px 是为 form-grid 对齐设计的，
   密集网格里会显得上下间距失衡，这里覆写。 */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 6px 12px;
  margin-top: 8px;
}
.check-grid .check {
  padding-top: 0;
  font-size: 12px;
  min-width: 0;
}
.check-grid .check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* textarea 与输入框共用统一规格，仅额外允许纵向缩放 */
.field textarea { resize: vertical; }

/* 节点批量操作条。★ 必须用类而不是内联 display:flex：
   hidden 属性靠 UA 样式表 [hidden]{display:none} 生效，
   内联 display 会把它覆盖掉，批量栏就会在未选中时也常显。 */
.batch-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.batch-bar[hidden] { display: none; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label {
  font-size: 11px;
  font-weight: 550;
  color: var(--fg-2);
  letter-spacing: 0;
}
/* 表单控件统一规格：字段、工具条、筛选条与通道添加器共用一套外观 */
.field input,
.field select,
.field textarea,
.toolbar input,
.toolbar select,
.filter-bar select,
.ch-add select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--fg);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input,
.field select,
.field textarea { width: 100%; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar input:focus,
.toolbar select:focus,
.filter-bar select:focus,
.ch-add select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input:disabled,
.field select:disabled,
.field textarea:disabled,
.toolbar input:disabled,
.toolbar select:disabled,
.filter-bar select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
/* 多选列表沿用输入框规格，不再由每个调用点手写边框/内边距 */
.field select[multiple] {
  min-height: 92px;
  padding: 4px;
  line-height: 1.7;
}
.field select[multiple] option { padding: 3px 7px; border-radius: 4px; }
.field input[type="file"] { padding: 6px 9px; font-size: 12px; }
.field-hint { font-size: 11px; color: var(--fg-3); }

/* 行内工具条：导出、令牌等“控件 + 按钮”混排场景 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.panel-title {
  font-size: 12px;
  font-weight: 650;
  color: var(--fg-2);
  letter-spacing: 0.01em;
}
.alert-link {
  color: var(--fg-2);
  text-decoration: none;
  border-bottom: 1px dotted var(--line-2);
}
.alert-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.alert-node { font-size: 11px; color: var(--fg-3); font-weight: 400; }

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--fg-2);
  padding-top: 18px;
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 14px; height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 9px;
  padding-top: 4px;
  flex-wrap: wrap;
}
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-note { font-size: 12px; color: var(--ok); }
.form-actions.start { justify-content: flex-start; }
.cell-sub { font-size: 11px; color: var(--fg-3); font-weight: 400; margin-top: 2px; }
.section-hint { margin: 10px 0 0; }
.inline-panel { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.inline-panel .btn { margin-left: auto; }
.toolbar .w-name { width: 220px; }
.toolbar .w-paths { width: 280px; }
.code-inline { font-size: 11.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--fg-2);
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover { color: var(--fg); border-color: var(--line-2); background: var(--panel-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.danger { color: var(--crit); }
.btn.danger:hover { background: var(--crit-soft); border-color: var(--crit); color: var(--crit); }
.btn.tiny { padding: 3px 9px; font-size: 11.5px; border-radius: 6px; }
/* 区块标题旁的操作按钮：比表格行内按钮大一档，又不使用一次性内联样式 */
.btn.sm { padding: 5px 11px; font-size: 12px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.row-link { color: inherit; text-decoration: none; border-bottom: 1px dotted transparent; }
.row-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.os-cell { font-size: 11.5px; }
.row-click { cursor: pointer; }
.col-check { width: 26px; }
.cell-compact { font-size: 11.5px; }
.text-crit { color: var(--crit); }
.text-warn { color: var(--warn); }
.text-faint { color: var(--fg-3); }
.target-cell { font-size: 11.5px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark-cell { width: 150px; padding: 6px 14px; }
.spark-box { height: 22px; }
.detail-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

details.panel { padding: 0; }
details.panel > summary.sum {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--accent);
  list-style: none;
  user-select: none;
}
details.panel > summary.sum::-webkit-details-marker { display: none; }
details.panel[open] > summary.sum { border-bottom: 1px solid var(--line); }
details.panel > form { padding: 16px; }

.subhead {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg-3);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 70;
  transform: translate(-50%, 16px);
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 9px;
  background: var(--fg);
  color: var(--panel);
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--crit); color: #fff; }

/* Modal */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.42);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 300;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  max-width: 620px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
  box-shadow: 0 20px 48px rgba(16, 24, 40, 0.24);
}
.modal-title { font-size: 14.5px; font-weight: 600; letter-spacing: 0; }
.modal-sub { font-size: 12px; color: var(--fg-2); margin: 6px 0 8px; }
.modal-text { font-size: 12.5px; color: var(--fg-2); line-height: 1.75; margin: 10px 0 14px; white-space: pre-line; }
.modal-form { display: flex; flex-direction: column; gap: 7px; margin: 12px 0 4px; }
.modal-form .input { width: 100%; }
pre.code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--fg);
  overflow-x: auto;
  margin: 0 0 12px;
  white-space: pre;
}

/* 通知通道卡片 */
.ch-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ch-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.ch-head .ch-name {
  flex: 1;
  min-width: 120px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 550;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
}
.ch-head .ch-name:hover { border-color: var(--line); background: var(--panel); }
.ch-head .ch-name:focus { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }

.check.inline { padding-top: 0; font-size: 11.5px; }

.ch-fields { padding: 14px; }

.ch-add {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.ch-add select { min-width: 170px; }

/* 启用/停用 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 19px;
  flex: none;
  cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  background: var(--line-2);
  border-radius: 20px;
  transition: background 0.18s ease;
}
.switch span::before {
  content: "";
  position: absolute;
  height: 15px;
  width: 15px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(15px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- 主题外观 ---------- */

.field input[type="color"] {
  height: 34px;
  padding: 3px;
  cursor: pointer;
}

/* 紧凑密度只压缩纵向间距，不改变信息层级与断点布局 */
html[data-density="compact"] .section { margin-bottom: 18px; }
html[data-density="compact"] .section-head { margin-bottom: 9px; }
html[data-density="compact"] .panel-pad { padding: 12px; }
html[data-density="compact"] .kpi { padding: 10px 12px 11px; }
html[data-density="compact"] .node-card { padding: 11px 12px 9px; }
html[data-density="compact"] tbody td { padding: 7px 12px; }
html[data-density="compact"] .ch-card { margin-bottom: 8px; }
html[data-density="compact"] .form-grid { gap: 9px 12px; }


/* ---------- 服务商分组 ---------- */

.prov-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.prov-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg-2);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.prov-chip:hover { border-color: var(--accent); color: var(--fg); background: var(--accent-soft); }
.prov-chip .prov-cnt { color: var(--fg-3); font-variant-numeric: tabular-nums; font-size: 11px; }
.prov-chip:hover .prov-cnt { color: var(--accent); }

.prov-group { margin-bottom: 16px; }
.prov-group:last-child { margin-bottom: 0; }
.prov-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.prov-title { font-size: 12.5px; font-weight: 600; letter-spacing: 0; }
.prov-meta { font-size: 11px; color: var(--fg-3); font-variant-numeric: tabular-nums; }

/* ---------- 一键接入向导 ---------- */

.wiz-cmd {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  margin: 4px 0 10px;
}
.wiz-note {
  font-size: 11.5px;
  color: var(--fg-3);
  margin: 0 0 12px;
  line-height: 1.6;
}
.btn.copied { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

.onecmd {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.onecmd pre.code {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.onecmd .btn { flex: none; align-self: flex-start; }

/* ---------- 首页紧凑节点表 ---------- */

/* 固定列宽 + 最小宽度：数字列不会被压到换行，窄屏由 .table-wrap 横向滚动。 */
.node-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}
.node-table th:nth-child(1), .node-table td:nth-child(1) { width: 84px; }
.node-table th:nth-child(2), .node-table td:nth-child(2) { width: 168px; }
.node-table th:nth-child(3), .node-table td:nth-child(3) { width: 74px; }
.node-table th:nth-child(5), .node-table td:nth-child(5),
.node-table th:nth-child(6), .node-table td:nth-child(6),
.node-table th:nth-child(7), .node-table td:nth-child(7) { width: 104px; }
.node-table th:nth-child(8), .node-table td:nth-child(8) { width: 66px; }
.node-table th:nth-child(9), .node-table td:nth-child(9) { width: 136px; }
.node-table th:nth-child(10), .node-table td:nth-child(10) { width: 92px; }
.node-table th:nth-child(11), .node-table td:nth-child(11) { width: 116px; }
.node-table td:nth-child(1),
.node-table td:nth-child(3),
.node-table td.num { white-space: nowrap; }
.node-table td:nth-child(2),
.node-table td:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.node-table thead th {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0;
  color: var(--fg-3); text-transform: none;
  padding: 7px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.node-table tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.node-table tbody tr:last-child td { border-bottom: none; }
.node-table tbody tr[data-node]:hover { background: var(--panel-2); }

.prov-row td {
  background: var(--panel-2);
  padding: 5px 10px !important;
  border-top: 1px solid var(--line);
}
.prov-row .prov-meta { margin-left: 10px; }

/* 节点页列多，窄屏下不再挤压换行，改为容器横向滚动。 */
.nodes-table { min-width: 1120px; }

/* 其余页面的多列表格同样保底宽度，避免手机上被压成逐字换行。 */
.services-table { min-width: 900px; }
.svc-compare-table { min-width: 980px; }
/* 同目标并排：组头行把不同主机分开，行内密度与主服务表一致。 */
.svc-group-row td {
  background: var(--panel-2);
  padding: 8px 14px;
  border-top: 1px solid var(--line);
}
.svc-compare-table tbody tr:first-child.svc-group-row td { border-top: none; }
.svc-group-row .svc-group-meta { margin-left: 8px; font-size: 11.5px; color: var(--fg-3); }
.section-note { margin: 0 0 10px; font-size: 12px; color: var(--fg-3); }
.alerts-table { min-width: 880px; }
.assets-table { min-width: 860px; }
.settings-nodes-table { min-width: 860px; }
.settings-services-table { min-width: 720px; }
.queue-table { min-width: 900px; }
.maint-table { min-width: 680px; }
/* 空表不横向滚动，否则空状态文案会被最小宽度推到屏幕外。 */
.table-wrap table:has(tbody .empty) { min-width: 0; table-layout: auto; }

.tbar {
  display: inline-block;
  vertical-align: middle;
  width: 46px;
  height: 5px;
  border-radius: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-right: 6px;
}
.tbar-fill { display: block; height: 100%; border-radius: 3px; }
.tbar-val { font-size: 11px; color: var(--fg-2); }

.tspark { width: 96px; height: 26px; }
.tspark svg { display: block; width: 100%; height: 100%; }

@media (max-width: 860px) {
  .node-table .tspark { display: none; }
  .node-table th:nth-child(11), .node-table td:nth-child(11) { display: none; }
}

/* ============================================================
   登录层 —— 全屏独立页（账号 + 密码表单、密码显隐、行内错误）
   未登录时整个后台骨架退场，避免"侧栏还在、正文一块小卡"的半登录观感。
   ============================================================ */

/* 门禁激活时整个后台骨架退场，只留登录页 */
body.auth-gate .app { display: none; }
/* 会话探测完成前不渲染骨架，避免未登录用户先看到一屏后台界面。 */
body.auth-checking .app { visibility: hidden; }

/* ★ 必须显式写 [hidden]：下面 #loginLayer 的 display:flex 会覆盖 UA 样式表的
   [hidden]{display:none} —— 结果是"隐藏"的登录层仍然整屏绘制，把仪表盘盖成白屏。
   与 .batch-bar[hidden] 是同一类陷阱，这是本项目第二次踩到。 */
#loginLayer[hidden] { display: none; }

#loginLayer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  /* 角落一抹极淡的品牌色，避免大面积纯灰显得像错误页 */
  background:
    radial-gradient(1100px 460px at 72% -8%, var(--accent-soft), transparent 62%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  /* 内容高于视口时 auto 边距归零，从顶部开始滚动，避免 flex 居中裁掉表单头部。 */
  margin: auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 26px 26px 18px;
}

.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.login-mark svg { width: 22px; height: 22px; }
.login-brand-name { font-size: 16px; font-weight: 650; letter-spacing: .01em; line-height: 1.2; }
.login-brand-sub { font-size: 10px; color: var(--fg-3); letter-spacing: .16em; text-transform: uppercase; }

.login-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.login-sub { font-size: 12.5px; color: var(--fg-2); margin: 0 0 18px; }

.login-error {
  display: none;
  margin: 0 0 12px; padding: 8px 11px; font-size: 12.5px;
  color: var(--crit); background: var(--crit-soft); border-radius: 8px;
}
.login-error.show { display: block; }

.login-field { display: block; margin-bottom: 14px; }
.login-label { display: block; font-size: 12px; font-weight: 550; color: var(--fg-2); margin-bottom: 6px; }
.login-input-wrap { position: relative; display: block; }
.login-input {
  width: 100%;
  padding: 10px 42px 10px 12px;
  font-size: 13.5px;
  color: var(--fg);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.login-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px;
  border: 0; background: transparent; color: var(--fg-3);
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.login-eye:hover { color: var(--fg); background: var(--accent-soft); }

.login-btn {
  width: 100%; padding: 10px 14px;
  font-size: 13.5px; font-weight: 600;
  color: #fff; background: var(--accent);
  border: 0; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .05s;
}
.login-btn:hover { background: var(--accent-2); }
.login-btn:active { transform: translateY(1px); }
.login-btn[disabled] { opacity: .65; cursor: default; }
.login-btn .spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: loginSpin .7s linear infinite;
}
@keyframes loginSpin { to { transform: rotate(360deg); } }

.login-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px; font-size: 11.5px; color: var(--fg-3);
}
.login-foot a { color: var(--fg-2); text-decoration: none; }
.login-foot a:hover { color: var(--accent); }
.login-foot button {
  border: 0; background: none; color: var(--fg-3);
  cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.login-foot button:hover { color: var(--fg); background: var(--accent-soft); }
.login-foot .login-theme-btn {
  width: 28px; height: 28px; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.login-foot .login-theme-btn svg { width: 16px; height: 16px; }

/* 令牌错误时的抖动反馈：重新触发动画用 reflow 技巧 */
@keyframes loginShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.login-card.shake { animation: loginShake .5s both; }

@media (max-width: 640px) {
  #loginLayer { padding: 14px; }
  .login-card { padding: 22px 18px 14px; }
}

/* ---------- 登录门禁：TOTP 字段 ---------- */
/* 作者样式的 display:block 会覆盖 UA 的 [hidden]{display:none}，必须显式兜底。 */
.login-field[hidden] { display: none; }

/* ---------- 通用小节标题 ---------- */
.sub-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-2);
  letter-spacing: 0;
  margin-bottom: 8px;
}

/* ---------- 进度条 ---------- */
.meter {
  height: 6px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.meter > i {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 4px;
  transition: width .4s ease;
}

/* ---------- 续费日历 ---------- */
.renew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.renew-month {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
  min-width: 0;
}
.renew-month-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  font-size: 11px;
  font-weight: 650;
  color: var(--fg-2);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.renew-month-h span {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--fg-3);
}
.renew-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  min-height: 38px;
}
.renew-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 7px;
  background: var(--panel-2);
  font-size: 11.5px;
  min-width: 0;
}
.renew-item.renew-paid { border-left: 2px solid var(--ok); }
.renew-date {
  flex: none;
  width: 18px;
  text-align: center;
  font-size: 10.5px;
  color: var(--fg-3);
}
.renew-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.renew-note { font-size: 11px; color: var(--fg-3); font-weight: 400; }
.renew-del {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
}
.renew-empty {
  padding: 6px 0;
  text-align: center;
  font-size: 11px;
  color: var(--fg-3);
}

/* ---------- 挂载点采集明细 ---------- */
.mount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}
.mount-path {
  flex: none;
  max-width: 45%;
  font-size: 10.5px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mount-val {
  flex: none;
  width: 34px;
  text-align: right;
  font-size: 10.5px;
  color: var(--fg-3);
}

/* ---------- 节点收藏与对比筛选 ---------- */
.fav-btn {
  border: 0;
  background: none;
  color: var(--fg-3);
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.fav-btn:hover { color: var(--warn); background: var(--accent-soft); }
.fav-btn.on { color: var(--warn); }

.compare-filter {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.compare-filter .field { min-width: 180px; }

/* ---------- 图表悬停读数 ---------- */
.chart-wrap { position: relative; }
.chart-tip {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
.chart-tip[hidden] { display: none; }
.chart-tip .tip-time { color: var(--fg-3); }
.chart-tip .tip-val { color: var(--fg); font-weight: 600; }
.chart-x {
  display: flex;
  justify-content: space-between;
  padding: 2px 2px 4px 34px;
  font-size: 10px;
  color: var(--fg-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- 表格排序 / 列显隐 / 分页 ---------- */
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--fg); }
thead th[data-sort="asc"]::after { content: " ↑"; color: var(--accent); }
thead th[data-sort="desc"]::after { content: " ↓"; color: var(--accent); }

.col-picker { display: flex; justify-content: flex-end; margin-bottom: 6px; position: relative; }
.col-picker > summary { list-style: none; }
.col-picker > summary::-webkit-details-marker { display: none; }
.col-menu {
  position: absolute;
  right: 0;
  top: 28px;
  z-index: 30;
  min-width: 160px;
  max-height: 300px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.col-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--fg-2);
  cursor: pointer;
  white-space: nowrap;
}
.col-item:hover { background: var(--panel-2); color: var(--fg); }
.col-item input { margin: 0; }

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
.pager-info { font-size: 11.5px; color: var(--fg-3); }

@media (max-width: 640px) {
  .chart-x { padding-left: 30px; }
  .table-pager { justify-content: space-between; }
}

/* ---------- 键值行（自动备份状态等） ---------- */
.kv-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.kv-row:last-child { border-bottom: none; }
.kv-key { flex: 0 0 84px; color: var(--fg-3); }
.kv-val { color: var(--fg-2); word-break: break-all; }

/* 节点详情：上一台 / 下一台与区间状态 */
.detail-nav { display: flex; align-items: center; gap: 6px; }
.detail-nav .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* 概览：机群趋势与资源 Top */
.seg { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.seg .btn { margin: 0; }
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.chart-panel { padding: 12px 14px; }
.top-panel { padding: 12px 14px; }
.top-panel .panel-head { margin-bottom: 4px; }
.top-row {
  display: grid;
  grid-template-columns: 22px minmax(80px, 150px) 1fr 78px;
  align-items: center;
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.top-row:last-child { border-bottom: 0; }
.top-row:hover { background: var(--panel-2); }
.top-rank { font-size: 11px; color: var(--fg-3); text-align: center; }
.top-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-bar { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.top-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); opacity: .7; }
.top-val { font-size: 11.5px; text-align: right; color: var(--fg-2); }
@media (max-width: 760px) {
  .fleet-grid { grid-template-columns: 1fr; }
  .top-row { grid-template-columns: 20px minmax(70px, 110px) 1fr 66px; }
}

/* ---------------- 能力矩阵（设置页尾部） ---------------- */
.cap-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--fg-2); margin-bottom: 10px; }
.cap-legend b { font-weight: 500; }
.cap-dot { font-size: 13px; line-height: 1; }
.cap-yes { color: var(--ok); }
.cap-part { color: var(--warn); }
.cap-no { color: var(--fg-3); }
.cap-na { color: var(--fg-3); }
.cap-group td { background: var(--panel-2); font-weight: 600; font-size: 12px; color: var(--fg-2); letter-spacing: .02em; }
.cap-desc { color: var(--fg-2); font-size: 12.5px; }

/* ---------------- 节点页状态 chips 与图表脚注 ---------------- */
.state-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.state-chip {
  border: 1px solid var(--line-2); background: var(--panel); color: var(--fg-2);
  border-radius: 999px; padding: 3.5px 11px; font-size: 12px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.state-chip .mono { color: var(--fg-3); font-size: 11px; margin-left: 2px; }
.state-chip:hover:not(:disabled) { border-color: var(--accent); color: var(--fg); }
.state-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.state-chip.on .mono { color: var(--accent); }
.state-chip:disabled { opacity: .45; cursor: default; }
.chart-foot { margin-top: 6px; padding-top: 5px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--fg-3); }

/* ---------------- 展示层第二批：旗帜 / OS 徽标 ---------------- */
.nc-flag { font-size: 13px; line-height: 1; margin-left: -2px; }
.os-badge {
  display: inline-block; margin-right: 5px; padding: 1px 6px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em; vertical-align: 1px;
}
