:root {
  --bg: #0f1216;
  --surface: #171c22;
  --surface-2: #20262e;
  --line: #2e3742;
  --text: #eef3f7;
  --dim: #a6b0bb;
  --mute: #697583;
  --accent: #66d9ef;
  --good: #5bd18a;
  --bad: #ff7373;
  --warn: #f0c36a;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input {
  font: inherit;
}

button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: #061015;
  font-weight: 700;
  padding: 9px 12px;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--dim);
  border-color: var(--line);
}

button.danger {
  background: transparent;
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad), transparent 45%);
}

button.small {
  padding: 6px 8px;
  font-size: 12px;
}

input {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b0e11;
  color: var(--text);
  padding: 9px 10px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  justify-content: space-between;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
  background: #11161b;
}

.kicker {
  color: var(--mute);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 3px 0 0;
  letter-spacing: -0.02em;
}

h1 { font-size: 25px; }
h2 { font-size: 17px; }

.auth {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(190px, 280px) auto auto;
  gap: 8px;
  align-items: center;
}

main {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 24px 42px;
}

.status {
  min-height: 38px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.status.ok { color: var(--good); }
.status.err { color: var(--bad); }
.muted { color: var(--mute); }

.grid {
  display: grid;
  gap: 10px;
}

.stats {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
}

.metric span {
  display: block;
  color: var(--mute);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel + .panel { margin-top: 16px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.tools {
  display: flex;
  gap: 8px;
}

.tools input {
  width: 290px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th, td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

thead th {
  border-top: 0;
  color: var(--mute);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--surface-2);
}

.right { text-align: right; }

.id {
  color: var(--mute);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 3px 7px;
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.pill.pro {
  color: var(--good);
  border-color: color-mix(in srgb, var(--good), transparent 40%);
}

.actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.split {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 16px;
  margin-top: 16px;
}

.health {
  margin: 0;
  padding: 4px 14px 14px;
}

.health div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.health div:first-child { border-top: 0; }

dt {
  color: var(--mute);
  font-size: 12px;
}

dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.events {
  list-style: none;
  margin: 0;
  padding: 0;
}

.events li {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
}

.events li:first-child { border-top: 0; }

.event-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--mute);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  color: var(--dim);
  font-size: 11px;
}

@media (max-width: 860px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
  .auth {
    grid-template-columns: 1fr;
  }
  .stats, .split {
    grid-template-columns: 1fr;
  }
}
