:root {
  --bg: #06080f;
  --bg2: #0c1019;
  --card: rgba(16, 22, 36, 0.85);
  --border: rgba(99, 179, 237, 0.12);
  --text: #e8edf7;
  --muted: #7a8ba8;
  --accent: #00e5a0;
  --accent2: #00b4d8;
  --danger: #ff4d6d;
  --warn: #ffb020;
  --radius: 14px;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 229, 160, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(0, 180, 216, 0.06), transparent);
}

/* Login */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; position: relative; overflow: hidden;
}
.login-glow {
  position: absolute; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,229,160,0.15), transparent 70%);
  top: -200px; right: -100px; pointer-events: none;
}
.login-card {
  width: 100%; max-width: 420px; padding: 2.5rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); backdrop-filter: blur(20px);
  box-shadow: var(--shadow); position: relative; z-index: 1;
}
.brand-mark { display: flex; gap: 1rem; align-items: center; margin-bottom: 2rem; }
.brand-icon {
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px; font-size: 1.25rem; color: #000; font-weight: 700;
}
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.brand-sub { font-size: 0.7rem; color: var(--accent); letter-spacing: 0.15em; font-weight: 600; }
.login-card h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.link-muted { display: block; margin-top: 1.5rem; color: var(--accent2); text-decoration: none; font-size: 0.85rem; }

/* App layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.5rem 0; flex-shrink: 0;
}
.sidebar-brand {
  display: flex; gap: 0.75rem; align-items: center; padding: 0 1.5rem 2rem;
  border-bottom: 1px solid var(--border); margin-bottom: 1rem;
}
.sidebar-brand strong { display: block; font-size: 0.95rem; }
.sidebar-brand small { color: var(--accent); font-size: 0.65rem; letter-spacing: 0.12em; }
.nav { flex: 1; display: flex; flex-direction: column; gap: 0.25rem; padding: 0 0.75rem; }
.nav a {
  padding: 0.75rem 1rem; border-radius: 10px; color: var(--muted);
  text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: all 0.2s;
}
.nav a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav a.active {
  background: linear-gradient(90deg, rgba(0,229,160,0.15), transparent);
  color: var(--accent); border-left: 3px solid var(--accent); margin-left: -3px;
}
.sidebar-footer { padding: 1rem 1.5rem; }
.status-pill {
  font-size: 0.75rem; font-weight: 600; padding: 0.5rem 0.75rem;
  border-radius: 999px; text-align: center;
}
.status-pill.online { background: rgba(0,229,160,0.15); color: var(--accent); }
.status-pill.offline { background: rgba(255,77,109,0.15); color: var(--danger); }

.main { flex: 1; padding: 2rem; overflow-x: auto; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.topbar h1 { font-size: 1.5rem; font-weight: 700; }
.topbar-actions { display: flex; gap: 0.75rem; }

/* Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
}
.stat-card.accent { border-color: rgba(0,229,160,0.3); }
.stat-card.warn { border-color: rgba(255,176,32,0.3); }
.stat-label { display: block; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-value { display: block; font-size: 2rem; font-weight: 700; margin: 0.25rem 0; }
.stat-hint { font-size: 0.8rem; color: var(--muted); }

/* Panels */
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
}
.panel h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel-header h2 { margin: 0; }

/* Forms */
.form label, .form-grid label { display: block; font-size: 0.8rem; color: var(--muted); margin: 1rem 0 0.4rem; }
.form input, .form-grid input {
  width: 100%; padding: 0.75rem 1rem; background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  font-family: var(--font); font-size: 0.95rem;
}
.form input:focus, .form-grid input:focus { outline: none; border-color: var(--accent); }
.form-grid { max-width: 560px; }
.form-actions { margin-top: 1.5rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.65rem 1.25rem; border-radius: 10px; border: none;
  font-family: var(--font); font-weight: 600; font-size: 0.875rem;
  cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #00c484);
  color: #000;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-danger { background: rgba(255,77,109,0.2); color: var(--danger); border: 1px solid rgba(255,77,109,0.4); }
.btn-success { background: rgba(0,229,160,0.2); color: var(--accent); border: 1px solid rgba(0,229,160,0.4); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-block { width: 100%; margin-top: 1.5rem; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.mono { font-family: var(--mono); font-size: 0.8rem; }
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  display: inline-block; padding: 0.2rem 0.5rem; background: rgba(0,180,216,0.15);
  color: var(--accent2); border-radius: 6px; font-family: var(--mono); font-size: 0.75rem;
}
.badge { padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge-ok { background: rgba(0,229,160,0.15); color: var(--accent); }
.badge-off { background: rgba(255,77,109,0.15); color: var(--danger); }

.code-block {
  display: flex; align-items: center; gap: 1rem; padding: 1rem;
  background: var(--bg); border-radius: 10px; border: 1px solid var(--border);
  margin: 1rem 0;
}
.code-block code { flex: 1; font-family: var(--mono); font-size: 0.8rem; word-break: break-all; }
.config-snippet {
  background: var(--bg); padding: 1rem; border-radius: 10px; font-family: var(--mono);
  font-size: 0.75rem; overflow-x: auto; color: var(--accent2); border: 1px solid var(--border);
}

.alert { padding: 0.75rem 1rem; border-radius: 10px; margin: 1rem 0; font-size: 0.9rem; }
.alert-error { background: rgba(255,77,109,0.15); color: var(--danger); border: 1px solid rgba(255,77,109,0.3); }

.toast {
  position: fixed; bottom: 2rem; right: 2rem; padding: 1rem 1.5rem;
  background: var(--card); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 999; transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* Docs */
.docs { max-width: 900px; margin: 0 auto; padding: 3rem 2rem; }
.docs h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.docs h2 { margin: 2rem 0 1rem; color: var(--accent); font-size: 1.2rem; }
.docs pre {
  background: var(--bg2); padding: 1rem; border-radius: 10px; overflow-x: auto;
  font-family: var(--mono); font-size: 0.8rem; border: 1px solid var(--border); margin: 1rem 0;
}
.docs table { margin: 1rem 0; }
.docs a { color: var(--accent2); }

@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; }
}
