:root {
	color-scheme: dark;
	--bg: #090e1b;
	--bg-soft: #0d1425;
	--surface: rgba(18, 28, 48, .82);
	--surface-2: rgba(24, 37, 61, .86);
	--surface-hover: rgba(34, 49, 78, .92);
	--border: rgba(148, 163, 184, .12);
	--border-bright: rgba(139, 92, 246, .34);
	--text: #eef2ff;
	--muted: #94a3b8;
	--muted-2: #64748b;
	--primary: #7c3aed;
	--primary-2: #4f7cff;
	--cyan: #21c7ff;
	--green: #34d399;
	--amber: #fbbf24;
	--red: #fb7185;
	--sidebar-width: 278px;
	--shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
	margin: 0;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	background:
		radial-gradient(circle at 75% 0%, rgba(79, 124, 255, .11), transparent 30%),
		radial-gradient(circle at 20% 10%, rgba(124, 58, 237, .12), transparent 28%),
		var(--bg);
	color: var(--text);
}
button, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }
.boot-screen {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	color: var(--muted);
}
.boot-screen strong { display: block; color: var(--text); font-size: 24px; letter-spacing: .06em; }
.boot-screen strong span { color: #a78bfa; }
.boot-screen p { margin: 4px 0 0; }

.brand-mark {
	width: 48px;
	height: 48px;
	border-radius: 15px;
	display: grid;
	place-items: center;
	font-size: 25px;
	font-weight: 900;
	background: linear-gradient(135deg, var(--primary-2), var(--primary));
	box-shadow: 0 10px 35px rgba(124, 58, 237, .35);
}

.layout { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar {
	position: sticky;
	top: 0;
	height: 100vh;
	padding: 22px 18px;
	border-right: 1px solid var(--border);
	background: rgba(7, 12, 25, .78);
	backdrop-filter: blur(24px);
	display: flex;
	flex-direction: column;
	z-index: 30;
}
.brand { display: flex; align-items: center; gap: 13px; padding: 2px 4px 20px; }
.brand .brand-mark { width: 44px; height: 44px; border-radius: 14px; }
.brand-title { font-weight: 850; font-size: 24px; letter-spacing: .04em; }
.brand-title span { color: #a78bfa; }
.brand-subtitle { margin-top: 1px; color: var(--muted); font-size: 10px; letter-spacing: .18em; }

.server-select-wrap { margin: 4px 4px 20px; position: relative; }
.server-select {
	width: 100%;
	appearance: none;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
	color: var(--text);
	padding: 12px 38px 12px 13px;
	outline: none;
}
.server-select-wrap::after { content: "⌄"; position: absolute; right: 14px; top: 9px; color: var(--muted); pointer-events: none; }

.nav-scroll { overflow-y: auto; padding-right: 3px; }
.nav-section { margin: 17px 0 8px; padding: 0 11px; color: var(--muted-2); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-item {
	width: 100%;
	border: 0;
	background: transparent;
	color: #b6c2d7;
	border-radius: 11px;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	cursor: pointer;
	text-align: left;
	transition: .18s ease;
}
.nav-item:hover { background: rgba(148, 163, 184, .08); color: var(--text); }
.nav-item.active { color: white; background: linear-gradient(110deg, rgba(79,124,255,.86), rgba(124,58,237,.9)); box-shadow: 0 10px 28px rgba(79, 70, 229, .22); }
.nav-icon { width: 20px; text-align: center; opacity: .92; }
.nav-badge { margin-left: auto; font-size: 10px; color: #c4b5fd; padding: 3px 7px; background: rgba(124,58,237,.16); border: 1px solid rgba(124,58,237,.24); border-radius: 999px; }

.profile {
	margin-top: auto;
	padding: 15px 10px 2px;
	border-top: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: 10px;
}
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.profile-info { min-width: 0; }
.profile-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role { color: #c4b5fd; font-size: 10px; margin-top: 2px; }

.main { min-width: 0; }
.topbar {
	height: 76px;
	position: sticky;
	top: 0;
	z-index: 20;
	border-bottom: 1px solid var(--border);
	background: rgba(9, 14, 27, .72);
	backdrop-filter: blur(22px);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 30px;
}
.topbar-left { display: flex; align-items: center; gap: 15px; }
.mobile-menu { display: none; border: 0; background: transparent; color: var(--text); font-size: 24px; cursor: pointer; }
.page-title { margin: 0; font-size: 21px; }
.page-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .help-button {
	border: 1px solid var(--border);
	background: var(--surface);
	color: #cbd5e1;
	height: 39px;
	border-radius: 10px;
	cursor: pointer;
}
.icon-button { width: 39px; }
.help-button { padding: 0 14px; }

.content { padding: 28px 30px 42px; max-width: 1700px; margin: 0 auto; }
.hero {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 18px;
	margin-bottom: 22px;
}
.hero h2 { margin: 0 0 6px; font-size: 24px; }
.hero p { margin: 0; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.button {
	border: 0;
	border-radius: 11px;
	padding: 11px 15px;
	font-weight: 700;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition: transform .18s ease, filter .18s ease;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button.primary { color: white; background: linear-gradient(110deg, var(--primary-2), var(--primary)); box-shadow: 0 12px 30px rgba(79,70,229,.22); }
.button.secondary { color: #dbeafe; background: var(--surface-2); border: 1px solid var(--border); }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card, .panel {
	border: 1px solid var(--border);
	background: linear-gradient(145deg, rgba(20, 31, 52, .9), rgba(12, 20, 37, .92));
	box-shadow: var(--shadow);
}
.stat-card { min-height: 120px; border-radius: 15px; padding: 17px; display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; background: rgba(124,58,237,.18); color: #c4b5fd; flex: 0 0 auto; }
.stat-card:nth-child(2) .stat-icon { background: rgba(33,199,255,.13); color: var(--cyan); }
.stat-card:nth-child(3) .stat-icon { background: rgba(52,211,153,.13); color: var(--green); }
.stat-card:nth-child(4) .stat-icon { background: rgba(251,191,36,.12); color: var(--amber); }
.stat-card:nth-child(5) .stat-icon { background: rgba(52,211,153,.13); color: var(--green); }
.stat-label { color: #cbd5e1; font-size: 12px; }
.stat-value { font-size: 23px; font-weight: 800; margin-top: 5px; }
.stat-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.stat-meta.good { color: var(--green); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(380px, .88fr); gap: 16px; }
.panel { border-radius: 16px; min-width: 0; }
.panel-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-title { font-size: 15px; font-weight: 760; }
.panel-subtitle { color: var(--muted); font-size: 11px; margin-top: 3px; }
.panel-body { padding: 20px; }

.empty-state { min-height: 360px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-icon { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; background: rgba(148,163,184,.08); font-size: 28px; }
.empty-state strong { display: block; color: var(--text); margin-bottom: 7px; }
.empty-state p { max-width: 420px; margin: 0; line-height: 1.6; }

.module-list { display: grid; gap: 2px; }
.module-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 12px 3px; border-bottom: 1px solid rgba(148,163,184,.08); }
.module-row:last-child { border-bottom: 0; }
.module-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(124,58,237,.16); }
.module-name { font-size: 13px; font-weight: 750; }
.module-description { color: var(--muted); font-size: 11px; margin-top: 3px; }
.status-pill { border-radius: 999px; font-size: 10px; padding: 5px 9px; border: 1px solid var(--border); color: var(--muted); background: rgba(148,163,184,.06); white-space: nowrap; }
.status-pill.active { color: #86efac; border-color: rgba(52,211,153,.24); background: rgba(52,211,153,.09); }

.bottom-grid { display: grid; grid-template-columns: .8fr .8fr 1.4fr; gap: 16px; margin-top: 16px; }
.status-list { display: grid; gap: 13px; }
.status-line { display: flex; justify-content: space-between; gap: 12px; color: #cbd5e1; font-size: 12px; }
.status-line span:last-child { color: var(--green); }
.server-card { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; padding: 14px; border-radius: 13px; background: rgba(148,163,184,.06); }
.server-logo { width: 58px; height: 58px; border-radius: 16px; object-fit: cover; background: var(--surface-2); }
.server-name { font-size: 17px; font-weight: 800; }
.server-id { color: var(--muted); font-size: 11px; margin-top: 4px; word-break: break-all; }
.info-list { display: grid; gap: 13px; }
.info-row { display: flex; justify-content: space-between; gap: 18px; font-size: 12px; }
.info-row span:first-child { color: var(--muted); }
.info-row span:last-child { text-align: right; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(470px, 100%); border: 1px solid var(--border); border-radius: 22px; padding: 34px; background: rgba(16,25,44,.9); box-shadow: var(--shadow); text-align: center; }
.login-card .brand-mark { margin: 0 auto 18px; width: 64px; height: 64px; border-radius: 19px; font-size: 32px; }
.login-card h1 { margin: 0 0 8px; font-size: 28px; }
.login-card h1 span { color: #a78bfa; }
.login-card p { margin: 0 auto 24px; color: var(--muted); line-height: 1.6; }
.login-card .button { justify-content: center; width: 100%; padding: 13px 16px; }

.toast { position: fixed; right: 24px; bottom: 24px; max-width: 340px; padding: 12px 15px; border-radius: 11px; color: white; background: #17223a; border: 1px solid var(--border-bright); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; z-index: 100; }
.toast.visible { opacity: 1; transform: translateY(0); }
.sidebar-backdrop { display: none; }

@media (max-width: 1280px) {
	.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.bottom-grid { grid-template-columns: 1fr 1fr; }
	.bottom-grid .panel:last-child { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
	.layout { display: block; }
	.sidebar { position: fixed; left: 0; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); }
	.sidebar.open { transform: translateX(0); }
	.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 25; }
	.sidebar-backdrop.visible { display: block; }
	.mobile-menu { display: block; }
	.dashboard-grid { grid-template-columns: 1fr; }
	.topbar { padding: 0 20px; }
	.content { padding: 22px 20px 36px; }
}

@media (max-width: 680px) {
	.help-button { display: none; }
	.stats-grid { grid-template-columns: 1fr 1fr; }
	.stat-card { min-height: 104px; padding: 14px; }
	.stat-icon { width: 40px; height: 40px; }
	.hero { align-items: flex-start; flex-direction: column; }
	.bottom-grid { grid-template-columns: 1fr; }
	.bottom-grid .panel:last-child { grid-column: auto; }
	.panel-header, .panel-body { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 430px) {
	.stats-grid { grid-template-columns: 1fr; }
	.top-actions .icon-button { display: none; }
	.content { padding-left: 14px; padding-right: 14px; }
	.topbar { padding: 0 14px; }
}

@media (max-width: 720px) { .hero { align-items: flex-start; flex-direction: column; } .hero-actions { width: 100%; justify-content: flex-start; } }
