:root {
  --bg: #0b0e14;
  --sidebar-bg: #11141d;
  --surface: rgba(26, 29, 39, 0.7);
  --surface-opaque: #1a1d27;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0f2f5;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --danger: #f43f5e;
  --warning: #f59e0b;
  --radius-lg: 16px;
  --radius-md: 10px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --sidebar-width: 260px;
  --glass: blur(12px) saturate(180%);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ────────────────────────────────────────── */
.app-container {
  display: flex;
  width: 100%;
}

aside {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 40px;
  max-width: 1240px;
  width: calc(100% - var(--sidebar-width));
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar-header {
  padding: 32px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow);
}
.logo-text { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.logo-text span { color: var(--accent); }

.nav-links { padding: 0 16px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--text); }
.nav-item svg { width: 18px; opacity: 0.7; }

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.user-avatar { width: 32px; height: 32px; background: var(--surface-opaque); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; border: 1px solid var(--border); font-weight: 600; }
.username { font-size: 13px; font-weight: 600; color: var(--text); }

/* ── Glass Cards ───────────────────────────────────── */
.card {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  transition: transform 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.15); }
.card h2 { font-size: 18px; font-weight: 700; margin-bottom: 24px; display: flex; align-items: center; gap: 10px; color: var(--text); }

/* ── Forms & Inputs ────────────────────────────────── */
input, select, textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  width: 100%;
  transition: all 0.2s;
}
select option {
  background: var(--sidebar-bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; background: rgba(255,255,255,0.08); box-shadow: 0 0 0 4px var(--accent-glow); }
input::placeholder { color: var(--text-muted); opacity: 0.5; }

.btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
}
.btn-primary { background: var(--accent); color: white; box-shadow: 0 4px 12px var(--accent-glow); }
.btn-primary:hover { background: #818cf8; transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.08); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.12); }
.btn-danger { background: rgba(244, 63, 94, 0.1); color: var(--danger); border: 1px solid rgba(244, 63, 94, 0.2); }
.btn-danger:hover { background: var(--danger); color: white; }

/* ── Stats & Health ────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--surface); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); backdrop-filter: var(--glass); }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }

.health-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.health-pill {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: rgba(255,255,255,0.03); border-radius: 100px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--border);
}
.dot { width: 8px; height: 8px; border-radius: 50%; transition: all 0.3s; }
.dot.ok { background: var(--success); box-shadow: 0 0 10px var(--success); }
.dot.err { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.dot.loading { background: var(--warning); animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(1.2); } 100% { opacity: 1; transform: scale(1); } }

/* ── Overlays & Login ──────────────────────────────── */
#login-overlay {
  position: fixed; inset: 0; z-index: 1000; background: #000;
  display: flex; align-items: center; justify-content: center;
  background-image: radial-gradient(circle at 50% 50%, #1a1d27 0%, #0b0e14 100%);
}
#login-overlay.hidden { display: none; }
.login-card {
  background: var(--sidebar-bg); border: 1px solid var(--border);
  border-radius: 28px; padding: 56px; width: 100%; max-width: 420px;
  text-align: center; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.login-card h2 { font-size: 26px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.03em; }
.login-card .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }

.status-msg { margin-top: 16px; padding: 12px; border-radius: 8px; font-size: 13px; font-weight: 500; display: none; }
.status-msg.show { display: block; animation: fadeIn 0.3s ease; }
.status-msg.success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-msg.error { background: rgba(244, 63, 94, 0.1); color: var(--danger); border: 1px solid rgba(244, 63, 94, 0.2); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── Utility ───────────────────────────────────────── */
.hidden { display: none !important; }
.panel { display: none; animation: fadeIn 0.4s ease; }
.panel.active { display: block; }

.badge { padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-free { background: rgba(148, 163, 184, 0.2); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-pro { background: rgba(99, 102, 241, 0.2); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.4); }
.badge-enterprise { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }

table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 8px; }
th { text-align: left; padding: 16px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
td { padding: 16px; font-size: 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
code { font-family: "JetBrains Mono", "Fira Code", monospace; background: rgba(255,255,255,0.05); padding: 4px 8px; border-radius: 4px; font-size: 12px; }

pre { background: rgba(0,0,0,0.3); padding: 16px; border-radius: 8px; overflow-x: auto; font-size: 12px; color: #a5b4fc; border: 1px solid var(--border); }

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }
.modal-card {
  background: var(--sidebar-bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.modal-card h3 { margin-bottom: 20px; font-size: 18px; font-weight: 700; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.checkbox-group { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.checkbox-group input { width: auto; }
