:root {
  color-scheme: dark;
  --bg: #08090b;
  --panel: #101318;
  --panel-2: #151920;
  --panel-hover: #1a1f27;
  --line: #262d37;
  --line-strong: #323a46;
  --text: #e8eaed;
  --text-muted: #9aa3ae;
  --text-dim: #7a8590;
  --mint: #7dd3a0;
  --amber: #f0b36a;
  --coral: #f27a72;
  --blue: #79a8ff;
  --violet: #b69cff;
  --glow-mint: 0 0 10px #7dd3a066;
  --radius: 3px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f2;
  --panel: #ffffff;
  --panel-2: #edf0ed;
  --panel-hover: #e6eae6;
  --line: #d3d9d3;
  --line-strong: #b0bab2;
  --text: #141814;
  --text-muted: #47504a;
  --text-dim: #5c665f;
  --mint: #177a4c;
  --amber: #956007;
  --coral: #bf3d36;
  --blue: #2b62c4;
  --violet: #7141bd;
  --glow-mint: 0 0 0 3px #177a4c29;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image: radial-gradient(120% 80% at 50% -10%, var(--glow-top, #7dd3a00d), transparent 60%);
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }

.live {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: var(--glow-mint);
  flex: 0 0 auto;
  transition: background .3s;
}
.live.stale { background: var(--coral); box-shadow: 0 0 10px #f27a7280; }

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.tools { display: flex; align-items: center; gap: 10px; }

.pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 5px 9px;
  white-space: nowrap;
}

.btn {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 30px;
  height: 30px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--panel-hover); color: var(--text); border-color: var(--line-strong); }

/* ----------------------------------------------------------------- grids */
.grid { display: grid; gap: 12px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) {
  .grid.two { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 14px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chip {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px 6px;
  white-space: nowrap;
}

/* ------------------------------------------------------------- stat kartu */
.value {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
}
.value small { font-size: 15px; color: var(--text-muted); margin-left: 2px; font-weight: 500; }
.value.net { font-size: 22px; }

.sub {
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

.spark {
  width: 100%;
  height: 34px;
  margin-top: 12px;
  display: block;
  overflow: visible;
}
.spark polyline { fill: none; stroke: var(--mint); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark .area { fill: var(--mint); opacity: .10; stroke: none; }

/* ------------------------------------------------------------------ cores */
.cores {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 132px;
}

.core-row {
  display: grid;
  grid-template-columns: 46px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}
.core-bar {
  height: 7px;
  background: var(--line-strong);
  border-radius: 2px;
  overflow: hidden;
}
.core-fill {
  height: 100%;
  width: 0%;
  background: var(--mint);
  border-radius: 2px;
  transition: width .4s ease, background .3s;
}
.core-row .pct { text-align: right; color: var(--text); font-weight: 600; }

/* --------------------------------------------------------------------- kv */
.model {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}

.kv { margin: 0; display: grid; gap: 1px; }
.kv > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.kv > div:first-child { border-top: 0; }
.kv dt { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.kv dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}
.kv.wide > div { padding: 7px 0; }

/* ------------------------------------------------------------------ chart */
.chart-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}
.chart {
  width: 100%;
  height: 78px;
  display: block;
}
.chart polyline { fill: none; stroke: var(--mint); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.chart #chart-mem polyline { stroke: var(--blue); }
.chart .area { fill: var(--mint); opacity: .09; stroke: none; }
.axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------- services */
.services { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.services li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.services li:first-child { border-top: 0; }
.services .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; background: var(--text-dim); }
.services .dot.on { background: var(--mint); box-shadow: var(--glow-mint); }
.services .dot.off { background: var(--coral); }
.services .dot.warn { background: var(--amber); }
.services .name { flex: 1 1 auto; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.services .unit { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); }
.services .st { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); }
.services .st.on { color: var(--mint); }
.services .st.off { color: var(--coral); }

/* ------------------------------------------------------------------- foot */
.foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
}
