.babfw-builder {
	position: relative;
	overflow: hidden;
	border: 1px solid #dedede;
	border-radius: 8px;
	margin: 0 0 1.25rem;
	padding: 1rem;
	background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
	box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.babfw-builder--empty {
	border-color: #c0392b;
}

.babfw-header {
	display: flex;
	gap: 1rem;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 1rem;
}

.babfw-header h3 {
	margin: 0 0 .25rem;
	font-size: 1.25rem;
}

.babfw-header p {
	margin: 0;
	color: #555;
}

.babfw-size {
	display: grid;
	gap: .35rem;
	min-width: 10rem;
	font-weight: 600;
}

.babfw-size select {
	width: 100%;
}

.babfw-progress {
	margin-bottom: 1rem;
}

.babfw-progress-label {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: .4rem;
}

.babfw-progress-track {
	height: .62rem;
	overflow: hidden;
	border-radius: 999px;
	background: #e8edf3;
}

.babfw-progress-track span {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, #2563eb, #14b8a6);
	transition: width .18s ease;
}

.babfw-builder.is-complete .babfw-progress-track span {
	background: linear-gradient(90deg, #10b981, #84cc16);
}

.babfw-builder.is-overfilled .babfw-progress-track span {
	background: #c0392b;
}

.babfw-tools {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: .75rem;
	align-items: end;
	margin-bottom: 1rem;
}

.babfw-search {
	display: grid;
	gap: .35rem;
	font-weight: 600;
}

.babfw-search-input {
	width: 100%;
	min-height: 2.65rem;
	margin: 0;
	padding: 0 .85rem;
	border: 1px solid #c8d1dc;
	border-radius: 8px;
	background: #fff;
	box-shadow: none;
	color: #1f2937;
	font: inherit;
	box-sizing: border-box;
}

.babfw-search-input:focus {
	border-color: #2271b1;
	outline: 2px solid rgba(34, 113, 177, .16);
	outline-offset: 0;
}

.babfw-visible-count {
	padding-bottom: .55rem;
	color: #667085;
	font-size: .92rem;
	white-space: nowrap;
}

.babfw-items {
	display: grid;
	gap: .7rem;
}

.babfw-item {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr) auto;
	gap: .75rem;
	align-items: center;
	padding: .7rem;
	border: 1px solid #e6e6e6;
	border-radius: 8px;
	background: #fafafa;
	transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.babfw-item[hidden] {
	display: none;
}

.babfw-item:focus-within,
.babfw-item:hover {
	border-color: #b9c7d8;
	box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.babfw-item-media {
	width: 64px;
	height: 64px;
	overflow: hidden;
	border-radius: 6px;
	background: #f1f1f1;
}

.babfw-item-image,
.babfw-item-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.babfw-item-main {
	display: grid;
	gap: .15rem;
	min-width: 0;
}

.babfw-item-title {
	display: flex;
	gap: .4rem;
	align-items: center;
	min-width: 0;
}

.babfw-item-main strong,
.babfw-item-main span {
	overflow-wrap: anywhere;
}

.babfw-fire {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 1.55rem;
	height: 1.55rem;
	border: 1px solid #fed7aa;
	border-radius: 999px;
	background: #fff7ed;
	font-size: .9rem;
	line-height: 1;
}

.babfw-item-main span {
	color: #666;
	font-size: .9rem;
}

.babfw-empty-results {
	margin: 1rem 0 0;
	padding: .85rem;
	border: 1px dashed #c8d1dc;
	border-radius: 8px;
	color: #667085;
	text-align: center;
}

.babfw-qty-control {
	display: inline-grid;
	grid-template-columns: 2.5rem 3.5rem 2.5rem;
	align-items: stretch;
	width: 8.5rem;
	height: 2.65rem;
	overflow: hidden;
	border: 1px solid #c8d1dc;
	border-radius: 8px;
	background: #fff;
	box-sizing: border-box;
}

.babfw-qty-control .babfw-step,
.babfw-qty-control .babfw-qty {
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: #1f2937;
	text-align: center;
	font: inherit;
	line-height: 1;
	box-sizing: border-box;
	appearance: none;
}

.babfw-qty-control .babfw-step {
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 1.25rem;
	font-weight: 700;
	transition: background .16s ease, color .16s ease, opacity .16s ease;
}

.babfw-qty-control .babfw-step:hover:not(:disabled),
.babfw-qty-control .babfw-step:focus-visible:not(:disabled) {
	background: #eef6ff;
	color: #0f5f9e;
}

.babfw-qty-control .babfw-step:disabled {
	cursor: not-allowed;
	opacity: .45;
}

.babfw-qty-control .babfw-qty {
	display: block;
	border-right: 1px solid #dbe2ea;
	border-left: 1px solid #dbe2ea;
	background: #fbfcfd;
	font-weight: 700;
	line-height: 2.65rem;
	-moz-appearance: textfield;
}

.babfw-qty::-webkit-outer-spin-button,
.babfw-qty::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

.babfw-confetti {
	position: absolute;
	right: 7.5rem;
	bottom: 4.1rem;
	z-index: 5;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

.babfw-confetti span {
	position: absolute;
	left: 0;
	top: 0;
	width: .44rem;
	height: .72rem;
	border-radius: 2px;
	opacity: 0;
	transform: translate3d(0, 0, 0) rotate(0);
	animation: babfw-confetti-pop .9s ease-out var(--babfw-delay) forwards;
}

@keyframes babfw-confetti-pop {
	0% {
		opacity: 0;
		transform: translate3d(0, 0, 0) rotate(0);
	}

	12% {
		opacity: 1;
	}

	100% {
		opacity: 0;
		transform: translate3d(var(--babfw-x), calc(var(--babfw-y) + 120px), 0) rotate(var(--babfw-r));
	}
}

@media (max-width: 640px) {
	.babfw-header {
		display: grid;
	}

	.babfw-size {
		min-width: 0;
	}

	.babfw-tools {
		grid-template-columns: 1fr;
		align-items: stretch;
	}

	.babfw-visible-count {
		padding-bottom: 0;
	}

	.babfw-item {
		grid-template-columns: 54px minmax(0, 1fr);
	}

	.babfw-item-media {
		width: 54px;
		height: 54px;
	}

	.babfw-qty-control {
		grid-column: 1 / -1;
		width: 100%;
		grid-template-columns: 1fr 4rem 1fr;
	}

	.babfw-confetti {
		right: 50%;
		bottom: 4.6rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.babfw-item,
	.babfw-progress-track span,
	.babfw-qty-control .babfw-step {
		transition: none;
	}

	.babfw-confetti {
		display: none;
	}
}
