:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #667085;
  --line: #e3e6ec;
  --accent: #2f6fed;
  --accent-text: #ffffff;
  --ok: #17924f;
  --warn: #b97509;
  --bad: #d43d3d;
  --info: #2f6fed;
  --track: #e9ecf2;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --card: #1b2029;
    --text: #e8ebf1;
    --muted: #98a2b3;
    --line: #2b323e;
    --accent: #5b8ff9;
    --accent-text: #0d1117;
    --ok: #3fc27c;
    --warn: #e5a73b;
    --bad: #f07171;
    --info: #5b8ff9;
    --track: #2b323e;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

header.top {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.top-inner, main {
  max-width: 1080px; margin: 0 auto; padding: 0 16px;
}
.top-inner { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { font-weight: 700; color: var(--text); }
nav { display: flex; gap: 4px; flex: 1; }
nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
nav a:hover { text-decoration: none; background: var(--bg); }
nav a.on { color: var(--text); background: var(--bg); }
main { padding-top: 24px; padding-bottom: 64px; }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.section { margin-top: 28px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 22px; font-weight: 650; margin: 2px 0 8px; }
.tile .value small { font-size: 13px; font-weight: 400; color: var(--muted); }

button, .btn {
  font: inherit; font-weight: 550; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 7px 14px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .btn:hover { border-color: var(--muted); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--bad); }
button.sm { padding: 4px 10px; font-size: 13px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; }

.svc-head { display: flex; align-items: center; gap: 12px; }
.icon {
  width: 42px; height: 42px; border-radius: 10px; background: var(--bg);
  display: grid; place-items: center; font-size: 22px; flex: none;
}
.svc-name { font-weight: 650; font-size: 16px; color: var(--text); overflow-wrap: anywhere; }
.svc-head .grow { flex: 1; min-width: 0; }
.pill {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c);
}
.pill::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.s-running { --c: var(--ok); }
.s-starting, .s-stopping { --c: var(--warn); }
.s-crashed { --c: var(--bad); }
.s-stopped { --c: var(--muted); }
.s-pending { --c: var(--info); }

.meter { margin-top: 12px; }
.meter .cap { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.meter .cap b { color: var(--text); font-weight: 550; }
.bar { height: 7px; background: var(--track); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.bar i.hot { background: var(--warn); }
.bar i.max { background: var(--bad); }
.spark { width: 100%; height: 30px; display: block; margin-top: 10px; }
.spark polyline, .chart polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart { width: 100%; height: 130px; display: block; }
.chart polygon { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.chart line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; color: var(--text);
}
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.banner {
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--c) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}
.banner .grow { flex: 1; min-width: 200px; }
.banner.work { --c: var(--info); }
.banner.good { --c: var(--ok); }
.banner.bad { --c: var(--bad); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid color-mix(in srgb, var(--info) 30%, transparent); border-top-color: var(--info);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

pre.log {
  background: #0f1319; color: #d7dde8; border-radius: 10px; padding: 12px; margin: 0;
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}

form .field { margin-bottom: 16px; }
label.name { display: block; font-weight: 600; margin-bottom: 4px; }
.help { color: var(--muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=number], input[type=password], select, textarea {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; max-width: 460px;
}
textarea { min-height: 92px; max-width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 550; }
.check input { margin-top: 4px; }
details.more { margin-bottom: 16px; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 550; margin-bottom: 12px; }
.error { color: var(--bad); font-weight: 550; margin: 8px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 460px; }

.pick { cursor: pointer; text-align: left; display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 14px; border-radius: var(--radius); font-weight: 400; }
.pick b { display: block; font-weight: 650; }
.pick:hover { border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 550; }
tr:last-child td { border-bottom: 0; }
td.right { text-align: right; white-space: nowrap; }

.login { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; }
.login h1 { margin-bottom: 18px; text-align: center; }
.login input { max-width: none; }
.login button { width: 100%; justify-content: center; margin-top: 6px; }

.empty { text-align: center; padding: 40px 16px; }
.empty .big { font-size: 40px; }

#modal:empty { display: none; }
#modal {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .55); z-index: 20;
  display: grid; place-items: center; padding: 16px;
}
#modal .card { width: 100%; max-width: 440px; }
#modal .actions { justify-content: flex-end; }

@media (max-width: 560px) {
  .top-inner { gap: 8px; }
  .brand { display: none; }
  .two { grid-template-columns: 1fr; }
}
