:root {
  color-scheme: light;
  --page: #eef3ef;
  --surface: #ffffff;
  --ink: #172722;
  --muted: #788780;
  --line: #dce5df;
  --green: #245c48;
  --green-bright: #a7df62;
  --blue: #38798a;
  --coral: #e27e62;
  --mono: "DM Mono", "Cascadia Code", monospace;
  --sans: "Manrope", "Aptos", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: var(--page);
  background-image: linear-gradient(rgba(36, 92, 72, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(36, 92, 72, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.topbar {
  height: 66px;
  padding: 0 max(28px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink);
  color: #f7faf6;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.brand-light { color: #aab9b1; font-weight: 500; }
.brand-mark { width: 19px; height: 19px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; transform: rotate(-8deg); }
.brand-mark i { background: var(--green-bright); border-radius: 2px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: 0.52; }

.connection-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #cad5ce;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status-dot, .footer-dot { width: 7px; height: 7px; border-radius: 50%; background: #e2a35a; box-shadow: 0 0 0 3px rgba(226, 163, 90, 0.15); }
.connection-state.is-online .status-dot { background: var(--green-bright); box-shadow: 0 0 0 3px rgba(167, 223, 98, 0.16); }
.connection-state.is-error .status-dot { background: var(--coral); box-shadow: 0 0 0 3px rgba(226, 126, 98, 0.16); }

.dashboard { width: min(1180px, calc(100% - 56px)); margin: 0 auto; padding: 52px 0 24px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 29px; }
.eyebrow, .meta-label { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.09em; }
.eyebrow span { padding: 0 7px; color: var(--coral); }
h1 { margin: 11px 0 5px; font-size: clamp(32px, 4vw, 46px); line-height: 1.08; letter-spacing: 0; font-weight: 700; }
h1 em { color: var(--green); font-style: normal; }
.intro-copy { margin: 0; color: #64736b; font-size: 13px; }

.refresh-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 15px;
  border: 1px solid #cbd8cf;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font: 700 12px var(--sans);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.refresh-button:hover { border-color: var(--green); background: white; }
.refresh-button:active { transform: translateY(1px); }
.refresh-button:focus-visible { outline: 3px solid rgba(56, 121, 138, 0.34); outline-offset: 2px; }
.refresh-button:disabled { opacity: 0.65; cursor: wait; }
.refresh-icon { color: var(--green); font: 20px/1 var(--mono); }
.refresh-button.is-loading .refresh-icon { animation: rotate 700ms linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

.host-strip {
  display: flex;
  min-height: 91px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 17px;
  padding: 17px 22px;
  border: 1px solid #29483b;
  border-radius: 6px;
  background: var(--ink);
  color: #f4f8f3;
  box-shadow: 0 8px 22px rgba(23, 39, 34, 0.08);
}
.host-identity { display: flex; min-width: 175px; align-items: center; gap: 14px; }
.host-icon { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid #496255; border-radius: 4px; color: var(--green-bright); font: 21px var(--mono); }
.host-identity > div, .host-meta > div { display: grid; gap: 6px; }
.host-strip .meta-label { color: #94a49a; font-size: 9px; }
.host-strip strong { overflow: hidden; max-width: 240px; color: #f4f8f3; font: 500 12px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.host-meta { display: flex; flex: 1; justify-content: flex-end; gap: clamp(24px, 6vw, 82px); }

.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.metric-panel {
  min-height: 218px;
  padding: 20px 22px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 7px 20px rgba(35, 67, 52, 0.035);
  animation: rise-in 420ms ease both;
}
.metric-panel:nth-child(2) { animation-delay: 50ms; }
.metric-panel:nth-child(3) { animation-delay: 100ms; }
.metric-panel:nth-child(4) { animation-delay: 150ms; }
@keyframes rise-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.panel-heading { display: flex; align-items: center; gap: 10px; }
.metric-index { color: #98a59e; font: 10px var(--mono); }
.panel-heading h2 { margin: 0; font-size: 13px; font-weight: 800; }
.panel-symbol { margin-left: auto; padding: 5px 7px; border: 1px solid #e3ebe5; border-radius: 3px; color: var(--muted); font: 9px var(--mono); }
.processor-symbol { color: var(--green); background: #f1f8eb; }
.memory-symbol { color: var(--blue); background: #edf6f7; }
.storage-symbol { color: #bd684e; background: #fff3ef; }
.uptime-symbol { color: #677b46; background: #f4f7e9; }
.metric-primary { display: flex; align-items: baseline; gap: 4px; margin: 25px 0 14px; }
.metric-value { font-size: 37px; line-height: 1; font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.metric-unit { color: var(--muted); font: 14px var(--mono); }
.metric-caption { margin-left: auto; color: #8a9790; font-size: 10px; }
.meter { height: 6px; overflow: hidden; border-radius: 2px; background: #edf1ed; }
.meter-fill { display: block; width: 0; height: 100%; border-radius: inherit; transition: width 550ms ease; }
.cpu-fill { background: var(--green); }
.memory-fill { background: var(--blue); }
.metric-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; color: #75837b; font-size: 10px; }
.metric-foot > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-foot strong { color: #45554c; font: 500 10px var(--mono); white-space: nowrap; }

.storage-list { display: grid; gap: 12px; margin-top: 18px; }
.storage-row { display: grid; gap: 7px; }
.storage-details { display: flex; justify-content: space-between; gap: 12px; color: #53645b; font: 10px var(--mono); }
.storage-details strong { color: var(--ink); font-weight: 500; }
.storage-meter { height: 5px; overflow: hidden; border-radius: 2px; background: #f0eeec; }
.storage-meter span { display: block; height: 100%; border-radius: inherit; background: var(--coral); transition: width 550ms ease; }
.empty-state { margin: 9px 0; color: var(--muted); font-size: 11px; }

.uptime-display { margin-top: 27px; color: var(--ink); font: 500 clamp(20px, 2.4vw, 30px)/1.2 var(--mono); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.uptime-caption { margin: 9px 0 16px; color: #7a8880; font-size: 10px; }
.uptime-rule { display: flex; height: 6px; gap: 4px; }
.uptime-rule span { flex: 1; border-radius: 2px; background: #e8eee8; }
.uptime-rule span:nth-child(1), .uptime-rule span:nth-child(2), .uptime-rule span:nth-child(3) { background: var(--green-bright); }

.page-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 22px; color: #7d8a82; font: 9px var(--mono); letter-spacing: 0.04em; }
.page-footer > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.footer-dot { width: 6px; height: 6px; background: var(--green); box-shadow: none; }
.page-footer b { padding: 0 5px; color: var(--coral); font-weight: 400; }
.error-message { margin: 14px 0 0; padding: 12px 14px; border: 1px solid #f1c7bb; border-radius: 4px; background: #fff5f1; color: #9c4a34; font-size: 12px; }

@media (max-width: 720px) {
  .topbar { height: 58px; padding: 0 20px; }
  .dashboard { width: calc(100% - 40px); padding-top: 37px; }
  .host-strip { align-items: flex-start; flex-direction: column; gap: 18px; padding: 17px; }
  .host-meta { width: 100%; justify-content: space-between; gap: 14px; }
  .host-strip strong { max-width: 180px; font-size: 10px; }
  .metrics-grid { gap: 12px; }
  .metric-panel { min-height: 210px; padding: 17px 16px 15px; }
  .metric-primary { margin-top: 23px; }
  .metric-value { font-size: 33px; }
  .metric-foot { font-size: 9px; }
  .metric-foot strong { font-size: 9px; }
}

@media (max-width: 480px) {
  .dashboard { width: calc(100% - 32px); padding-top: 29px; }
  .topbar { padding: 0 16px; }
  .intro { align-items: flex-start; }
  h1 { font-size: 34px; }
  .intro-copy { max-width: 230px; font-size: 11px; line-height: 1.6; }
  .refresh-button { min-height: 38px; gap: 5px; padding: 0 10px; font-size: 10px; }
  .refresh-icon { font-size: 17px; }
  .host-meta { flex-wrap: wrap; row-gap: 14px; }
  .host-meta > div { min-width: 42%; }
  .host-strip strong { max-width: 155px; }
  .metrics-grid { grid-template-columns: 1fr; gap: 11px; }
  .metric-panel { min-height: 196px; padding: 18px; }
  .storage-panel { min-height: 188px; }
  .uptime-panel { min-height: 185px; }
  .metric-primary { margin: 23px 0 13px; }
  .metric-value { font-size: 38px; }
  .uptime-display { font-size: 25px; }
  .page-footer { align-items: flex-start; flex-direction: column; gap: 8px; margin-top: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}