:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --font: "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: linear-gradient(160deg, #0a0e14 0%, #121a28 50%, #0f1419 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.page { max-width: 1180px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.brand { display: flex; gap: 1rem; align-items: center; }
.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex-shrink: 0;
  display: block;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
}
h1 { font-size: 1.35rem; font-weight: 600; }
.subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 0.15rem; }

.user-bar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  max-width: 320px;
}
.user-bar .name { font-weight: 600; }
.user-bar button {
  margin-top: 0.5rem; background: transparent; border: 1px solid var(--surface2);
  color: var(--muted); padding: 0.25rem 0.6rem; border-radius: 6px; cursor: pointer;
}
.user-bar button:hover { color: var(--text); border-color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card.center { text-align: center; padding: 2.5rem 1.5rem; }
.card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.card p { color: var(--muted); margin-bottom: 1rem; }

.hidden { display: none !important; }

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
  border: 1px solid var(--surface2);
  color: var(--text);
  background: var(--surface2);
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.stat .label { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 0.35rem; }
.stat .value { font-size: 1.5rem; font-weight: 600; }
.stat .value.small { font-size: 0.95rem; font-weight: 500; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.badge {
  background: var(--surface2);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge.warn { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.badge.danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge.muted { opacity: 0.7; }

.progress-wrap {
  height: 8px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  min-width: 80px;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #6366f1);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-bar.warn { background: linear-gradient(90deg, var(--warn), #f97316); }
.progress-bar.danger { background: linear-gradient(90deg, var(--danger), #dc2626); }

.error { color: var(--danger); margin-top: 1rem; font-size: 0.9rem; }
.muted { color: var(--muted); font-size: 0.88rem; }

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tab {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--surface2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.alert-list { display: grid; gap: 0.5rem; }
.alert {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  border: 1px solid var(--surface2);
}
.alert.critical { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); }
.alert.warn { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.08); }

.table-wrap { overflow-x: auto; font-size: 0.85rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--surface2); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; }
tr.unavailable { background: rgba(239, 68, 68, 0.06); }
tr.warn-row { background: rgba(245, 158, 11, 0.06); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: min(480px, 100%);
}
.modal h3 { margin-bottom: 1rem; }
.form { display: grid; gap: 0.75rem; }
.form label { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.form input, .form select {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--surface2);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}
.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }

.toolbar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; flex-wrap: wrap; }
