:root {
  color-scheme: dark;
  --page: #070b12;
  --page-raised: #0b111c;
  --surface: #101824;
  --surface-strong: #151f2e;
  --surface-soft: #0c1420;
  --ink: #f1f6f8;
  --ink-soft: #cad5da;
  --muted: #778994;
  --line: rgba(151, 177, 188, 0.14);
  --line-strong: rgba(151, 177, 188, 0.25);
  --cyan: #35d6c1;
  --cyan-soft: rgba(53, 214, 193, 0.12);
  --blue: #5ca8ff;
  --blue-soft: rgba(92, 168, 255, 0.12);
  --amber: #ffb454;
  --amber-soft: rgba(255, 180, 84, 0.12);
  --violet: #a997ff;
  --violet-soft: rgba(169, 151, 255, 0.12);
  --red: #ff6b78;
  --red-soft: rgba(255, 107, 120, 0.12);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(53, 214, 193, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 214, 193, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 20% -10%, rgba(48, 132, 159, 0.14), transparent 31rem),
    var(--page);
  background-size: 32px 32px, 32px 32px, auto, auto;
}

button,
table {
  font: inherit;
}

button {
  color: inherit;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.88);
  backdrop-filter: blur(20px);
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(53, 214, 193, 0.35), transparent);
  content: "";
}

.topbar-inner,
.dashboard,
footer {
  width: min(1500px, calc(100% - 64px));
  margin-inline: auto;
}

.topbar-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(53, 214, 193, 0.36);
  border-radius: 11px;
  color: var(--cyan);
  background: var(--cyan-soft);
  box-shadow: inset 0 0 20px rgba(53, 214, 193, 0.06), 0 0 24px rgba(53, 214, 193, 0.08);
}

.brand-mark::after {
  position: absolute;
  width: 16px;
  height: 1px;
  top: 7px;
  right: 6px;
  background: var(--cyan);
  opacity: 0.4;
  content: "";
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  line-height: 19px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.topbar-actions,
.connection-state {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 18px;
}

.connection-state {
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.connection-state.online .status-dot {
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(53, 214, 193, 0.1), 0 0 12px var(--cyan);
  animation: pulse 2s ease-in-out infinite;
}

.connection-state.offline .status-dot {
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
}

@keyframes pulse {
  50% { opacity: 0.55; }
}

.updated-at {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  border-color: rgba(53, 214, 193, 0.5);
  color: var(--cyan);
  transform: translateY(-1px);
}

.icon-button:focus-visible,
.text-button:focus-visible {
  outline: 3px solid rgba(53, 214, 193, 0.22);
  outline-offset: 2px;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.icon-button.loading svg {
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.dashboard {
  padding: 42px 0 52px;
}

.page-heading {
  min-height: 90px;
  margin-bottom: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow::before {
  margin-right: 8px;
  content: "//";
  opacity: 0.5;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: clamp(30px, 3vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.host-summary {
  margin-bottom: 0;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.uptime-block {
  position: relative;
  min-width: 220px;
  padding: 14px 16px 14px 20px;
  border-left: 2px solid var(--cyan);
  text-align: right;
}

.uptime-block span,
.uptime-block strong {
  display: block;
}

.uptime-block span {
  margin-bottom: 5px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.uptime-block strong {
  color: var(--cyan);
  font-size: 18px;
}

.alert-banner {
  margin-bottom: 20px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid rgba(255, 107, 120, 0.35);
  border-radius: 12px;
  color: #ffb2b9;
  background: var(--red-soft);
}

.alert-banner[hidden] { display: none; }
.alert-banner > svg { width: 20px; flex: 0 0 20px; }
.alert-banner div { min-width: 0; flex: 1; }
.alert-banner strong { font-size: 13px; }
.alert-banner p { margin: 3px 0 0; color: #ca8d94; font-size: 11px; }

.text-button {
  padding: 8px 13px;
  border: 1px solid currentColor;
  border-radius: 7px;
  color: #ff929c;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card,
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(21, 31, 46, 0.92), rgba(13, 21, 33, 0.96));
  box-shadow: var(--shadow);
}

.metric-card::before,
.panel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  content: "";
}

.metric-card {
  min-width: 0;
  min-height: 198px;
  padding: 21px;
  border-radius: 14px;
}

.metric-card::after {
  position: absolute;
  width: 105px;
  height: 105px;
  right: -38px;
  bottom: -50px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.05;
  content: "";
}

.metric-card[data-metric="cpu"] { color: var(--cyan); }
.metric-card[data-metric="memory"] { color: var(--blue); }
.metric-card[data-metric="disk"] { color: var(--amber); }
.metric-card[data-metric="network"] { color: var(--violet); }

.metric-card-header {
  min-height: 38px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.metric-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  opacity: 0.95;
}

.metric-icon svg { width: 18px; height: 18px; }
.metric-icon.cpu { color: var(--cyan); background: var(--cyan-soft); }
.metric-icon.memory { color: var(--blue); background: var(--blue-soft); }
.metric-icon.disk { color: var(--amber); background: var(--amber-soft); }
.metric-icon.network { color: var(--violet); background: var(--violet-soft); }

.metric-label {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.metric-trend {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.metric-value {
  min-height: 58px;
  margin: 17px 0 12px;
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--ink);
}

.metric-value strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 43px;
  line-height: 48px;
  font-weight: 700;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.metric-value span {
  color: currentColor;
  font-size: 16px;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.065);
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--cyan);
  box-shadow: 0 0 12px currentColor;
  transition: width 400ms ease, background 200ms ease;
}

[data-metric="memory"] .progress-track span { background: var(--blue); }
[data-metric="disk"] .progress-track span { background: var(--amber); }

.metric-caption {
  margin: 11px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-rates {
  min-height: 78px;
  margin: 14px 0 7px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  color: var(--ink);
}

.network-rates div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.network-rates svg { width: 16px; height: 16px; color: var(--muted); }
.network-rates div:first-child svg { color: var(--blue); }
.network-rates div:last-child svg { color: var(--cyan); }

.network-rates strong {
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 22px;
  border-radius: 14px;
}

.panel-heading {
  min-height: 42px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-heading h2 {
  margin-bottom: 4px;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: -0.01em;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 16px;
}

.heading-icon { width: 19px; height: 19px; color: var(--cyan); opacity: 0.65; }

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 3px; border-radius: 2px; }
.cpu-dot { background: var(--cyan); box-shadow: 0 0 7px var(--cyan); }
.memory-dot { background: var(--blue); box-shadow: 0 0 7px var(--blue); }
.download-dot { background: var(--blue); box-shadow: 0 0 7px var(--blue); }
.upload-dot { background: var(--amber); box-shadow: 0 0 7px var(--amber); }

.chart-wrap {
  position: relative;
  width: 100%;
  height: 255px;
  margin-top: 20px;
}

.detail-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 0.9fr 1fr 1.2fr;
  gap: 16px;
}

.system-list { margin: 16px 0 0; }

.system-list div {
  min-height: 43px;
  padding: 9px 0;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
}

.system-list dt,
.system-list dd { margin: 0; font-size: 10px; }
.system-list dt { color: var(--muted); }

.system-list dd {
  overflow: hidden;
  color: var(--ink-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-list,
.partition-list { margin-top: 16px; }

.service-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.service-info { min-width: 0; display: flex; align-items: center; gap: 11px; }

.service-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.service-indicator.online { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.service-name, .service-meta { display: block; }

.service-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-meta {
  margin-top: 3px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.service-state {
  padding: 4px 8px;
  border: 1px solid rgba(255, 107, 120, 0.18);
  border-radius: 999px;
  color: #ff929c;
  background: var(--red-soft);
  font-size: 9px;
  font-weight: 700;
}

.service-state.online {
  border-color: rgba(53, 214, 193, 0.18);
  color: var(--cyan);
  background: var(--cyan-soft);
}

.partition-row {
  min-height: 62px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.partition-heading {
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 9px;
}

.partition-heading strong {
  max-width: 55%;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partition-heading span { color: var(--muted); font-variant-numeric: tabular-nums; }
.partition-row .progress-track { height: 4px; }
.partition-row .progress-track span { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

.empty-state {
  min-height: 140px;
  display: grid;
  place-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

footer {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.04em;
}

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .storage-panel { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .topbar-inner, .dashboard, footer { width: min(100% - 30px, 1500px); }
  .topbar-actions { gap: 10px; }
  .updated-at { display: none; }
  .dashboard { padding-top: 28px; }
  .page-heading { align-items: flex-start; }
  h1 { font-size: 30px; }
  .chart-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .storage-panel { grid-column: auto; }
  .chart-wrap { height: 225px; }
}

@media (max-width: 520px) {
  body { background-size: 24px 24px, 24px 24px, auto, auto; }
  .topbar { min-height: 66px; }
  .topbar-inner { min-height: 66px; }
  .brand-mark { width: 37px; height: 37px; border-radius: 9px; }
  .brand strong { font-size: 12px; }
  .brand small, .connection-state span:last-child { display: none; }
  .connection-state { width: 28px; height: 28px; padding: 0; justify-content: center; border: 0; background: transparent; }
  .topbar-actions { gap: 8px; }
  .icon-button { width: 35px; height: 35px; }
  .page-heading { min-height: auto; flex-direction: column; gap: 15px; margin-bottom: 22px; }
  h1 { font-size: 28px; word-break: break-all; }
  .host-summary { font-size: 10px; }
  .uptime-block { min-width: 0; padding: 2px 0 2px 12px; text-align: left; }
  .uptime-block span, .uptime-block strong { display: inline; }
  .uptime-block span { margin-right: 7px; }
  .uptime-block strong { font-size: 14px; }
  .metric-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .metric-card { min-height: 182px; }
  .chart-grid, .detail-grid { gap: 12px; margin-top: 12px; }
  .panel { padding: 18px; }
  .legend { gap: 9px; }
  .panel-heading { gap: 10px; }
  .alert-banner { align-items: flex-start; flex-wrap: wrap; }
  .alert-banner .text-button { margin-left: 33px; }
  footer { gap: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
