:root {
  --bg: #151715;
  --panel: #1d211e;
  --panel-2: #242a25;
  --ink: #f3f1ec;
  --muted: #aaa79f;
  --muted-2: #77766f;
  --line: #363c36;
  --ok: #72b086;
  --warn: #d6a85c;
  --bad: #e28b73;
  --r: 8px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0) 240px),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 58px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(21, 23, 21, .92);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
}

.brand i,
.card-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ok);
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.access-dot {
  position: relative;
  padding-left: 13px;
}

.access-dot::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  transform: translateY(-50%);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.pagehead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.pagehead p {
  margin: 0 0 7px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
}

.pagehead h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--muted-2);
}

.icon-btn:disabled {
  opacity: .55;
  cursor: wait;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.system-card {
  min-height: 252px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}

.system-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent), #ffffff 20%);
  background: #202520;
}

.system-card.is-error {
  border-color: rgba(226, 139, 115, .45);
}

.system-card .card-mark {
  color: var(--accent);
}

.card-head {
  min-height: 52px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.card-head strong {
  display: block;
  font-size: 18px;
  font-weight: 650;
}

.card-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.state {
  flex: none;
  min-width: 46px;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
}

.state.ok {
  color: #cdebd6;
  background: rgba(114, 176, 134, .16);
}

.state.bad {
  color: #ffd1c6;
  background: rgba(226, 139, 115, .18);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  min-height: 88px;
  padding: 11px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .03);
}

.metric small,
.metric em {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.metric strong {
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 650;
}

.metric.warn strong { color: var(--warn); }
.metric.ok strong { color: var(--ok); }

.source {
  margin-top: auto;
  color: var(--muted-2);
  font-size: 11px;
}

.unavailable,
.page-error,
.loading {
  min-height: 128px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 7px;
}

.loading {
  grid-column: 1 / -1;
}

.skeleton {
  pointer-events: none;
}

.skeleton .card-mark,
.sk-line,
.sk-metrics {
  display: block;
  background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.11), rgba(255,255,255,.05));
  background-size: 220% 100%;
  animation: pulse 1.35s infinite;
}

.sk-line {
  width: 56%;
  height: 16px;
  border-radius: 4px;
}

.sk-line.wide {
  width: 78%;
}

.sk-metrics {
  height: 88px;
  border-radius: 7px;
}

@keyframes pulse {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

@media (max-width: 960px) {
  .system-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar {
    height: auto;
    min-height: 58px;
    padding: 10px 14px;
  }

  main {
    width: min(100% - 20px, 1180px);
    padding-top: 24px;
  }

  .pagehead {
    align-items: center;
  }

  .pagehead h1 {
    font-size: 23px;
  }

  .system-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .system-card {
    min-height: 0;
  }
}
