.autochtoon-page {
	color-scheme: light;
	--bg: #f6f4ee;
	--surface: #fffdfa;
	--surface-quiet: #f0ece4;
	--ink: #211f1b;
	--muted: #696256;
	--line: #d8d0c3;
	--blue: #235789;
	--red: #d1495b;
	--green: #2a9d8f;
	--amber: #e9c46a;
	--shadow: 0 20px 48px rgba(43, 38, 28, 0.14);
	box-sizing: border-box;
	min-height: calc(100vh - 10rem);
	padding: 28px clamp(16px, 4vw, 48px) 44px;
	background: var(--bg);
	color: var(--ink);
	font-family:
		Inter,
		ui-sans-serif,
		system-ui,
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		sans-serif;
}

body:has(.autochtoon-page) {
	overflow-x: hidden;
}

.autochtoon-page * {
	box-sizing: border-box;
}

.autochtoon-header {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 560px);
	gap: 24px;
	align-items: end;
	max-width: 1480px;
	margin: 0 auto 24px;
}

.autochtoon-header h1 {
	max-width: 900px;
	margin: 0;
	color: var(--ink);
	font: inherit;
	font-size: clamp(42px, 7vw, 88px);
	font-weight: 850;
	letter-spacing: 0;
	line-height: 0.92;
	text-transform: none;
}

.autochtoon-header p:last-child {
	max-width: 62ch;
	margin: 0;
	color: #4b453c;
	font-size: 17px;
	line-height: 1.5;
}

.eyebrow,
.stat-list span,
.grid-card dt {
	margin: 0;
	color: var(--muted);
	font-size: 12px;
	font-weight: 780;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.dashboard {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 360px;
	gap: 18px;
	max-width: 1480px;
	margin: 0 auto;
	align-items: stretch;
}

.chart-panel,
.side-panel,
.notes {
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--surface);
	box-shadow: var(--shadow);
}

.chart-panel {
	min-width: 0;
	overflow: hidden;
}

.toolbar {
	display: grid;
	grid-template-columns: minmax(430px, 560px) minmax(260px, 1fr);
	gap: 16px;
	align-items: end;
	padding: 16px;
	border-bottom: 1px solid var(--line);
	background: var(--surface-quiet);
}

.view-switch {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	gap: 8px;
}

.autochtoon-page button,
.autochtoon-page input {
	font: inherit;
}

.autochtoon-page button {
	min-height: 42px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
	color: var(--ink);
	cursor: pointer;
}

.autochtoon-page button.active {
	border-color: rgba(35, 87, 137, 0.65);
	background: #dcebf5;
	color: #183c5d;
	font-weight: 800;
}

.year-control {
	display: grid;
	gap: 7px;
	color: var(--muted);
	font-size: 12px;
	font-weight: 780;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.definition-control {
	display: grid;
	gap: 6px;
}

.definition-control[hidden] {
	display: none;
}

.definition-options {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px;
}

.definition-options button {
	min-height: 34px;
	padding: 0 8px;
	font-size: 12px;
	font-weight: 780;
	line-height: 1.1;
}

.year-control-head,
.year-range-labels {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.year-control strong {
	color: var(--ink);
	letter-spacing: 0;
	text-transform: none;
}

.year-stepper {
	display: grid;
	grid-template-columns: 34px minmax(0, 1fr) 34px;
	gap: 8px;
	align-items: center;
}

.year-stepper button {
	min-height: 34px;
	border-radius: 6px;
	font-size: 22px;
	font-weight: 820;
	line-height: 1;
}

.year-stepper button:disabled {
	opacity: 0.42;
	cursor: not-allowed;
}

.zoom-reset {
	justify-self: end;
	min-height: 32px;
	padding: 0 12px;
	color: #183c5d;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0;
	text-transform: none;
}

.chart-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.zoom-reset:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.year-control input {
	width: 100%;
	accent-color: var(--blue);
}

.year-range-labels {
	color: #80786b;
	font-size: 11px;
	letter-spacing: 0;
	text-transform: none;
}

.chart-head {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	align-items: start;
	padding: 18px 18px 8px;
}

.chart-head h2,
.year-panel h2,
.grid-panel h2,
.notes h2 {
	margin: 4px 0 0;
	color: var(--ink);
	font: inherit;
	font-size: 24px;
	font-weight: 820;
	letter-spacing: 0;
	line-height: 1.1;
	text-transform: none;
}

.legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	justify-content: flex-start;
	align-content: start;
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
	color: var(--muted);
	font-size: 12px;
	font-weight: 740;
	line-height: 1.25;
}

.legend-group {
	display: grid;
	gap: 6px;
	min-width: 0;
}

.legend-group-title {
	color: #80786b;
	font-size: 11px;
	font-weight: 780;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.legend-group-items {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	min-width: 0;
}

.legend-item {
	display: inline-flex;
	min-width: 0;
	gap: 7px;
	align-items: center;
	border-radius: 4px;
	white-space: normal;
	cursor: help;
}

.legend-item i {
	width: 14px;
	height: 14px;
	border: 2px solid transparent;
	border-radius: 3px;
}

.legend-item .line-swatch {
	width: 22px;
	height: 0;
	border-width: 0;
	border-top: 3px solid currentcolor;
	border-radius: 0;
}

.legend-item.is-highlighted {
	color: var(--ink);
	font-weight: 900;
}

.legend-item.is-highlighted i {
	box-shadow: 0 0 0 3px rgba(35, 87, 137, 0.16);
}

.chart-note {
	max-width: 132ch;
	margin: -2px 0 0;
	color: #5f584d;
	font-size: 12px;
	font-weight: 680;
	line-height: 1.45;
}

.chart-note[hidden] {
	display: none;
}

.chart-wrap {
	position: relative;
	height: min(68vh, 680px);
	min-height: 460px;
	padding: 10px 8px 12px;
}

.chart-wrap.is-split {
	height: min(90vh, 980px);
	min-height: 780px;
}

#mainChart {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.axis path,
.axis line {
	color: #9c9282;
}

.axis text {
	fill: var(--muted);
	font-size: 12px;
}

.grid-lines line {
	stroke: rgba(105, 98, 86, 0.18);
}

.axis-label {
	fill: var(--muted);
	font-size: 12px;
	font-weight: 760;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.line {
	stroke-linecap: round;
	stroke-linejoin: round;
}

.bar {
	shape-rendering: crispEdges;
}

.point {
	pointer-events: none;
}

.estimated-band {
	fill: rgba(237, 174, 73, 0.08);
	stroke: rgba(237, 174, 73, 0.24);
	stroke-width: 1;
	shape-rendering: crispEdges;
}

.estimated-band-label {
	fill: #9a6a21;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.selected-year {
	stroke: rgba(33, 31, 27, 0.58);
	stroke-dasharray: 4 5;
	pointer-events: none;
}

.selected-year-label {
	fill: #3a352e;
	font-size: 12px;
	font-weight: 850;
	paint-order: stroke;
	stroke: rgba(255, 253, 250, 0.86);
	stroke-width: 4px;
}

.definition-marker {
	stroke: rgba(129, 103, 169, 0.46);
	stroke-dasharray: 2 5;
	pointer-events: none;
}

.definition-marker-label {
	fill: #5d4b78;
	font-size: 11px;
	font-weight: 800;
	paint-order: stroke;
	stroke: rgba(255, 253, 250, 0.9);
	stroke-width: 4px;
	text-transform: uppercase;
}

.hover-capture {
	fill: transparent;
	cursor: grab;
	touch-action: none;
}

.chart-wrap.is-panning .hover-capture {
	cursor: grabbing;
}

.tooltip {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 4;
	min-width: 250px;
	max-width: 320px;
	padding: 12px;
	border: 1px solid rgba(33, 31, 27, 0.18);
	border-radius: 6px;
	background: rgba(255, 253, 250, 0.96);
	box-shadow: 0 18px 40px rgba(43, 38, 28, 0.2);
	color: var(--ink);
	font-size: 13px;
	pointer-events: none;
}

.tooltip[hidden] {
	display: none;
}

.tooltip-title {
	display: grid;
	gap: 3px;
	margin-bottom: 8px;
}

.tooltip-title strong {
	font-size: 18px;
	font-weight: 850;
}

.tooltip-title small {
	color: var(--muted);
	font-size: 11px;
	font-weight: 740;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.tooltip dl {
	display: grid;
	gap: 7px;
	margin: 0;
}

.tooltip dl div {
	display: flex;
	justify-content: space-between;
	gap: 18px;
}

.tooltip span {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 7px;
	align-items: center;
	color: var(--muted);
}

.tooltip span small {
	color: #8b443d;
	font-size: 11px;
	font-weight: 760;
}

.quality-badge {
	display: inline-flex;
	width: fit-content;
	align-items: center;
	margin-left: 7px;
	padding: 2px 6px;
	border: 1px solid rgba(35, 87, 137, 0.22);
	border-radius: 999px;
	background: #eef5f8;
	color: #264d69;
	font-size: 10px;
	font-weight: 850;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	vertical-align: middle;
}

.tooltip i {
	width: 10px;
	height: 10px;
	border-radius: 2px;
}

.tooltip strong {
	font-weight: 820;
	white-space: nowrap;
}

.info-tooltip {
	position: fixed;
	z-index: 20;
	max-width: min(330px, calc(100vw - 20px));
	padding: 12px;
	border: 1px solid rgba(33, 31, 27, 0.18);
	border-radius: 6px;
	background: rgba(255, 253, 250, 0.98);
	box-shadow: 0 18px 40px rgba(43, 38, 28, 0.22);
	color: var(--ink);
	font-size: 13px;
	pointer-events: none;
}

.info-tooltip[hidden] {
	display: none;
}

.info-tooltip strong {
	display: block;
	margin-bottom: 6px;
	font-size: 15px;
	font-weight: 850;
}

.info-tooltip p {
	margin: 0;
	color: #4b453c;
	line-height: 1.45;
}

.info-tooltip small {
	display: block;
	margin-top: 8px;
	color: var(--muted);
	font-size: 11px;
	font-weight: 740;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.has-info:focus-visible {
	outline: 2px solid rgba(35, 87, 137, 0.75);
	outline-offset: 3px;
}

.legend-item.has-info:hover,
.legend-item.has-info:focus-visible {
	color: var(--ink);
}

.side-panel {
	display: grid;
	grid-template-rows: auto 1fr;
	gap: 18px;
	padding: 18px;
}

.year-panel,
.grid-panel {
	min-width: 0;
}

.stat-list {
	display: grid;
	gap: 1px;
	margin-top: 14px;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}

.stat-item {
	display: grid;
	gap: 4px;
	padding: 12px 0;
	border-top: 1px solid rgba(216, 208, 195, 0.7);
	cursor: help;
}

.stat-item:first-child {
	border-top: 0;
}

.stat-item strong {
	font-size: 18px;
	font-weight: 850;
	line-height: 1.1;
}

.stat-note {
	color: #8b443d;
	font-size: 12px;
	font-weight: 760;
	line-height: 1.35;
}

.grid-cards {
	display: grid;
	gap: 14px;
	margin-top: 14px;
}

.grid-card {
	padding: 13px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fbf8f1;
	cursor: help;
}

.grid-card.is-list {
	cursor: default;
}

.grid-card h3 {
	margin: 0;
	font: inherit;
	font-size: 17px;
	font-weight: 850;
}

.grid-card > strong {
	display: block;
	margin-top: 6px;
	font-size: 18px;
}

.positive {
	color: #176f5f;
}

.negative {
	color: #b53645;
}

.grid-card dl {
	display: grid;
	gap: 7px;
	margin: 12px 0 0;
}

.grid-card dl div {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.grid-card dd {
	margin: 0;
	font-weight: 780;
	text-align: right;
}

.rank-list {
	display: grid;
	gap: 8px;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.rank-list li {
	display: grid;
	grid-template-columns: minmax(0, 1fr) max-content;
	gap: 10px;
	align-items: baseline;
}

.rank-list span {
	min-width: 0;
	overflow: hidden;
	color: #4b453c;
	font-size: 13px;
	font-weight: 720;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rank-list strong {
	font-size: 13px;
	font-weight: 850;
	white-space: nowrap;
}

.card-note {
	display: block;
	margin-top: 10px;
	color: var(--muted);
	font-size: 11px;
	font-weight: 720;
	line-height: 1.35;
}

.notes {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 460px);
	gap: 24px;
	max-width: 1480px;
	margin: 18px auto 0;
	padding: 22px;
}

.notes p,
.notes li {
	color: #4b453c;
	font-size: 15px;
	line-height: 1.55;
}

.notes p {
	margin: 10px 0 0;
}

.notes ul {
	margin: 10px 0 0;
	padding-left: 18px;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 1080px) {
	.autochtoon-header,
	.dashboard,
	.notes {
		grid-template-columns: 1fr;
	}

	.side-panel {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-rows: auto;
	}
}

@media (max-width: 760px) {
	.autochtoon-page {
		padding: 18px 12px 30px;
	}

	.autochtoon-header h1 {
		font-size: clamp(34px, 11vw, 48px);
		line-height: 0.96;
	}

	.toolbar,
	.chart-head,
	.side-panel {
		grid-template-columns: 1fr;
	}

	.year-stepper {
		grid-template-columns: 38px minmax(0, 1fr) 38px;
	}

	.legend {
		justify-content: flex-start;
	}

	.view-switch {
		grid-template-columns: 1fr;
	}

	.chart-wrap {
		height: 560px;
		min-height: 520px;
		padding: 0;
	}

	.chart-wrap.is-split {
		height: 940px;
		min-height: 900px;
	}

	.axis-label {
		font-size: 10px;
	}

	.axis-label.right {
		display: none;
	}

	.grid-cards {
		grid-template-columns: 1fr;
	}
}
