:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: #10131a;
  --surface-2: #141821;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #f4f6f8;
  --muted: #87909f;
  --blue: #5b8cff;
  --violet: #a377ff;
  --amber: #f2b84b;
  --green: #47d99b;
  --red: #ff667a;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 78% -10%, rgba(91, 140, 255, 0.10), transparent 32rem),
    radial-gradient(circle at 15% 35%, rgba(163, 119, 255, 0.045), transparent 26rem),
    var(--bg);
}

button, a { font: inherit; }

.page-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 36px;
}

.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: linear-gradient(145deg, #1b2230, #0d1016);
  font-weight: 800;
  font-size: 15px;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; letter-spacing: 0.16em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 8px; letter-spacing: 0.24em; }

.live-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.13em;
}

.pulse {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(242, 184, 75, 0.10);
}

.live-state.online .pulse { background: var(--green); box-shadow: 0 0 0 4px rgba(71, 217, 155, 0.10); }
.live-state.offline .pulse { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 102, 122, 0.10); }

main { padding: 64px 0 42px; }

.intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 48px;
  margin-bottom: 56px;
}

.eyebrow {
  margin: 0 0 14px;
  color: #6f7c91;
  font: 600 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.17em;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(42px, 5.2vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 660;
}

h1 span { color: #667083; }

.intro-meta {
  display: flex;
  gap: 40px;
  padding-bottom: 7px;
}

.intro-meta span, .intro-meta strong { display: block; }
.intro-meta span { color: var(--muted); font: 600 9px/1 ui-monospace, monospace; letter-spacing: 0.14em; }
.intro-meta strong { margin-top: 9px; font: 500 13px/1.2 ui-monospace, monospace; white-space: nowrap; }

.host-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric-card, .panel {
  border: 1px solid var(--line);
  background: rgba(16, 19, 26, 0.90);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 206px;
  padding: 22px;
  border-radius: 14px;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  opacity: 0.85;
}

.accent-blue { --accent: var(--blue); }
.accent-violet { --accent: var(--violet); }
.accent-amber { --accent: var(--amber); }
.accent-green { --accent: var(--green); }

.metric-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #a3adbc;
  font: 600 9px/1 ui-monospace, monospace;
  letter-spacing: 0.14em;
}

.metric-state { color: var(--accent); }

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 31px;
}

.metric-value strong { font-size: 43px; line-height: 1; letter-spacing: -0.045em; font-weight: 590; }
.metric-value span { color: var(--muted); font-size: 16px; }

.meter {
  height: 3px;
  margin-top: 26px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
}

.meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 400ms ease;
}

.metric-card p { margin: 14px 0 0; color: var(--muted); font: 500 11px/1.4 ui-monospace, monospace; }

.network-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 34px; }
.network-values div { min-width: 0; }
.network-values span { margin-right: 6px; color: var(--green); }
.network-values strong { font: 560 19px/1 ui-monospace, monospace; letter-spacing: -0.05em; }

.chart-panel { margin-top: 12px; padding: 25px 26px 20px; border-radius: 14px; }
.panel-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
h2 { margin: 0; font-size: 24px; letter-spacing: -0.035em; font-weight: 600; }

.chart-controls { display: flex; gap: 10px; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #0b0e13; }
.segmented button {
  min-width: 42px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  color: #737e8e;
  background: transparent;
  cursor: pointer;
  font: 600 9px/1 ui-monospace, monospace;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { color: var(--text); background: #202633; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }

.chart-wrap { position: relative; height: 290px; margin-top: 25px; }
#history-chart { display: block; width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 0; display: none; place-items: center; color: var(--muted); font-size: 12px; }
.chart-empty.visible { display: grid; }

.chart-legend { display: flex; justify-content: space-between; margin-top: 17px; color: var(--muted); font: 500 10px/1 ui-monospace, monospace; }
.chart-legend span:first-child { display: flex; align-items: center; gap: 8px; }
.chart-legend i { width: 14px; height: 2px; border-radius: 3px; background: var(--blue); }
.chart-legend b { color: #aeb7c4; font-weight: 550; }

.services-section { margin-top: 58px; }
.section-heading { margin-bottom: 20px; }
.service-summary { text-align: right; }
.service-summary strong { display: block; font: 600 24px/1 ui-monospace, monospace; }
.service-summary span { display: block; margin-top: 6px; color: var(--muted); font: 500 9px/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .12em; }

.service-table { overflow: hidden; border-radius: 14px; }
.service-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) minmax(110px, .8fr) minmax(80px, .6fr) minmax(180px, 1.2fr) minmax(130px, .9fr) minmax(90px, .6fr);
  align-items: center;
  gap: 18px;
  min-height: 74px;
  padding: 0 22px;
  border-top: 1px solid var(--line);
}

.service-table-head { min-height: 45px; border-top: 0; background: rgba(255,255,255,.015); color: #667181; font: 600 8px/1 ui-monospace, monospace; letter-spacing: .14em; }
.service-data-row { cursor: pointer; transition: background 150ms ease; }
.service-data-row:hover, .service-data-row.selected { background: rgba(91, 140, 255, .045); }
.service-data-row.selected { box-shadow: inset 2px 0 var(--blue); }

.service-name { min-width: 0; }
.service-name strong { display: block; overflow: hidden; color: #e8ebef; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.service-name span { display: block; margin-top: 5px; overflow: hidden; color: #687283; font: 500 9px/1 ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.service-name a { color: inherit; text-decoration: none; }
.service-name a:hover { color: var(--blue); }

.status-pill { display: inline-flex; width: fit-content; align-items: center; gap: 7px; color: #a6b0bd; font: 600 9px/1 ui-monospace, monospace; text-transform: uppercase; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.status-pill.operational::before { background: var(--green); box-shadow: 0 0 0 3px rgba(71,217,155,.08); }
.status-pill.degraded::before { background: var(--amber); }

.service-number { color: #d1d6dd; font: 550 12px/1.3 ui-monospace, monospace; }
.memory-cell strong { display: block; font: 550 11px/1 ui-monospace, monospace; }
.mini-meter { display: block; width: 100%; max-width: 145px; height: 2px; margin-top: 9px; background: rgba(255,255,255,.06); }
.mini-meter i { display: block; height: 100%; background: var(--violet); }
.io-cell span { display: block; color: #8993a1; font: 500 9px/1.6 ui-monospace, monospace; }
.loading-row { display: grid; min-height: 120px; place-items: center; color: var(--muted); font-size: 12px; }
.table-note { margin: 12px 4px 0; color: #596272; font-size: 10px; line-height: 1.5; }

footer {
  display: flex;
  justify-content: space-between;
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  color: #515a69;
  font: 600 8px/1 ui-monospace, monospace;
  letter-spacing: .13em;
}

@media (max-width: 1050px) {
  .host-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-row { grid-template-columns: minmax(200px, 1.5fr) 110px 75px minmax(150px, 1fr) 90px; }
  .service-row > :last-child { display: none; }
}

@media (max-width: 720px) {
  .page-shell { padding: 0 18px; }
  .topbar { height: 68px; }
  main { padding-top: 42px; }
  .intro { align-items: start; flex-direction: column; margin-bottom: 38px; }
  .intro-meta { width: 100%; justify-content: space-between; }
  .host-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 180px; }
  .chart-panel { padding: 20px 16px 16px; }
  .chart-heading { align-items: start; flex-direction: column; }
  .chart-controls { width: 100%; justify-content: space-between; }
  .chart-wrap { height: 230px; }
  .services-section { margin-top: 42px; }
  .service-row { grid-template-columns: minmax(150px, 1.5fr) 98px 60px 95px; gap: 10px; padding: 0 14px; }
  .service-row > :nth-child(5), .service-row > :nth-child(6) { display: none; }
  .service-table-head { font-size: 7px; }
  footer { flex-direction: column; gap: 10px; }
}

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