/* windows-probe console - one light, monochrome surface, no build step.
   Layout: dark sidebar + top bar + scrolling content (panels in a grid). */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f5f5f4;
  --panel: #ffffff;
  --ink: #161616;
  --ink-soft: #3d3d3a;
  --muted: #8a8a85;
  --line: #e7e7e3;
  --line-strong: #d5d5d0;
  --track: #efefec;
  --fill: #1c1c1a;
  --sidebar: #111110;
  --sidebar-hover: #1d1d1b;
  --sidebar-line: #2a2a27;
  --sidebar-ink: #c9c9c4;
  --sidebar-muted: #8f8f8a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(17, 17, 16, .04);
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h1, h2, h3 { letter-spacing: -.1px; }
code {
  font-family: "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
  font-size: .92em;
  background: #f1f1ee;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.mono { font-family: "Cascadia Mono", Consolas, "SFMono-Regular", monospace; font-size: 12px; }
.muted { color: var(--muted); }

/* ---------- shell ---------- */

.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  border-right: 1px solid #000;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; }
.brand .mark {
  width: 30px; height: 30px; flex: none;
  border-radius: 8px;
  background: #f4f4f2; color: #111110;
  display: grid; place-items: center;
}
.brand .mark svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.brand-name { display: flex; flex-direction: column; line-height: 1.2; font-size: 13.5px; font-weight: 600; color: #f2f2ef; }
.brand-name small { font-weight: 400; font-size: 11px; color: var(--sidebar-muted); }
.brand-version { margin-left: auto; font-size: 11px; color: var(--sidebar-muted); }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--sidebar-ink);
  font-size: 13px; text-align: left; cursor: pointer;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.is-active { background: #f4f4f2; color: #141412; font-weight: 600; }
.nav-item:focus-visible { outline: 2px solid #f4f4f2; outline-offset: 1px; }
.nav-item .ico { width: 16px; height: 16px; flex: none; display: grid; place-items: center; }
.nav-item .ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-foot { margin-top: auto; padding: 10px 8px 12px; border-top: 1px solid var(--sidebar-line); }
.user { display: flex; align-items: center; gap: 10px; padding: 6px 10px 10px; min-width: 0; }
.avatar {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%; background: #2c2c29; color: #f0f0ee;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
.user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-text b { font-size: 13px; font-weight: 600; color: #f0f0ee; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text i { font-style: normal; font-size: 11px; color: var(--sidebar-muted); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  height: 52px; padding: 0 22px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.topbar h1 { margin: 0; font-size: 14px; font-weight: 600; }
.crumb { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.conn { display: inline-flex; align-items: center; gap: 6px; }
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fill); }
.conn.is-error { color: var(--ink); }
.conn.is-error .dot { background: #fff; border: 1.5px solid var(--fill); }
.clock { font-variant-numeric: tabular-nums; }

.content { width: 100%; max-width: 1340px; padding: 26px 28px 64px; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--ink-soft);
  font-size: 12.5px; cursor: pointer;
}
.btn:hover { border-color: #b8b8b2; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-toggle::before {
  content: ""; width: 8px; height: 8px; flex: none;
  border: 1.5px solid #b8b8b2; border-radius: 2px;
}
.btn-toggle.is-on { color: var(--ink); }
.btn-toggle.is-on::before { background: var(--fill); border-color: var(--fill); }
/* Detail-page chart window: the pressed range is the only filled button in the row. */
.range-pick { display: inline-flex; gap: 4px; }
.range-pick .btn { padding: 4px 10px; font-size: 12px; }
.range-pick .btn.is-on {
  background: var(--fill);
  border-color: var(--fill);
  color: #fff;
}
.range-pick .btn.is-on:hover { color: #fff; }
.btn-primary {
  width: 100%; padding: 9px 14px;
  background: var(--fill); border-color: var(--fill); color: #fff; font-weight: 600;
}
.btn-primary:hover { background: #000; color: #fff; }

/* ---------- page head ---------- */

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.4px; }
.page-head .sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.page-head-right { margin-left: auto; text-align: right; font-size: 12px; color: var(--muted); }

/* ---------- kpis ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 16px; box-shadow: var(--shadow);
}
.kpi span { display: block; font-size: 12px; color: var(--muted); }
.kpi b { display: block; margin-top: 5px; font-size: 24px; font-weight: 600; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.kpi small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }

/* ---------- cards ---------- */

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

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; gap: 12px; padding: 15px 18px 13px; }
.card-title { min-width: 0; }
.card-title h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-title .sub { margin: 4px 0 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.card-ico {
  width: 34px; height: 34px; flex: none;
  border-radius: 8px; background: #f2f2ef; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-soft);
}
.card-ico svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.card-body { padding: 0 18px 16px; }
.card-body.is-flush { padding: 0; }
.card-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 18px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.empty { padding: 22px 0 8px; color: var(--muted); font-size: 13px; }
.empty b { color: var(--ink); }

/* ---------- host card ---------- */

.host-card { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.host-card:hover { border-color: #c6c6c0; box-shadow: 0 3px 12px rgba(17, 17, 16, .07); }
.host-card:focus-visible { outline: 2px solid var(--fill); outline-offset: 2px; }
.host-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.host-head h3 {
  margin: 0; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.host-card .pill { margin-left: auto; }

/* ---------- overview v2 host cards ---------- */

.host-card-body { display: flex; flex-direction: column; gap: 12px; padding: 0 18px 14px; }
.host-busy-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.host-card-foot .queue-btn { margin-left: auto; }
.host-card .queue-btn.is-joined { border-style: solid; }

.busy-badge {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-strong);
  font-size: 11.5px; white-space: nowrap; cursor: help;
}
.busy-badge.is-busy { color: #a33d00; background: #fff3f0; border-color: #e8a894; }
.busy-badge.is-idle { color: #106423; background: #f0f8f1; border-color: #98c2a1; }
.busy-badge.is-unknown { color: var(--muted); background: #fff; border-style: dashed; }

.software-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.software-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: #fbfbfa; color: var(--ink-soft); font-size: 11.5px; max-width: 100%;
}
.software-chip i { font-size: 9px; font-style: normal; line-height: 1; }
.software-chip.is-running i { color: #106423; }
.software-chip.is-stopped i { color: #6f6f6a; }
.software-chip.is-unknown { color: var(--muted); border-style: dashed; }
.software-more {
  border: 1px dashed var(--line-strong); border-radius: 999px; background: #fff;
  color: var(--muted); font-size: 11.5px; padding: 1px 8px; cursor: pointer;
}
.software-more:hover { color: var(--ink-soft); border-color: var(--ink-soft); }
.software-inventory { padding-top: 0; }

.queue-btn { flex: none; }
.busy-card.is-busy { border-color: #e8a894; }
.busy-detail { display: flex; align-items: flex-start; gap: 12px; }
.busy-reasons { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-soft); }
.busy-reasons li + li { margin-top: 5px; }
.software-map { display: flex; flex-wrap: wrap; gap: 10px 16px; padding: 2px 0 12px; }
.queue-table { margin-top: 14px; }

/* ---------- status ---------- */

.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #c9c9c4; }
.dot.state-online { background: var(--fill); }
.dot.state-degraded { background: linear-gradient(90deg, var(--fill) 50%, #fff 50%); border: 1px solid var(--fill); }
.dot.state-offline { background: #fff; border: 1.5px solid #9a9a94; }
.dot.state-unknown { background: #fff; border: 1.5px dashed #9a9a94; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 2px 9px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: #fbfbfa; color: var(--ink-soft);
  font-size: 11.5px; white-space: nowrap;
}
.pill.state-online { background: var(--fill); border-color: var(--fill); color: #fff; }
.pill.state-degraded { background: #f0f0ed; }
.pill.state-offline { background: #fff; color: #6f6f6a; }
.pill.state-unknown { background: #fff; color: var(--muted); border-style: dashed; }

/* ---------- metric rows ---------- */

.metrics { display: flex; flex-direction: column; gap: 11px; }
.card .metrics { padding: 2px 18px 16px; }
.metric {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) 78px;
  align-items: center; gap: 10px;
  font-size: 12px;
}
.metric .label { color: var(--ink-soft); }
.metric .value { text-align: right; font-variant-numeric: tabular-nums; }
.metric.is-na .label, .metric.is-na .value { color: var(--muted); }
.bar { height: 7px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--fill); transition: width .4s ease; }
.bar.is-na { background: repeating-linear-gradient(135deg, #ececE8 0 4px, #f7f7f4 4px 8px); }
.metric-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--muted); }

/* ---------- tables ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  padding: 10px 18px; text-align: left;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: #fbfbfa; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 10px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfcfb; }
.table .nowrap { white-space: nowrap; }
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- detail ---------- */

.detail-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-top h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.4px; }
.detail-top .sub { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.detail-top .btn { flex: none; }
.detail-meta { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.detail-cols {
  display: grid; gap: 14px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }

.kv { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 1px; }
.chip {
  padding: 1px 8px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: #fbfbfa; color: var(--ink-soft); font-size: 11.5px;
}

/* ---------- processes ---------- */

.proc-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); }
.proc { border: 1px solid var(--line); border-radius: 9px; background: #fdfdfc; }
.proc.is-missing { background: #fafaf8; border-style: dashed; }
.proc-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 4px; }
.proc-head b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proc-head .pill { margin-left: auto; }
.proc-body { padding: 8px 14px 12px; }
.proc-body .metric { grid-template-columns: 58px minmax(0, 1fr) 84px; }
.spark { margin-top: 11px; padding-top: 9px; border-top: 1px dashed var(--line); }
.spark svg { display: block; width: 100%; height: 34px; }
.spark .cap { font-size: 11px; color: var(--muted); }
.spark-empty { padding: 12px 0 4px; font-size: 11px; color: var(--muted); }

/* ---------- raw snapshot ---------- */

.raw { margin-top: 14px; }
.raw summary { padding: 12px 18px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.raw summary:hover { color: var(--ink); }
.raw pre {
  margin: 0; padding: 14px 18px; max-height: 360px; overflow: auto;
  background: #141412; color: #e9e9e6;
  border-radius: 0 0 var(--radius) var(--radius);
  font: 12px/1.5 "Cascadia Mono", Consolas, monospace;
}

/* ---------- login ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(370px, 100%);
  display: flex; flex-direction: column; gap: 14px;
  padding: 26px 24px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 6px 28px rgba(17, 17, 16, .06);
}
.login-brand { display: flex; align-items: center; gap: 11px; }
.login-brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--fill); color: #fff; display: grid; place-items: center; }
.login-brand .mark svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.login-brand b { display: block; font-size: 14px; }
.login-brand i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field input {
  padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit; font-size: 13px;
}
.field input:focus { outline: none; border-color: var(--fill); }
.login-hint { margin: 0; font-size: 11.5px; color: var(--muted); min-height: 15px; }
.login-hint.is-error { color: var(--ink); font-weight: 600; }

/* ---------- toast ---------- */

.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 50;
  padding: 9px 14px;
  background: var(--fill); color: #fff; border-radius: 8px; font-size: 12.5px;
  opacity: 0; transform: translateY(6px); transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.toast.is-on { opacity: 1; transform: none; }

/* ---------- narrow screens: sidebar keeps icons only ---------- */

/* ---------- 侧栏徽标（告警计数） ---------- */

.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #f2f2ef; color: #111110;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}

/* ---------- 表单（告警规则 / 设置） ---------- */

.field select {
  padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit; font-size: 13px;
}
.field select:focus { outline: none; border-color: var(--fill); }
.field .hint { font-style: normal; font-size: 11px; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.form-row .field.grow { flex: 1 1 260px; min-width: 0; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.inline { display: flex; gap: 8px; }
.inline select { flex: none; width: 84px; }
.inline input { flex: 1 1 auto; min-width: 0; }
.checks { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 0 0 9px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); }
.check input { width: 14px; height: 14px; accent-color: var(--fill); }

/* ---------- 表格里的操作列与按钮尺寸 ---------- */

.actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.btn-sm { padding: 4px 9px; font-size: 11.5px; }
.btn.is-on { background: var(--fill); border-color: var(--fill); color: #fff; }
.pill.sev-critical { background: var(--fill); border-color: var(--fill); color: #fff; }
.pill.sev-warning { background: #f0f0ed; }
.pill.sev-info { background: #fff; color: var(--muted); border-style: dashed; }
.pre {
  margin: 0; padding: 12px;
  background: #f7f7f4; border: 1px solid var(--line); border-radius: 8px;
  font-family: "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
  font-size: 12px; max-height: 280px; overflow: auto; white-space: pre-wrap;
}

@media (max-width: 960px) {
  .app { grid-template-columns: 64px minmax(0, 1fr); }
  .brand { justify-content: center; padding: 16px 8px; }
  .brand-name, .brand-version, .nav-item .label, .user-text { display: none; }
  .nav-badge { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .user { justify-content: center; padding: 6px 0 10px; }
  .content { padding: 18px 16px 48px; }
  .page-head h2 { font-size: 22px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .clock { display: none; }
}

/* 壁纸发布：本地预览和只读状态均在卡片内 */
.wallpaper-form { padding-top: 4px; }
.wallpaper-preview { margin-top: 14px; min-height: 100px; display: grid; place-items: center;
  border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted); font-size: 12px;
  background: #fafaf8; overflow: hidden; }
.wallpaper-preview img { display: block; max-width: 100%; max-height: 360px; object-fit: contain; }
.wallpaper-thumb { width: 96px; max-height: 64px; object-fit: contain; }
.wallpaper-banner { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
  background: #fff4dd; border: 1px solid #e8d6a6; color: #665019; font-size: 13px; }
.wallpaper-error { margin: 12px 0 0; color: #9a2929; font-size: 13px; }

.wallpaper-banner .btn { margin-left: 12px; }

.password-login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
#password-login summary { cursor: pointer; color: var(--muted); font-size: 12px; }
