/* ==========================================================================
   AndNode 运维平台 · 视觉规范
   设计取向：中性灰阶为主 + 单一强调色；用边框划分层次而非阴影；
             圆角克制；信息密度优先；避免渐变、发光、装饰性图形。
   ========================================================================== */

:root {
  /* 中性色阶 */
  --bg: #fafafa;
  --panel: #ffffff;
  --panel-2: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #a1a1aa;

  /* 强调色（单一，仅用于交互与关键信息） */
  --accent: #18181b;
  --accent-h: #2f2f33;
  --link: #1d4ed8;
  --focus: rgba(24, 24, 27, .12);

  /* 语义色（低饱和，信息优先） */
  --ok-fg: #15803d;    --ok-bg: #f0fdf4;   --ok-bd: #bbf7d0;
  --warn-fg: #a16207;  --warn-bg: #fefce8; --warn-bd: #fde68a;
  --danger-fg: #b91c1c; --danger-bg: #fef2f2; --danger-bd: #fecaca;
  --neutral-fg: #52525b; --neutral-bg: #f4f4f5; --neutral-bd: #e4e4e7;

  /* 进度条 */
  --track: #e4e4e7;
  --bar: #18181b;
  --bar-warn: #ca8a04;
  --bar-danger: #dc2626;

  --radius: 6px;
  --radius-lg: 8px;
  --ambient: rgba(24, 24, 27, .04);
}

html[data-theme="dark"] {
  --bg: #09090b;
  --panel: #131316;
  --panel-2: #1a1a1e;
  --border: #26262b;
  --border-strong: #34343a;
  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #71717a;

  --accent: #fafafa;
  --accent-h: #e4e4e7;
  --link: #7ba7ff;
  --focus: rgba(250, 250, 250, .14);

  --ok-fg: #4ade80;    --ok-bg: #0d2016;   --ok-bd: #1a4229;
  --warn-fg: #fbbf24;  --warn-bg: #241c07; --warn-bd: #453713;
  --danger-fg: #f87171; --danger-bg: #240f0f; --danger-bd: #4b1c1c;
  --neutral-fg: #a1a1aa; --neutral-bg: #1e1e22; --neutral-bd: #2f2f36;

  --track: #26262b;
  --bar: #fafafa;
  --bar-warn: #eab308;
  --bar-danger: #ef4444;
  --ambient: rgba(255, 255, 255, .055);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  /* 顶部一层极淡的中性柔光，避免大面积死平；不是彩色渐变 */
  background:
    radial-gradient(1000px 460px at 50% -160px, var(--ambient), transparent 72%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .15s, color .15s;
}

/* 数字统一等宽，避免跳动 */
.n, .countdown, b, .kv b, td { font-variant-numeric: tabular-nums; }

/* ============================ 布局 ============================ */
.layout { display: flex; min-height: 100vh; }

.side {
  width: 196px; flex: none;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 5;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  flex: none;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--panel);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: 0;
}
.brand-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-txt b { font-size: 13.5px; font-weight: 600; letter-spacing: 0; }
.brand-txt i {
  font-style: normal; font-size: 11px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side nav { padding: 8px; flex: 1; overflow-y: auto; }
.side nav a {
  display: flex; align-items: center; gap: 9px; position: relative;
  padding: 7px 10px; margin-bottom: 1px;
  border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; font-size: 13px;
  transition: background .1s, color .1s;
}
.side nav a svg {
  flex: none; width: 15px; height: 15px; opacity: .7;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  transition: opacity .1s;
}
.side nav a.on svg { opacity: 1; }
.side nav a:hover { background: var(--panel-2); color: var(--text); }
.side nav a.on {
  background: var(--panel-2); color: var(--text); font-weight: 500;
}
.side nav a.on::before {
  content: ''; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 15px; border-radius: 1px; background: var(--text);
}
.side-foot {
  padding: 10px 10px 12px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 1px;
}
.side-foot a, .side-foot button {
  color: var(--text-3); text-decoration: none; font-size: 12.5px;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 6px 8px; border-radius: var(--radius); font-family: inherit;
  transition: background .1s, color .1s;
}
.side-foot a:hover, .side-foot button:hover { background: var(--panel-2); color: var(--text); }

.main { flex: 1; min-width: 0; margin-left: 196px; padding: 22px 26px 56px; }

h3 {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin: 26px 0 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
h3:first-child { margin-top: 0; }
h3 .sub { font-size: 12px; font-weight: 400; color: var(--text-3); }
.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 24px 0 10px;
}
.bar h3 { margin: 0; }

/* ============================ 表格 ============================ */
.table-wrap {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--panel); overflow-x: auto; -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 560px; }
th {
  text-align: left; font-weight: 500; color: var(--text-3); white-space: nowrap;
  padding: 8px 12px; background: var(--panel-2);
  border-bottom: 1px solid var(--border); font-size: 12px;
}
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--panel-2); }
td.wrap { word-break: break-word; color: var(--text-2); font-size: 12px; white-space: normal; }
td.nowrap, .nowrap { white-space: nowrap; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; color: var(--text-2);
}

/* ============================ 统计条 ============================ */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--panel); overflow: hidden;
}
.stat { padding: 14px 16px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
/* 等宽数字：数据刷新时位数不跳动 */
.stat .n { font-size: 20px; font-weight: 600; letter-spacing: -.3px; line-height: 1.3;
           font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

/* ============================ 宿主机卡片 ============================ */
/* 等高网格：卡片内部也用 flex 纵向排布，让进度条与提示贴底对齐 */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  align-items: stretch;
}
.card {
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--border-strong); box-shadow: 0 1px 3px var(--ambient); }

/* 状态点：表达水位状态，卡片本身不做整块变色 */
.card-h {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 11px; font-size: 13.5px;
}
.card-h .dot {
  flex: none; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3); transition: background .2s;
}
.card-h .dot.ok   { background: #16a34a; }
.card-h .dot.warn { background: #d97706; animation: breathe 2.4s ease-in-out infinite; }
.card-h .dot.bad  { background: #dc2626; animation: breathe 1.3s ease-in-out infinite; }
html[data-theme="dark"] .card-h .dot.ok   { background: #4ade80; }
html[data-theme="dark"] .card-h .dot.warn { background: #fbbf24; }
html[data-theme="dark"] .card-h .dot.bad  { background: #f87171; }
@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.8); }
}
.card-h .name {
  flex: 1; font-weight: 600; letter-spacing: -.1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.card-b { display: flex; flex-direction: column; flex: 1; }
.card-b .kv {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding: 2.5px 0;
}
.card-b .kv span { color: var(--text-3); }
.card-b .kv b { font-weight: 600; }
.water {
  height: 5px; background: var(--track); border-radius: 3px;
  margin-top: auto; position: relative; overflow: hidden;
}
.water i {
  display: block; height: 100%; background: var(--bar); border-radius: 3px;
  transition: width .45s ease, background .2s;
}
.water.warn i { background: var(--bar-warn); }
.water.red i { background: var(--bar-danger); }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 8px; }
.empty {
  padding: 30px 18px; text-align: center; font-size: 13px; color: var(--text-3);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
}

/* ============================ 标签 ============================ */
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  border: 1px solid transparent; line-height: 1.5;
}
.t-red   { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-bd); }
.t-grn   { background: var(--ok-bg);     color: var(--ok-fg);     border-color: var(--ok-bd); }
.t-org   { background: var(--warn-bg);   color: var(--warn-fg);   border-color: var(--warn-bd); }
.t-gry   { background: var(--neutral-bg);color: var(--neutral-fg);border-color: var(--neutral-bd); }
.t-blue  { background: var(--neutral-bg);color: var(--text-2);    border-color: var(--neutral-bd); }

/* ============================ 按钮 ============================ */
.btn {
  display: inline-block; background: var(--accent); color: var(--panel);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 6px 13px; font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: opacity .1s, background .1s, border-color .1s;
  white-space: nowrap;
}
.btn:hover { opacity: .88; }
.btn:active { opacity: .76; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.ghost {
  background: var(--panel); color: var(--text-2); border-color: var(--border-strong);
}
.btn.ghost:hover { background: var(--panel-2); color: var(--text); opacity: 1; }
.btn.danger {
  background: var(--panel); color: var(--danger-fg); border-color: var(--border-strong);
}
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger-bd); opacity: 1; }

/* ============================ 提示条 ============================ */
.alert {
  padding: 10px 13px; border-radius: var(--radius); font-size: 12.5px;
  line-height: 1.6; margin-bottom: 14px;
  background: var(--danger-bg); color: var(--danger-fg); border: 1px solid var(--danger-bd);
}
.alert.ok   { background: var(--ok-bg);   color: var(--ok-fg);   border-color: var(--ok-bd); }
.alert.info { background: var(--neutral-bg); color: var(--text-2); border-color: var(--neutral-bd); }
.alert.bad  { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-bd); }
.alert.warn { background: var(--warn-bg);  color: var(--warn-fg);   border-color: var(--warn-bd); }

/* ============================ 表单 ============================ */
.form {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 22px;
}
.form h3 { margin: 22px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.form h3:first-child { margin-top: 0; }
label {
  display: block; margin-bottom: 13px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
}
label input, label select {
  display: block; width: 100%; margin-top: 5px;
  padding: 7px 10px; font-size: 13px; font-family: inherit;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color .1s, box-shadow .1s;
}
label input:focus, label select:focus {
  outline: none; border-color: var(--text-3); box-shadow: 0 0 0 3px var(--focus);
}
label.chk { display: flex; align-items: center; gap: 7px; }
label.chk input { width: auto; margin: 0; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row label { flex: 1; min-width: 146px; }
.form-actions {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
}
.msg { font-size: 12.5px; color: var(--text-3); }
.filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter select, .filter input {
  padding: 6px 10px; font-size: 12.5px; font-family: inherit;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.filter input:focus, .filter select:focus {
  outline: none; border-color: var(--text-3); box-shadow: 0 0 0 3px var(--focus);
}

/* ============================ 弹窗 ============================ */
.mask {
  display: none; position: fixed; inset: 0; z-index: 10;
  background: rgba(24, 24, 27, .42);
}
.mask.on { display: block; }
.modal {
  display: none; position: fixed; z-index: 11;
  top: 8%; left: 50%; transform: translateX(-50%);
  width: 520px; max-width: calc(100vw - 28px); max-height: 84vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.modal.on { display: block; }
.modal h3 { margin-bottom: 14px; font-size: 13.5px; }

/* ============================ 登录 ============================ */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px; background: var(--bg);
}
.login-box {
  width: 340px; max-width: 100%;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px 24px;
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.login-box label { display: block; margin-bottom: 13px; font-size: 12.5px; color: var(--text-2); }
.login-box input {
  width: 100%; margin-top: 5px; padding: 8px 10px; font-size: 13px; font-family: inherit;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.login-box input:focus {
  outline: none; border-color: var(--text-3); box-shadow: 0 0 0 3px var(--focus);
}
.login-box button {
  width: 100%; margin-top: 6px; padding: 9px;
  font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer;
  color: var(--panel); background: var(--accent); border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.login-box button:hover { opacity: .88; }

/* ==========================================================================
   对外公示页 —— 参照状态页（status page）风格：信息优先、极简、无装饰
   ========================================================================== */
.pub-body { min-height: 100vh; background: var(--bg); padding: 0 20px 48px; }
.pub-wrap { max-width: 860px; margin: 0 auto; }

.pub-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 30px 0 18px; border-bottom: 1px solid var(--border);
}
.pub-brand { display: flex; align-items: center; gap: 11px; }
.pub-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; font-size: 17px; }
.pub-title { font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.pub-sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

/* 状态指示：方点 + 文字，不用大圆点发光 */
.pub-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500;
  padding: 3px 9px; border-radius: 4px; border: 1px solid transparent;
}
.pub-state.ok   { background: var(--ok-bg);     color: var(--ok-fg);     border-color: var(--ok-bd); }
.pub-state.busy { background: var(--warn-bg);   color: var(--warn-fg);   border-color: var(--warn-bd); }
.pub-state::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
}

/* 指标行：分隔线式，不用卡片堆叠 */
.pub-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  border-bottom: 1px solid var(--border);
}
.pub-metrics .m { padding: 16px 0 16px 0; }
.pub-metrics .m .n { font-size: 22px; font-weight: 600; letter-spacing: -.4px; line-height: 1.3; }
.pub-metrics .m .l { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.pub-section-title {
  font-size: 12px; font-weight: 500; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 26px 0 10px;
}

/* 限速条目：列表式，左侧信息右侧倒计时 */
.pub-list { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); overflow: hidden; }
.pub-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.pub-item:last-child { border-bottom: none; }
.pub-item .name { font-size: 13.5px; font-weight: 600; letter-spacing: -.1px; }
.pub-item .meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.pub-item .right { text-align: right; flex: none; }
.pub-item .countdown {
  font-size: 13.5px; font-weight: 600; color: var(--danger-fg); white-space: nowrap;
}
.pub-item .until { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.pub-item .bar-mini {
  height: 3px; background: var(--track); border-radius: 2px; margin-top: 8px;
  overflow: hidden; max-width: 190px;
}
.pub-item .bar-mini i {
  display: block; height: 100%; background: var(--bar-danger); border-radius: 2px;
  transition: width 1s linear;
}

.pub-ok {
  padding: 40px 20px; text-align: center; font-size: 13.5px; color: var(--ok-fg);
  background: var(--ok-bg); border: 1px solid var(--ok-bd); border-radius: var(--radius-lg);
}
.pub-ok .t { font-weight: 600; }

.pub-foot {
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3); display: flex;
  justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* ============================ 排行榜 ============================ */
/* 时间区间选择 */
.range-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.segmented {
  display: inline-flex; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; background: var(--panel);
}
.segmented a {
  padding: 6px 13px; font-size: 12.5px; text-decoration: none;
  color: var(--text-2); border-right: 1px solid var(--border);
  transition: background .1s, color .1s;
}
.segmented a:last-child { border-right: none; }
.segmented a:hover { background: var(--panel-2); color: var(--text); }
.segmented a.on { background: var(--accent); color: var(--panel); font-weight: 500; }
.range-bar input[type="date"] {
  padding: 6px 10px; font-size: 12.5px; font-family: inherit;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.range-sep { font-size: 12.5px; color: var(--text-3); }

/* 表格内的占比横条 */
.bar-cell {
  height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; min-width: 60px;
}
.bar-cell i {
  display: block; height: 100%; background: var(--text); border-radius: 3px;
  transition: width .4s ease;
}
html[data-theme="dark"] .bar-cell i { background: var(--text-2); }

/* 名次 */
td.rank {
  font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--text-3); font-size: 12.5px;
}
td.rank.top { color: var(--text); }

/* 单元格副标题 */
.cell-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

/* ============================ 公示页查询 ============================ */
.pub-search { margin: 22px 0 4px; }
.pub-search form { display: flex; gap: 8px; flex-wrap: wrap; }
.pub-search input[type="text"] {
  flex: 1; min-width: 200px; padding: 9px 12px; font-size: 13.5px; font-family: inherit;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.pub-search input[type="text"]:focus {
  outline: none; border-color: var(--text-3); box-shadow: 0 0 0 3px var(--focus);
}
.qr-box {
  margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--panel); padding: 14px 16px;
}
.qr-box .qr-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.qr-box .qr-name { font-size: 14px; font-weight: 600; }
.qr-box .qr-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.qr-box .qr-state { font-size: 13px; font-weight: 600; }
.qr-box.limited { border-color: var(--danger-bd); }
.qr-box.limited .qr-state { color: var(--danger-fg); }
.qr-box.normal  { border-color: var(--ok-bd); }
.qr-box.normal  .qr-state { color: var(--ok-fg); }
.qr-msg { font-size: 12.5px; color: var(--text-3); padding: 10px 0; }
.qr-loading { font-size: 12.5px; color: var(--text-3); padding: 10px 0; }

/* ============================ 响应式 ============================ */
/* 手机端顶栏与遮罩：桌面端隐藏 */
.topbar { display: none; }
.nav-mask { display: none; }

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  /* 侧栏：默认收起为抽屉，点汉堡才展开（原来默认铺开占满屏幕顶部） */
  .side {
    position: fixed; top: 0; bottom: 0; left: 0; width: 246px;
    transform: translateX(-100%); transition: transform .22s ease;
    z-index: 40; border-right: 1px solid var(--border);
  }
  .layout.nav-open .side { transform: translateX(0); box-shadow: 0 10px 34px rgba(0, 0, 0, .22); }
  .layout.nav-open .nav-mask {
    display: block; position: fixed; inset: 0;
    background: rgba(0, 0, 0, .38); z-index: 35;
  }
  .brand { padding: 12px 14px; }
  .side nav { overflow-y: auto; }
  .side nav a { padding: 10px 12px; }
  .side-foot {
    flex-direction: row; align-items: center; gap: 12px;
    padding: 8px 12px; border-top: 1px solid var(--border);
  }
  /* 顶栏（汉堡） */
  .topbar {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 20;
    margin: -12px -12px 12px; padding: 8px 12px;
    background: var(--panel); border-bottom: 1px solid var(--border);
  }
  .burger {
    width: 34px; height: 30px; font-size: 15px; line-height: 1;
    border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
    cursor: pointer;
  }
  .tb-title { font-size: 13px; font-weight: 600; color: var(--text); }
  .tb-spacer { flex: 1; }
  .tb-btn {
    font-size: 12px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 7px;
    background: var(--bg); color: var(--text-2); text-decoration: none; cursor: pointer;
  }
  .main { margin-left: 0; padding: 12px 12px 48px; padding-top: 46px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-bottom: 1px solid var(--border); }
  .stat:nth-child(2n) { border-right: none; }
  .cards { grid-template-columns: 1fr; }
  .modal { top: 4%; width: calc(100vw - 20px); padding: 16px; }
  .form { padding: 16px 14px; }
  .pub-body { padding: 0 14px 40px; }
  .pub-head { padding: 22px 0 14px; }
  .pub-title { font-size: 17px; }
  .pub-metrics { grid-template-columns: repeat(2, 1fr); }
  .pub-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .pub-item .right { text-align: left; }
  .pub-item .bar-mini { max-width: 100%; }
}

/* ============================ 无障碍 ============================ */
/* 尊重系统的"减少动态效果"偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
/* 键盘可见焦点 */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--text); outline-offset: 2px;
}

/* ============================ 侧边栏二级目录 ============================ */
.nav-group { margin-bottom: 4px; }
.nav-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; margin-bottom: 1px;
  font-size: 11.5px; font-weight: 500; color: var(--text-3);
  letter-spacing: .03em; cursor: pointer; user-select: none;
  border-radius: var(--radius); transition: background .1s, color .1s;
}
.nav-title:hover { background: var(--panel-2); color: var(--text-2); }
.nav-title svg {
  width: 13px; height: 13px; flex: none; opacity: .7;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .18s ease;
}
.nav-group.collapsed .nav-title svg { transform: rotate(-90deg); }
.nav-group.collapsed .nav-body { display: none; }
.side nav a.disabled { opacity: .42; cursor: not-allowed; }
.side nav a.disabled:hover { background: none; color: var(--text-2); }
.soon {
  margin-left: auto; font-size: 10px; line-height: 1.6;
  padding: 0 5px; border-radius: 3px;
  background: var(--gry-bg); color: var(--gry-fg); border: 1px solid var(--border);
}

/* ============================ 工单模块 ============================ */
.tk-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--panel); overflow: hidden; margin-bottom: 18px;
}
.tk-stats .s { padding: 13px 15px; border-right: 1px solid var(--border); }
.tk-stats .s:last-child { border-right: none; }
.tk-stats .s .n { font-size: 20px; font-weight: 600; letter-spacing: -.3px;
                  font-variant-numeric: tabular-nums; }
.tk-stats .s .l { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.tk-stats .s .n.warn { color: var(--danger-fg); }
.tk-stats .s .n.ok { color: var(--ok-fg); }

.tk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
@media (max-width: 980px) { .tk-grid { grid-template-columns: 1fr; } }
.tk-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 15px 17px;
}
.tk-card h4 { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 11px; }

.kv2 { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 3px 0; }
.kv2 span { color: var(--text-3); }
.kv2 b { font-weight: 600; }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.check-list li:last-child { border-bottom: none; }
.check-list .mk { flex: none; width: 15px; text-align: center; font-weight: 700; }
.check-list .mk.ok { color: var(--ok-fg); }
.check-list .mk.bad { color: var(--danger-fg); }
.check-list .mk.unk { color: var(--warn-fg); }
.check-list .nm { font-weight: 500; }
.check-list .dt { color: var(--text-3); font-size: 11.5px; margin-top: 1px; }
.check-list .src { color: var(--text-3); font-size: 11px; }

.badge-ai {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  padding: 1px 7px; border-radius: 4px; border: 1px solid var(--neutral-bd);
  background: var(--neutral-bg); color: var(--text-2);
}
.badge-ai.on { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
.badge-ai.diff { border-color: #fde68a; background: #fefce8; color: #a16207; }
.badge-ai.off { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }

.draft-box {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px; font-size: 13px;
  white-space: pre-wrap; line-height: 1.72;
}
.flow-step {
  display: flex; gap: 9px; padding: 6px 0; font-size: 12.5px;
  border-bottom: 1px dashed var(--border);
}
.flow-step:last-child { border-bottom: none; }

.diag-steps { display: flex; flex-direction: column; gap: 0; }
.diag-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.diag-row:last-child { border-bottom: none; }
.diag-row .mk { flex: none; width: 18px; text-align: center; font-weight: 700; font-size: 14px; }
.diag-row .mk.ok { color: var(--ok-fg); }
.diag-row .mk.bad { color: var(--danger-fg); }
.diag-row .mk.unk { color: var(--warn-fg); }
.diag-row .nm { font-weight: 500; font-size: 13px; }
.diag-row .tx { color: var(--text-2); font-size: 12.5px; }
.diag-row .sc { color: var(--text-3); font-size: 11px; margin-top: 2px; }

.verdict {
  border-radius: var(--radius-lg); padding: 15px 18px; margin: 16px 0;
  border: 1px solid var(--border); background: var(--panel);
}
.verdict.ok { border-color: var(--ok-bd); background: var(--ok-bg); }
.verdict.bad { border-color: var(--danger-bd); background: var(--danger-bg); }
.verdict.warn { border-color: var(--warn-bd); background: var(--warn-bg); }
.verdict .v1 { font-size: 15px; font-weight: 650; margin-bottom: 5px; }
.verdict .v2 { font-size: 12.5px; line-height: 1.7; }

.tk-search { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tk-search input {
  flex: 1; min-width: 220px; padding: 9px 12px; font-size: 13.5px; font-family: inherit;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.tk-search input:focus { outline: none; border-color: var(--text-3); box-shadow: 0 0 0 3px var(--focus); }

/* ==========================================================================
   设计系统增强层 · 2026-10-03
   目标：不改结构、不换框架，只提升「排版层级 / 空间纵深 / 交互反馈 / 无障碍」
   取舍：克制优先 —— 运维后台要的是信息密度与可读性，不做花哨动效
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei UI", "Microsoft YaHei", "Source Han Sans SC",
               "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", "Courier New", monospace;
  --ambient-strong: rgba(24, 24, 27, .10);
}
html[data-theme="dark"] { --ambient-strong: rgba(0, 0, 0, .5); }

/* ---------- 1. 排版：层级 + 数字等宽（IP/金额/时间对运维极关键） ---------- */
body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: .005em;
}
h3 { font-weight: 650; letter-spacing: -.01em; }
.tk-card h4, .form h4 {
  font-weight: 650; letter-spacing: .02em; text-transform: none;
  color: var(--text-2);
}
b, strong, .kv2 b, th { font-weight: 650; }
/* 表格化数字，避免 IP / 金额 / 时间戳跳动 */
table, .kv2, .diag-row, .check-list, .tag, .badge-ai, input, select, textarea, .btn {
  font-variant-numeric: tabular-nums;
}
code, kbd {
  font-family: var(--font-mono); font-size: .92em;
  padding: 1px 5px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--border);
}

/* ---------- 2. 空间纵深：背景不再是死平色 ---------- */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 10% -8%,
      color-mix(in srgb, var(--link) 8%, transparent), transparent 62%),
    radial-gradient(900px 460px at 100% 0%,
      color-mix(in srgb, var(--ok-fg) 6%, transparent), transparent 58%);
  background-repeat: no-repeat;
}

/* ---------- 3. 卡片：层次 + 悬停反馈 ---------- */
.tk-card, .card, .empty, .alert {
  border-radius: 12px;
  box-shadow: 0 1px 2px var(--ambient), 0 8px 22px -14px var(--ambient-strong);
}
@media (hover: hover) {
  .tk-card:hover { border-color: var(--border-strong); }
}

/* ---------- 4. 按钮：主次分明 + 按压反馈 + 焦点环 ---------- */
.btn {
  border-radius: 9px; padding: 7px 15px; font-weight: 600;
  box-shadow: 0 1px 2px var(--ambient);
  transition: transform .1s ease, box-shadow .1s ease, background .1s ease, border-color .1s ease;
}
.btn.sm { padding: 4px 11px; border-radius: 7px; }
@media (hover: hover) {
  .btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 3px 8px -2px var(--ambient-strong); }
  .btn:not(:disabled):active { transform: translateY(0); box-shadow: 0 1px 2px var(--ambient); }
}
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.ghost { box-shadow: none; }

/* ---------- 5. 侧栏：激活态更有存在感 ---------- */
.nav-body a { border-radius: 8px; transition: background .12s ease, color .12s ease; }
@media (hover: hover) { .nav-body a:hover { background: var(--panel-2); color: var(--text); } }
.nav-body a.on {
  font-weight: 650;
  background: color-mix(in srgb, var(--link) 12%, transparent);
  color: var(--text);
}
.nav-title { font-weight: 650; letter-spacing: .03em; }

/* ---------- 6. 标签 / 状态：更精致的胶囊 ---------- */
.tag, .badge-ai { border-radius: 999px; padding: 2px 9px; font-weight: 600; }

/* ---------- 7. 表格 / 列表：斑马纹 + 悬停高亮 ---------- */
table tbody tr { transition: background .1s ease; }
table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--panel-2) 55%, transparent);
}
@media (hover: hover) { table tbody tr:hover { background: var(--panel-2); } }

/* ---------- 8. 流程步骤：更清晰的时间线 ---------- */
.diag-row { padding: 12px 0; }
.diag-row .mk {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--panel-2); font-size: 12px;
}
.diag-row .mk.ok { background: var(--ok-bg); }
.diag-row .mk.bad { background: var(--danger-bg); }
.diag-row .nm { font-weight: 600; }

/* ---------- 9. 输入控件：更明确的聚焦 ---------- */
input, select, textarea {
  border-radius: 8px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--link) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 18%, transparent);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* ---------- 10. 无障碍：焦点可见 + 触摸目标 + 减弱动效 ---------- */
a:focus-visible, button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--link); outline-offset: 2px; border-radius: 6px;
}
@media (max-width: 820px) {
  .btn { min-height: 44px; }
  .btn.sm { min-height: 38px; }
  .nav-body a { min-height: 44px; display: flex; align-items: center; }
  body { background-attachment: scroll; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- 11. 打印：去掉装饰，保留信息 ---------- */
@media print {
  .side, .topbar, .btn { display: none !important; }
  .tk-card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
}

/* ---------- 12. 记忆点：标题区的竖条 + 主按钮的唯一高光 ---------- */
.bar {
  display: flex; align-items: center; gap: 11px;
  margin: 2px 0 16px;
}
.bar::before {
  content: ""; flex: none; width: 3px; height: 1.05em; border-radius: 999px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--link) 85%, transparent),
    color-mix(in srgb, var(--ok-fg) 70%, transparent));
}
.bar h3 { margin: 0; font-size: 15px; font-weight: 680; letter-spacing: -.012em; }
.bar h3 .sub { font-size: 12px; font-weight: 450; color: var(--text-3); letter-spacing: 0; }

/* 主按钮：全站唯一的高光，其余保持克制 */
.btn:not(.ghost):not(.danger) {
  background-image: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 88%, #ffffff 12%),
    var(--accent));
}
html[data-theme="dark"] .btn:not(.ghost):not(.danger) {
  background-image: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 86%, #000000 14%),
    var(--accent));
}
/* 关键结论块：轻微内发光，强化"这是一条结论" */
.verdict {
  border-radius: 12px;
  box-shadow: 0 1px 2px var(--ambient), 0 10px 24px -16px var(--ambient-strong);
}
.verdict.ok   { box-shadow: inset 3px 0 0 var(--ok-fg), 0 1px 2px var(--ambient); }
.verdict.warn { box-shadow: inset 3px 0 0 var(--warn-fg), 0 1px 2px var(--ambient); }
.verdict.bad  { box-shadow: inset 3px 0 0 var(--danger-fg), 0 1px 2px var(--ambient); }

/* ---------- 12. 记忆点：标题区的竖条 + 主按钮的唯一高光 ---------- */
.bar {
  display: flex; align-items: center; gap: 11px;
  margin: 2px 0 16px;
}
.bar::before {
  content: ""; flex: none; width: 3px; height: 1.05em; border-radius: 999px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--link) 85%, transparent),
    color-mix(in srgb, var(--ok-fg) 70%, transparent));
}
.bar h3 { margin: 0; font-size: 15px; font-weight: 680; letter-spacing: -.012em; }
.bar h3 .sub { font-size: 12px; font-weight: 450; color: var(--text-3); letter-spacing: 0; }

/* 主按钮：全站唯一的高光，其余保持克制 */
.btn:not(.ghost):not(.danger) {
  background-image: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 88%, #ffffff 12%),
    var(--accent));
}
html[data-theme="dark"] .btn:not(.ghost):not(.danger) {
  background-image: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 86%, #000000 14%),
    var(--accent));
}
/* 关键结论块：轻微内发光，强化"这是一条结论" */
.verdict {
  border-radius: 12px;
  box-shadow: 0 1px 2px var(--ambient), 0 10px 24px -16px var(--ambient-strong);
}
.verdict.ok   { box-shadow: inset 3px 0 0 var(--ok-fg), 0 1px 2px var(--ambient); }
.verdict.warn { box-shadow: inset 3px 0 0 var(--warn-fg), 0 1px 2px var(--ambient); }
.verdict.bad  { box-shadow: inset 3px 0 0 var(--danger-fg), 0 1px 2px var(--ambient); }
