.kfms-form {
	--kfms-accent: #2563eb;
	--kfms-accent-contrast: #fff;
	--kfms-complete: #15803d;
	--kfms-muted: #64748b;
	--kfms-border: #dbe2ea;
	--kfms-surface: #fff;
	--kfms-soft: #f1f5f9;
	--kfms-radius: 8px;
}

.kfms-step[hidden],
.kfms-actions [hidden],
.kfms-extra-submit {
	display: none !important;
}

.kfms-progress {
	box-sizing: border-box;
	margin: 0 0 2rem;
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	padding: 4px 2px 10px;
	-webkit-overflow-scrolling: touch;
}

.kfms-progress__list {
	display: grid;
	grid-template-columns: repeat(var(--kfms-step-count), minmax(110px, 1fr));
	list-style: none;
	margin: 0;
	min-width: max-content;
	padding: 0;
}

.kfms-progress__item {
	box-sizing: border-box;
	min-width: 110px;
	position: relative;
	text-align: center;
}

.kfms-progress__item:not(:last-child)::after {
	background: var(--kfms-border);
	content: "";
	height: 2px;
	left: calc(50% + 25px);
	position: absolute;
	right: calc(-50% + 25px);
	top: 22px;
	transition: background-color 180ms ease;
	z-index: 0;
}

.kfms-progress__item.is-complete:not(:last-child)::after {
	background: var(--kfms-complete);
}

.kfms-progress__button {
	appearance: none;
	background: transparent;
	border: 0;
	box-shadow: none;
	color: var(--kfms-muted);
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	gap: 7px;
	margin: 0;
	max-width: 100%;
	padding: 0 7px;
	position: relative;
	text-align: center;
	text-decoration: none;
	z-index: 1;
	align-items: center;
	flex-direction: column;
}

.kfms-progress__button:disabled {
	cursor: default;
	opacity: 1;
}

.kfms-progress__marker {
	align-items: center;
	background: var(--kfms-surface);
	border: 2px solid var(--kfms-border);
	border-radius: 999px;
	box-sizing: border-box;
	color: var(--kfms-muted);
	display: inline-flex;
	font-size: 14px;
	font-weight: 700;
	height: 44px;
	justify-content: center;
	line-height: 1;
	transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, transform 180ms ease;
	width: 44px;
}

.kfms-progress__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	line-height: 1;
}

.kfms-progress__icon::before {
	line-height: 1;
}

.kfms-progress__item.is-current .kfms-progress__marker {
	background: var(--kfms-accent);
	border-color: var(--kfms-accent);
	color: var(--kfms-accent-contrast);
	transform: scale(1.04);
}

.kfms-progress__item.is-complete .kfms-progress__marker {
	background: var(--kfms-complete);
	border-color: var(--kfms-complete);
	color: #fff;
}

.kfms-progress__item.is-current .kfms-progress__label {
	color: var(--kfms-accent);
}

.kfms-progress__item.is-reached:not(.is-current) .kfms-progress__button:not(:disabled):hover .kfms-progress__marker,
.kfms-progress__item.is-reached:not(.is-current) .kfms-progress__button:not(:disabled):focus-visible .kfms-progress__marker {
	border-color: currentColor;
}

.kfms-progress__button:focus-visible,
.kfms-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.kfms-progress__label {
	box-sizing: border-box;
	line-height: 1.3;
	max-width: 150px;
	overflow-wrap: anywhere;
}

.kfms-step {
	scroll-margin-top: 32px;
}

.kfms-step:focus {
	outline: none;
}

/* The Kadence Submit field itself becomes the shared multi-step action row. */
.kfms-actions {
	align-items: center;
	box-sizing: border-box;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	width: 100%;
}

/* Only provide fallback button styling when Kadence button classes are unavailable. */
.kfms-button:not(.kb-button) {
	appearance: none;
	background: var(--kfms-surface);
	border: 1px solid var(--kfms-border);
	border-radius: var(--kfms-radius);
	box-sizing: border-box;
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	margin: 0;
	min-height: 44px;
	padding: 11px 20px;
	text-decoration: none;
}

.kfms-button:not(.kb-button).kfms-button--next {
	background: var(--kfms-accent);
	border-color: var(--kfms-accent);
	color: var(--kfms-accent-contrast);
}

.kfms-button {
	cursor: pointer;
}

@media (max-width: 767px) {
	.kfms-progress {
		margin-bottom: 1.4rem;
	}

	.kfms-progress__list {
		grid-template-columns: repeat(var(--kfms-step-count), minmax(92px, 1fr));
	}

	.kfms-progress__item {
		min-width: 92px;
	}

	.kfms-progress__marker {
		height: 38px;
		width: 38px;
	}

	.kfms-progress__item:not(:last-child)::after {
		left: calc(50% + 22px);
		right: calc(-50% + 22px);
		top: 19px;
	}

	.kfms-progress__label {
		font-size: 11px;
		max-width: 105px;
	}

	.kfms-actions {
		gap: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kfms-progress__marker {
		transition: none;
	}

	.kfms-step {
		scroll-behavior: auto;
	}
}
