@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --bg: #09090b;
  --bg2: #0f0f12;
  --bg3: #16161c;
  --bg4: #1e1e28;
  --border: rgba(255,255,255,.07);
  --border2: rgba(255,255,255,.12);
  --text: #f4f4f5;
  --muted: #9b9baf;
  --accent: #8b5cf6;
  --accent2: #a78bfa;
  --accent-glow: rgba(139,92,246,.45);
  --danger: #f43f5e;
  --warn: #f59e0b;
  --ok: #22c55e;
  --info: #38bdf8;
  --card-bg: rgba(15,15,18,.75);
  --topbar-bg: rgba(15,15,18,.72);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
  overflow-x: hidden;
}

/* Animated background */
#net-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.85;
}
.bg-fx {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
}
.bg-fx .orb {
  position: absolute; border-radius: 50%; filter: blur(80px);
  opacity: .35; animation: float 18s ease-in-out infinite;
}
.bg-fx .orb-1 {
  width: 420px; height: 420px; top: -80px; left: -60px;
  background: radial-gradient(circle, #7c3aed, transparent 70%);
  animation-delay: 0s;
}
.bg-fx .orb-2 {
  width: 380px; height: 380px; bottom: -100px; right: -40px;
  background: radial-gradient(circle, #2563eb, transparent 70%);
  animation-delay: -6s;
}
.bg-fx .orb-3 {
  width: 280px; height: 280px; top: 40%; left: 45%;
  background: radial-gradient(circle, #db2777, transparent 70%);
  opacity: .2; animation-delay: -12s;
}
.bg-fx .grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.08); }
  66% { transform: translate(-30px, 25px) scale(.95); }
}

a { color: var(--accent2); text-decoration: none; transition: color .15s; }
a:hover { color: #fff; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: rgba(15,15,18,.82);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  flex-shrink: 0;
  transition: width .28s cubic-bezier(.4,0,.2,1);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 8px 10px 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.brand-badge { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; background: linear-gradient(135deg, #8b5cf6, #6366f1); box-shadow: 0 0 24px var(--accent-glow); }
.brand-text h1 { font-size: 14px; font-weight: 700; white-space: nowrap; }
.brand-text span { font-size: 11px; color: var(--muted); display: block; white-space: nowrap; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 10px; margin: 0 4px 10px; background: var(--bg3); border-radius: var(--radius-sm); border: 1px solid var(--border); color: inherit; text-decoration: none; }
.me-chip img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(139,92,246,.5); flex-shrink: 0; }
.me-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.me-role { font-size: 11px; color: var(--muted); white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 2px; text-decoration: none; min-height: 42px; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.04); color: var(--text); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(139,92,246,.25), rgba(139,92,246,.08)); color: #e9e0ff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .ico { width: 20px; height: 20px; flex: 0 0 20px; stroke: currentColor; }
.nav a span { white-space: nowrap; transition: opacity .2s; }
.nav .sep { height: 1px; background: var(--border); margin: 10px 8px; }
.nav a.nav-logout { color: #fb7185; }
.nav a.nav-logout:hover { background: rgba(244,63,94,.12); }
.content-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: var(--topbar-bg); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 30; }
.topbar-spacer { flex: 1; }
.lang-switch { display: inline-flex; background: var(--bg3); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.lang-btn { min-width: 40px; text-align: center; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; }
.lang-btn.active { background: var(--accent); color: #fff; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg3); color: var(--text); text-decoration: none; }
.topbar-user img { width: 28px; height: 28px; border-radius: 50%; }
.main { padding: 22px 32px 56px; max-width: 1400px; }
.page-title { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card-bg); backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card:hover { border-color: var(--border2); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.card h3 { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .08em; }
.stat-val { font-size: 30px; font-weight: 800; background: linear-gradient(135deg, #fff, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-val.blue { background: linear-gradient(135deg, #7dd3fc, #38bdf8); -webkit-background-clip: text; background-clip: text; }
.stat-val.green { background: linear-gradient(135deg, #86efac, #22c55e); -webkit-background-clip: text; background-clip: text; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.on { background: rgba(34,197,94,.15); color: #4ade80; }
.badge.off { background: rgba(155,155,175,.12); color: var(--muted); }
.badge.warn { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge.danger { background: rgba(244,63,94,.15); color: #fb7185; }
.role-pill { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; background: transparent; }
.role-pill::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; background: linear-gradient(135deg, var(--c1,#aaa), var(--c2,#666)); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.role-pill-text { background-image: linear-gradient(135deg, var(--c1,#aaa), var(--c2,#666)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 10px; padding: 9px 16px; font-family: var(--font); font-size: 13px; font-weight: 700; cursor: pointer; color: #fff; text-decoration: none; transition: background .15s, color .15s, transform .12s; }
.btn-primary { background: linear-gradient(135deg, #8b5cf6, #6366f1); box-shadow: 0 8px 24px rgba(139,92,246,.3); }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.btn-ghost { background: rgba(255,255,255,.04); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
input, select, textarea { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 10px 12px; font-family: var(--font); font-size: 14px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,92,246,.2); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.form-row { margin-bottom: 14px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; position: relative; z-index: 1; }
.login-card { width: min(420px, 92vw); position: relative; z-index: 2; }
.login-card h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.error { background: rgba(244,63,94,.12); color: #fb7185; border: 1px solid rgba(244,63,94,.35); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.note { background: rgba(139,92,246,.1); border: 1px solid rgba(139,92,246,.25); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: #ddd6fe; margin-bottom: 16px; }
.note.warn { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fde68a; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.user-name { font-weight: 600; font-size: 13px; color: var(--text); text-decoration: none; }
.user-id { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; background: var(--bg3); border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--border2); background: var(--bg4); text-decoration: none; }
.icon-btn.active { color: #fff; border-color: var(--accent); background: rgba(139,92,246,.2); }
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .me-meta,
body.sidebar-collapsed .nav-label { display: none !important; }
body.sidebar-collapsed .nav a { justify-content: center; padding: 11px 0; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 45; }
.sidebar-close { display: none; }
.muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 28px; text-align: center; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.flash-toast { position: fixed; bottom: 24px; right: 24px; z-index: 400; padding: 12px 18px; border-radius: 12px; background: linear-gradient(135deg, #7c3aed, #4f46e5); color: #fff; font-weight: 600; }
.site-modal-overlay { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(0,0,0,.65); padding: 16px; }
.site-modal-overlay[hidden] { display: none !important; }
.site-modal { width: min(400px, 100%); padding: 24px; border-radius: 18px; background: linear-gradient(160deg, rgba(28,24,40,.98), rgba(12,10,18,.99)); border: 1px solid rgba(167,139,250,.28); }
.site-modal-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.site-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.verify-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(0,0,0,.78); backdrop-filter: blur(10px); padding: 16px; }
.verify-modal { width: min(420px, 100%); padding: 28px 26px 22px; border-radius: 20px; background: linear-gradient(160deg, rgba(28,24,40,.96), rgba(12,10,18,.98)); border: 1px solid rgba(167,139,250,.28); text-align: center; }
.otp-row { display: flex; gap: 8px; justify-content: center; margin: 12px 0 16px; }
.otp-box { width: 42px; height: 52px; text-align: center; font-size: 22px; font-weight: 800; font-family: var(--mono); border-radius: 12px; border: 1px solid rgba(167,139,250,.4); background: rgba(0,0,0,.35); color: var(--text); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .sidebar { position: fixed; transform: translateX(-105%); width: min(300px, 86vw) !important; z-index: 50; transition: transform .28s; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .sidebar-close { display: flex; position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg3); color: var(--text); align-items: center; justify-content: center; }
  .main { padding: 16px 12px 40px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .topbar { padding: 10px 12px; }
}
.row-danger td { background: rgba(237,66,69,.12); }
.badge-muted { opacity: .75; }
