:root {
	--bg: #111214;
	--panel: #1e1f22;
	--panel-2: #2b2d31;
	--panel-3: #313338;
	--text: #f2f3f5;
	--muted: #b5bac1;
	--line: #3f4147;
	--brand: #5865f2;
	--green: #23a55a;
	--red: #da373c;
	--yellow: #f0b232;
	--link: #78a9ff;
	--radius: 16px;
	--shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--text);
	font-family: Inter, Arial, sans-serif;
}

a { color: var(--link); text-decoration: none; }
img { display: block; }

/* Layout */
.layout {
	display: grid;
	grid-template-columns: 260px 1fr;
	min-height: 100vh;
}

.sidebar {
	background: #0b0c0e;
	border-right: 1px solid var(--line);
	padding: 24px 18px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	font-weight: 700;
	font-size: 20px;
	margin-bottom: 28px;
}

.brand-badge {
	width: 40px;
	height: 40px;
	border-radius: 12px;
	background: var(--brand);
	display: grid;
	place-items: center;
	font-size: 18px;
}

.nav {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nav a {
	padding: 12px 14px;
	border-radius: 12px;
	color: var(--muted);
	font-weight: 600;
}

.nav a.active,
.nav a:hover {
	background: var(--panel);
	color: var(--text);
}

/* Main */
.main {
	padding: 24px;
}

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
}

.page-title h1 {
	margin: 0 0 6px;
	font-size: 30px;
}

.page-title p {
	margin: 0;
	color: var(--muted);
}

.userbox {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--panel);
	border: 1px solid var(--line);
	padding: 10px 14px;
	border-radius: 14px;
	box-shadow: var(--shadow);
}

.avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--panel-3);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
}

/* Grid */
.grid-4,
.grid-2 {
	display: grid;
	gap: 16px;
	margin-bottom: 24px;
}

.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* Cards */
.card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 18px;
	box-shadow: var(--shadow);
}

.stat-label {
	color: var(--muted);
	font-size: 14px;
	margin-bottom: 10px;
}

.stat-value {
	font-size: 30px;
	font-weight: 800;
}

/* Filters */
.toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
}

.filters {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.input,
.select,
.button {
	background: var(--panel-2);
	color: var(--text);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 12px 14px;
	font-size: 14px;
}

.input { min-width: 260px; }

.button {
	cursor: pointer;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.button.primary {
	background: var(--brand);
	border-color: transparent;
	color: white;
}

.button.ghost {
	background: transparent;
}

/* Table */
.table-wrap {
	overflow: visible; /* IMPORTANT for hover card */
}

.table {
	width: 100%;
	border-collapse: collapse;
}

.table th,
.table td {
	padding: 14px 12px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: middle;
}

.table th {
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
}

.sort-link {
	color: var(--muted);
}

.sort-link.active {
	color: var(--text);
}

/* Badges */
.badge {
	display: inline-flex;
	align-items: center;
	padding: 6px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	border: 1px solid transparent;
}

.badge.open {
	background: rgba(35, 165, 90, 0.14);
	color: #7ee2a8;
	border-color: rgba(35, 165, 90, 0.22);
}

.badge.closed {
	background: rgba(218, 55, 60, 0.14);
	color: #ff9ca1;
	border-color: rgba(218, 55, 60, 0.22);
}

/* Hover user card FIXED */
.user-cell {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.user-hover {
	position: absolute;
	top: 48px;
	left: 0;
	min-width: 280px;
	background: var(--panel-2);
	border: 1px solid var(--line);
	border-radius: 14px;
	padding: 14px;
	box-shadow: var(--shadow);
	display: none;
	z-index: 999;
}

.user-cell:hover .user-hover {
	display: block;
}

/* Charts */
.chart-list {
	display: grid;
	gap: 12px;
}

.chart-row {
	display: grid;
	grid-template-columns: 220px 1fr 60px;
	gap: 12px;
	align-items: center;
}

.chart-label {
	color: var(--muted);
	font-size: 14px;
}

.chart-bar {
	background: var(--panel-3);
	border-radius: 999px;
	overflow: hidden;
	height: 14px;
}

.chart-fill {
	height: 100%;
	width: var(--fill);
	background: linear-gradient(90deg, var(--brand), #7b87ff);
	border-radius: 999px;
}

/* Misc */
.subtle {
	color: var(--muted);
	font-size: 13px;
}

.empty {
	color: var(--muted);
	padding: 24px 0;
	text-align: center;
}

/* Pagination */
.pagination {
	display: flex;
	gap: 8px;
	margin-top: 18px;
}

.pagination a,
.pagination span {
	padding: 10px 12px;
	border-radius: 10px;
	background: var(--panel-2);
	border: 1px solid var(--line);
}

.pagination .current {
	background: var(--brand);
}

/* Responsive */
@media (max-width: 1100px) {
	.grid-4,
	.grid-2 {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 820px) {
	.layout { grid-template-columns: 1fr; }
	.sidebar { display: none; }
	.grid-4,
	.grid-2 { grid-template-columns: 1fr; }
}