body.admin-body { background: #f4f7f5; }
body.admin-body::before { display: none; }

.admin-shell { display: flex; min-height: 100vh; }

.side {
  width: 218px; flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.side-brand { padding: 4px 8px 20px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 11px; border-radius: 9px;
  font-size: 13.4px; color: var(--ink-2); font-weight: 520;
  transition: background .15s, color .15s;
}
.side-nav a:hover { background: #f4f8f6; }
.side-nav a.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 620; }
.side-nav .si {
  width: 18px; text-align: center; font-size: 13px; opacity: .62;
}
.side-nav a.active .si { opacity: 1; }

.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.side-link { font-size: 12.5px; color: var(--muted); padding: 0 10px; }
.side-link:hover { color: var(--ink); }
.side-user { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px; background: #f7faf8; }
.side-user .avatar { width: 26px; height: 26px; border-radius: 7px; font-size: 10.5px; }
.side-user div { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.side-user b { font-size: 12.5px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; }
.side-user span { font-size: 10.5px; color: var(--muted); }
.side-user button { border: 0; background: none; color: var(--muted); font-size: 11px; padding: 0 2px; }
.side-user button:hover { color: var(--ink); }
.side-user button:first-of-type { margin-left: auto; }

.admin-main { flex: 1; min-width: 0; padding: 26px 30px 60px; max-width: 1500px; }

.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-head h1 { font-size: 22px; letter-spacing: -.03em; }
.admin-head p { font-size: 12.8px; color: var(--muted); margin-top: 5px; }
.admin-head .acts { display: flex; gap: 9px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px;
  padding: 17px 18px; position: relative; overflow: hidden;
}
.kpi span { font-size: 11.8px; color: var(--muted); }
.kpi b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.035em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi b small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.kpi i {
  position: absolute; right: 16px; top: 16px; width: 26px; height: 26px; border-radius: 8px;
  background: var(--brand-soft); display: grid; place-items: center;
}
.kpi i svg { color: var(--brand-deep); }
.kpi.alt i { background: var(--warn-soft); }
.kpi.alt i svg { color: var(--warn); }

.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-bottom: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 18px 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head b { font-size: 13.5px; font-weight: 640; }
.card-head span { font-size: 11.5px; color: var(--muted); }

/* 柱状图 */
.chart { display: flex; align-items: flex-end; gap: 7px; height: 152px; padding-top: 8px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart .bar-v {
  width: 100%; max-width: 18px; border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #00cf82, #00b56a);
  min-height: 4px; transition: height .5s cubic-bezier(.2, .8, .3, 1); position: relative;
}
.chart .col:hover .bar-v { background: linear-gradient(180deg, #00e08f, #00a35f); }
.chart .bar-v.zero { background: #e6ede9; }
.chart .col span { font-size: 9.5px; color: #9fb0a8; white-space: nowrap; }
.chart .col em {
  position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%);
  background: var(--dark); color: #d9f7e9; font-size: 10px; padding: 2px 6px; border-radius: 5px;
  opacity: 0; pointer-events: none; white-space: nowrap; font-style: normal;
}
.chart .col:hover em { opacity: 1; }

.dist { display: flex; flex-direction: column; gap: 11px; }
.dist-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.dist-row .name { width: 62px; color: var(--ink-2); flex: none; }
.dist-row .track { flex: 1; height: 6px; border-radius: 999px; background: #eef3f0; overflow: hidden; }
.dist-row .track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #12b886, #00c97b); }
.dist-row b { font-size: 12px; font-variant-numeric: tabular-nums; width: 24px; text-align: right; }

.node-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f1f5f3; }
.node-row:last-child { border-bottom: 0; }
.node-row .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); flex: none; }
.node-row .dot.off { background: #c2cdc8; box-shadow: 0 0 0 3px #f1f5f3; }
.node-row .nm { flex: 1; font-size: 12.8px; }
.node-row .nm span { display: block; font-size: 10.5px; color: var(--muted); }
.node-row .load { width: 96px; }
.node-row .load .track { height: 5px; border-radius: 999px; background: #eef3f0; overflow: hidden; }
.node-row .load .track i { display: block; height: 100%; min-width: 3px; background: linear-gradient(90deg, #00c97b, #0d9488); }
.node-row .load span { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 表格（后台更紧凑） */
.admin-main .table th { padding: 10px 14px; font-size: 11px; }
.admin-main .table td { padding: 11px 14px; font-size: 12.6px; }
.admin-main .table-card { box-shadow: none; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.toolbar .input { height: 36px; width: 240px; font-size: 13px; }
.toolbar .select { height: 36px; width: 132px; font-size: 13px; }

.act-row { display: flex; gap: 12px; align-items: center; }
.act-row button { font-size: 12.4px; color: var(--brand-deep); background: none; border: 0; font-weight: 600; padding: 0; }
.act-row button:hover { text-decoration: underline; text-underline-offset: 3px; }
.act-row button.danger { color: var(--danger); }
.act-row button.muted { color: var(--muted); font-weight: 500; }

/* 登录 */
.admin-login { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.admin-login .auth-card { box-shadow: var(--shadow-md); }

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .side { position: fixed; left: -230px; z-index: 60; transition: left .2s; box-shadow: var(--shadow-lg); }
  .side.open { left: 0; }
  .admin-main { padding: 18px 16px 50px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
