/**
 * Checkout styles, matching the brief's Screens 1-7 mockups and the UI & Copy
 * Requirements (Section 2):
 *   - Card radius 8px, button radius 4px, per brand standard.
 *   - No red anywhere in this flow, including validation and error states;
 *     amber (#F59E0B) for warnings.
 *   - Every control works by keyboard, with a visible, AA-contrast focus state.
 *   - The flow works at 375px with no horizontal scroll or overlapping labels.
 */

:root {
	--pgbfc-radius-card: 8px;
	--pgbfc-radius-button: 4px;
	--pgbfc-color-green: #1a7a1a;
	--pgbfc-color-green-bg: #f3faf3;
	--pgbfc-color-green-border: #2e8b2e;
	--pgbfc-color-warning: #f59e0b;
	--pgbfc-color-warning-bg: #fef6e7;
	--pgbfc-color-warning-text: #92660a;
	--pgbfc-color-border: #dcdcdc;
	--pgbfc-color-text: #1a1a1a;
	--pgbfc-color-text-muted: #6b6b6b;
	--pgbfc-color-focus: #1a5fb4;
}

.pgbfc-mode-toggle,
.pgbfc-pickup-selector,
.pgbfc-modal,
.pgbfc-tier3-popup,
.pgbfc-tier3-status {
	max-width: 100%;
	min-width: 0; /* prevents flex/grid children from forcing extra width */
	box-sizing: border-box;
	color: var(--pgbfc-color-text);
}

/*
 * woocommerce_checkout_before_order_review_heading, the hook the mode toggle
 * and pickup selector render on, fires as a direct child of <form
 * class="checkout">, between the floated #customer_details billing column and
 * the "Your order" heading. It's NOT inside #order_review (checked against
 * woocommerce/templates/checkout/form-checkout.php). Left unstyled, a block
 * here doesn't clear that float, so its box spans the full form width and its
 * background paints across the billing column.
 *
 * To match Screens 1-7, where Delivery sits beside Billing, PGBFC_Mode_Toggle
 * wraps its render(), PGBFC_Pickup_Selector::render() and the Tier 3 status
 * card in one .pgbfc-delivery-section container
 * (open_wrapper()/close_wrapper(), priorities 4 and 8 on that hook). Only the
 * container gets the float and width this theme gives #order_review_heading
 * and .woocommerce-checkout-review-order: two `float: left; width: 50%` boxes
 * sit side by side, the same way #customer_details does it. One wrapper means
 * one rule, so siblings don't each need their own.
 *
 * This ties us to Kadence's checkout column spacing variable (with a plain
 * fallback for other themes). We chose a close match to the mockups over a
 * theme-agnostic full-width layout, so it may need another look if Kadence's
 * checkout CSS changes.
 */
.pgbfc-delivery-section {
	float: left;
	width: 50%;
	padding-left: var(--global-md-spacing, 2rem);
	box-sizing: border-box;
	min-width: 0;
}

#pgbfc-pickup-selector {
	margin-top: 0.75rem;
	margin-bottom: 30px;
}

.pgbfc-mode-toggle *,
.pgbfc-pickup-selector *,
.pgbfc-modal *,
.pgbfc-tier3-popup * {
	box-sizing: border-box;
}

.pgbfc-icon {
	width: 1.1em;
	height: 1.1em;
	flex-shrink: 0;
}

.pgbfc-visually-hidden-input {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Ship/Pickup mode toggle (Screens 1, 3) */

.pgbfc-mode-toggle__heading {
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--pgbfc-color-text);
	margin-bottom: 0.75rem;
}

.pgbfc-toggle {
	display: flex;
	background: #f2f2f2;
	border: 1px solid var(--pgbfc-color-border);
	border-radius: var(--pgbfc-radius-card);
	padding: 4px;
	gap: 4px;
}

.pgbfc-toggle__segment {
	flex: 1 1 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	border-radius: calc(var(--pgbfc-radius-card) - 2px);
	font-weight: 700;
	color: var(--pgbfc-color-text-muted);
	cursor: pointer;
	background: transparent;
	border: 2px solid transparent;
}

.pgbfc-toggle__segment.is-active {
	background: #fff;
	border-color: var(--pgbfc-color-green-border);
	color: var(--pgbfc-color-text);
}

.pgbfc-toggle__segment:has(.pgbfc-visually-hidden-input:focus-visible) {
	outline: 3px solid var(--pgbfc-color-focus);
	outline-offset: 2px;
}

/* Pickup default card + "4 More Locations" row (Screen 3) */

.pgbfc-pickup-card {
	border: 2px solid var(--pgbfc-color-green-border);
	background: var(--pgbfc-color-green-bg);
	border-radius: var(--pgbfc-radius-card);
	padding: 1rem 1.25rem;
	margin-top: 0.75rem;
	box-sizing: border-box;
}

.pgbfc-pickup-card__row {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.5rem 1rem;
	min-width: 0;
}

.pgbfc-pickup-card__label,
.pgbfc-pickup-card__address,
.pgbfc-pickup-card__meta {
	overflow-wrap: anywhere;
}

.pgbfc-pickup-card__label {
	font-size: 1rem;
}

.pgbfc-pickup-card__price {
	font-weight: 800;
	white-space: nowrap;
}

.pgbfc-pickup-card__price--free {
	color: var(--pgbfc-color-green);
	text-transform: uppercase;
}

.pgbfc-pickup-card__address,
.pgbfc-pickup-card__meta {
	margin: 0.25rem 0 0;
	font-size: 0.8125rem;
	color: var(--pgbfc-color-text-muted);
}

.pgbfc-more-locations {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin-top: 0.5rem;
	padding: 0.75rem 1rem;
	background: #fff;
	border: 1px solid var(--pgbfc-color-border);
	border-radius: var(--pgbfc-radius-button);
	font-weight: 700;
	color: var(--pgbfc-color-green);
	cursor: pointer;
}

.pgbfc-more-locations .pgbfc-icon--chevron {
	color: var(--pgbfc-color-text-muted);
}

/*
 * Pickup Locations modal (Screen 4). Checkout now uses the warehouse
 * dropdown; the Tier 3 popup still borrows .pgbfc-modal__close.
 */

.pgbfc-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	padding: 1rem;
}

.pgbfc-modal {
	background: #fff;
	border-radius: var(--pgbfc-radius-card);
	padding: 1.5rem;
	max-width: 560px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
}

.pgbfc-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1rem;
}

.pgbfc-modal__header h2 {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 800;
}

.pgbfc-modal__close {
	background: none;
	border: none;
	color: var(--pgbfc-color-text-muted);
	cursor: pointer;
	padding: 0.25rem;
}

.pgbfc-modal__helper {
	font-size: 0.8125rem;
	color: var(--pgbfc-color-text-muted);
	margin: 0.75rem 0 0.5rem;
}

.pgbfc-pickup-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--pgbfc-color-border);
	border-radius: var(--pgbfc-radius-card);
	overflow: hidden;
}

.pgbfc-pickup-list__item {
	border-bottom: 1px solid var(--pgbfc-color-border);
	cursor: pointer;
}

.pgbfc-pickup-list__item:last-child {
	border-bottom: none;
}

.pgbfc-pickup-list__item.is-selected {
	background: var(--pgbfc-color-green-bg);
}

.pgbfc-pickup-list__item label {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	cursor: pointer;
}

.pgbfc-pickup-list__text {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.pgbfc-pickup-list__label {
	font-weight: 700;
}

.pgbfc-pickup-list__address,
.pgbfc-pickup-list__meta {
	font-size: 0.8125rem;
	color: var(--pgbfc-color-text-muted);
}

.pgbfc-pickup-list__price {
	font-weight: 700;
	white-space: nowrap;
}

.pgbfc-pickup-list__price--free {
	color: var(--pgbfc-color-green);
	text-transform: uppercase;
}

.pgbfc-modal__footer {
	display: flex;
	justify-content: flex-end;
	margin-top: 1rem;
}

/* Buttons */

.pgbfc-button {
	display: inline-block;
	border: none;
	border-radius: var(--pgbfc-radius-button);
	padding: 0.65rem 1.5rem;
	font-weight: 700;
	cursor: pointer;
}

.pgbfc-button--primary {
	background: var(--pgbfc-color-green);
	color: #fff;
}

.pgbfc-button--primary:hover {
	background: var(--pgbfc-color-green-border);
}

/* Estimate and curbside notices: amber, never red */

.pgbfc-notice {
	font-size: 0.8125rem;
	color: var(--pgbfc-color-warning-text);
	background: var(--pgbfc-color-warning-bg);
	border: 1px solid var(--pgbfc-color-warning);
	padding: 0.75rem 1rem;
	border-radius: var(--pgbfc-radius-button);
	margin-top: 0.75rem;
}

.pgbfc-notice__heading {
	display: block;
	color: var(--pgbfc-color-warning-text);
}

.pgbfc-notice__body {
	margin: 0.25rem 0 0;
}

/* Tier 3 popup */

.pgbfc-tier3-popup {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	padding: 1rem;
}

.pgbfc-tier3-popup__panel {
	position: relative;
	background: #fff;
	border-radius: var(--pgbfc-radius-card);
	padding: 1.25rem;
	max-width: 400px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
}

.pgbfc-tier3-popup__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
}

.pgbfc-tier3-popup__option {
	display: block;
	width: 100%;
	text-align: left;
	border: 1px solid var(--pgbfc-color-border);
	border-radius: var(--pgbfc-radius-button);
	padding: 0.75rem 1rem;
	margin-top: 0.75rem;
	background: var(--pgbfc-color-green-bg);
	cursor: pointer;
}

.pgbfc-tier3-popup__option:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

/*
 * Without its own hover state, the theme's dark default button hover showed
 * through while the title and sub text stayed near-black and grey, so neither
 * was readable (the brief's AA-contrast requirement, Section 2). Uses the
 * plugin's green accent instead of whatever the theme supplies.
 */
.pgbfc-tier3-popup__option:hover:not(:disabled) {
	background: var(--pgbfc-color-green);
	border-color: var(--pgbfc-color-green);
}

.pgbfc-tier3-popup__option:hover:not(:disabled) .pgbfc-tier3-popup__option-title,
.pgbfc-tier3-popup__option:hover:not(:disabled) .pgbfc-tier3-popup__option-sub {
	color: #fff;
}

.pgbfc-tier3-popup__option-title {
	display: block;
	color:#000;
	font-weight: 700;
}

.pgbfc-tier3-popup__option-sub {
	display: block;
	font-size: 0.8125rem;
	color: var(--pgbfc-color-text-muted);
}

.pgbfc-tier3-popup__contact {
	font-size: 0.8125rem;
	color: var(--pgbfc-color-text-muted);
	margin-top: 1rem;
}

.pgbfc-tier3-popup__confirmation {
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	background: var(--pgbfc-color-warning-bg);
	border: 1px solid var(--pgbfc-color-warning);
	border-radius: var(--pgbfc-radius-button);
}

.pgbfc-tier3-popup__error {
	margin-bottom: 1rem;
	padding: 0.75rem 1rem;
	background: var(--pgbfc-color-warning-bg);
	border: 1px solid var(--pgbfc-color-warning);
	border-radius: var(--pgbfc-radius-button);
	font-size: 0.875rem;
}

.pgbfc-tier3-popup__done {
	margin-top: 1rem;
	width: 100%;
}

.pgbfc-tier3-popup__restart {
	margin-top: 0.5rem;
	width: 100%;
	background: transparent;
	border: 1px solid var(--pgbfc-color-border);
}

/*
 * Tier 3 status card (Ship mode's version of the pickup card). It sits in
 * .pgbfc-delivery-section with the toggle and pickup panel, so it gets the
 * same card styling as .pgbfc-pickup-card.
 */

.pgbfc-tier3-status {
	margin-top: 0.75rem;
	margin-bottom: 30px;
	padding: 1rem 1.25rem;
	background: var(--pgbfc-color-warning-bg);
	border: 2px solid var(--pgbfc-color-warning);
	border-radius: var(--pgbfc-radius-card);
	box-sizing: border-box;
}

.pgbfc-tier3-status__message {
	margin: 0;
	color: var(--pgbfc-color-warning-text);
}

.pgbfc-tier3-status__restart {
	margin-top: 0.75rem;
	width: 100%;
	background: #fff;
	border: 1px solid var(--pgbfc-color-border);
}

/* Keyboard focus: AA-contrast visible ring on every interactive control */

.pgbfc-more-locations:focus-visible,
.pgbfc-button:focus-visible,
.pgbfc-modal__close:focus-visible,
.pgbfc-pickup-list__item input:focus-visible,
.pgbfc-tier3-status__restart:focus-visible,
.pgbfc-tier3-popup__option:focus-visible {
	outline: 3px solid var(--pgbfc-color-focus);
	outline-offset: 2px;
}

/* Loading states: every AJAX round trip gets visible feedback */

@keyframes pgbfc-spin {
	to {
		transform: rotate(360deg);
	}
}

.pgbfc-mode-toggle.is-loading .pgbfc-toggle {
	position: relative;
	opacity: 0.7;
}

.pgbfc-mode-toggle.is-loading .pgbfc-toggle::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 0.75rem;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	border: 2px solid var(--pgbfc-color-border);
	border-top-color: var(--pgbfc-color-green-border);
	border-radius: 50%;
	animation: pgbfc-spin 0.6s linear infinite;
}

.pgbfc-toggle__segment {
	position: relative;
}

.pgbfc-pickup-list__loading {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 1rem;
	color: var(--pgbfc-color-text-muted);
	font-size: 0.875rem;
	cursor: default;
}

.pgbfc-pickup-list__loading::before {
	content: "";
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	border: 2px solid var(--pgbfc-color-border);
	border-top-color: var(--pgbfc-color-green-border);
	border-radius: 50%;
	animation: pgbfc-spin 0.6s linear infinite;
}

.pgbfc-button.pgbfc-is-busy {
	position: relative;
	padding-right: 2rem;
	opacity: 0.85;
	cursor: default;
}

.pgbfc-button.pgbfc-is-busy::after {
	content: "";
	position: absolute;
	right: 0.75rem;
	top: 50%;
	width: 12px;
	height: 12px;
	margin-top: -6px;
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: pgbfc-spin 0.6s linear infinite;
}

/* 375px viewport: no horizontal scroll, no overlapping labels */

@media (max-width: 375px) {
	.pgbfc-toggle {
		flex-direction: column;
	}

	.pgbfc-modal,
	.pgbfc-tier3-popup__panel {
		padding: 1rem;
	}

	.pgbfc-pickup-list__item label {
		flex-wrap: wrap;
	}

	.pgbfc-pickup-list__price {
		margin-left: auto;
	}
}

/* Explicit secondary-button colors prevent theme white text on white. */
#pgbfc-tier3-popup-restart,
#pgbfc-tier3-status-restart {
	color: var(--pgbfc-color-text);
	background: #fff;
	border-color: var(--pgbfc-color-green);
}

#pgbfc-tier3-popup-restart:hover:not(:disabled),
#pgbfc-tier3-popup-restart:focus-visible,
#pgbfc-tier3-status-restart:hover:not(:disabled),
#pgbfc-tier3-status-restart:focus-visible {
	color: #fff;
	background: var(--pgbfc-color-green);
	border-color: var(--pgbfc-color-green);
}
/* Classic cart: one summary beside products; checkout styles remain separate. */
.pgbfc-cart-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(340px,390px); gap:28px; align-items:start; clear:both; }
.woocommerce .pgbfc-cart-layout::before,.woocommerce .pgbfc-cart-layout::after { display:none; }
.woocommerce .pgbfc-cart-layout > .woocommerce-notices-wrapper { grid-column:1/-1; }
.woocommerce .pgbfc-cart-layout .woocommerce-cart-form,.woocommerce .pgbfc-cart-layout .cart-collaterals { float:none; width:100%; min-width:0; margin:0; clear:none; }
.woocommerce .pgbfc-cart-layout .cart_totals { float:none; width:100%; padding:20px; border:1px solid var(--pgbfc-color-border); border-radius:8px; box-sizing:border-box; background:#fff; }
.pgbfc-cart-layout .cart_totals > h2:not(.pgbfc-summary-heading) { display:none; }
.pgbfc-cart-delivery { margin-bottom:18px; color:var(--pgbfc-color-text); }
.pgbfc-cart-layout .pgbfc-summary-heading { font-size:1.2rem; margin:0 0 18px; }
.pgbfc-cart-delivery .pgbfc-mode-toggle__heading { font-size:1rem; margin:0 0 10px; }
.pgbfc-cart-delivery .pgbfc-toggle { margin-bottom:16px; }
.pgbfc-cart-fields { display:grid; grid-template-columns:minmax(0,1fr); gap:10px; }
.pgbfc-cart-fields .form-row { float:none!important; width:100%!important; min-width:0; padding:0!important; margin:0 0 10px!important; }
.pgbfc-cart-delivery label { display:block; font-size:.875rem; font-weight:600; }
.pgbfc-cart-delivery input,.pgbfc-cart-delivery select { width:100%; min-width:0; box-sizing:border-box; min-height:44px; }
.pgbfc-cart-fields .select2-container { width:100%!important; min-width:0; }
.pgbfc-cart-destination .button { width:100%; color:var(--pgbfc-color-green)!important; background:#fff!important; border:1px solid var(--pgbfc-color-green)!important; padding:10px; }
.pgbfc-cart-destination .button:hover,.pgbfc-cart-destination .button:focus-visible { background:var(--pgbfc-color-green)!important; color:#fff!important; }
.pgbfc-cart-layout .pgbfc-cart-helper,.pgbfc-cart-rate-note { font-size:.8rem; line-height:1.5; color:#555; margin:8px 0 0; }
.pgbfc-cart-quote,.pgbfc-cart-save-error { padding:12px; background:var(--pgbfc-color-warning-bg); color:#5b4107; font-size:.875rem; }
.pgbfc-cart-layout .pgbfc-total-exclusion { display:block; font-weight:400; font-size:.8rem; color:#5b4107; }
.pgbfc-cart-layout .cart_totals .woocommerce-shipping-calculator { display:none; }
.pgbfc-cart-layout .cart_totals table { width:100%; table-layout:fixed; margin:0; }
.pgbfc-cart-layout .cart_totals table th { width:30%; }
.pgbfc-cart-layout .cart_totals table td { overflow-wrap:anywhere; }
.pgbfc-cart-layout .cart_totals #shipping_method li { display:block!important; }
.pgbfc-cart-layout .cart_totals .wc-proceed-to-checkout { padding-bottom:0; }
.pgbfc-cart-layout .cart_totals .checkout-button { margin-bottom:0; font-size:1rem; }
.pgbfc-cart-layout [hidden] { display:none!important; }
@media(max-width:1024px) {
 .pgbfc-cart-layout { grid-template-columns:minmax(0,1fr); gap:24px; }
 .pgbfc-cart-layout .cart_totals { max-width:none; }
}
@media(max-width:480px) {
 .woocommerce .pgbfc-cart-layout .cart_totals { padding:16px; }
 .pgbfc-cart-delivery input,.pgbfc-cart-delivery select { font-size:16px; }
 .pgbfc-cart-layout .pgbfc-toggle { flex-direction:row; }
}

/* Kadence wraps both columns in its own floated layout container. */
.pgbfc-cart-layout > .kadence-woo-cart-form-wrap { display:contents; }
.pgbfc-cart-layout > .woocommerce-notices-wrapper:empty { display:none; }

.pgbfc-cart-layout > .kadence-woo-cart-form-wrap::before,.pgbfc-cart-layout > .kadence-woo-cart-form-wrap::after { display:none; }

/* Pickup describes collection, not shipment to the customer address. */
.pgbfc-cart-layout:has(input[name=pgbfc_mode][value=pickup]:checked) .woocommerce-shipping-destination { display:none; }

/* Keep pickup changes visibly busy until the new server totals are rendered. */
.pgbfc-cart-layout .cart_totals { position:relative; }
.pgbfc-cart-pickup-loading { position:absolute; inset:0; z-index:10; display:flex; align-items:center; justify-content:center; padding:20px; border-radius:8px; background:rgba(255,255,255,.94); color:var(--pgbfc-color-text); text-align:center; cursor:wait; }
.pgbfc-cart-pickup-loading span::before { content:""; display:block; width:30px; height:30px; margin:0 auto 12px; border:3px solid var(--pgbfc-color-border); border-top-color:var(--pgbfc-color-green); border-radius:50%; animation:pgbfc-spin .7s linear infinite; }
@media(prefers-reduced-motion:reduce) { .pgbfc-cart-pickup-loading span::before { animation:none; } }

/* Match the Cart warehouse dropdown on checkout. */
.pgbfc-checkout-pickup { position:relative; }
.pgbfc-checkout-pickup > label { display:block; margin:0 0 5px; font-weight:500; }
.pgbfc-checkout-pickup > select { display:block; width:100%; min-height:44px; margin:0; font-size:16px; }
.pgbfc-checkout-pickup .pgbfc-pickup-card__address { margin:8px 0 0; font-size:.85rem; line-height:1.5; }
.pgbfc-checkout-pickup .pgbfc-pickup-card__meta { margin:4px 0 0; font-size:.8rem; line-height:1.5; }
.pgbfc-checkout-pickup-loading { position:absolute; inset:0; z-index:10; display:flex; align-items:center; justify-content:center; padding:16px; border-radius:8px; background:rgba(255,255,255,.94); text-align:center; cursor:wait; }
.pgbfc-checkout-pickup-loading span::before { content:""; display:block; width:26px; height:26px; margin:0 auto 8px; border:3px solid var(--pgbfc-color-border); border-top-color:var(--pgbfc-color-green); border-radius:50%; animation:pgbfc-spin .7s linear infinite; }
@media(prefers-reduced-motion:reduce) { .pgbfc-checkout-pickup-loading span::before { animation:none; } }

.pgbfc-checkout-pickup[hidden], .pgbfc-checkout-pickup [hidden] { display:none!important; }

/* October 26 brief: readable full labels, hover/tap/keyboard descriptions. */
.pgbfc-toggle { flex-wrap: wrap; }
.pgbfc-toggle__segment { min-width: 0; white-space: normal; }
.pgbfc-pickup-addresses { margin: 1rem 0; padding-left: 1.2rem; }
.pgbfc-pickup-addresses li { margin-bottom: .75rem; }
.pgbfc-pickup-postcode input { max-width: 12rem; margin: .4rem; }
.pgbfc-pallet-message { margin: 1rem 0; }
/* Contain WooCommerce's notice clearfix beside the theme's floated checkout columns. */
.woocommerce-checkout .woocommerce-form-coupon-toggle { display: flow-root; }

/* Classic checkout: stable columns instead of consecutive theme floats. */
.woocommerce form.checkout:has(.pgbfc-delivery-section) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 40px;
    row-gap: 20px;
    align-items: start;
}
.woocommerce form.checkout:has(.pgbfc-delivery-section)::before,
.woocommerce form.checkout:has(.pgbfc-delivery-section)::after { display: none; }
.woocommerce form.checkout:has(.pgbfc-delivery-section) > #customer_details {
    grid-column: 1; grid-row: 1 / span 3;
    float: none; width: 100%; padding: 0; margin: 0; min-width: 0;
}
.woocommerce form.checkout:has(.pgbfc-delivery-section) #customer_details > .col-1,
.woocommerce form.checkout:has(.pgbfc-delivery-section) #customer_details > .col-2 {
    float: none; width: 100%; padding: 0; margin: 0 0 24px;
}
.woocommerce form.checkout > .pgbfc-delivery-section {
    grid-column: 2; grid-row: 1;
    float: none; width: 100%; padding: 22px; margin: 0;
    border: 1px solid var(--pgbfc-color-border); border-radius: 8px; background: #fff;
}
.woocommerce form.checkout:has(.pgbfc-delivery-section) > #order_review_heading {
    grid-column: 2; grid-row: 2;
    float: none; width: 100%; padding: 0; margin: 4px 0 0; clear: none;
}
.woocommerce form.checkout:has(.pgbfc-delivery-section) > #order_review {
    grid-column: 2; grid-row: 3;
    float: none; width: 100%; padding: 0; margin: 0; min-width: 0; clear: none;
}
.woocommerce form.checkout:has(.pgbfc-delivery-section) > .woocommerce-NoticeGroup { grid-column: 1 / -1; }
.pgbfc-delivery-section .pgbfc-mode-toggle__heading { margin: 0 0 14px; font-size: 20px; }
.pgbfc-delivery-section .pgbfc-toggle__segment { padding: 12px 8px; font-size: 14px; line-height: 1.4; text-align: center; }
.pgbfc-pickup-postcode { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin: 20px 0; }
.pgbfc-pickup-postcode > label { grid-column: 1 / -1; margin: 0; font-size: 14px; font-weight: 600; }
.pgbfc-pickup-postcode > input { width: 100%; max-width: none; min-width: 0; margin: 0; padding: 10px 12px; min-height: 44px; }
.pgbfc-pickup-postcode > .button { margin: 0; padding: 10px 14px; font-size: 13px; line-height: 1.4; border-radius: 4px; }
.pgbfc-pickup-postcode > p { grid-column: 1 / -1; margin: 0; font-size: 12px; line-height: 1.5; color: #5b655b; }
.pgbfc-pickup-addresses { list-style: none; margin: 14px 0 0; padding: 0; }
.pgbfc-pickup-addresses li { margin: 0; padding: 14px 0; border-bottom: 1px solid #e6eae6; font-size: 13px; line-height: 1.6; }
.pgbfc-pickup-addresses li:last-child { border-bottom: 0; padding-bottom: 0; }
.pgbfc-pickup-addresses strong { font-size: 13px; font-weight: 600; }
.pgbfc-pickup-addresses small { color: #647064; font-size: 12px; }
.pgbfc-delivery-section #pgbfc-pickup-selector { margin-bottom: 0; }
.pgbfc-pallet-message { font-size: 13px; line-height: 1.65; color: #566156; }
.pgbfc-delivery-section .pgbfc-pallet-message { padding-top: 16px; border-top: 1px solid #e6eae6; margin: 20px 0 0; }
@media (max-width: 900px) {
    .woocommerce form.checkout:has(.pgbfc-delivery-section) { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .woocommerce form.checkout:has(.pgbfc-delivery-section) > #customer_details,
    .woocommerce form.checkout > .pgbfc-delivery-section,
    .woocommerce form.checkout:has(.pgbfc-delivery-section) > #order_review_heading,
    .woocommerce form.checkout:has(.pgbfc-delivery-section) > #order_review { grid-column: 1; grid-row: auto; }
}
@media (max-width: 480px) {
    .woocommerce form.checkout > .pgbfc-delivery-section { padding: 16px; }
    .pgbfc-pickup-postcode { grid-template-columns: minmax(0, 1fr); }
    .pgbfc-pickup-postcode > input { font-size: 16px; }
}

/* Each information control belongs to its delivery option. */
.pgbfc-toggle__segment { position: relative; gap: 8px; }
.pgbfc-toggle__segment .pgbfc-toggle__choice { display: flex; align-items: center; justify-content: center; flex: 1; gap: 6px; margin: 0; cursor: pointer; min-width: 0; font: inherit; line-height: 1.4; }
.pgbfc-toggle .pgbfc-option-help { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 28px; width: 28px; height: 28px; min-height: 28px; padding: 0; margin: 0; border: 1px solid #687568; border-radius: 50%; background: transparent; color: #344834; font: 600 13px Georgia, serif; text-transform: none; box-shadow: none; cursor: pointer; }
.pgbfc-toggle .pgbfc-option-help:hover { background: #e5eee5; color: #203d20; }
.pgbfc-toggle .pgbfc-option-help:focus-visible { outline: 3px solid var(--pgbfc-color-focus); outline-offset: 2px; }
.pgbfc-option-tooltip { position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; display: block; width: 270px; max-width: min(76vw, 340px); padding: 12px 14px; border: 1px solid #cdd7cd; border-radius: 6px; background: #fff; color: #263326; box-shadow: 0 4px 16px #00000015; text-align: left; font-size: 13px; font-weight: 400; line-height: 1.55; cursor: default; }
.pgbfc-toggle__segment:last-child .pgbfc-option-tooltip { left: auto; right: 0; }
.pgbfc-option-tooltip[hidden] { display: none !important; }

/* 0.15.5: Ship postal code and freight price inside the Delivery box. */
.pgbfc-ship-quote[hidden] { display: none !important; }
.pgbfc-ship-quote__result:empty { display: none; }
.pgbfc-ship-quote__result { margin: 0 0 4px; padding: 14px 16px; border: 1px solid #cfe0cf; border-radius: 6px; background: #f4f9f4; }
.pgbfc-ship-quote__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin: 0; font-size: 15px; line-height: 1.4; }
.pgbfc-ship-quote__label { flex: 1 1 auto; font-weight: 600; color: #263326; }
.pgbfc-ship-quote__price strong { font-size: 20px; color: #1f5f1f; }
.pgbfc-ship-quote__price small { font-size: 12px; color: #5b655b; }
.pgbfc-ship-quote__note, .pgbfc-ship-quote__message { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: #5b655b; }
.pgbfc-ship-quote__message:first-child { margin-top: 0; font-size: 13px; color: #263326; }

/* 0.15.5: on phones and tablets (one column) Delivery comes before Billing. Desktop layout unchanged. */
@media (max-width: 900px) {
    .woocommerce form.checkout:has(.pgbfc-delivery-section) > .woocommerce-NoticeGroup { order: -2; }
    .woocommerce form.checkout > .pgbfc-delivery-section { order: -1; }
}

/* 0.15.6: one Delivery section. Pallet and tailgate are itemized under the Shipment row, so their own rows are hidden. */
.woocommerce table.shop_table tr.fee:has(.pgbfc-grouped-fee) { display: none; }
.pgbfc-delivery-summary { display: block; }
.pgbfc-delivery-summary__total { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-weight: 600; }
.pgbfc-delivery-summary__lines { display: block; margin: 8px 0 4px; padding: 8px 0 0; border-top: 1px solid #e6eae6; }
.pgbfc-delivery-summary__line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 400; line-height: 1.7; color: #4b564b; }
.pgbfc-delivery-summary__line > span:last-child { white-space: nowrap; }
.pgbfc-ship-quote__result .pgbfc-delivery-summary__lines { margin-top: 10px; }

/* 0.15.8: pickup nudge on regional Ship prices, and the one-line notice. */
.pgbfc-pickup-nudge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0 4px; padding: 10px 12px; border: 1px solid #3fae49; border-radius: 6px; background: #f0f8f0; }
.pgbfc-pickup-nudge__text { flex: 1 1 200px; font-size: 13px; line-height: 1.45; color: #263326; }
.pgbfc-pickup-nudge__text strong { display: block; font-size: 14px; color: #1f5f1f; }
.woocommerce .pgbfc-pickup-nudge__button.button { flex: 0 0 auto; margin: 0; padding: 8px 14px; font-size: 13px; line-height: 1.2; white-space: nowrap; }
.pgbfc-cart-rate-note { display: block; margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: #555; }

/* 0.16.0: delivery and parcel choices in the Delivery box. */
.pgbfc-ship-options { margin: 10px 0 0; padding: 0; border: 0; }
.pgbfc-ship-options legend { font-size: 13px; font-weight: 600; margin: 0 0 6px; padding: 0; }
.pgbfc-ship-option { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: 0 0 6px; border: 1px solid #d5ddd5; border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1.3; background: #fff; }
.pgbfc-ship-option:has(input:checked) { border-color: #3fae3f; background: #f3fbf3; }
.pgbfc-ship-option__input { margin: 0; flex: 0 0 auto; }
.pgbfc-ship-option__label { flex: 1 1 auto; }
.pgbfc-ship-option__price { flex: 0 0 auto; color: #1f5f1f; }
@media (max-width: 480px) { .pgbfc-ship-option { padding: 12px 10px; font-size: 15px; } }

/* 0.16.7: How it ships */
.pgbfc-how-ships { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: #3c463c; }
.pgbfc-how-ships ul { margin: 4px 0 0 18px; padding: 0; }
.pgbfc-how-ships li { margin: 0 0 2px; }
