:root {
  --bg: #f3efe6;
  --paper: rgba(255, 255, 255, 0.82);
  --panel: rgba(255, 250, 243, 0.92);
  --line: rgba(64, 44, 16, 0.12);
  --text: #27180a;
  --muted: #715e49;
  --accent: #bb4d24;
  --good: #17835d;
  --bad: #c03f2f;
  --shadow: 0 24px 60px rgba(64, 39, 12, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 233, 196, 0.9), transparent 32%),
    linear-gradient(135deg, #f6f0e3 0%, #e9dfcf 100%);
}

button,
input {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  font-weight: 800;
}

h2 {
  font-size: 20px;
}

.auth-box {
  display: flex;
  align-items: center;
  min-height: 48px;
}

.login-form,
.admin-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-form input,
.login-form button,
.admin-status button,
.rename-row input,
.rename-row button {
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
}

.login-form button,
.admin-status button,
.rename-row button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.summary-card,
.panel,
.node-card {
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(14px);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.summary-card {
  padding: 18px 20px;
}

.summary-card .value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.switches button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.switches button.active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.sidebar {
  height: calc(100vh - 180px);
  overflow: hidden;
}

.node-list {
  height: calc(100% - 58px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.node-card {
  padding: 16px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.node-card:hover,
.node-card.selected {
  transform: translateY(-2px);
  border-color: rgba(187, 77, 36, 0.4);
}

.node-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.online {
  background: rgba(23, 131, 93, 0.14);
  color: var(--good);
}

.status-pill.offline {
  background: rgba(192, 63, 47, 0.12);
  color: var(--bad);
}

.metric-line {
  display: grid;
  grid-template-columns: 48px 1fr 52px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  gap: 8px;
  margin-top: 6px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(39, 24, 10, 0.08);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ee8b54, #bb4d24);
}

.content {
  display: grid;
  gap: 18px;
}

.chart-wrap {
  width: 100%;
  min-height: 360px;
}

#historyChart {
  width: 100%;
  height: 360px;
  display: block;
}

.detail-panel {
  display: grid;
  gap: 14px;
}

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

.detail-item {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(64, 44, 16, 0.08);
}

.detail-item .label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.detail-item .value {
  font-size: 22px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.rename-row {
  display: flex;
  gap: 10px;
}

.rename-row input {
  flex: 1;
}

.empty-state {
  padding: 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 1024px) {
  .summary-row,
  .layout,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
  }

  .node-list {
    height: auto;
    max-height: 420px;
  }
}
