:root {
	--bg: #0f1216;
	--panel: #171b21;
	--panel-2: #1e232b;
	--line: #2a313b;
	--text: #e6e9ee;
	--muted: #8b95a3;
	--accent: #5aa9ff;
	--low: #c9b45a;
	--medium: #e8913a;
	--high: #e5534b;
	--definitive: #c0365f;
	--ok: #4cc38a;
	color-scheme: dark;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 10px 20px;
	background: var(--panel);
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	z-index: 5;
	flex-wrap: wrap;
}

.brand { font-weight: 700; color: var(--text); font-size: 16px; }
nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; }
nav a.active, nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }

main { padding: 20px; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 24px 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: var(--panel-2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
tr.excluded td { opacity: .55; }
.table-wrap { overflow-x: auto; }

.lvl { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #111; white-space: nowrap; }
.lvl-0 { background: var(--low); }
.lvl-1 { background: var(--medium); }
.lvl-2, .lvl-3 { background: var(--high); }
.lvl-4 { background: var(--definitive); color: #fff; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); margin-right: 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.on { background: var(--ok); }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.details { margin: 6px 0 0; padding: 8px 10px; background: var(--bg); border-radius: 6px; white-space: pre-wrap; word-break: break-word; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.grow { flex: 1; }
.error { color: var(--high); }

input, select, textarea {
	background: var(--panel-2);
	color: var(--text);
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 6px 9px;
	font: inherit;
}

button, .button {
	background: var(--accent);
	color: #08111c;
	border: 0;
	border-radius: 6px;
	padding: 7px 12px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	display: inline-block;
}

button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--high); border: 1px solid var(--high); }
button.small { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }

.key { padding: 12px; background: var(--bg); border: 1px dashed var(--accent); border-radius: 8px; margin-top: 10px; }

#toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: var(--panel-2);
	border: 1px solid var(--line);
	padding: 10px 14px;
	border-radius: 8px;
	max-width: 420px;
}

body.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { text-align: center; padding: 32px 40px; }
.login-card h1 { font-size: 26px; margin-bottom: 0; }

@media (max-width: 700px) {
	main { padding: 12px; }
	th, td { padding: 6px; }
}
.mt { margin: 12px 0 0; }
.settings table { table-layout: fixed; }
.settings th:nth-child(1) { width: 230px; }
.settings th:nth-child(3) { width: 110px; }
.settings th:nth-child(4) { width: 240px; }
.settings th:nth-child(5) { width: 200px; }
.settings td { overflow-wrap: anywhere; }
