:root {
	color-scheme: light;
	--surface-0: #f6f6f4;
	--surface-1: #ffffff;
	--border: #e3e3e0;
	--grid: #ececea;
	--text-primary: #191919;
	--text-secondary: #666666;
	--accent: #257de0;
	--series-1: #257de0; /* site load */
	--series-1-wash: rgba(37, 125, 224, 0.12);
	--series-2: #f47230; /* flexible-load ceiling / weekend */
	--series-2-wash: rgba(244, 114, 48, 0.28);
	--conf-high: #1d7a35;
	--conf-medium: #8a5a00;
	--conf-low: #666666;
	--fault: #b42318;
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--text-primary);
	background: var(--surface-0);
}
@media (prefers-color-scheme: dark) {
	:root {
		color-scheme: dark;
		--surface-0: #111111;
		--surface-1: #191919;
		--border: #2e2e2e;
		--grid: #262626;
		--text-primary: #efefef;
		--text-secondary: #9c9c9c;
		--accent: #338ced;
		--series-1: #338ced;
		--series-1-wash: rgba(51, 140, 237, 0.16);
		--series-2: #e76624;
		--series-2-wash: rgba(231, 102, 36, 0.32);
		--conf-high: #4cc26a;
		--conf-medium: #e0a83a;
		--conf-low: #9c9c9c;
		--fault: #f97066;
	}
}

* {
	box-sizing: border-box;
}
body {
	margin: 0;
}
h1,
h2,
h3 {
	line-height: 1.2;
	margin: 0;
}
h1 {
	font-size: 1.6rem;
	letter-spacing: -0.01em;
}
h2 {
	font-size: 1.15rem;
}
p {
	margin: 0;
}
.wrap {
	max-width: 1040px;
	margin: 0 auto;
	padding: 0 1.25rem;
}
.muted {
	color: var(--text-secondary);
}
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Header */
.top {
	background: var(--surface-1);
	border-bottom: 1px solid var(--border);
}
.top-inner {
	display: flex;
	gap: 1.5rem;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	padding-top: 1.1rem;
	padding-bottom: 1.1rem;
}
.tagline {
	color: var(--text-secondary);
	margin-top: 0.2rem;
}
.title-block {
	flex: 1 1 20rem;
}
.top-actions {
	display: flex;
	gap: 1.25rem;
	align-items: center;
}
.account-link {
	color: var(--accent);
	font-weight: 600;
	text-decoration: none;
}
.account-link:hover {
	text-decoration: underline;
}
.site-switch {
	border: 0;
	margin: 0;
	padding: 0;
}
.segmented {
	display: inline-flex;
	background: var(--surface-0);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 3px;
	gap: 2px;
}
.segmented label {
	position: relative;
}
.segmented input {
	position: absolute;
	opacity: 0;
	inset: 0;
	cursor: pointer;
}
.segmented span {
	display: block;
	padding: 0.4rem 0.9rem;
	border-radius: 7px;
	font-weight: 500;
	color: var(--text-secondary);
}
.segmented input:checked + span {
	background: var(--surface-1);
	color: var(--text-primary);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.segmented input:focus-visible + span {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

main {
	display: grid;
	gap: 1.25rem;
	padding-top: 1.5rem;
	padding-bottom: 1.5rem;
}
main[aria-busy="true"] {
	opacity: 0.6;
	transition: opacity 0.15s;
}

.site-head {
	display: grid;
	gap: 0.5rem;
}
.badge {
	justify-self: start;
	font-size: 0.82rem;
	padding: 0.15rem 0.6rem;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--surface-1);
	color: var(--text-secondary);
}

/* Stat tiles */
.stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 0.75rem;
	margin: 0.5rem 0 0;
}
.stats div {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 0.8rem 1rem;
}
.stats dt {
	font-size: 0.82rem;
	color: var(--text-secondary);
}
.stats dd {
	margin: 0.15rem 0 0;
	font-size: 1.5rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.01em;
}
.stats.compact div {
	background: var(--surface-0);
}
.stats.compact dd {
	font-size: 1.25rem;
}

/* Cards */
.card {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.25rem;
	display: grid;
	gap: 1rem;
}
.card-head {
	display: grid;
	gap: 0.3rem;
}
.footnote {
	font-size: 0.82rem;
}

/* Findings */
.findings {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.75rem;
	counter-reset: finding;
}
.finding {
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 0.9rem 1rem;
	display: grid;
	gap: 0.5rem;
	counter-increment: finding;
}
.finding-top {
	display: flex;
	gap: 1rem;
	justify-content: space-between;
	align-items: baseline;
	flex-wrap: wrap;
}
.finding h3 {
	font-size: 1rem;
}
.finding h3::before {
	content: counter(finding) ". ";
	color: var(--text-secondary);
	font-weight: 500;
}
.finding .impact {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.tags {
	display: flex;
	gap: 0.4rem;
	flex-wrap: wrap;
	font-size: 0.8rem;
}
.tag {
	padding: 0.05rem 0.5rem;
	border-radius: 999px;
	background: var(--surface-0);
	border: 1px solid var(--border);
	color: var(--text-secondary);
}
.tag.conf-high {
	color: var(--conf-high);
}
.tag.conf-medium {
	color: var(--conf-medium);
}
.tag.conf-low {
	color: var(--conf-low);
}
.tag.fault {
	color: var(--fault);
}
.finding ul {
	margin: 0;
	padding-left: 1.1rem;
}
.finding .next {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.2rem 0.75rem;
	font-size: 0.9rem;
}
.finding .next dt {
	color: var(--text-secondary);
}
.finding .next dd {
	margin: 0;
}

/* Grid headroom section */
.slider-row {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
}
.slider-row label {
	font-weight: 600;
}
.slider-row input {
	flex: 1;
	min-width: 200px;
	accent-color: var(--series-2);
}
.slider-row output {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	min-width: 5ch;
}
.chart-figure {
	margin: 0;
	display: grid;
	gap: 0.5rem;
}
.chart-figure figcaption {
	display: grid;
	gap: 0.1rem;
	font-size: 0.9rem;
}

/* Charts */
.chart {
	position: relative;
	width: 100%;
}
.chart svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}
.chart text {
	font-size: 12px;
	fill: var(--text-secondary);
	font-variant-numeric: tabular-nums;
}
.chart .label-strong {
	fill: var(--text-primary);
	font-weight: 600;
}
.chart .gridline {
	stroke: var(--grid);
	stroke-width: 1;
}
.chart .axis {
	stroke: var(--border);
	stroke-width: 1;
}
.chart .crosshair {
	stroke: var(--text-secondary);
	stroke-width: 1;
	stroke-dasharray: 2 3;
}
.legend {
	display: flex;
	gap: 1rem;
	font-size: 0.85rem;
	color: var(--text-secondary);
}
.legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}
.legend-item i {
	display: inline-block;
	width: 16px;
	height: 2px;
	border-radius: 1px;
}

.tooltip {
	position: fixed;
	pointer-events: none;
	z-index: 10;
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0.45rem 0.65rem;
	font-size: 0.82rem;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	display: grid;
	gap: 0.15rem;
	min-width: 140px;
}
.tooltip .tt-head {
	color: var(--text-secondary);
}
.tooltip .tt-row {
	display: flex;
	align-items: center;
	gap: 0.45rem;
}
.tooltip .tt-row i {
	width: 12px;
	height: 2px;
	border-radius: 1px;
	display: inline-block;
}
.tooltip strong {
	font-variant-numeric: tabular-nums;
}

/* Tables */
.data-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
	font-variant-numeric: tabular-nums;
}
.data-table caption {
	text-align: left;
	padding-bottom: 0.5rem;
}
.data-table th,
.data-table td {
	text-align: left;
	padding: 0.4rem 0.6rem;
	border-bottom: 1px solid var(--border);
}
.data-table th {
	color: var(--text-secondary);
	font-weight: 500;
}
.table-view summary {
	cursor: pointer;
	color: var(--text-secondary);
	font-size: 0.9rem;
}
.table-view .data-table {
	margin-top: 0.5rem;
}

.footer {
	padding-bottom: 2rem;
	font-size: 0.82rem;
	display: grid;
	gap: 0.3rem;
}

@media (forced-colors: active) {
	.chart .series-line {
		stroke: CanvasText;
	}
}

/* Last on purpose: beats single-class display rules (e.g. .card) without !important. */
[hidden] {
	display: none;
}
