:root {
	color-scheme: light;
	--ink: #1c1917;
	--muted: #57534e;
	--line: #e7e5e4;
	--paper: #fafaf9;
	--card: #ffffff;
	--online: #166534;
	--online-bg: #dcfce7;
	--offline: #57534e;
	--offline-bg: #f5f5f4;
	--danger: #991b1b;
	--danger-bg: #fee2e2;
	--danger-line: #fecaca;
	--error-bg: #fef2f2;
	--warn: #92400e;
	--warn-bg: #fef3c7;
	--header: #f5f5f4;
	--action-fg: #ffffff;
}
[data-theme="dark"] {
	color-scheme: dark;
	--ink: #fafaf9;
	--muted: #a8a29e;
	--line: #44403c;
	--paper: #1c1917;
	--card: #292524;
	--online: #86efac;
	--online-bg: #14532d;
	--offline: #d6d3d1;
	--offline-bg: #44403c;
	--danger: #fca5a5;
	--danger-bg: #450a0a;
	--danger-line: #7f1d1d;
	--error-bg: #450a0a;
	--warn: #fcd34d;
	--warn-bg: #78350f;
	--header: #44403c;
	--action-fg: #1c1917;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) {
		color-scheme: dark;
		--ink: #fafaf9;
		--muted: #a8a29e;
		--line: #44403c;
		--paper: #1c1917;
		--card: #292524;
		--online: #86efac;
		--online-bg: #14532d;
		--offline: #d6d3d1;
		--offline-bg: #44403c;
		--danger: #fca5a5;
		--danger-bg: #450a0a;
		--danger-line: #7f1d1d;
		--error-bg: #450a0a;
		--warn: #fcd34d;
		--warn-bg: #78350f;
		--header: #44403c;
		--action-fg: #1c1917;
	}
}
* { box-sizing: border-box; }
body {
	margin: 0;
	font: 15px/1.45 "Segoe UI", system-ui, sans-serif;
	color: var(--ink);
	background: var(--paper);
}
main {
	--pad-x: 20px;
	--pad-top: 28px;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 var(--pad-x) 48px;
}
h1 {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 650;
}
h2 {
	margin: 0;
	font-size: 1.05rem;
}
a { color: inherit; }
.toolbar {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	margin: 0 0 20px;
	padding: var(--pad-top) 0 12px;
	background: var(--paper);
}
.title { display: flex; flex-direction: column; gap: 2px; }
.back {
	color: var(--muted);
	font-size: 0.85rem;
	text-decoration: none;
}
.back:hover { color: var(--ink); }
.session {
	display: flex;
	align-items: baseline;
	gap: 16px;
}
.updated, .hint {
	margin: 0;
	color: var(--muted);
	font-size: 0.85rem;
}
.logout, .theme-toggle, .action, .ghost {
	font: inherit;
	cursor: pointer;
}
.logout, .theme-toggle {
	color: var(--muted);
	background: transparent;
	border: 0;
	padding: 0;
}
.logout:hover, .theme-toggle:hover { color: var(--ink); }
.action, .ghost {
	border-radius: 6px;
	padding: 7px 12px;
}
.action {
	color: var(--action-fg);
	background: var(--ink);
	border: 0;
}
.ghost {
	color: var(--ink);
	background: transparent;
	border: 1px solid var(--line);
}
.error {
	margin: 0 0 16px;
	padding: 10px 12px;
	border: 1px solid var(--danger-line);
	background: var(--error-bg);
	color: var(--danger);
}
.note {
	margin: 0 0 12px;
	color: var(--muted);
}
.health, .counts {
	display: grid;
	gap: 12px;
	margin: 0 0 28px;
	padding: 0;
	list-style: none;
}
.health { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.counts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.health li, .counts li, .card {
	min-width: 0;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 12px 14px;
}
.health > li > span, .counts > li > span, .card > span {
	display: block;
	min-width: 0;
	color: var(--muted);
	font-size: 0.8rem;
	overflow-wrap: anywhere;
}
.health strong, .counts strong, .card strong {
	display: block;
	min-width: 0;
	margin-top: 2px;
	font-size: 1.35rem;
	font-weight: 650;
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
	overflow-wrap: anywhere;
}
.card strong.fit {
	font-family: Consolas, ui-monospace, monospace;
	font-size: 0.95rem;
	font-weight: 650;
}
.card.state strong, .health strong:has(.dot) {
	font-size: 14px;
	line-height: 1;
	margin-top: 8px;
}
.counts strong { font-size: 1.6rem; }
.health small, .card small, .sub {
	display: block;
	min-width: 0;
	margin-top: 2px;
	color: var(--muted);
	font-size: 0.75rem;
	overflow-wrap: anywhere;
}
.pill.warn strong, .pill.warn small { color: var(--warn); }
.health .label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
	color: var(--muted);
	font-size: 0.8rem;
}
.health .info {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: transparent;
	color: var(--muted);
	font: 650 0.72rem/1 Georgia, serif;
	cursor: pointer;
}
.health .info:hover,
.health .info[aria-expanded="true"] {
	color: var(--ink);
	border-color: var(--ink);
}
#health-info { margin-top: -16px; }
.dot {
	display: inline-block;
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	vertical-align: middle;
	background: transparent;
	box-shadow: inset 0 0 0 2px var(--muted);
}
.dot.on { background: var(--online); box-shadow: none; }
.dot.off { background: var(--danger); box-shadow: none; }
.dot.mid { background: var(--warn); box-shadow: none; }
section { margin-top: 8px; }
.section-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	margin: 24px 0 10px;
}
.section-head h2, section > h2 { margin: 24px 0 10px; }
.section-head h2 { margin: 0; }
input {
	font: inherit;
	color: var(--ink);
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 6px 8px;
}
#filter { width: 180px; }
.filters {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 12px;
	margin: 0 0 10px;
}
.filters label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: var(--muted);
	font-size: 0.8rem;
}
table {
	width: 100%;
	border-collapse: collapse;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 8px;
	overflow: hidden;
}
th, td {
	padding: 8px 10px;
	text-align: left;
	vertical-align: middle;
	border-bottom: 1px solid var(--line);
	overflow-wrap: anywhere;
}
th {
	font-size: 0.75rem;
	font-weight: 650;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--muted);
	background: var(--header);
}
tr:last-child td { border-bottom: 0; }
.chips {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 10px;
	width: max-content;
}
.port {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
	gap: 10px;
}
.rate {
	display: grid;
	grid-template-columns: 148px minmax(0, 1fr);
	gap: 8px 16px;
	align-items: center;
	margin: 0 0 12px;
	padding: 12px 14px 8px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 8px;
}
.rate span {
	display: block;
	color: var(--muted);
	font-size: 0.8rem;
}
.rate strong {
	display: block;
	font-size: 2rem;
	font-weight: 650;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}
.rate small {
	display: block;
	margin-top: 2px;
	color: var(--muted);
	font-size: 0.75rem;
}
#rate-chart {
	width: 100%;
	height: 132px;
	display: block;
}
.low { color: var(--danger); }
.mono { font-family: Consolas, ui-monospace, monospace; }
.empty { margin: 0; color: var(--muted); }
main.login {
	max-width: 360px;
	padding: 48px 20px;
}
.login-bar {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
}
main.login h1 { margin: 0 0 16px; }
main.login form {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 16px;
}
main.login label {
	display: block;
	margin-bottom: 12px;
	color: var(--muted);
	font-size: 0.8rem;
}
main.login input {
	display: block;
	width: 100%;
	margin-top: 4px;
	padding: 8px 10px;
}
@media (max-width: 720px) {
	main {
		--pad-x: 14px;
		--pad-top: 16px;
		padding-bottom: 32px;
	}
	.toolbar, .session, .section-head {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}
	.logout, .theme-toggle, .action, .ghost { min-height: 44px; }
	.logout, .theme-toggle {
		display: inline-flex;
		align-items: center;
		align-self: flex-start;
		padding: 0 4px;
	}
	.action, .ghost {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
	#filter, .filters input { width: 100%; }
	.filters label { flex: 1 1 100%; }
	input { font-size: 16px; }
	.counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.rate { grid-template-columns: 1fr; }
	.chips { flex-wrap: wrap; width: auto; }
	table, thead, tbody, tr, th, td { display: block; }
	table {
		background: transparent;
		border: 0;
		overflow: visible;
	}
	thead { display: none; }
	tr {
		background: var(--card);
		border: 1px solid var(--line);
		border-radius: 8px;
		margin: 0 0 10px;
		padding: 8px 12px;
	}
	td {
		border: 0;
		padding: 4px 0;
	}
	td::before {
		content: attr(data-label);
		display: block;
		margin-bottom: 2px;
		color: var(--muted);
		font-size: 0.75rem;
		font-weight: 650;
		letter-spacing: 0.02em;
		text-transform: uppercase;
	}
	tr:last-child td { border-bottom: 0; }
	table.fleet tr {
		display: grid;
		grid-template-columns: 1fr 1fr;
		column-gap: 12px;
		padding: 8px 12px 6px;
	}
	table.fleet td {
		padding: 2px 0;
	}
	table.fleet td:first-child,
	table.fleet td[data-label="Antennas"] {
		grid-column: 1 / -1;
	}
	table.fleet td::before {
		display: inline;
		margin: 0 6px 0 0;
	}
	table.fleet td:first-child::before { content: none; }
	table.fleet td:first-child {
		padding-bottom: 4px;
		font-weight: 650;
	}
}
