/* 后台公共样式（WP-06；ADM-84 重排版式）。不引用任何第三方资源：没有外部字体、图标库，图标全部用纯 CSS 画。 */
* { box-sizing: border-box; }
:root { --bg: #f2f4f8; --card: #fff; --line: #dde2ea; --line-soft: #edf0f5; --ink: #1c2430; --mute: #5b6677;
  --faint: #98a1af; --brand: #24467a; --brand-soft: #e8eef8; --danger: #a3262a; --danger-soft: #fdecea;
  --ok: #1f7a40; --ok-soft: #e4f4ea; --warn: #8a6300; --warn-soft: #fdf3d3; --side: 216px; --top: 52px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
html { -webkit-text-size-adjust: 100%; }
body.adm { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--bg); -webkit-touch-callout: none; }
.screen { min-height: 100vh; }
.print-block { display: none; }
[hidden] { display: none !important; }
h1 { font-size: 20px; margin: 0 0 12px; line-height: 1.3; } h2 { font-size: 15px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 0 0 8px; }
a { color: var(--brand); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ---- 外壳：左侧固定导航 + 顶栏 + 内容区（内容区用满可用宽度） */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: #172133; color: #cdd6e4; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 0 0 16px; }
.brand { height: var(--top); display: flex; align-items: center; padding: 0 16px; font-weight: 700; color: #fff;
  border-bottom: 1px solid #263349; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modnav { display: flex; flex-direction: column; padding: 8px 0; }
.modnav a { color: #cdd6e4; text-decoration: none; padding: 9px 16px; border-left: 3px solid transparent; }
.modnav a:hover { background: #1f2c43; color: #fff; }
.modnav a.current { color: #fff; font-weight: 700; background: #22324e; border-left-color: #7fa6e6; }
.modnav .sub { display: flex; flex-direction: column; padding: 2px 0 6px; background: #131c2c; }
.modnav .sub a { padding: 5px 16px 5px 30px; font-size: 13px; color: #a9b5c8; border-left: 3px solid transparent; }
.modnav .sub a.current { color: #fff; background: transparent; border-left-color: #7fa6e6; font-weight: 600; }
.modnav .sub .sub-title { padding: 6px 16px 2px 30px; font-size: 12px; color: #7f8ca3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { padding: 12px 16px; font-size: 12px; color: #7f8ca3; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; gap: 8px; align-items: center;
  padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .spacer { flex: 1; min-width: 8px; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--mute); white-space: nowrap; overflow: hidden; }
.crumbs > * { flex: none; }
.crumbs > code.here, .crumbs > .here:last-child { flex: 0 1 auto; min-width: 8ch; overflow: hidden; text-overflow: ellipsis; }
.crumbs a.crumb { color: var(--mute); text-decoration: none; } .crumbs a.crumb:hover { color: var(--brand); text-decoration: underline; }
.crumb-back { display: none; text-decoration: none; font-weight: 600; }
.crumbs .sep { color: var(--faint); flex: none; }
.crumbs .here { color: var(--ink); font-weight: 600; }
.session { display: flex; gap: 6px; align-items: center; color: var(--mute); font-size: 12.5px; white-space: nowrap; }
.session .pill { padding: 2px 8px; border-radius: 10px; background: var(--line-soft); font-variant-numeric: tabular-nums; }
.session .pill.low { background: var(--warn-soft); color: var(--warn); }
.session .pill.off { background: var(--danger-soft); color: var(--danger); }
.content { padding: 20px; min-width: 0; }
.nav-toggle { display: none; width: 36px; height: 34px; padding: 0; background: #fff; border: 1px solid var(--line); position: relative; }
.nav-toggle::before { content: ""; position: absolute; left: 9px; right: 9px; top: 10px; height: 2px; background: var(--ink);
  box-shadow: 0 5px 0 var(--ink), 0 10px 0 var(--ink); }
.tag { padding: 2px 8px; border-radius: 10px; background: var(--line-soft); font-size: 12.5px; white-space: nowrap; }

/* ---- 卡片与栅格 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 0 0 16px; min-width: 0; }
.card.narrow { max-width: 380px; margin: 48px auto; }
.card > h2 { display: flex; align-items: baseline; gap: 8px; }
.card > h2 .count { font-weight: 400; color: var(--mute); font-size: 12.5px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.cols > .card { margin: 0; } .cols { margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.group { margin: 0 0 18px; } .group > h2 { margin: 0 0 8px; color: var(--mute); font-size: 13px; font-weight: 600; }
.metric { background: #fff; border: 1px solid var(--line); border-top: 4px solid #b9c2d0; border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metric-label { color: var(--mute); font-size: 12.5px; }
.metric-value { font-size: 22px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-value small { font-size: 12px; font-weight: 400; color: var(--mute); }
.metric-value.is-text { font-size: 15px; }
.metric-health { align-self: flex-start; margin-top: 2px; }
.metric, .card { scroll-margin-top: 64px; } .metric.jumped { box-shadow: 0 0 0 3px #7fa6e6; }
.health-green { border-top-color: #2f8f4e; } .health-yellow { border-top-color: #d9a514; } .health-red { border-top-color: #c0392b; }
.metric.health-red { background: #fff8f7; } .metric.health-yellow { background: #fffcf0; }
.verdict { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 10px; margin: 0 0 16px;
  border: 1px solid var(--line); background: #fff; font-size: 15px; font-weight: 600; }
.verdict.health-red { border-color: #e2a59e; background: var(--danger-soft); color: #8a1f15; }
.verdict.health-yellow { border-color: #e6cd7a; background: var(--warn-soft); color: #6b4d00; }
.verdict.health-green { border-color: #a9d8b8; background: var(--ok-soft); color: #17602f; }
.verdict .dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; flex: none; }
.verdict .jump { background: none; border: 0; padding: 0; color: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.verdict .why { font-weight: 400; }
.verdict .scope { font-weight: 400; font-size: 12.5px; opacity: .8; }
.verdict .alert-part { flex-basis: 100%; font-weight: 400; font-size: 14px; }
.verdict .alert-part small { font-family: var(--mono); font-size: 11.5px; opacity: .7; margin-left: 4px; }
#card-alerts details.fold { margin-top: 10px; } #card-alerts details.fold > summary { cursor: pointer; color: var(--mute); font-size: 12.5px; }
#card-alerts details.fold ul { margin-top: 8px; } .card.jumped { box-shadow: 0 0 0 3px #7fa6e6; }
.verdict .part { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }

/* ---- 状态标签（正常 / 警告 / 危险 / 中性） */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12.5px; line-height: 1.5; white-space: nowrap;
  background: var(--line-soft); color: #3b4656; border: 1px solid transparent; }
.badge.tone-ok, .badge.health-green { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cb; }
.badge.tone-warn, .badge.health-yellow { background: var(--warn-soft); color: var(--warn); border-color: #ecd98f; }
.badge.tone-danger, .badge.health-red { background: var(--danger-soft); color: var(--danger); border-color: #efb9b4; }
.code-sub { color: var(--faint); font-family: var(--mono); font-size: 11.5px; }
.none { color: var(--faint); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; }

/* ---- 表单控件 */
label { display: block; margin: 0 0 12px; }
input, select, button, textarea { font: inherit; padding: 6px 10px; border: 1px solid #b9c2d0; border-radius: 6px; color: inherit; background: #fff; }
input:focus, select:focus, textarea:focus, button:focus-visible, .ident:focus-visible, .clip:focus-visible { outline: 2px solid #7fa6e6; outline-offset: 1px; }
label input { display: block; width: 100%; margin-top: 4px; }
button { background: var(--brand); border-color: var(--brand); color: #fff; cursor: pointer; white-space: nowrap; }
button:hover { filter: brightness(1.1); }
button.ghost { background: #fff; color: var(--brand); border-color: #b9c2d0; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.message { padding: 8px 12px; border-radius: 6px; background: #fff7e0; border: 1px solid #c79a12; margin: 0 0 16px; }
.alert-red { background: var(--danger-soft); border: 1px solid #c0392b; color: #8a1f15; padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.stepup-panel { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; border-color: #7fa6e6; }
.stepup-panel label { margin: 0; flex: 1 1 260px; max-width: 420px; }

/* ---- 表格：在自身容器内横向滚动，表头吸顶，单元格不折行 */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; vertical-align: middle; }
thead th { position: sticky; top: 0; z-index: 2; background: #f6f8fb; color: #3b4656; font-weight: 600; font-size: 12.5px;
  border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
th.c-num, td.c-num { text-align: right; font-variant-numeric: tabular-nums; }
td.c-time, .ts { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.empty { text-align: center; color: var(--mute); padding: 22px 10px; white-space: normal; }
.num { font-variant-numeric: tabular-nums; }
.login-failure td { color: #8a1f15; }

/* ---- 长内容：单行省略，悬停（title）或点击看全文；标识：等宽、中间省略，点击选中标识本身 */
.clip { display: inline-block; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; cursor: pointer; }
.clip.open { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 56ch; min-width: 32ch; }
.ident { display: inline-block; white-space: nowrap; vertical-align: bottom; cursor: pointer; color: inherit; border-radius: 4px; }
.ident .id-head { display: inline-block; max-width: 10ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.ident .id-tail { display: inline-block; vertical-align: bottom; }
.ident.picked { background: var(--brand-soft); }
.ident.open .id-head { max-width: none; }

/* ---- 列表类卡片（缺什么、告警） */
ul.missing, ul.alerts { list-style: none; margin: 0; padding: 0; }
ul.missing li, ul.alerts li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
ul.missing li:last-child, ul.alerts li:last-child { border-bottom: 0; }
ul.missing li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: #c0392b; }
ul.missing li.later::before { background: #d9a514; }
ul.missing li.ok::before { background: #2f8f4e; }
ul.missing .state { color: var(--ink); }
ul.missing .state small { color: var(--faint); font-family: var(--mono); font-size: 11.5px; margin-left: 8px; white-space: nowrap; }
.missing-group { margin: 12px 0 2px; color: var(--mute); font-size: 12.5px; font-weight: 600; }
.missing-group:first-of-type { margin-top: 0; }
ul.alerts .what small { color: var(--faint); font-family: var(--mono); font-size: 11.5px; margin-left: 8px; }
ul.alerts .when { display: flex; gap: 8px; align-items: center; white-space: nowrap; color: var(--mute); font-size: 12.5px; }
ul.alerts li { border-left: 4px solid #b9c2d0; padding-left: 10px; margin: 0 0 6px; border-bottom: 0; background: #fafbfd; border-radius: 4px; grid-template-columns: minmax(0, 1fr) auto; }
ul.alerts li.health-red { border-left-color: #c0392b; } ul.alerts li.health-yellow { border-left-color: #d9a514; } ul.alerts li.health-green { border-left-color: #2f8f4e; }
.note { color: var(--mute); margin: 0 0 12px; }

/* 图片画布组件（ADM-29）：不可选中、不可拖拽、长按无菜单 */
canvas.preview-canvas { max-width: 100%; user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
  -webkit-touch-callout: none; touch-action: pan-x pan-y; background: #e6ebf2; }

/* ---- 中等宽度与窄屏：导航收成顶部可展开的菜单 */
@media (max-width: 1180px) { .cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 899px) {
  .shell { display: flex; flex-direction: column; }
  .main { display: contents; }
  .topbar { order: 0; padding: 0 10px; gap: 6px; }
  .side { order: 1; position: static; height: auto; display: none; }
  .side .brand { display: none; }
  body.nav-open .side { display: block; }
  .content { order: 2; padding: 12px; }
  .nav-toggle { display: inline-block; flex: none; }
  .topbar button { padding: 5px 8px; }
  .crumbs .root, .crumbs .root + .sep { display: none; }
  .card { padding: 12px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .topbar { height: auto; min-height: var(--top); flex-wrap: wrap; padding: 6px 10px; }
  .crumbs { flex: 1 1 50%; }
  .crumbs > * { display: none; }                 /* 窄屏：面包屑只留"返回上一级"（没有上一级的页面留本页名） */
  .crumbs > .crumb-back, .crumbs:not(:has(.crumb-back)) > .here { display: inline; }
  .session { font-size: 12px; }
  .topbar .spacer { display: none; }
  .session { order: 5; flex: 1 1 100%; }
}
/* 打印时隐藏全部内容（ADM-29） */
@media print {
  .screen, canvas { display: none !important; }
  .print-block { display: block; padding: 48px; font-size: 18px; }
}
