.zpower-product-discounts,
.zpower-crm-checkout-promotions,
.zpower-crm-checkout-coupon-control,
.zpower-crm-credit-control {
	--zpower-discount-accent: var(--theme-palette-color-1, var(--wp--preset--color--primary, #2271b1));
	--zpower-discount-accent-hover: var(--theme-button-background-hover-color, var(--theme-palette-color-2, var(--zpower-discount-accent)));
	--zpower-discount-text: var(--theme-palette-color-4, currentColor);
	--zpower-discount-muted: var(--theme-palette-color-3, #667085);
	--zpower-discount-border: var(--theme-palette-color-5, #e3e8f1);
	--zpower-discount-surface: var(--theme-palette-color-8, #fff);
	--zpower-discount-button-accent: var(--theme-button-background-initial-color, var(--zpower-discount-accent));
}

.zpower-product-discounts {
	margin: 24px 0;
	padding: 20px;
	border: 1px solid var(--zpower-discount-border);
	border-radius: 0;
	background: var(--zpower-discount-surface);
}

.zpower-product-discounts__title {
	margin: 0 0 14px;
	color: var(--zpower-discount-text);
	font-size: 17px !important;
	line-height: 1.3;
}

.zpower-product-discounts__list {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.zpower-product-discounts__item {
	display: grid;
	gap: 4px;
	padding: 5px 10px;
	border: 0;
	border-left: 3px solid var(--zpower-discount-accent);
	border-radius: 0;
	background: var(--zpower-discount-surface);
}

.zpower-product-discounts__name {
	color: var(--zpower-discount-text);
	font-size: 15px;
}

.zpower-product-discounts__description,
.zpower-product-discounts__summary,
.zpower-product-discounts__code {
	color: var(--zpower-discount-muted);
	font-size: 13px;
	line-height: 1.5;
}

.zpower-product-discounts__description {
	margin: 0;
}

.zpower-product-discounts__code {
	color: var(--zpower-discount-accent);
	font-weight: 700;
}

.zpower-product-discounts__quantity {
	display: grid;
	gap: 12px;
	margin-bottom: 20px;
}

.zpower-product-discounts__quantity-title {
	margin: 0;
	color: var(--zpower-discount-text);
	font-size: 16px !important;
}

.zpower-product-discounts__quantity-list {
	display: grid;
	gap: 12px;
}

.zpower-product-discounts__quantity-item {
	display: grid;
	grid-template-columns: 100px minmax(0, 1fr) auto;
	align-items: stretch;
	position: relative;
	min-height: 132px;
	overflow: hidden;
	border: 1px solid var(--zpower-discount-border);
	border-radius: 18px;
	background: var(--zpower-discount-surface);
}

.zpower-product-discounts__quantity-item:hover {
	border-color: var(--zpower-discount-accent);
}

.zpower-product-discounts__quantity-tier {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 18px 16px;
	background: var(--theme-palette-color-7, var(--zpower-discount-surface));
	background: color-mix(in srgb, var(--zpower-discount-accent) 10%, var(--zpower-discount-surface));
}

.zpower-product-discounts__quantity-count {
	display: flex;
	align-items: baseline;
	justify-content: center;
	width: 100%;
	gap: 3px;
	padding: 0;
	color: var(--zpower-discount-accent);
	background: transparent;
	text-align: center;
}

.zpower-product-discounts__quantity-count strong {
	font-size: 34px;
	line-height: 1;
}

.zpower-product-discounts__quantity-count span {
	font-size: 18px;
	font-weight: 700;
}

.zpower-product-discounts__quantity-price {
	display: grid;
	align-content: center;
	gap: 5px;
	box-sizing: border-box;
	width: 235px;
	padding: 18px 0 18px 10px;
}

.zpower-product-discounts__quantity-original {
	color: var(--zpower-discount-muted);
	font-size: 16px;
}

.zpower-product-discounts__quantity-total {
	color: var(--zpower-discount-muted);
	font-size: 17px;
}

.zpower-product-discounts__quantity-offer {
	color: var(--zpower-discount-accent);
}

.zpower-product-discounts__quantity-offer strong {
	font-size: 24px;
}

.zpower-product-discounts__quantity-badge {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 2;
	display: block;
	width: 82px;
	height: 82px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	color: var(--zpower-discount-surface);
	background: var(--zpower-discount-accent);
	clip-path: polygon(0 0, 100% 0, 100% 100%);
	pointer-events: none;
}

.zpower-product-discounts__quantity-badge-label {
	position: absolute;
	top: 12px;
	right: -10px;
	display: block;
	width: 70px;
	color: var(--zpower-discount-surface);
	font-size: 20px;
	font-weight: 700;
	line-height: 1;
	text-align: center;
	white-space: nowrap;
	transform: rotate(45deg);
}

.zpower-product-discounts__quantity-button.button {
	align-self: center;
	margin: 0 48px 0 18px;
	border: 1px solid var(--zpower-discount-button-accent);
	border-radius: 999px;
	color: var(--zpower-discount-button-accent);
	background: transparent;
	white-space: nowrap;
}

.zpower-product-discounts__quantity-button.button:hover,
.zpower-product-discounts__quantity-button.button:focus {
	color: var(--zpower-discount-surface);
	border-color: var(--zpower-discount-accent-hover);
	background: var(--zpower-discount-accent-hover);
}

.zpower-product-discounts__quantity-button.button:focus-visible {
	outline: 2px solid var(--zpower-discount-button-accent);
	outline-offset: 2px;
}

/* The right-side mini cart opens automatically after a tier is added. */
.zpower-product-discounts__quantity-item > a.added_to_cart.wc-forward {
	display: none !important;
}

.zpower-product-discounts__quantity-note {
	align-self: center;
	margin: 0 18px;
	color: var(--zpower-discount-muted);
	font-size: 13px;
}

.zpower-crm-checkout-promotions th,
.zpower-crm-checkout-promotions td {
	padding-top: 10px;
	padding-bottom: 10px;
	vertical-align: top;
}

.zpower-crm-checkout-promotions {
	width: 100%;
}

.zpower-crm-checkout-promotions > th {
	display: table-cell;
	box-sizing: border-box;
	width: 100% !important;
	min-width: 0;
	white-space: normal;
}

.zpower-crm-checkout-promotions__inner {
	display: grid;
	grid-template-columns: minmax(0, 40%) minmax(0, 60%);
	width: 100%;
	box-sizing: border-box;
}

.zpower-crm-checkout-promotions__label {
	display: block;
	min-width: 0;
	white-space: nowrap;
}

.zpower-crm-checkout-promotions__list {
	display: grid;
	gap: 5px;
	margin: 0;
	padding: 0;
	list-style: none;
	text-align: right;
}

.zpower-crm-checkout-promotions__list li {
	display: grid;
	gap: 2px;
}

.zpower-crm-checkout-promotion-line {
	display: flex;
	align-items: baseline;
	justify-content: flex-end;
	gap: 16px;
}

.zpower-crm-checkout-promotion-amount {
	color: #147a4b;
	font-size: 15px !important;
	font-weight: 600 !important;
	white-space: nowrap;
}

.zpower-crm-checkout-promotions__list span {
	color: #667085;
	font-size: .9em;
}

body.woocommerce-checkout .woocommerce-form-coupon-toggle,
body.woocommerce-checkout form#woocommerce-checkout-form-coupon {
	display: none !important;
}

.zpower-crm-checkout-coupon-control {
	margin-top: 12px;
}

.zpower-crm-checkout-coupon-control__field {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: stretch;
	gap: 8px;
	margin-bottom: 20px;
}

body.woocommerce-checkout .woocommerce-checkout-review-order-table tr.fee.zpower-crm-credit-fee-row {
	display: none !important;
}

@supports selector(tr:has(*)) {
	body.woocommerce-checkout .woocommerce-checkout-review-order-table tr.fee:has([data-zpower-crm-credit-fee]) {
		display: none !important;
	}
}

.zpower-crm-checkout-coupon-control__field input {
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	min-height: 40px;
	margin: 0;
	padding: 6px 10px;
	border: 1px solid var(--zpower-discount-border);
	border-radius: 0;
	background: var(--zpower-discount-surface);
}

.zpower-crm-checkout-coupon-control__button.button {
	min-height: 40px;
	margin: 0;
	padding: 6px 14px;
	border-color: var(--zpower-discount-button-accent);
	border-radius: 0;
	background: var(--zpower-discount-button-accent);
	white-space: nowrap;
}

.zpower-crm-checkout-coupon-control.is-processing {
	opacity: .7;
}

.zpower-crm-checkout-coupon-control__notices:empty {
	display: none;
}

.zpower-crm-checkout-coupon-control__notices > * {
	margin: 8px 0 0;
}

.zpower-crm-credit-control {
	margin-top: 12px;
}

.zpower-crm-credit-control__toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 26px;
	line-height: 1.4;
}

.zpower-crm-credit-control__toggle input[type="checkbox"] {
	position: absolute;
	inset: 0 auto auto 0;
	width: 26px;
	height: 26px;
	min-width: 26px;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.zpower-crm-credit-control__checkbox {
	display: inline-grid;
	place-items: center;
	flex: 0 0 26px;
	width: 26px;
	height: 26px;
	box-sizing: border-box;
	border: 1px solid var(--zpower-discount-accent);
	border-radius: 2px;
	background: var(--zpower-discount-surface);
	transition: background-color .15s ease, border-color .15s ease;
}

.zpower-crm-credit-control__toggle input[type="checkbox"]:checked + .zpower-crm-credit-control__checkbox {
	border-color: var(--zpower-discount-accent);
	background: var(--zpower-discount-accent);
}

.zpower-crm-credit-control__toggle input[type="checkbox"]:checked + .zpower-crm-credit-control__checkbox::after {
	content: "";
	width: 7px;
	height: 13px;
	border: solid #fff;
	border-width: 0 3px 3px 0;
	transform: translateY(-1px) rotate(45deg);
}

.zpower-crm-credit-control__toggle input[type="checkbox"]:focus-visible + .zpower-crm-credit-control__checkbox {
	outline: 2px solid var(--zpower-discount-accent-hover);
	outline-offset: 2px;
}

.zpower-crm-credit-control__toggle input[type="checkbox"]:disabled + .zpower-crm-credit-control__checkbox {
	opacity: .55;
	cursor: not-allowed;
}

.zpower-crm-credit-control__amount {
	display: grid;
	grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
	align-items: center;
	gap: 6px 10px;
	max-width: 380px;
	margin: 8px 0 0;
	padding: 10px 12px;
	border: 1px solid var(--zpower-discount-border);
	background: var(--zpower-discount-surface);
}

.zpower-crm-credit-control__amount-input {
	display: flex;
	align-items: center;
	gap: 6px;
}

.zpower-crm-credit-control__amount-input input {
	box-sizing: border-box;
	width: 100%;
	min-height: 38px;
	padding: 6px 8px;
	border: 1px solid var(--zpower-discount-accent-hover);
	border-radius: 0;
	background: var(--zpower-discount-surface);
}

.zpower-crm-credit-control__amount-input > span,
.zpower-crm-credit-control__amount > small {
	color: var(--zpower-discount-muted);
	font-size: 12px;
}

.zpower-crm-credit-control__amount > small {
	grid-column: 1 / -1;
}

.zpower-crm-checkout-credit .zpower-crm-checkout-promotion-amount {
	color: var(--zpower-discount-accent);
}

.zpower-crm-shipping-method-name,
.zpower-crm-shipping-method-cost {
	display: inline-block;
	vertical-align: middle;
}

.zpower-crm-shipping-method-cost {
	float: right;
	margin-left: 16px;
	white-space: nowrap;
}

.zpower-crm-shipping-method-cost.is-free {
	color: #147a4b;
	font-weight: 700;
}

@media (max-width: 1100px) {
	.zpower-product-discounts {
		padding: 14px;
	}

	.zpower-product-discounts__quantity-item {
		grid-template-columns: 86px minmax(0, 1fr);
		min-height: 0;
	}

	.zpower-product-discounts__quantity-tier {
		grid-row: 1 / span 3;
		padding: 16px 10px;
	}

	.zpower-product-discounts__quantity-count {
		flex-direction: column;
		align-items: center;
		gap: 2px;
	}

	.zpower-product-discounts__quantity-price {
		width: 100%;
		padding: 16px 14px 8px;
	}

	.zpower-product-discounts__quantity-offer strong {
		font-size: 20px;
	}

	.zpower-product-discounts__quantity-badge {
		width: 68px;
		height: 68px;
	}

	.zpower-product-discounts__quantity-badge-label {
		top: 12px;
		right: -10px;
		width: 60px;
		font-size: 20px;
	}

	.zpower-product-discounts__quantity-button.button,
	.zpower-product-discounts__quantity-note {
		grid-column: 2;
		justify-self: stretch;
		margin: 0 14px 14px;
		text-align: center;
	}

	.zpower-crm-checkout-promotions__inner {
		grid-template-columns: minmax(0, 1fr);
	}

	.zpower-crm-credit-control__amount {
		grid-template-columns: minmax(0, 1fr);
		max-width: none;
		margin-left: 0;
	}
}
