:root {
	--header-bg: #1f5fd6;
	--header-text: #ffffff;
	--bg: #ffffff;
	--panel-bg: #ffffff;
	--panel-bg-alt: #f4f6f8;
	--border: #d8d9da;
	--border-strong: #c1c3c6;
	--text-primary: #1f2226;
	--text-secondary: #6c7278;
	--accent: #1f5fd6;
	--accent-dim: #e6edfb;
	--good: #299c46;
	--warning: #e0a500;
	--danger: #d0311c;
	--font-body: 'Roboto', Arial, sans-serif;
	--font-mono: 'Roboto Mono', monospace;
	--radius: 0px;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text-primary);
	font-family: var(--font-body);
	min-height: 100vh;
}

/* ---------- topbar ---------- */

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 24px;
	height: 56px;
	background: var(--header-bg);
	color: var(--header-text);
	border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.topbar-left,
.topbar-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.brand {
	font-weight: 700;
	font-size: 18px;
	letter-spacing: 0.02em;
	display: flex;
	align-items: center;
	gap: 8px;
}

.brand i {
	font-size: 16px;
}

.chip {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 5px 12px;
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: var(--radius);
	font-family: var(--font-mono);
	font-size: 12px;
	color: var(--header-text);
}

.logout-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: var(--radius);
	color: var(--header-text);
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
}

.logout-btn:hover {
	background: rgba(255, 255, 255, 0.22);
}

/* ---------- layout ---------- */

.page {
	max-width: 1280px;
	margin: 0 auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 16px;
}

/* ---------- panel ---------- */

.panel {
	background: var(--panel-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	padding: 14px 16px 16px;
}

.panel-head {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--text-secondary);
	font-size: 12px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	border-bottom: 1px solid var(--border);
	padding-bottom: 10px;
	margin-bottom: 12px;
}

.panel-head i {
	color: var(--accent);
	font-size: 13px;
}

/* ---------- stat panels ---------- */

.stat-value {
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 32px;
	line-height: 1;
	color: var(--text-primary);
}

.stat-bar {
	margin-top: 10px;
	height: 6px;
	width: 100%;
	background: var(--panel-bg-alt);
	border: 1px solid var(--border);
}

.stat-bar-fill {
	height: 100%;
	width: 0%;
	background: var(--accent);
	transition: width 0.4s ease, background 0.4s ease;
}

.stat-sub {
	margin-top: 8px;
	font-family: var(--font-mono);
	font-size: 12px;
	color: var(--text-secondary);
}

.cpu-cores {
	margin-top: 12px;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.cpu-core {
	flex: 1 1 auto;
	min-width: 8px;
	height: 20px;
	background: var(--panel-bg-alt);
	border: 1px solid var(--border);
	position: relative;
	overflow: hidden;
}

.cpu-core-fill {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	background: var(--accent);
	transition: height 0.4s ease, background 0.4s ease;
}

/* ---------- load / sysinfo ---------- */

.load-rows {
	display: flex;
	gap: 10px;
}

.load-item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 10px 6px;
	background: var(--panel-bg-alt);
	border: 1px solid var(--border);
}

.load-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-secondary);
}

.load-value {
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 16px;
}

.sysinfo-rows {
	display: flex;
	flex-direction: column;
	gap: 8px;
	font-size: 13px;
}

.sysinfo-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.sysinfo-row span:first-child {
	color: var(--text-secondary);
}

.sysinfo-row span:last-child {
	font-family: var(--font-mono);
	font-weight: 500;
	text-align: right;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 65%;
}

/* ---------- tables ---------- */

.table-panel {
	overflow-x: auto;
}

.data-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.data-table th {
	text-align: left;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-secondary);
	font-weight: 500;
	padding: 6px 10px;
	border-bottom: 1px solid var(--border);
}

.data-table td {
	padding: 8px 10px;
	border-bottom: 1px solid var(--border);
	font-family: var(--font-mono);
}

.data-table tbody tr:last-child td {
	border-bottom: none;
}

.empty-row {
	color: var(--text-secondary);
	text-align: center;
	font-family: var(--font-body);
}

.io-rows {
	display: flex;
	gap: 16px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--border);
}

.io-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
}

.io-item i {
	color: var(--accent);
	width: 12px;
}

.io-label {
	color: var(--text-secondary);
}

.io-value {
	font-family: var(--font-mono);
	font-weight: 600;
}

/* ---------- charts ---------- */

.chart-panel-wide {
	grid-column: 1 / -1;
}

.chart-panel .panel-head {
	justify-content: space-between;
}

.chart-canvas {
	width: 100%;
	height: 160px;
	display: block;
}

.range-buttons {
	margin-left: auto;
	display: flex;
	gap: 4px;
}

.range-buttons button {
	font-family: var(--font-body);
	font-size: 12px;
	padding: 4px 10px;
	background: var(--panel-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text-secondary);
	cursor: pointer;
}

.range-buttons button.active {
	background: var(--accent);
	border-color: var(--accent);
	color: #ffffff;
}

.range-buttons button:hover:not(.active) {
	background: var(--panel-bg-alt);
}

/* ---------- auth pages (login / setup) ---------- */

.auth-body {
	background: var(--panel-bg-alt);
}

.topbar-auth {
	justify-content: flex-start;
}

.auth-wrap {
	display: flex;
	justify-content: center;
	padding: 60px 20px;
}

.auth-panel {
	width: 100%;
	max-width: 380px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: var(--panel-bg);
}

.auth-panel-wide {
	max-width: 460px;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 13px;
}

.field-label {
	color: var(--text-secondary);
	font-weight: 500;
}

.field input {
	font-family: var(--font-body);
	font-size: 14px;
	padding: 9px 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--panel-bg);
	color: var(--text-primary);
}

.field input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 2px var(--accent-dim);
}

.btn {
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 500;
	padding: 10px 16px;
	border: 1px solid transparent;
	border-radius: var(--radius);
	cursor: pointer;
}

.btn-primary {
	background: var(--accent);
	color: #ffffff;
	border-color: var(--accent);
}

.btn-primary:hover {
	background: #1a52bd;
}

.btn-secondary {
	background: var(--panel-bg);
	color: var(--text-primary);
	border-color: var(--border-strong);
}

.btn-secondary:hover {
	background: var(--panel-bg-alt);
}

.btn-block {
	width: 100%;
}

.alert {
	padding: 10px 12px;
	font-size: 13px;
	border: 1px solid transparent;
	border-radius: var(--radius);
}

.alert-error {
	background: #fbe9e7;
	border-color: #f3b6ac;
	color: var(--danger);
}

.wizard-steps {
	display: flex;
	gap: 0;
	margin-bottom: 6px;
}

.wizard-step {
	flex: 1;
	text-align: center;
	padding: 8px 4px;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-secondary);
	background: var(--panel-bg-alt);
	border: 1px solid var(--border);
}

.wizard-step.active {
	background: var(--accent);
	border-color: var(--accent);
	color: #ffffff;
}

.wizard-hint {
	margin: 0 0 4px;
	font-size: 13px;
	color: var(--text-secondary);
	line-height: 1.5;
}

.wizard-panel {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.wizard-panel-hidden {
	display: none;
}

.wizard-actions {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-top: 4px;
}

.wizard-actions .btn {
	flex: 1;
}
