:root {
  color-scheme: light;
  --ink: #101c30;
  --muted: #526074;
  --line: #d8dfe7;
  --paper: #ffffff;
  --surface: #f0f3f6;
  --nav: #111a27;
  --nav-active: #224770;
  --accent: #c64414;
  --chart: #eb571c;
  --good: #167141;
  --warn: #925400;
  --bad: #a82c23;
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .table-wrap:focus-visible {
  outline: 2px solid #3867a2;
  outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3vw, 2.7rem); letter-spacing: -.04em; line-height: 1.17; }
h2 { font-size: 1.14rem; }
h3 { font-size: 1rem; }
small, .subtle, .secondary-text { color: var(--muted); }
.icon { width: 1.28em; height: 1.28em; flex: none; vertical-align: -.22em; }
.layout { display: grid; grid-template-columns: clamp(190px, 16.7vw, 255px) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--nav);
  color: #f1f5f9;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 38px;
  height: 100vh;
  position: sticky;
  top: 0;
}
.brand { display: flex; align-items: center; gap: 14px; margin-inline: 13px; min-width: 0; }
.brand strong { display: block; font-size: 1.72rem; line-height: 1.2; white-space: nowrap; letter-spacing: .015em; }
.brand small { display: block; margin-top: 3px; font-size: .83rem; letter-spacing: .06em; white-space: nowrap; color: inherit; }
.brand-mark {
  display: grid; place-items: center; flex: none;
  width: 54px; height: 54px; border-radius: 7px; color: white;
  background: #cc4a15; font-size: 2rem; font-weight: 760;
}
.sidebar nav { display: grid; gap: 6px; }
.nav-item {
  color: #f1f5f9; text-align: left; display: flex; align-items: center;
  gap: 18px; width: 100%; padding: 11px 18px; font-size: 1.12rem;
  border: 0; border-radius: 8px; background: transparent; font-weight: 560;
}
.nav-item:hover { background: #1d2d40; }
.nav-item[aria-current="page"] { background: var(--nav-active); }
.sidebar-foot { margin-top: auto; }
.sidebar-foot > span { display: block; margin: 0 13px 10px; padding-bottom: 8px; border-bottom: 1px solid #607082; color: #cbd6e2; }
.workspace { min-width: 0; }
.topbar {
  min-height: 60px; background: #fcfdfe; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px clamp(18px, 2.1vw, 35px); font-size: 1.18rem;
}
.topbar strong { font-size: 1.4rem; }
.sync { display: flex; align-items: center; gap: 9px; font-size: .94rem; color: var(--muted); }
main { max-width: 1740px; margin-inline: auto; padding: 30px clamp(18px, 2.1vw, 35px) 36px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 26px; }
.page-head p { margin-top: 8px; color: var(--muted); font-size: 1.04rem; }
.heading-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  color: var(--ink); background: var(--paper); border: 1px solid #cbd4de;
  border-radius: 7px; padding: 8px 14px; min-height: 39px; font-weight: 580; white-space: nowrap;
}
.button:hover { background: #f4f7fa; }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { background: #a83810; }
.button.outline { color: var(--accent); border-color: var(--accent); }
.button.small { min-height: 33px; padding: 4px 10px; font-size: .86rem; }
.button.text { padding: 0; border: 0; color: #204f7e; min-height: 0; background: transparent; }
.link { color: #1e4d7e; font-weight: 650; }
.link:hover, .button.text:hover { text-decoration: underline; text-underline-offset: 3px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.metric { padding: 17px 20px 19px; display: block; }
a.metric:hover { border-color: #a8b7c6; }
.metric-title { display: flex; align-items: center; gap: 9px; font-size: 1.03rem; font-weight: 700; }
.metric-value { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-top: 12px; }
.metric strong { font-size: clamp(1.64rem, 3.25vw, 3.1rem); line-height: 1.04; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric .subtle { font-size: .81rem; line-height: 1.48; text-align: right; }
.pair { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 18px; margin-bottom: 22px; }
.panel-head { min-height: 54px; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.panel-head h2 { display: flex; gap: 10px; align-items: center; }
.panel-head small { font-size: .83rem; }
.chart-body { padding: 0 14px 12px; }
canvas.chart { width: 100%; height: 227px; display: block; }
.chart-legend { display: flex; gap: 14px; padding: 3px 0 3px 37px; color: var(--muted); font-size: .82rem; flex-wrap: wrap; }
.alert-preview { margin: 0; list-style: none; padding: 0; }
.alert-preview li { border-top: 1px solid var(--line); padding: 12px 16px; }
.alert-preview a { display: flex; gap: 10px; align-items: flex-start; }
.alert-preview a:hover strong { text-decoration: underline; }
.alert-preview .dot { margin-top: 8px; }
.alert-preview a > div { min-width: 0; flex: 1; }
.alert-preview small { display: block; overflow-wrap: anywhere; }
.alert-preview time { color: var(--muted); font-size: .79rem; white-space: nowrap; }
.dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: #8692a0; vertical-align: .02em; }
.dot.online, .dot.good { background: #249746; }
.dot.warning, .dot.stale { background: #bc7400; }
.dot.critical, .dot.offline { background: #c13a30; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; white-space: nowrap; color: var(--muted); }
.status.online { color: var(--good); }
.status.offline { color: var(--bad); }
.status.stale { color: var(--warn); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
.inventory { min-width: 640px; }
th { font-weight: 660; background: #edf1f5; color: #27374b; white-space: nowrap; }
th, td { padding: 11px 15px; border-top: 1px solid var(--line); vertical-align: middle; }
td { overflow-wrap: anywhere; }
td .muted-block { display: block; color: var(--muted); font-size: .82rem; max-width: 31ch; }
tbody tr:hover td { background: #f8fafc; }
.resource { display: flex; align-items: center; gap: 8px; min-width: 82px; font-variant-numeric: tabular-nums; }
progress { width: min(72px, 100%); height: 8px; flex: 1; min-width: 20px; border: 0; border-radius: 10px; overflow: hidden; background: #dfe5eb; color: #269551; }
progress::-webkit-progress-bar { background: #dfe5eb; border-radius: 10px; }
progress::-webkit-progress-value { background: #269551; border-radius: 10px; }
progress::-moz-progress-bar { background: #269551; }
progress.hot::-webkit-progress-value { background: #cc481e; }
progress.hot::-moz-progress-bar { background: #cc481e; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); }
.empty .button { margin-top: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; padding: 13px 15px; }
.filters input { min-width: 180px; }
.filters output { margin-left: auto; color: var(--muted); font-size: .88rem; }
input, select, textarea {
  background: var(--paper); border: 1px solid #c6d0da; border-radius: 6px; min-height: 38px;
  padding: 7px 9px; color: var(--ink); max-width: 100%;
}
input[type=checkbox] { min-height: 0; accent-color: var(--accent); }
label { display: grid; gap: 5px; font-weight: 620; }
label.check { display: flex; align-items: center; gap: 7px; font-weight: 520; }
.back { display: inline-block; margin-bottom: 13px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.detail-top { margin-bottom: 16px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; padding: 0 18px 17px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.sub-list { padding: 0; margin: 0; list-style: none; }
.sub-list li { padding: 11px 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.sub-list li > span:first-child { overflow-wrap: anywhere; }
.notice { padding: 12px 15px; margin-bottom: 15px; background: #fff7e7; color: #754914; border: 1px solid #ead1a2; border-radius: 8px; }
.pill { display: inline-block; border-radius: 5px; padding: 2px 7px; white-space: nowrap; font-size: .82rem; font-weight: 650; background: #edf1f5; color: var(--muted); }
.pill.critical { background: #fce9e7; color: var(--bad); }
.pill.warning { background: #fff0d2; color: var(--warn); }
.pill.done { background: #e8f5ec; color: var(--good); }
.login-screen, .boot { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(100%, 390px); padding: 28px; border-radius: 11px;
  background: var(--paper); border: 1px solid var(--line); display: grid; gap: 16px;
}
.login-brand { margin: 0; padding-bottom: 10px; }
.login-card h1 { font-size: 1.6rem; }
.login-card .button { margin-top: 4px; }
dialog {
  border: 1px solid var(--line); border-radius: 11px; padding: 0; max-height: calc(100dvh - 24px);
  width: min(520px, calc(100% - 24px)); max-width: none; color: var(--ink);
}
dialog::backdrop { background: #0f1827a6; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 15px 19px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 17px 19px; display: grid; gap: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.form-error { color: var(--bad); font-size: .91rem; }
.host-options { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin: 0; max-height: 155px; overflow: auto; }
.host-options legend { padding: 0 4px; }
.snippet { width: 100%; min-height: 112px; font: .87rem/1.5 "IBM Plex Mono", ui-monospace, monospace; resize: vertical; }
.toast {
  position: fixed; z-index: 10; right: 17px; bottom: 17px; padding: 11px 15px;
  max-width: min(420px, calc(100vw - 34px)); border-radius: 8px; color: #fff; background: #162738;
}
.toast.error { background: #8e2b22; }
@media (max-width: 1180px) {
  .metric-value { align-items: start; flex-direction: column; }
  .metric .subtle { text-align: left; }
  .sidebar .brand { margin-inline: 7px; gap: 9px; }
  .sidebar .brand strong { font-size: 1.45rem; }
  .sidebar .brand-mark { width: 44px; height: 44px; font-size: 1.63rem; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 156px minmax(0, 1fr); }
  .sidebar .brand small { font-size: .65rem; }
  .sidebar .brand strong { font-size: 1.12rem; }
  .sidebar .brand-mark { width: 33px; height: 36px; font-size: 1.3rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-value { flex-direction: row; align-items: end; }
  .metric .subtle { text-align: right; }
  .pair, .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .layout { display: block; }
  .sidebar { height: auto; position: static; padding: 11px 11px 8px; gap: 8px; }
  .sidebar .brand { margin: 0; padding-right: 77px; }
  .sidebar .brand small { margin: 0; }
  .sidebar nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .nav-item { padding: 7px 6px; gap: 5px; justify-content: center; font-size: .86rem; }
  .sidebar-foot { position: absolute; top: 15px; right: 11px; }
  .sidebar-foot > span { display: none; }
  .sidebar-foot .icon { display: none; }
  .topbar { min-height: 43px; padding: 6px 12px; }
  .topbar strong { font-size: .95rem; }
  .sync { font-size: .76rem; }
  main { padding: 17px 11px 25px; }
  .page-head { margin-bottom: 15px; gap: 9px; align-items: flex-start; flex-wrap: wrap; }
  .page-head p { font-size: .88rem; margin-top: 4px; }
  .metric { padding: 11px 12px; }
  .metric-title { font-size: .89rem; }
  .metric-value { flex-direction: column; align-items: start; margin-top: 8px; }
  .metric .subtle { text-align: left; }
  .stats { gap: 8px; margin-bottom: 14px; }
  .pair { gap: 13px; margin-bottom: 14px; }
  .panel-head { padding: 10px 12px; min-height: 47px; }
  .panel-head h2 { font-size: .98rem; }
  .alert-preview time { display: none; }
  .filters input { width: 100%; }
  .filters output { margin: 0; }
}
.button.danger { border-color: #a82c23; color: #a82c23; }
.button.danger:hover { background: #fce9e7; }
