:root {
  --bg: #0f1720;
  --panel: #16212c;
  --panel-2: #1d2a38;
  --line: #2b3a4a;
  --text: #d6e2ee;
  --muted: #91a2b5;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --accent: #38bdf8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #0f1720 0%, #111827 100%);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 32, 0.85);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  margin-left: 8px;
}

.badge.ok {
  border-color: var(--ok);
  color: var(--ok);
}

.badge.warn {
  border-color: var(--warn);
  color: var(--warn);
}

.badge.bad {
  border-color: var(--bad);
  color: var(--bad);
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 110px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(22, 33, 44, 0.7);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tab-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
}

.tab-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.content {
  padding: 18px;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.card, .pane {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
  margin-bottom: 12px;
}

.card h3, .pane h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.card p {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
}

th {
  color: var(--muted);
}

.ops-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.service-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0e1620;
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  margin-top: 4px;
  margin-bottom: 10px;
}

label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

label.inline input {
  width: auto;
  margin: 0;
}

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

.stream {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b121a;
  padding: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.filters {
  display: grid;
  grid-template-columns: 240px 180px 130px;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    flex-wrap: wrap;
  }

  .tab-btn {
    flex: 1 1 auto;
    min-width: 120px;
  }

  .filters {
    grid-template-columns: 1fr;
  }
}
