.dso-widget {
	--dso-fg: #1a2b2b;
	--dso-muted: #5c6b6b;
	--dso-card-bg: #ffffff;
	--dso-card-fg: #1a2b2b;
	--dso-card-muted: #5c6b6b;
	--dso-border: #e3ece9;
	--dso-accent: #0f9d68;

	box-sizing: border-box;
	max-width: 760px;
	margin: 0 auto;
	padding: 28px 32px;
	background: transparent;
	color: var(--dso-fg);
	font-family: inherit;
	color-scheme: light;
	container-type: inline-size;
}

.dso-widget * {
	box-sizing: border-box;
}

.dso-header {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px 14px;
	margin-bottom: 24px;
}

.dso-title {
	font-size: 18px;
	font-weight: 800;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.dso-period {
	font-size: 14px;
	color: var(--dso-muted);
	display: flex;
	align-items: center;
	gap: 8px;
}

.dso-period::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--dso-accent);
	display: inline-block;
}

.dso-badge {
	margin-left: auto;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--dso-accent);
	background: rgba(15, 157, 104, 0.12);
	padding: 6px 12px;
	border-radius: 999px;
}

.dso-body {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 24px;
	flex-wrap: nowrap;
}

.dso-donut-wrap {
	position: relative;
	flex: 0 0 auto;
	width: clamp(160px, 42cqi, 260px);
	aspect-ratio: 1 / 1;
}

.dso-canvas {
	width: 100% !important;
	height: 100% !important;
}

.dso-center-text {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	pointer-events: none;
	padding: 0 14%;
}

.dso-center-number {
	font-size: clamp(1.3em, 22cqi, 2em);
	font-weight: 800;
	line-height: 1;
	color: var(--dso-accent);
}

.dso-center-line1 {
	font-size: clamp(0.55em, 8cqi, 0.7em);
	font-weight: 800;
	letter-spacing: 0.02em;
	margin-top: 5px;
}

.dso-center-line2 {
	font-size: clamp(0.48em, 6.5cqi, 0.6em);
	color: var(--dso-muted);
	margin-top: 2px;
}

.dso-legend {
	flex: 1 1 260px;
	max-width: 300px;
	min-width: 0;
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.dso-legend-item {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--dso-card-bg);
	color: var(--dso-card-fg);
	border-left: 4px solid var(--dso-legend-color, var(--dso-accent));
	border-radius: 8px;
	padding: 8px 10px;
	box-shadow: 0 1px 2px rgba(16, 24, 24, 0.08);
}

.dso-legend-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--dso-legend-color, var(--dso-accent));
	flex: 0 0 auto;
}

.dso-legend-text {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
}

.dso-legend-name {
	font-weight: 700;
	font-size: 13.5px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dso-legend-desc {
	font-size: 11px;
	color: var(--dso-card-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dso-legend-value {
	font-weight: 800;
	font-size: 16px;
	color: var(--dso-legend-color, var(--dso-accent));
	white-space: nowrap;
	flex: 0 0 auto;
}

.dso-headline {
	text-align: center;
	font-size: 19px;
	font-weight: 800;
	margin: 28px 0 6px;
	line-height: 1.3;
}

.dso-subtitle {
	text-align: center;
	font-size: 14px;
	color: var(--dso-muted);
	margin: 0 0 16px;
}

.dso-source {
	text-align: center;
	font-size: 11.5px;
	color: var(--dso-muted);
	border-top: 1px solid var(--dso-border);
	padding-top: 12px;
	margin: 0;
}

@container (max-width: 340px) {
	.dso-widget {
		padding: 20px;
	}

	.dso-body {
		flex-direction: column;
		flex-wrap: wrap;
	}

	.dso-donut-wrap {
		width: 200px;
	}

	.dso-legend {
		width: 100%;
	}

	.dso-badge {
		margin-left: 0;
	}
}

/* Fallback para navegadores sin soporte de container queries: usa el viewport. */
@supports not (container-type: inline-size) {
	@media (max-width: 400px) {
		.dso-widget {
			padding: 20px;
		}

		.dso-body {
			flex-direction: column;
			flex-wrap: wrap;
		}

		.dso-donut-wrap {
			width: 200px;
		}

		.dso-legend {
			width: 100%;
		}

		.dso-badge {
			margin-left: 0;
		}
	}
}

