/* =============================================================
   ProbePanel · 样式表
   单文件、无框架依赖、无构建步骤 —— 直接改就生效。
   ============================================================= */

:root {
    --bg:          #f4f5f7;
    --surface:     #ffffff;
    --border:      #e5e7eb;
    --border-soft: #f1f5f9;
    --text:        #111827;
    --text-muted:  #6b7280;
    --text-faint:  #9ca3af;
    --primary:     #2563eb;
    --primary-dark:#1d4ed8;
    --success:     #16a34a;
    --success-bg:  #f0fdf4;
    --warn:        #d97706;
    --warn-bg:     #fffbeb;
    --danger:      #dc2626;
    --danger-bg:   #fef2f2;
    --info:        #0891b2;
    --info-bg:     #ecfeff;
    --radius:      10px;
    --radius-sm:   6px;
    --shadow:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --mono:        ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono {
    font-family: var(--mono);
    font-size: 12.5px;
}

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

.sidebar {
    width: 210px;
    flex-shrink: 0;
    background: #111827;
    color: #d1d5db;
    display: flex;
    flex-direction: column;
}
.sidebar .brand {
    padding: 20px 20px 16px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .3px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand small {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #6b7280;
    margin-top: 3px;
    letter-spacing: 0;
}
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: #d1d5db;
    font-size: 13.5px;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav a.disabled {
    color: #4b5563;
    cursor: not-allowed;
    pointer-events: none;
}
.sidebar nav .tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 20px;
    background: rgba(255,255,255,.08);
    color: #9ca3af;
    font-weight: 500;
}
/* ---- 侧栏分组 ----
   ★ 用 <details>：服务端渲染好 open，页面第一帧就是最终形态，换页不会「跳一下」；
     关掉 JS 也能收能展（只是不记住），这是 <details> 白送的。 */
.sidebar nav .navgrp { margin: 6px 0 2px; }
.sidebar nav .navgrp > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: #6b7280;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .06em;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.sidebar nav .navgrp > summary::-webkit-details-marker { display: none; }
/* 自己画三角：默认标记的位置和颜色都改不动 */
.sidebar nav .navgrp > summary::before {
    content: '';
    width: 0; height: 0;
    border-left: 4px solid currentColor;
    border-top: 3.5px solid transparent;
    border-bottom: 3.5px solid transparent;
    transition: transform .12s;
    flex-shrink: 0;
}
.sidebar nav .navgrp[open] > summary::before { transform: rotate(90deg); }
.sidebar nav .navgrp > summary:hover { color: #d1d5db; background: rgba(255,255,255,.05); }
/* 收起时里面有当前页 —— 给个小点，免得「我明明在这一页，侧栏里却找不到它」 */
.sidebar nav .navgrp > summary .dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--primary);
    margin-left: auto;
}
.sidebar nav .navgrp > a { padding-left: 26px; }

.sidebar .foot {
    padding: 14px 20px;
    font-size: 11.5px;
    color: #4b5563;
    border-top: 1px solid rgba(255,255,255,.08);
}

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

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 56px;
    display: flex;
    align-items: center;
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; }
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-muted); }

/* 内容区：居中 + 更宽的上限。
   之前只写了 max-width 没写 margin:auto，宽屏（2K/超宽屏）下内容全挤在左边、
   右侧空出一大块。这里改成居中，并把上限提到 1560px 让宽屏能真正用起来。 */
.content {
    padding: 24px 32px 48px;
    max-width: 1560px;
    width: 100%;
    margin: 0 auto;
}
/* 顶栏内容与主体对齐，避免居中后标题和卡片左边缘错位 */
.topbar-inner {
    max-width: 1560px;
    width: 100%;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---------- 收窄并居中的内容区 ----------
   表单类页面（新建 / 编辑 / 系统设置…）内容天然比列表窄。
   只写 max-width 不写 margin:auto 的话，宽屏下整块会贴在左边缘、
   右侧空出一大片 —— 必须配对使用。 */
.narrow      { max-width: 780px; margin-left: auto; margin-right: auto; }
.narrow-wide { max-width: 940px; margin-left: auto; margin-right: auto; }
.narrow > .card, .narrow-wide > .card,
.narrow > form, .narrow-wide > form { width: 100%; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card > header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card > header h2 { font-size: 14.5px; font-weight: 600; margin: 0; }
.card > header .sub { font-size: 12.5px; color: var(--text-muted); font-weight: 400; }
.card .body { padding: 18px; }
.card .body.tight { padding: 0; }

/* ---------- 统计卡片 ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat .label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat.alert .value { color: var(--danger); }
.stat.good  .value { color: var(--success); }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
thead th {
    background: #fafafa;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: left;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 11px 18px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fcfcfd; }
tbody tr.is-current { background: #eff6ff; }
tbody tr.is-current:hover { background: #e6f0fe; }
td.num, th.num { text-align: right; }
.empty {
    padding: 40px 18px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
}

/* ---------- 徽章 ---------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.6;
    white-space: nowrap;
}
.badge.ok      { background: var(--success-bg); color: var(--success); }
.badge.warn    { background: var(--warn-bg);    color: var(--warn); }
.badge.danger  { background: var(--danger-bg);  color: var(--danger); }
.badge.info    { background: var(--info-bg);    color: var(--info); }
.badge.muted   { background: #f3f4f6;           color: var(--text-muted); }

.dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 6px;
    /* baseline 会让圆点贴到文字顶部，看起来像悬在半空；middle 才和文字齐平 */
    vertical-align: middle;
}
.dot.ok     { background: var(--success); }
.dot.warn   { background: var(--warn); }
.dot.danger { background: var(--danger); }
.dot.muted  { background: var(--text-faint); }
.dot.info   { background: var(--info); }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    /* ★ 必须显式写死行高。
       <a class="btn"> 会继承 body 的 line-height:1.6（12.5px 字号 → 20px），
       而 <button> 的浏览器默认是 normal（约 1.2 → 15px）——
       同样 class 的链接和按钮就会差 1px 高，并排放在一行里一眼能看出来。
       列表里「编辑」是链接、「暂停/删除」是按钮，
       高矮不齐就是这么来的。 */
    line-height: 1.45;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    text-decoration: none;
    white-space: nowrap;
    /* 同一行里的按钮统一基线，不受各自内容影响 */
    vertical-align: middle;
    box-sizing: border-box;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn.ghost-danger { color: var(--danger); border-color: #fecaca; }
.btn.ghost-danger:hover { background: var(--danger-bg); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; min-height: 28px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* =============================================================
   表单
   —— ★ 全站控件统一 38px 高，标签统一 26px（20 行高 + 6 间距）。
      对不齐的根源就在这里：以前只有 .form-row 里的控件写死了 38px，
      卡片里独立的 .field 走的是 padding + line-height 撑出来的 ~42px。
      同一页上并排的两组字段一个 38 一个 42，边框差 4px，
      再加上标签字号也不一样（13 / 12.5），两列的基线就永远错开。
      高度和标签行高只有**写死**才对得齐 —— 靠内容撑出来的高度，
      换个字号、换个浏览器、加一行提示就又不齐了。
   ============================================================= */
.field { margin-bottom: 16px; min-width: 0; }
.field > label {
    display: block;
    height: 20px;
    line-height: 20px;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    /* 标签定高就必须处理超长文本，否则会顶破行高把控件挤下去 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.field > label .req { color: var(--danger); font-weight: 400; }

/* 勾选项是一整句话，不是字段名 —— 不参与上面的定高规则，
   否则「启用（停用的监控项不探测…）」这种长句会被裁掉。 */
.field > label.check-line {
    height: auto;
    line-height: 1.65;
    font-size: 13.5px;
    font-weight: 400;
    white-space: normal;
    overflow: visible;
    cursor: pointer;
}
.field > label.check-line input { margin-right: 5px; vertical-align: -1px; }

/* 说明文字。以前只写了 .field .hint —— 卡片里独立使用的 .hint
   拿不到任何样式，直接掉回正文的 14px 黑字，看着就像没做样式。 */
.hint {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-top: 5px;
}
.hint strong { color: var(--text); font-weight: 600; }
.hint code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; }

/* ★ 每加一种 input 类型都要补进这个选择器。漏掉的那一种会掉回浏览器默认样式：
   宽度按内容缩、高度不是 38px，和旁边的框差着几个像素 ——
   就是那种「看着不对但说不出哪不对」的问题。check-ui.js 里的
   formAlignProbe 用的是同一份类型清单，两边要一起改。 */
input[type=text], input[type=password], input[type=number], input[type=url],
input[type=datetime-local], input[type=date], input[type=time], input[type=email], select {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color .12s, box-shadow .12s;
}
select { padding-right: 6px; }
input[disabled] { background: #f9fafb; color: var(--text-muted); }
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
/* 登录页只有两个框，给得宽松一点 */
.auth-card input[type=text], .auth-card input[type=password] { height: 42px; font-size: 14px; }

/* ---------- 提示条 ---------- */
.flash-stack { margin-bottom: 18px; }
.flash {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    line-height: 1.75;
    margin-bottom: 10px;
    border: 1px solid transparent;
    /* ★ pre-line：保留换行、但空格照常折叠。
       诊断类的报错是多行的（环境、每条路线的结果各一行），
       挤成一坨的话没人看得下去 —— 而报错正是最需要被看完的那种文字。 */
    white-space: pre-line;
}
.flash.success { background: var(--success-bg); color: #15803d; border-color: #bbf7d0; }
.flash.error   { background: var(--danger-bg);  color: #b91c1c; border-color: #fecaca; }
.flash.info    { background: var(--info-bg);    color: #0e7490; border-color: #a5f3fc; }

.notice {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    border: 1px solid var(--border);
    background: #fafafa;
    color: var(--text-muted);
}
.notice.warn { background: var(--warn-bg); border-color: #fde68a; color: #92400e; }

/* ---------- 分页 ---------- */
.pagination {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.pagination .pages { display: flex; gap: 5px; flex-wrap: wrap; }
.pagination a, .pagination span.gap {
    display: inline-block;
    min-width: 32px;
    text-align: center;
    padding: 5px 9px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    background: #f3f4f6;
    text-decoration: none;
}
.pagination a:hover { background: #e5e7eb; text-decoration: none; }
.pagination a.active { background: var(--primary); color: #fff; }
.pagination span.gap { background: transparent; color: var(--text-faint); }
.pagination .meta { font-size: 12.5px; color: var(--text-muted); }

/* ---------- 筛选标签 ---------- */
.filters { display: flex; gap: 6px; }
.filters a {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    background: #f3f4f6;
    color: var(--text-muted);
    text-decoration: none;
}
.filters a.active { background: var(--text); color: #fff; }
.filters a:hover { text-decoration: none; }

/* ---------- 自检列表 ---------- */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li {
    display: flex;
    /* ★ center 而不是 flex-start：flex-start 会把状态圆点顶到行的左上角，
       和它右边的文字不在一条水平线上，看着像掉出去了 */
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
}
.checks li:last-child { border-bottom: none; }
.checks .dot {
    /* li 已经用 gap 控制间距，这里再留 margin 会多出一截 */
    margin-right: 0;
    flex-shrink: 0;
    align-self: center;
}
.checks .name { width: 130px; flex-shrink: 0; font-weight: 500; }
.checks .msg { color: var(--text-muted); word-break: break-all; }



/* ---------- 登录页 ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, #eef2ff 0%, #f8fafc 55%, #f1f5f9 100%);
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15,23,42,.10);
    padding: 34px 32px 30px;
}
.auth-card h1 {
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 4px;
    text-align: center;
}
.auth-card .sub {
    text-align: center;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 26px;
}
.auth-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14.5px; }
.auth-foot {
    margin-top: 18px;
    text-align: center;
    font-size: 11.5px;
    color: var(--text-faint);
}

/* ---------- 杂项 ---------- */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.inline-form { display: inline; }

@media (max-width: 860px) {
    .sidebar { width: 60px; }
    .sidebar .brand small, .sidebar nav a span.label, .sidebar nav .tag, .sidebar .foot { display: none; }
    .sidebar .brand { padding: 18px 10px; text-align: center; font-size: 13px; }
    .sidebar nav a { justify-content: center; padding: 10px 6px; }
    .content { padding: 18px 14px 40px; }
    .topbar-inner { padding: 0 16px; }
    thead th, tbody td { padding-left: 12px; padding-right: 12px; }
}


/* =============================================================
   表单栅格 —— 12 列
   ============================================================= */
/* ★ 为什么是栅格而不是 flex：
     flex 的 flex-basis 会随内容伸缩，同一个字段在「上面一行有 2 个框」
     和「有 4 个框」时宽度完全不同 —— 上下两行的边框对不上，
     这就是「判定策略跟其他表单对不齐」的来源。
     栅格的列宽只由跨度决定：跨 4 列的字段在这一页的任何一行都一样宽，
     上下两行的竖边框天然对齐。

   ★ 每个字段自己写跨度（c2 ~ c12），一行加起来是 12。
     不写就是整行独占（span 12），这对「一个框 + 一段说明」的字段正好。 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    /* 行间距交给 .field 自己的 margin-bottom，
       这样「字段 + 它下面的 hint」始终是一个整体，不会被行间距撑开 */
    gap: 0 16px;
    align-items: start;
}
.form-grid > .field { grid-column: span 12; min-width: 0; }
.form-grid > .c2  { grid-column: span 2; }
.form-grid > .c3  { grid-column: span 3; }
.form-grid > .c4  { grid-column: span 4; }
.form-grid > .c5  { grid-column: span 5; }
.form-grid > .c6  { grid-column: span 6; }
.form-grid > .c7  { grid-column: span 7; }
.form-grid > .c8  { grid-column: span 8; }
.form-grid > .c9  { grid-column: span 9; }
.form-grid > .c12 { grid-column: span 12; }

/* 没有标签的按钮格：靠 padding 顶掉一个标签的高度（20 行高 + 6 间距），
   这样它和同一行的输入框上边缘对齐。
   ★ 不能用 align-self:end —— 同行里只要有一个字段带 hint，
     整行会变高，按钮就被推到输入框下面去了。 */
.form-grid > .field-action { padding-top: 26px; }
.form-grid > .field-action .btn { width: 100%; height: 38px; justify-content: center; }

@media (max-width: 900px) {
    .form-grid > * { grid-column: span 12 !important; }
    .form-grid > .field-action { padding-top: 0; }
}

/* -------------------------------------------------------------
   筛选工具条
   —— 和上面的表单栅格是两回事：工具条里的控件宽度该跟着内容走
      （分组下拉要放得下最长的分组名），而且「重置」按钮是有条件出现的，
      列数会变 —— 硬套 12 列反而会时对时不对。所以这里保留 flex。
   ------------------------------------------------------------- */
.form-bar {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.form-bar > .field { flex: 1 1 200px; margin-bottom: 0; }
.form-bar > .field-action { flex: 0 0 auto; padding-top: 26px; }
.form-bar > .field-action .btn { height: 38px; }
.form-bar .w-sm { flex: 0 1 140px; }
.form-bar .w-md { flex: 0 1 180px; }
.form-bar .w-lg { flex: 0 1 240px; }

@media (max-width: 900px) {
    .form-bar > .field, .form-bar > .field-action { flex: 1 1 100%; }
    .form-bar > .field-action { padding-top: 0; }
    .form-bar > .field-action .btn { width: 100%; }
}

/* 卡片内嵌的测试动作：按钮待在它对应的卡片里，不用翻到页面最底下找。 */
.inline-test {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

/* 表单底部的按钮排 */
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ---------- 分类管理 ---------- */
.cat-group + .cat-group { border-top: 1px solid var(--border); }
.cat-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #fafafa;
    border-bottom: 1px solid var(--border-soft);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}
.cat-group-head span { font-weight: 400; color: var(--text-faint); }
.cat-order { white-space: nowrap; }
.cat-order .inline-form { display: inline-block; }
.btn.icon {
    padding: 0;
    width: 24px;
    height: 24px;
    justify-content: center;
    line-height: 1;
    font-size: 12px;
}
.cat-edit {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.cat-edit input[type=text] {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    min-width: 0;
}
.cat-edit input[name=name]       { flex: 1 1 130px; font-weight: 500; }
.cat-edit input[name=group_name] { flex: 1 1 110px; color: var(--text-muted); }
.cat-edit .btn { flex: 0 0 auto; }

/* 说明用的两列表格 */
table.kv td:first-child {
    width: 92px;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: top;
}

/* =============================================================
   宽表格
   —— 列一多（六七列 + 一排操作按钮），窄屏下浏览器会
      硬把每一列压扁：机器名被拆成竖排、hostname 断成三行、
      右边的操作按钮直接被切掉。这就是「堆叠」的来源。
      正确做法是让表格保持自然宽度、容器横向滚动。
   ============================================================= */
.card .body.tight { overflow-x: auto; }

/* 表格的自然宽度下限。
   ★ 这个值要按列数调，别所有表都用同一个数字：
     调小了 → 浏览器压扁列，名称拆成竖排（就是「堆叠」）
     调大了 → 明明放得下也要横向滚动，而右侧 sticky 的操作列是不透明的，
              它会盖住底下那一列的末尾几个字（时间列最容易中招，
              看起来就像「2026-08-07 16:53:」被切了秒）
   粗略估法：普通列 100~140px + 操作列（按钮数 × 56px）。

   ★★ 定这个值的硬规则：**在最窄的目标分辨率（1280）下不能触发横向滚动。**
     1280 时内容区实测是 1004px，所以带 .sticky-actions 的表这个值不能超过 1000。
     超一点点是最坏的情况：表格刚好宽出十几像素，右侧 sticky 的操作列
     就永久压在旁边那一列的末尾几个字上，而用户根本不知道这里能横向滚 ——
     他看到的就是「字被吃了」。真的放不下就减列、缩短内容，别调大这个数。 */
table.wide { min-width: var(--table-min, 1200px); }

/* ★ 宽表把左右内边距从 18 收到 13。
   看起来是审美调整，其实是**容量**：7 列 × 两侧各省 5px = 70px，
   刚好是「1280 下多出十几像素、sticky 列压住旁边一列」和「正好放得下」的差别。
   数据密集的表本来也不需要 18px 的呼吸感。 */
table.wide thead th, table.wide tbody td { padding-left: 13px; padding-right: 13px; }
table.wide thead th:first-child, table.wide tbody td:first-child { padding-left: 18px; }
table.wide thead th:last-child,  table.wide tbody td:last-child  { padding-right: 18px; }

/* 名称、时间、操作这几列不该被拆行 */
.cell-name   { white-space: nowrap; }
.cell-nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }

/* ★★ 表格里的操作列**不能**用 display:flex。
   一旦 td 变成 flex，它就不再是 table-cell —— 行高被消息撑高时，
   按钮会贴在单元格顶部，和左边那几行的垂直中线对不齐；
   行内的文字基线也会跟着变。这里让 td 保持 table-cell，
   只把「按钮之间 6px」用相邻兄弟 margin 补回来。 */
td.row-actions {
    display: table-cell;
    vertical-align: middle;
    text-align: right;
    white-space: nowrap;
}
td.row-actions > * { vertical-align: middle; }
td.row-actions > * + * { margin-left: 6px; }
td.row-actions > form.inline-form { display: inline-block; margin-left: 6px; }
td.row-actions > form.inline-form:first-child { margin-left: 0; }

/* 列表顶部的筛选表单 */
.filter-form {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: #fcfcfd;
}
.filter-summary {
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--text-muted);
}
.head-actions { display: flex; gap: 8px; align-items: center; }

/* 操作列固定在右侧：横向滚动时按钮始终可见，
   不然一窄屏「删除/编辑」就滚到看不见的地方去了。

   ★★ 必须**显式**加 .sticky-actions 才生效，不能对所有 table.wide 一刀切。
     这一列是**不透明**的，它会盖住底下那一列的末尾几个字。
     最后一列是按钮时这没问题（按钮列本来就该浮在上面）；
     但最后一列如果是「说明」「备注」这种正文，就变成了内容被吃掉 ——
     而且只在窄屏下才出现，宽屏上开发时完全看不到。
     所以：**只有真的以操作按钮结尾的表才加这个类。** */
table.wide.sticky-actions thead th:last-child,
table.wide.sticky-actions tbody td:last-child {
    position: sticky;
    right: 0;
    z-index: 1;
}
table.wide.sticky-actions thead th:last-child { background: #fafafa; }
table.wide.sticky-actions tbody td:last-child {
    background: var(--surface);
    box-shadow: -8px 0 8px -8px rgba(15,23,42,.14);
}
table.wide.sticky-actions tbody tr:hover td:last-child { background: #fcfcfd; }

/* =============================================================
   批次 1 追加：机器列表用到的几个类
   ============================================================= */

/* 分组标签 —— 列表里可点的分组，点了就按这个分组筛选。
   用浅底灰字而不是彩色：一列里出现七八个彩块，页面会花得没法看。 */
.group-tag {
    display: inline-block;
    max-width: 100%;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--border-soft);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}
.group-tag:hover { background: #e6e9ee; color: var(--text); }

/* ★ 分组标签不再和操作按钮并排 —— 一个圆角灰标签夹在三个彩色按钮中间，
   既不像按钮也不像数据，看着就是没对齐。
   卡片视图里它挨着主机地址，表格视图里它自己占一列。 */
.group-tag.none { color: var(--text-faint); background: transparent; padding-left: 0; padding-right: 4px; }

/* 勾选列。★ 宽度写在 th 上，一处改全列改 */
.col-check { width: 34px; text-align: center; }
.col-check input[type=checkbox] { margin: 0; vertical-align: middle; cursor: pointer; }

/* 状态列：徽章 + 底下一行相对时间。
   ★ 用相对时间（"3 分钟前"）而不是完整时间戳，是为了省下一整列 170px ——
     等宽的 19 个字符「2026-08-07 16:53:46」放不进这张表，而表格一旦比容器宽，
     右侧不透明的 sticky 操作列就会压住旁边的内容。完整时间放在 title 里，鼠标一悬停就有。 */
.cell-state { white-space: nowrap; line-height: 1.35; }
.cell-state .faint { display: block; font-size: 11.5px; margin-top: 3px; }

/* 分组改名的一行。
   ★ 不要复用 .cat-edit —— 它的 flex 规则是按 input[name=name] / input[name=group_name]
     写死的，换个字段名就完全不生效，输入框会撑满整行、按钮被挤到下一行。 */
.group-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    flex-wrap: nowrap;
}
.group-row + .group-row { border-top: 1px solid var(--border-soft); }
.group-row .group-tag { flex: 0 0 auto; }
.group-row .count     { flex: 0 0 46px; font-size: 12px; color: var(--text-faint); }
.group-row input[type=text] {
    flex: 1 1 auto;
    min-width: 0;              /* 关键：不加这条，flex 子项不收缩只溢出 */
    max-width: 240px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
}
.group-row input[type=text]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.group-row .btn { flex: 0 0 auto; }
.group-row .spacer { flex: 1 1 auto; min-width: 0; }

@media (max-width: 900px) {
    .group-row { flex-wrap: wrap; }
    .group-row input[type=text] { max-width: none; }
}

/* 批量操作条 —— 默认隐藏，勾中任意一行才出现。
   常驻显示的话，一排「删除」按钮会一直杵在那里，反而增加误点风险。 */
.bulk-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.bulk-bar .picked {
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
}
.bulk-bar .picked strong { color: var(--primary); }
.bulk-bar .sep { flex: 1 1 auto; min-width: 0; }
.bulk-bar select,
.bulk-bar input[type=text] {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: #fff;
    color: var(--text);
    min-width: 0;
    /* ★ 必须显式写 width:auto。
       全局规则给所有 input/select 设了 width:100%，而 flex 子项的
       flex-basis:auto 会去取这个 width —— 结果是下拉框独占一整行，
       后面的输入框和按钮全被挤到第二行。这不是「挤爆」，是我们自己写的 100%。 */
    width: auto;
}
.bulk-bar select { flex: 0 1 150px; }
.bulk-bar .bulk-group { display: block; flex: 0 1 230px; min-width: 0; }
.bulk-bar .bulk-group input[type=text] { width: 100%; }
.bulk-bar > .btn { flex: 0 0 auto; }

/* =============================================================
   批次 2 追加：监控项
   ============================================================= */

/* 类型选择卡片。★ 五种类型的字段完全不同，所以切换走一次 GET
   而不是「全渲染 + JS 显隐」—— 表单里永远只有一组字段，
   提交的东西和看到的东西一致。 */
.type-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}
.type-card {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    text-decoration: none;
    color: var(--text);
    min-width: 0;
}
.type-card:hover { border-color: var(--primary); text-decoration: none; }
.type-card.active {
    border-color: var(--primary);
    background: #eff6ff;
    box-shadow: 0 0 0 1px var(--primary) inset;
}
.type-card .t { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.type-card .d { display: block; font-size: 12px; color: var(--text-muted); line-height: 1.55; }

/* =============================================================
   批次 3 追加：探测节点
   ============================================================= */

/* 一次性令牌卡片 —— 用醒目的边框强调「只显示这一次」 */
.token-card { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset, var(--shadow); }
.token-card > header { background: #eff6ff; }

.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row input[type=text] { flex: 1 1 240px; min-width: 0; width: auto; }
/* ★ 多行命令（自签证书的引导式装机）也要能放进复制行里。
   不给 min-width:0 的话，pre 会被里面最长那一行撑破容器，横向溢出。 */
.copy-row pre.code-block { flex: 1 1 240px; min-width: 0; }
.copy-row .btn { flex: 0 0 auto; }
.copy-row .hint { flex: 1 1 200px; min-width: 0; }

textarea.mono {
    width: 100%;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.6;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fafbfc;
    color: var(--text);
    resize: vertical;
}

/* 监控项表单里的「参与探测的节点」。
   ★ 它单独占一整行，不和「多节点判定」那个下拉挤在一行 ——
     一个是 38px 的下拉，一个是能长到几百像素的勾选框列表，
     并排放永远是一大一小，没有任何对齐方案能救。 */
.probe-picker {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: #fff;
}
.probe-picker label { font-size: 13px; cursor: pointer; margin: 0; }
.probe-picker input[type=radio], .probe-picker input[type=checkbox] {
    margin-right: 5px;
    vertical-align: -1px;
}
.probe-picker .pp-modes { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.probe-picker .pp-modes label { font-weight: 500; }
/* 节点横排成一行行的小项，不是竖着堆 —— 十来个节点也只占两三行 */
.probe-picker .pp-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}
.probe-picker .pp-list label { color: var(--text-muted); }
.probe-picker .faint { font-size: 12px; }

/* 机器详情页里的监控项小表 */
.mini-monitors td, .mini-monitors th { padding-left: 0; }
.mini-monitors td:last-child, .mini-monitors th:last-child { padding-right: 0; text-align: right; }

.is-hidden { display: none !important; }
.cat-view { display: flex; align-items: center; gap: 10px; }
.cat-view .cat-name { font-weight: 500; }
.cat-view .faint { font-size: 12px; }

/* =============================================================
   马卡龙配色的行内操作按钮
   —— 一排全灰的按钮扫过去分不出哪个是哪个，误点「删除」的成本又最高。
      用低饱和的柔和底色 + 同色系深字，既有区分度又不刺眼；
      对比度都在 4.5:1 以上，不是那种看不清的马卡龙。
   ============================================================= */
.btn.mac        { border-width: 1px; font-weight: 500; }
.btn.mac-mint   { background: #ddf4ea; border-color: #b3e3d0; color: #0e7a58; }
.btn.mac-mint:hover   { background: #cceee0; border-color: #94d9be; }
.btn.mac-sky    { background: #ddeefb; border-color: #b1d7f4; color: #15618f; }
.btn.mac-sky:hover    { background: #cae4f8; border-color: #90c6ee; }
.btn.mac-lilac  { background: #e8e4fb; border-color: #cbc2f2; color: #5643b6; }
.btn.mac-lilac:hover  { background: #ddd7f7; border-color: #b8abec; }
.btn.mac-butter { background: #fdf2d6; border-color: #f3dfa4; color: #8a6810; }
.btn.mac-butter:hover { background: #fbeabf; border-color: #edd287; }
.btn.mac-peach  { background: #fde8db; border-color: #f8cdb3; color: #9b5322; }
.btn.mac-peach:hover  { background: #fbdcc8; border-color: #f4bb99; }
.btn.mac-rose   { background: #fde2e8; border-color: #f7c2ce; color: #a52a4a; }
.btn.mac-rose:hover   { background: #fbd1db; border-color: #f2acbe; }

.btn.mac:disabled:hover { background: inherit; }

/* =============================================================
   批次 4：可用率与图表
   —— 服务端渲染的内联 SVG，没有图表库，打开就有图、打印也有图。
   ============================================================= */

/* 四个窗口的可用率并排 */
.avail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}
.avail-cell {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    background: #fff;
    min-width: 0;
}
.avail-cell .k { font-size: 12.5px; color: var(--text-muted); }
.avail-cell .v { font-size: 22px; font-weight: 600; line-height: 1.25; margin-top: 3px; }
.avail-cell .v.ok     { color: var(--success); }
.avail-cell .v.warn   { color: var(--warn); }
.avail-cell .v.danger { color: var(--danger); }
.avail-cell .v.muted  { color: var(--text-faint); }
.avail-cell .d { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; line-height: 1.5; }

/* SVG 用 viewBox 画，宽度交给容器 —— 容器多宽都不变形 */
.chart-blocks, .chart-line { display: block; width: 100%; }
.chart-blocks { height: 34px; }
.chart-line   { height: 64px; }
.chart-empty {
    padding: 18px 0;
    text-align: center;
    color: var(--text-faint);
    font-size: 12.5px;
}
.chart-axis {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-faint);
    margin-top: 5px;
}
.chart-box + .chart-box { margin-top: 18px; }
.chart-box > .t {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 7px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.chart-box > .t .n { color: var(--text-faint); font-weight: 400; }

/* 图例 */
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.chart-legend .c-ok      { background: #16a34a; }
.chart-legend .c-partial { background: #d97706; }
.chart-legend .c-down    { background: #dc2626; }
.chart-legend .c-nodata  { background: #e5e7eb; }

/* =============================================================
   批次 5：被控 Agent 的指标
   ============================================================= */
.metrics {
    display: grid;
    /* ★ 180 是量出来的：机器详情页容器宽 940，(940+12)/(180+12) = 4.9 → 一行 4 个。
       写 190 的话在这个宽度下只放得下 3 个，第 4 个会孤零零地掉到下一行。 */
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.metric {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    background: #fff;
    min-width: 0;
}
.metric .k { font-size: 12.5px; color: var(--text-muted); }
.metric .v { font-size: 22px; font-weight: 600; line-height: 1.25; margin-top: 2px; }
.metric .v.ok     { color: var(--text); }
.metric .v.warn   { color: var(--warn); }
.metric .v.danger { color: var(--danger); }
.metric .v.muted  { color: var(--text-faint); }
.metric .d {
    font-size: 11.5px;
    color: var(--text-faint);
    margin-top: 5px;
    line-height: 1.5;
    word-break: break-all;
}

/* 占用率条 */
.bar {
    height: 5px;
    border-radius: 3px;
    background: var(--border-soft);
    overflow: hidden;
    margin-top: 8px;
}
.bar i { display: block; height: 100%; border-radius: 3px; }
.bar i.ok     { background: var(--success); }
.bar i.warn   { background: var(--warn); }
.bar i.danger { background: var(--danger); }
.bar i.muted  { background: var(--text-faint); }

/* ★★ 失联时整块变灰。
   数字本身是真的，但它是半小时前的 —— 和正常时长得一模一样是最危险的，
   页面会理直气壮地告诉你「一切正常」。 */
.is-stale { opacity: .55; filter: saturate(.35); }

.kv-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--text-muted);
}
.kv-inline strong { color: var(--text); font-weight: 600; }

.disks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}
.disk { min-width: 0; }
.disk .t {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
}
.disk .t .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disk .d { font-size: 11.5px; margin-top: 5px; }

/* ---------------- 通知渠道块（批次 6） ----------------
   四个渠道并列，每个是一个可折叠的小块。
   ★ 不勾选的渠道要把字段折起来 —— 四个渠道全展开有 15 个输入框，
     用户要找的那两个会淹在里面。 */
.chan {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}
.chan-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: var(--bg-soft, #f9fafb);
}
.chan-head .name { font-weight: 600; font-size: 13.5px; margin: 0; cursor: pointer; }
.chan-head .name input { margin-right: 6px; vertical-align: -1px; }
.chan-head .spacer { flex: 1 1 auto; }
.chan-body { padding: 14px 14px 0; border-top: 1px solid var(--border); }
.chan-body .field:last-child { margin-bottom: 14px; }
.chan.off .chan-body { display: none; }

/* 投递记录里的小结果条 */
.deliv { display: flex; flex-wrap: wrap; gap: 6px; }
.deliv .badge { font-weight: 500; }

/* 维护窗口 / 规则页里的「作用范围」两段式选择器 */
.scope-pick { display: flex; gap: 8px; align-items: flex-end; }
.scope-pick > * { min-width: 0; }
.scope-pick select { flex: 1 1 0; }
/* =============================================================
   机器列表 —— 卡片视图（默认）与表格视图

   ★★ 版式是用户从四个方案里挑的：一台一张卡，四个指标是大号数字，
     每块盘都摆得下，分组挨着主机地址、按钮在另一头 ——
     上一版把分组塞在三个彩色按钮中间，既不像按钮也不像数据。

   ★★ 两种视图共用同一套「数值 + 占用条」的小件（.q / .n-*），
     不各写一份：各写一份的下场是同一个 93% 在两个视图里一个红一个黄。
   ============================================================= */

/* 数值按水平上色 —— 两种视图共用 */
.n-ok     { color: var(--success); }
.n-warn   { color: var(--warn); }
.n-danger { color: var(--danger); }
.n-muted  { color: var(--text-faint); }

/* 一个指标：标签 / 数值 / 占用条，三行 */
.q { min-width: 0; display: block; }
.q .k { display: block; font-size: 10.5px; color: var(--text-faint); line-height: 14px; }
.q .v { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.q .u { display: block; height: 3px; border-radius: 2px; background: #eef0f3; overflow: hidden; }
.q .u > i { display: block; height: 100%; border-radius: 2px; }
.q .u.ok     > i { background: var(--success); }
.q .u.warn   > i { background: var(--warn); }
.q .u.danger > i { background: var(--danger); }
.q .u.muted  > i { background: var(--text-faint); }

/* 挂载点前面那个小圆点 */
.dot.ok { background: var(--success); } .dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); } .dot.muted { background: var(--text-faint); }

/* 没装 / 未部署 / 已失联时的那一句 */
.mc-none { font-size: 12.5px; color: var(--text-faint); }
.mc-none a { font-size: 12px; }

/* ---------------- 卡片视图 ---------------- */

/* ★ auto-fill + minmax：1280/1440 一行两张，1600 以上一行三张，
   不用写任何媒体查询。minmax 的下限 430px 是量出来的 ——
   再窄的话四个指标那一排会开始换行。 */
.m-selall {
    display: inline-flex; align-items: center; gap: 7px;
    margin-bottom: 12px;
    font-size: 12.5px; color: var(--text-muted); cursor: pointer;
}
.m-selall input { margin: 0; cursor: pointer; }

.m-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }

.mc { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; }
.mc:hover { border-color: #d7dbe2; }

.mc-h {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: #fcfcfd;
}
.mc-h input[type=checkbox] { margin: 0; cursor: pointer; flex: 0 0 auto; }
.mc-h .mc-id { min-width: 0; }
.mc-h .r1 { display: flex; align-items: center; gap: 8px; }
.mc-h .r2 { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.mc-h .m-name { font-weight: 600; font-size: 13.5px; color: var(--text); text-decoration: none; }
.mc-h .m-name:hover { color: var(--primary); }
.mc-h .host { font-size: 11px; color: var(--text-faint); }
.mc-h .faint { font-size: 11px; }
.mc-h .sp { flex: 1; }
.mc-h .row-actions { gap: 5px; flex: 0 0 auto; }
/* ★ 分组标签在卡头，给一个上限宽度：分组名最长 32 字符，
   不限宽的话一个长名字会把三个按钮挤出卡片。 */
.mc-h .group-tag { max-width: 120px; font-size: 11px; padding: 1px 8px; line-height: 1.7; }
.mc-h .group-tag.none { background: transparent; color: var(--text-faint); padding-left: 0; }

/* ★ min-height 只给一个下限，不写死高度：
   CSS Grid 本来就会把**同一行**的卡片拉到等高。
   写死一个大高度的话，没装 Agent 的卡片下面会空出一大片。 */
.mc-b { padding: 12px 14px 13px; min-height: 110px; }

.mc-quad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; margin-bottom: 11px; }
.mc-quad .q .v { font-size: 17px; line-height: 22px; }
.mc-quad .q .u { margin-top: 3px; }

.mc-disks { display: flex; flex-wrap: wrap; gap: 5px 14px; font-size: 11.5px;
            color: var(--text-muted); margin-bottom: 10px; }
.mc-disks .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; }
.mc-disks .m { font-family: var(--mono); color: var(--text-faint); }

.mc-av { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.mc-av .n { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mc-av .s { font-size: 11.5px; color: var(--text-faint); }
.mc-av .sp { flex: 1; }
/* 备注在这一行右端，截断 + title —— 多行备注会把卡片撑得高矮不一 */
.mc-av .rm { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ★★ 覆盖率低时用虚下划线标出来。面板停了半天 = 没探测 = 没有故障事件 =
   可用率 100%，一个漂亮的谎。 */
.mc-av .thin { border-bottom: 1px dashed currentColor; cursor: help; }

.mc-strip .chart-blocks { width: 100%; height: 14px; display: block; }

.mc-x { font-size: 11px; color: var(--text-faint); margin-top: 10px; padding-top: 9px;
        border-top: 1px dashed var(--border);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-x span + span::before { content: '·'; color: var(--border); margin: 0 6px; }

/* ---------------- 表格视图 ----------------
   机器多了之后的密度兜底。数据和卡片一模一样，只是排得更挤。 */

.cell-name .m-name { font-weight: 600; color: var(--text); text-decoration: none; }
.cell-name .m-name:hover { color: var(--primary); }

/* ★★ .mcell 用 grid + minmax(0,1fr)。
   overflow:hidden **不会**减小元素的「最小内容宽度」，而表格 auto 布局
   是按最小内容宽度撑表的 —— 于是「运行 30 天」那行 nowrap 小字
   会把整张表顶宽二三十像素，刚好落进最坏的区间：表只宽出一点点，
   用户看不出还能横滚，只觉得右边的字被吃掉了。
   grid 的 minmax(0,1fr) 才真的允许子项缩到 0。
   ★ min-height 保证「没装 Agent」和「装了」的行一样高。 */
.mcell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 81px; }
.mcell > * { min-width: 0; }

.tq { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; }
.tq .q .v { font-size: 13px; line-height: 17px; }
.tq .q .u { height: 2px; }

.td-line { font-size: 11.5px; color: var(--text-muted); margin-top: 5px;
           white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-line > span { margin-right: 12px; }
.td-line .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; }
.td-line .m { font-family: var(--mono); color: var(--text-faint); }

.tx-line { font-size: 11px; color: var(--text-faint); margin-top: 5px;
           white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-line span + span::before { content: '·'; color: var(--border); margin: 0 6px; }

/* 可用率列 */
.cell-avail { white-space: nowrap; line-height: 1.4; }
.cell-avail .a1 { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cell-avail .a2 { font-size: 11.5px; color: var(--text-faint); margin-left: 5px; }
.cell-avail .ok     { color: var(--success); }
.cell-avail .warn   { color: var(--warn); }
.cell-avail .danger { color: var(--danger); }
.cell-avail .muted  { color: var(--text-faint); }
.cell-avail .thin   { border-bottom: 1px dashed currentColor; cursor: help; }
.av-strip { margin-top: 5px; width: 118px; }
.av-strip .chart-blocks { width: 100%; height: 14px; display: block; }

/* ★ 分组列必须 nowrap。这一列旁边是 width:100% 的「机器内部」，
   在 table-layout:auto 下它会把别的列压到**最小内容宽度** ——
   而中文标签的最小内容宽度是**一个字**，于是「大带宽」被竖着排成三行。
   th 上写的 84px 拦不住这件事，只有 nowrap 能。 */
.cell-group { white-space: nowrap; }

/* 备注：固定窄列 + 截断 + title。
   ★ 不能用 .cell-clip（那个类靠 max-width:1px 实现，最小内容宽度是 0，
     碰上 width:100% 的邻居会被压到只剩两三个字）。
     改成内层 span 写死宽度，这一列就永远是这么宽。 */
.cell-remark { color: var(--text-muted); }
.cell-remark > span {
    display: block; width: 90px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 视图切换开关 */
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-switch a {
    padding: 4px 12px;
    font-size: 12.5px;
    color: var(--text-muted);
    background: #fff;
    text-decoration: none;
    line-height: 20px;
}
.view-switch a + a { border-left: 1px solid var(--border); }
.view-switch a.on { background: var(--text); color: #fff; }
.view-switch a:hover { text-decoration: none; }

/* =============================================================
   可悬停的折线图（批次 8）

   ★★ 坐标轴文字全部是 HTML，不进 SVG。
     图的 SVG 是 preserveAspectRatio="none"（宽度随容器走），
     放进去的 <text> 会跟着被横向拉扁 —— 字看起来像被压过一遍。
   ============================================================= */
.chart-i + .chart-i { margin-top: 20px; }
.chart-i .ci-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12.5px;
    margin-bottom: 8px;
}
.chart-i .ci-title  { font-weight: 500; }
.chart-i .ci-hint   { color: var(--text-faint); font-size: 11.5px; margin-left: auto; }
.chart-i .ci-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--text-muted); }
.chart-i .ci-legend i {
    display: inline-block; width: 9px; height: 9px;
    border-radius: 2px; margin-right: 4px; vertical-align: -1px;
}

/* 左边一条 Y 轴刻度 + 右边画图区 */
.chart-i .ci-wrap { display: grid; grid-template-columns: 46px 1fr; gap: 0; }
.chart-i .ci-y { position: relative; }
.chart-i .ci-y span {
    position: absolute;
    right: 8px;
    /* ★ -0.7em 把文字的中线对到刻度线上。不写的话文字顶边对齐刻度，
       整列刻度看起来比网格线**高半行**，像是没对齐。 */
    margin-top: -0.7em;
    font-size: 10.5px;
    color: var(--text-faint);
    white-space: nowrap;
}
.chart-i .ci-plot {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    /* ★ overflow:hidden 让气泡不会溢出卡片；配合 JS 里的边界判断，
       鼠标移到最右边时气泡会翻到左侧显示。 */
    overflow: hidden;
    cursor: crosshair;
    touch-action: none;      /* 触屏拖动查看时不要顺带滚动页面 */
}
.chart-i .ci-svg { display: block; width: 100%; height: 150px; }

/* 十字线 / 圆点 / 气泡 —— 默认 hidden，JS 才会显示。
   ★ 全部 pointer-events:none，否则鼠标一移上去就触发 pointerleave，
     十字线开始疯狂闪烁。 */
.chart-i .ci-cross {
    position: absolute; top: 0; bottom: 0; width: 1px;
    background: rgba(37,99,235,.45);
    pointer-events: none;
}
.chart-i .ci-dot {
    position: absolute; width: 7px; height: 7px; border-radius: 50%;
    margin: -3.5px 0 0 -3.5px;
    box-shadow: 0 0 0 2px #fff;
    pointer-events: none;
}
.chart-i .ci-tip {
    position: absolute; top: 8px;
    min-width: 118px;
    padding: 6px 9px;
    border-radius: var(--radius-sm);
    background: rgba(17,24,39,.92);
    color: #fff;
    font-size: 11.5px;
    line-height: 1.7;
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
}
.chart-i .ci-tip .t { color: #9ca3af; font-family: var(--mono); font-size: 11px; margin-bottom: 2px; }
.chart-i .ci-tip .r { display: grid; grid-template-columns: 10px auto 1fr; gap: 0 6px; align-items: center; }
.chart-i .ci-tip .r i { width: 8px; height: 8px; border-radius: 2px; }
.chart-i .ci-tip .r .l { color: #d1d5db; }
.chart-i .ci-tip .r .v { text-align: right; font-weight: 600; }

.chart-i .ci-x {
    display: flex;
    justify-content: space-between;
    margin: 5px 0 0 46px;
    font-size: 10.5px;
    color: var(--text-faint);
    font-family: var(--mono);
}

/* 时间跨度切换 —— 和列表页的完整/紧凑用同一套外观 */
.range-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.range-switch a {
    padding: 4px 11px; font-size: 12.5px; color: var(--text-muted);
    background: #fff; text-decoration: none; line-height: 20px;
}
.range-switch a + a { border-left: 1px solid var(--border); }
.range-switch a.on { background: var(--text); color: #fff; }
.range-switch a:hover { text-decoration: none; }

/* 延迟图上方的监控项选择（批次 8）。
   ★ 用链接而不是 <select>：多几个监控项时一眼能看到全部，
     而且当前选中的那个能被浏览器记进历史 —— 刷新后不会跳回默认那个。 */
.mon-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12.5px; }
.mon-pick .k { color: var(--text-muted); }
.mon-pick a {
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    text-decoration: none;
}
.mon-pick a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.mon-pick a.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* =============================================================
   存储用量页（批次 8）
   ============================================================= */

/* 降采样阶梯：明细 → 分钟 → 小时。
   ★ 画成三级台阶而不是一段说明文字：用户要建立的是
     「同一份数据在三个粒度上各存一份，越久越粗」这个模型，
     图形能一眼看出层级，段落不能。 */
.ladder { display: grid; gap: 0; }
.ladder .lv {
    display: grid;
    grid-template-columns: 76px 300px 1fr;
    gap: 4px 14px;
    align-items: baseline;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fcfcfd;
}
.ladder .lv .k { font-weight: 600; font-size: 13px; }
.ladder .lv .v { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.ladder .lv .d { font-size: 12.5px; color: var(--text-muted); line-height: 1.7; }
.ladder .arrow {
    padding: 4px 0 4px 30px;
    font-size: 11.5px;
    color: var(--text-faint);
}

/* 分区明细：一张表一块 */
.part-block + .part-block { margin-top: 18px; }
.part-block > .t { font-family: var(--mono); font-size: 12.5px; margin-bottom: 6px; color: var(--text); }

/* 统计卡片里的补充说明 */
.stat .hint { font-size: 11.5px; color: var(--text-faint); line-height: 1.6; }

/* ★ 除了最后一列，其余全部 nowrap。
   最后一列是 width:100%，在 table-layout:auto 下它会把别的列压到
   「最小内容宽度」—— 于是「216 B」被折成两行、「7 天」被折成两行，
   一张本来很规整的数字表看起来像排版坏了。 */
.storage-tbl th:not(:last-child), .storage-tbl td:not(:last-child) { white-space: nowrap; }
.storage-tbl td:last-child { line-height: 1.7; }

/* =============================================================
   代码块（批次 9：nginx 片段、下发脚本正文）

   ★ 只在需要**逐字复制**的地方用。它会横向滚而不是折行 ——
     配置文件和 shell 脚本被折行之后，复制出去就是坏的。
   ============================================================= */
.code-block {
    margin: 0;
    padding: 12px 14px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.75;
    overflow-x: auto;
    white-space: pre;
    tab-size: 4;
}
.code-block::-webkit-scrollbar { height: 8px; }
.code-block::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

details > summary { color: var(--text-muted); font-size: 12.5px; }
details > summary:hover { color: var(--primary); }
