*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	margin: 0;
	padding: 0;
	background: #f5f5f5;
	color: #333;
	line-height: 1.5;
}

.controls {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
	background: white;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 20px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.control-group label {
	font-weight: 500;
	color: #374151;
	font-size: 14px;
}

select,
button,
input[type='date'] {
	padding: 8px 16px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
}

select,
input[type='date'] {
	min-width: 160px;
	background: white;
}

button {
	background: #007cba;
	color: white;
	cursor: pointer;
	border: none;
	font-weight: 500;
}

button:hover {
	background: #005a87;
}

button:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.error {
	background: #f8d7da;
	color: #721c24;
	padding: 12px 16px;
	border-radius: 4px;
	margin-bottom: 20px;
	border: 1px solid #f5c6cb;
}

.loading {
	text-align: center;
	padding: 40px;
	color: #666;
	background: white;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.loading-message {
	text-align: center;
}

.loading-message p {
	margin: 8px 0;
}

.loading-message .loading-hint {
	font-size: 13px;
	color: #888;
	font-style: italic;
}

.report-header {
	background: white;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 16px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.report-header-top {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 20px;
}

.report-header h2 {
	margin: 0 0 4px 0;
}

.report-domain {
	font-weight: 400;
	color: #6c757d;
}

.report-header p {
	margin: 0;
	color: #666;
	font-size: 14px;
}

.resource-data {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-shrink: 0;
	font-size: 13px;
	color: #6c757d;
}

.resource-stat-value {
	font-weight: 600;
	color: #333;
}

.resource-divider {
	width: 1px;
	height: 14px;
	background: #ddd;
}

.metric-cards {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-bottom: 16px;
}

.metric-card {
	background: white;
	border-radius: 8px;
	padding: 16px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metric-card-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 12px;
	padding-bottom: 10px;
	border-bottom: 1px solid #e9ecef;
}

.metric-card-header h3 {
	margin: 0;
	font-size: 15px;
	color: #333;
	line-height: 1.3;
}

.metric-count {
	font-weight: 400;
	font-size: 12px;
	color: #999;
}

.metric-info-btn {
	flex-shrink: 0;
	background: none;
	border: none;
	padding: 2px;
	margin-left: 8px;
	color: #adb5bd;
	cursor: pointer;
	min-width: auto;
	line-height: 1;
}

.metric-info-btn:hover {
	color: #007cba;
	background: none;
}

.metric-percentiles {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.metric-pct {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 4px 0;
}

.metric-pct-label {
	font-size: 13px;
	color: #6c757d;
	font-weight: 500;
}

.metric-pct-value {
	font-size: 15px;
	font-weight: 600;
	color: #212529;
}

.metric-unit {
	font-size: 12px;
	font-weight: 400;
	color: #999;
	margin-left: 1px;
}


.metric-popover {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.metric-popover-content {
	background: white;
	border-radius: 8px;
	padding: 24px;
	max-width: 440px;
	width: 90%;
	position: relative;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.metric-popover-content h4 {
	margin: 0 0 12px 0;
	font-size: 16px;
	color: #333;
	padding-right: 24px;
}

.metric-popover-content p {
	margin: 0;
	color: #555;
	font-size: 14px;
	line-height: 1.6;
}

.metric-popover-close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: none;
	border: none;
	font-size: 20px;
	color: #999;
	cursor: pointer;
	padding: 0;
	line-height: 1;
	min-width: auto;
}

.metric-popover-close:hover {
	color: #333;
	background: none;
}

.trends-section {
	background: white;
	border-radius: 8px;
	padding: 20px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.trends-section h2 {
	margin: 0 0 20px 0;
}

.trends-controls {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
	margin-bottom: 20px;
	padding-bottom: 20px;
	border-bottom: 1px solid #e9ecef;
}

.chart-toggles {
	display: flex;
	gap: 8px;
	margin-bottom: 12px;
}

.chart-toggle {
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 600;
	border: 2px solid var(--toggle-color);
	border-radius: 4px;
	background: var(--toggle-color);
	color: white;
	cursor: pointer;
	min-width: auto;
}

.chart-toggle:hover {
	opacity: 0.85;
}

.chart-toggle:not(.active) {
	background: white;
	color: var(--toggle-color);
}

.chart-container {
	height: 400px;
	position: relative;
}

@media (max-width: 768px) {
	body {
		padding: 10px;
	}

	.controls {
		flex-direction: column;
	}

	.control-group {
		width: 100%;
	}

	select {
		min-width: auto;
		width: 100%;
	}

	button {
		width: 100%;
	}

	.report-header-top {
		flex-direction: column;
	}

	.resource-data {
		flex-wrap: wrap;
	}

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

	.trends-controls {
		flex-direction: column;
	}
}
