/**
 * CheckoutGuard — Frontend Checkout Styles
 *
 * Design language (matches admin/css/admin.css, dev19 redesign):
 * indigo primary (#6366f1 family), white cards with 12px radius and a
 * soft shadow, generous spacing, pill buttons, green/red/amber/blue
 * status colours.
 *
 * THEME-SAFE: every selector is scoped under a CheckoutGuard class.
 * No :root globals, no bare element selectors, no styling of core
 * WooCommerce elements outside our own containers. Design tokens are
 * custom properties defined on the five CheckoutGuard scopes below —
 * they inherit down to every descendant of those scopes and leak
 * nowhere else.
 *
 * TABLE OF CONTENTS
 * -----------------
 * 1. Design tokens (scoped)
 * 2. Shared: buttons, inputs, checkboxes, focus, notes, inline warnings
 * 3. COD notices (classic + Blocks share the .cgw-cod-notice base)
 * 4. Reservation countdown chip (shared base + urgency states)
 * 5. Gifting panel (classic cart/checkout)
 * 6. Blocks surfaces (gifting, reservation, COD notices)
 * 7. Media queries (shared + classic; Blocks carries its own)
 */

/* 1. Design tokens (scoped — never :root) */
.cgw-gifting-panel,
.cgw-gifting-blocks,
.cgw-reservation-blocks,
.cgw-cod-notice,
.cgw-reservation-timer {
	--cgw-indigo: #6366f1;
	--cgw-indigo-dark: #4f46e5;
	--cgw-indigo-bg: #eef2ff;
	--cgw-radius: 12px;
	--cgw-radius-sm: 8px;
	--cgw-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	--cgw-border: #e5e7eb;
	--cgw-text: #1f2937;
	--cgw-muted: #6b7280;
	--cgw-green: #16a34a;
	--cgw-green-bg: #f0fdf4;
	--cgw-red: #dc2626;
	--cgw-red-bg: #fef2f2;
	--cgw-amber: #d97706;
	--cgw-amber-bg: #fffbeb;
	--cgw-blue: #1d4ed8;
	--cgw-blue-bg: #eff6ff;
}

/* 2. Shared: buttons, inputs, checkboxes, focus, notes, inline warnings */

/* Pill buttons. The doubled .cgw-btn class (specificity 0,3,0) beats
 * WooCommerce core's `.woocommerce button.button` (0,2,1) and theme
 * button rules without !important. The `button` class is kept in the
 * markup so themes still apply their font inheritance. */
.cgw-gifting-panel .cgw-btn.cgw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 20px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	text-align: center;
	text-decoration: none;
	white-space: normal;
	color: var(--cgw-text);
	background: #fff;
	border: 1px solid var(--cgw-border);
	border-radius: 999px;
	box-shadow: var(--cgw-shadow);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cgw-gifting-panel .cgw-btn.cgw-btn:hover {
	border-color: #c7d2fe;
	color: var(--cgw-indigo-dark);
}

.cgw-gifting-panel .cgw-btn--primary.cgw-btn--primary {
	/* #4f46e5, not #6366f1: white on #6366f1 is only ~3.9:1,
	 * below the 4.5:1 floor; #4f46e5 is ~5.3:1. */
	color: #fff;
	background: var(--cgw-indigo-dark);
	border-color: var(--cgw-indigo-dark);
}

/* .cgw-btn--secondary is the base .cgw-btn look (white, bordered) —
 * the class exists in the markup as a semantic hook only. */

.cgw-gifting-panel .cgw-btn--primary.cgw-btn--primary:hover {
	background: #4338ca;
	border-color: #4338ca;
	color: #fff;
}

.cgw-gifting-panel .cgw-btn--danger.cgw-btn--danger {
	color: var(--cgw-red);
	border-color: #fecaca;
}

.cgw-gifting-panel .cgw-btn--danger.cgw-btn--danger:hover {
	background: var(--cgw-red-bg);
	border-color: var(--cgw-red);
	color: var(--cgw-red);
}

.cgw-gifting-panel .cgw-btn--small.cgw-btn--small {
	padding: 7px 14px;
	font-size: 13px;
}

.cgw-gifting-panel .cgw-btn.cgw-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* Form controls inside the classic panel. Scoped through
 * .cgw-copy-card / .cgw-addr-grid so the selectors (0,3,1) beat
 * WooCommerce core's `.woocommerce form .form-row textarea` (0,2,2)
 * and theme input rules without !important. */
.cgw-gifting-panel .cgw-copy-card input[type="text"],
.cgw-gifting-panel .cgw-copy-card input[type="number"],
.cgw-gifting-panel .cgw-copy-card input[type="email"],
.cgw-gifting-panel .cgw-copy-card input[type="tel"],
.cgw-gifting-panel .cgw-copy-card select,
.cgw-gifting-panel .cgw-copy-card textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 9px 12px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--cgw-text);
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: var(--cgw-radius-sm);
}

.cgw-gifting-panel .cgw-copy-card textarea {
	min-height: 64px;
	resize: vertical;
}

/* Checkboxes stay native-sized; accent-color tints them indigo in
 * supporting browsers and is ignored elsewhere. */
.cgw-gifting-panel .cgw-copy-card input[type="checkbox"] {
	width: auto;
	accent-color: var(--cgw-indigo);
}

/* Visible focus on every interactive element in the panel. */
.cgw-gifting-panel input:focus-visible,
.cgw-gifting-panel select:focus-visible,
.cgw-gifting-panel textarea:focus-visible,
.cgw-gifting-panel button:focus-visible {
	outline: 2px solid var(--cgw-indigo);
	outline-offset: 2px;
}

.cgw-gifting-panel .cgw-copy-card input[type="text"]:focus,
.cgw-gifting-panel .cgw-copy-card input[type="number"]:focus,
.cgw-gifting-panel .cgw-copy-card input[type="email"]:focus,
.cgw-gifting-panel .cgw-copy-card input[type="tel"]:focus,
.cgw-gifting-panel .cgw-copy-card select:focus,
.cgw-gifting-panel .cgw-copy-card textarea:focus {
	border-color: var(--cgw-indigo);
	box-shadow: 0 0 0 3px var(--cgw-indigo-bg);
}

/* Muted helper text (panel descriptions). */
.cgw-gifting-panel .cgw-panel__note {
	font-size: 13px;
	line-height: 1.5;
	color: var(--cgw-muted);
}

/* Inline warnings created by gifting.js (data-cgw-error,
 * data-cgw-no-items-warn, data-cgw-addr-warn). The JS sets inline
 * color (#b32d2e) and font-size only, so background/border/padding
 * from here still apply; #b32d2e on #fef2f2 keeps >= 4.5:1 contrast. */
.cgw-gifting-panel [data-cgw-error],
.cgw-gifting-panel [data-cgw-no-items-warn],
.cgw-gifting-panel [data-cgw-addr-warn] {
	margin: 12px 0;
	padding: 10px 12px;
	background: var(--cgw-red-bg);
	border: 1px solid #fecaca;
	border-left: 3px solid var(--cgw-red);
	border-radius: var(--cgw-radius-sm);
}

/* 3. COD notices — classic + Blocks share the .cgw-cod-notice base.
 * Classic renders inside .cgw-cod-notice-wrap (fragment key); Blocks
 * renders the div directly. Variants are keyed on the action class
 * the PHP/JS already emits: cgw-cod-blocked (amber warning),
 * cgw-checkout-blocked (red error), cgw-partial-cod (blue info). */

/* Empty wrapper renders nothing (no margin) until a rule matches. */
.cgw-cod-notice-wrap:empty {
	display: none;
}

.cgw-cod-notice-wrap {
	margin: 12px 0;
}

.cgw-cod-notice {
	padding: 14px 16px;
	margin: 12px 0;
	font-size: 14px;
	line-height: 1.5;
	color: #92400e;
	background: var(--cgw-amber-bg);
	border: 1px solid #fcd34d;
	border-left: 3px solid var(--cgw-amber);
	border-radius: var(--cgw-radius);
	box-shadow: var(--cgw-shadow);
}

/* Classic inner divs also carry WooCommerce's .woocommerce-info /
 * .woocommerce-error classes: neutralise WC's top border, icon
 * glyph and wide left padding (our 0,3,0 selectors beat WC's 0,1,0). */
.cgw-cod-notice-wrap .cgw-cod-notice::before {
	content: none;
}

.cgw-cod-notice.cgw-checkout-blocked {
	color: #991b1b;
	background: var(--cgw-red-bg);
	border-color: #fecaca;
	border-left-color: var(--cgw-red);
}

.cgw-cod-notice.cgw-partial-cod {
	color: #1e40af;
	background: var(--cgw-blue-bg);
	border-color: #bfdbfe;
	border-left-color: var(--cgw-blue);
}

/* 4. Reservation countdown chip — shared base + urgency states.
 * Markup contract (module-reservation.php + reservation-blocks.js):
 * .cgw-reservation-timer > .cgw-timer-label + .cgw-timer-value, with
 * [data-cgw-expires-at]. reservation-timer.js adds .cgw-timer-
 * caution at <= 600s remaining and .cgw-timer-warning at <= 120s
 * and at expiry; both classes are present below 120s, so the
 * warning rule comes after caution and wins. */
.cgw-reservation-timer {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 2px 0 2px 8px;
	padding: 6px 12px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	white-space: nowrap;
	color: #4338ca;
	background: var(--cgw-indigo-bg);
	border: 1px solid #c7d2fe;
	border-radius: 999px;
}

/* Inside the Blocks reservation list the chip is a flex item, so the
 * inline left margin (needed after the classic item name) is reset. */
.cgw-reservation-blocks .cgw-reservation-timer {
	margin-left: 0;
}

.cgw-reservation-timer .cgw-timer-label {
	font-weight: 500;
}

.cgw-reservation-timer .cgw-timer-value {
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.cgw-reservation-timer.cgw-timer-caution {
	color: #92400e;
	background: #fef3c7;
	border-color: #fde68a;
}

.cgw-reservation-timer.cgw-timer-warning {
	color: #991b1b;
	background: var(--cgw-red-bg);
	border-color: #fecaca;
}

/* 5. Gifting panel (classic cart/checkout) */

.cgw-gifting-panel {
	margin: 1.5em 0;
	padding: 20px 24px;
	font-size: 14px;
	line-height: 1.6;
	color: var(--cgw-text);
	background: #fff;
	border: 1px solid var(--cgw-border);
	border-radius: var(--cgw-radius);
	box-shadow: var(--cgw-shadow);
}

.cgw-gifting-panel .cgw-panel__title {
	margin: 0 0 12px;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	color: #111827;
}

.cgw-gifting-panel .cgw-panel__intro {
	margin: 0 0 16px;
}

.cgw-gifting-panel .cgw-panel__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 16px 0;
}

.cgw-gifting-panel .cgw-panel__note {
	margin: 12px 0 0;
}

/* Per-copy cards. The main copy (ships to the order address) gets an
 * indigo top accent so it reads as the primary destination. */
.cgw-gifting-panel .cgw-copy-card {
	padding: 20px 24px;
	margin: 16px 0;
	background: #fff;
	border: 1px solid var(--cgw-border);
	border-radius: var(--cgw-radius);
	box-shadow: var(--cgw-shadow);
}

.cgw-gifting-panel .cgw-copy-card--main {
	border-top: 3px solid var(--cgw-indigo);
}

.cgw-gifting-panel .cgw-copy-card__title {
	margin: 0 0 16px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: #111827;
}

/* Field rows. The .cgw-copy-card middle scope (0,3,0) beats
 * WooCommerce core's `.woocommerce form .form-row` (0,2,1). Labels
 * wrap their control in the markup, so the control is block-level
 * and full-width and drops onto its own line under the label text. */
.cgw-gifting-panel .cgw-copy-card .form-row {
	margin: 0 0 14px;
	padding: 0;
}

.cgw-gifting-panel .cgw-copy-card .form-row > label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	color: var(--cgw-text);
}

.cgw-gifting-panel .cgw-copy-card .form-row > label > input[type="text"],
.cgw-gifting-panel .cgw-copy-card .form-row > label > input[type="email"],
.cgw-gifting-panel .cgw-copy-card .form-row > label > input[type="tel"],
.cgw-gifting-panel .cgw-copy-card .form-row > label > select,
.cgw-gifting-panel .cgw-copy-card .form-row > label > textarea,
.cgw-gifting-panel .cgw-copy-card .form-row > label > span[data-cgw-state-wrap] {
	display: block;
	margin-top: 6px;
}

.cgw-gifting-panel .cgw-copy-card .cgw-panel__note {
	margin: 0 0 14px;
}

.cgw-gifting-panel .cgw-copy-card__actions {
	margin: 16px 0 0;
}

/* Address grid: 2 columns on desktop, 1 on phones. Company and
 * street lines span the full width (.cgw-field--wide). */
.cgw-gifting-panel .cgw-addr-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px 16px;
	margin: 0 0 14px;
}

.cgw-gifting-panel .cgw-addr-grid .form-row {
	margin: 0;
}

.cgw-gifting-panel .cgw-addr-grid .cgw-field--wide {
	grid-column: 1 / -1;
}

/* Gift options: checkbox labels in a wrapping row. The label rule
 * below (0,4,1) overrides the block-level field-label rule (0,3,1)
 * so the option labels stay inline-flex and normal weight. */
.cgw-gifting-panel .cgw-gift-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
}

.cgw-gifting-panel .cgw-copy-card .cgw-gift-options > label {
	display: inline-flex;
	font-weight: 400;
}

.cgw-gifting-panel .cgw-gift-option {
	display: inline-flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
	cursor: pointer;
}

.cgw-gifting-panel .cgw-gift-option input[type="checkbox"] {
	flex: 0 0 auto;
	margin-top: 3px;
}

/* Assignment table: the wrapper scrolls horizontally on narrow
 * screens so the table never overflows the page. */
.cgw-gifting-panel .cgw-assign__title {
	margin: 20px 0 12px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: #111827;
}

.cgw-gifting-panel .cgw-assign-wrap {
	margin: 0 0 12px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--cgw-border);
	border-radius: var(--cgw-radius-sm);
}

.cgw-gifting-panel table.cgw-assign {
	width: 100%;
	min-width: 480px;
	margin: 0;
	border-collapse: collapse;
}

.cgw-gifting-panel table.cgw-assign th,
.cgw-gifting-panel table.cgw-assign td {
	padding: 10px 12px;
	text-align: left;
	vertical-align: middle;
	border-top: 1px solid #f3f4f6;
}

.cgw-gifting-panel table.cgw-assign thead th {
	font-size: 13px;
	font-weight: 600;
	background: #f9fafb;
	border-top: none;
}

.cgw-gifting-panel table.cgw-assign tbody tr:first-child td {
	border-top: none;
}

.cgw-gifting-panel table.cgw-assign td:first-child {
	min-width: 140px;
}

.cgw-gifting-panel table.cgw-assign input[type="number"] {
	width: 4.5em;
	padding: 6px 8px;
}

/* 6. Blocks surfaces (gifting, reservation, COD notices)
 *
 * Styles ONLY the WooCommerce Blocks surfaces. Shared tokens (§1),
 * the COD notice base + variants (§3), the chip base + urgency
 * states (§4) and shared mobile rules (§7) live in this file and
 * are NOT duplicated here. Literal token values were swapped for
 * the var(--cgw-*) tokens at merge; supporting tints (#c7d2fe,
 * #f9fafb, #f3f4f6, #d1d5db, #fecaca, #fde68a, #bfdbfe, #4338ca,
 * #991b1b, #92400e) are the same Tailwind scale admin.css uses.
 *
 * Buttons use the shared .cgw-btn system (§2): the classic panel
 * and Blocks carry the same hook names, scoped apart by their
 * containers. Primary buttons use #4f46e5 (~5.3:1 white-text
 * contrast); white on #6366f1 is only ~3.9:1, so it is never a
 * button background. Status text uses the -800 shades on -50/-100
 * backgrounds (all ≥5.9:1); #6b7280 muted text on white is ~4.8:1.
 *
 * No !important anywhere: the conflicting inline styles in the
 * React markup (copy-card box style, field margin-bottom, button
 * margin-right) were removed from gifting-blocks.js at merge and
 * replaced by the rules below — visual only, no behaviour change.
 */

/* ------------------------------------------------------------------
 * 0. Scoped box-sizing — every descendant of our two containers is
 * our own markup, so this cannot leak onto theme/core elements. It
 * guarantees width:100% inputs + padding never overflow.
 * ------------------------------------------------------------------ */
.cgw-gifting-blocks,
.cgw-gifting-blocks *,
.cgw-reservation-blocks,
.cgw-reservation-blocks * {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------
 * 1. Gifting panel (Blocks cart + checkout)
 * ------------------------------------------------------------------ */
.cgw-gifting-blocks {
	margin: 1em 0;
	padding: 20px 24px;
	background: #fff;
	border: 1px solid var(--cgw-border);
	border-radius: var(--cgw-radius);
	box-shadow: var(--cgw-shadow);
	color: var(--cgw-text);
}

.cgw-gifting-blocks .cgw-gifting-title {
	margin-top: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--cgw-text);
}

.cgw-gifting-blocks .cgw-gifting-desc {
	margin: 8px 0 16px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--cgw-muted);
}

/* ------------------------------------------------------------------
 * 2. Gift buttons — pill buttons, the shared .cgw-btn system (§2).
 * The button.cgw-btn qualifier (0,2,1) beats WooCommerce core's
 * .wc-block-components-button rules regardless of enqueue order.
 * ------------------------------------------------------------------ */
.cgw-gifting-blocks button.cgw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 9px 18px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	border: 1px solid transparent;
	border-radius: 999px;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cgw-gifting-blocks button.cgw-btn--primary {
	background: var(--cgw-indigo-dark);
	color: #fff;
}

.cgw-gifting-blocks button.cgw-btn--primary:hover {
	background: #4338ca;
}

.cgw-gifting-blocks button.cgw-btn--secondary {
	background: #fff;
	color: #374151;
	border-color: #d1d5db;
}

.cgw-gifting-blocks button.cgw-btn--secondary:hover {
	color: var(--cgw-indigo-dark);
	border-color: var(--cgw-indigo);
}

.cgw-gifting-blocks button.cgw-btn--danger {
	background: #fff;
	color: var(--cgw-red);
	border-color: #fecaca;
}

.cgw-gifting-blocks button.cgw-btn--danger:hover {
	background: var(--cgw-red-bg);
	border-color: #fca5a5;
}

.cgw-gifting-blocks button.cgw-btn:focus-visible {
	outline: 2px solid var(--cgw-indigo);
	outline-offset: 2px;
}

.cgw-gifting-blocks button.cgw-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* The two action buttons are adjacent siblings; the second gets
 * its gap from the left (the inline margin-right on the first
 * button was removed from the React markup at merge). */
.cgw-gifting-blocks button.cgw-btn + button.cgw-btn {
	margin-left: 8px;
}

/* ------------------------------------------------------------------
 * 3. Copy cards + address fields
 * The card is a wrapping flex row so paired fields (first/last
 * name, town/state, postcode/country) sit two-up on desktop.
 * Class names match the classic panel's (.cgw-copy-card,
 * .cgw-copy-card--main, .cgw-copy-card__title) — scopes differ,
 * so the rules never collide.
 * ------------------------------------------------------------------ */
.cgw-gifting-blocks .cgw-copy-card {
	display: flex;
	flex-wrap: wrap;
	column-gap: 12px;
	/* The card's old inline box style (1px #ddd, 4px radius,
	 * 12px padding, #fafafa background) was removed from the
	 * React markup at merge; margin stays inline (12px 0). */
	border: 1px solid var(--cgw-border);
	border-radius: var(--cgw-radius);
	padding: 16px;
	background: #fff;
	box-shadow: var(--cgw-shadow);
}

.cgw-gifting-blocks .cgw-copy-card--main {
	/* Top accent matches the classic panel's main-copy treatment. */
	border-top: 3px solid var(--cgw-indigo);
}

.cgw-gifting-blocks .cgw-copy-card__title {
	flex: 1 1 100%;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--cgw-text);
}

.cgw-gifting-blocks .cgw-copy-card .cgw-main-note {
	flex: 1 1 100%;
	margin: 0 0 12px;
	padding: 8px 12px;
	background: var(--cgw-indigo-bg);
	border-radius: var(--cgw-radius-sm);
	line-height: 1.5;
	/* Colour/size stay inline (#555, 0.9em) — ~7:1 on #eef2ff. */
}

.cgw-gifting-blocks .cgw-copy-card .cgw-field {
	flex: 1 1 100%;
	min-width: 0;
	margin-bottom: 12px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--cgw-text);
}

.cgw-gifting-blocks .cgw-copy-card .cgw-field--half {
	flex: 1 1 calc(50% - 6px);
}

.cgw-gifting-blocks .cgw-field input[type="text"],
.cgw-gifting-blocks .cgw-field select,
.cgw-gifting-blocks .cgw-field textarea {
	display: block;
	width: 100%;
	padding: 9px 12px;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	color: var(--cgw-text);
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: var(--cgw-radius-sm);
}

.cgw-gifting-blocks .cgw-field textarea {
	min-height: 80px;
	resize: vertical;
}

.cgw-gifting-blocks .cgw-field input[type="text"]:focus,
.cgw-gifting-blocks .cgw-field select:focus,
.cgw-gifting-blocks .cgw-field textarea:focus {
	border-color: var(--cgw-indigo);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
	outline: none;
}

.cgw-gifting-blocks .cgw-copy-card .cgw-btn--danger {
	flex: 0 0 auto;
	margin-left: auto;
}

/* ------------------------------------------------------------------
 * 4. Gift options (gift-wrap / hide-prices checkboxes)
 * The label keeps its inline display:block, so alignment is done
 * with the checkbox's own box rather than flex.
 * ------------------------------------------------------------------ */
.cgw-gifting-blocks .cgw-copy-card .cgw-gift-option {
	flex: 1 1 100%;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	color: #374151;
	cursor: pointer;
}

.cgw-gifting-blocks .cgw-gift-option input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin-right: 6px;
	vertical-align: -2px;
	accent-color: var(--cgw-indigo);
}

.cgw-gifting-blocks .cgw-gift-option input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--cgw-indigo);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------
 * 5. Assignment table ("Which items go where?")
 * The wrapper scrolls horizontally on narrow screens instead of
 * letting the table overflow the page. Values match the classic
 * table (§5) except the border, which sits on the table here:
 * the Blocks title renders INSIDE the wrapper, so a bordered
 * wrapper would box the title in too.
 * ------------------------------------------------------------------ */
.cgw-gifting-blocks .cgw-assign-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 4px 0 12px;
}

.cgw-gifting-blocks .cgw-assign__title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--cgw-text);
}

.cgw-gifting-blocks .cgw-assign-wrap table.cgw-assign {
	width: 100%;
	min-width: 480px;
	margin: 0;
	border: 1px solid var(--cgw-border);
	border-collapse: collapse;
}

.cgw-gifting-blocks .cgw-assign-wrap table.cgw-assign th,
.cgw-gifting-blocks .cgw-assign-wrap table.cgw-assign td {
	padding: 10px 12px;
	font-size: 14px;
	color: var(--cgw-text);
	text-align: left;
	vertical-align: middle;
	border: none;
	border-top: 1px solid #f3f4f6;
}

.cgw-gifting-blocks .cgw-assign-wrap table.cgw-assign thead th {
	font-size: 13px;
	font-weight: 600;
	color: #374151;
	white-space: nowrap;
	background: #f9fafb;
	border-top: none;
	border-bottom: 1px solid var(--cgw-border);
}

.cgw-gifting-blocks .cgw-assign-wrap table.cgw-assign tbody tr:first-child td {
	border-top: none;
}

.cgw-gifting-blocks .cgw-assign-wrap table.cgw-assign td:first-child {
	min-width: 140px;
}

.cgw-gifting-blocks .cgw-assign-wrap table.cgw-assign input[type="number"] {
	padding: 6px 8px;
	font-size: 14px;
	color: var(--cgw-text);
	text-align: center;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-variant-numeric: tabular-nums;
	/* Width stays inline (4.5em). */
}

.cgw-gifting-blocks .cgw-assign-wrap table.cgw-assign input[type="number"]:focus {
	border-color: var(--cgw-indigo);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
	outline: none;
}

/* ------------------------------------------------------------------
 * 6. Validation alerts + shipping/tax note
 * Colour/size stay inline (#b32d2e, 0.9em — ~5.9:1 on #fef2f2);
 * the alert box is added around them. No !important needed.
 * ------------------------------------------------------------------ */
.cgw-gifting-blocks .cgw-action-error,
.cgw-gifting-blocks .cgw-addr-warning,
.cgw-gifting-blocks .cgw-no-items-warning {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	margin: 12px 0;
	padding: 10px 12px;
	line-height: 1.5;
	background: var(--cgw-red-bg);
	border: 1px solid #fecaca;
	border-radius: var(--cgw-radius-sm);
}

.cgw-gifting-blocks .cgw-action-error::before,
.cgw-gifting-blocks .cgw-addr-warning::before,
.cgw-gifting-blocks .cgw-no-items-warning::before {
	content: "!";
	display: inline-flex;
	flex: 0 0 20px;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin-top: 1px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	color: #fff;
	background: var(--cgw-red);
	border-radius: 50%;
}

.cgw-gifting-blocks .cgw-gifting-note {
	margin: 16px 0 0;
	padding-top: 12px;
	line-height: 1.5;
	border-top: 1px solid #f3f4f6;
	/* Colour/size stay inline (#555, 0.9em). */
}

/* ------------------------------------------------------------------
 * 7. Reservation panel + countdown chip
 *
 * Shared §4 already carries the chip base (layout, indigo),
 * .cgw-timer-label/.cgw-timer-value, and the amber .cgw-timer-
 * caution + red .cgw-timer-warning states — all unscoped, so
 * they apply to Blocks chips too. This section adds ONLY:
 *   (a) the panel container / rows (Blocks-only markup),
 *   (b) Blocks-scoped caution/warning rules at (0,3,0), so the
 *       urgency states beat the panel rules when both classes
 *       are present (warning last, so red beats amber),
 *   (c) the compact mini-cart chip.
 * ------------------------------------------------------------------ */
.cgw-reservation-blocks {
	margin: 1em 0;
	padding: 20px 24px;
	background: #fff;
	border: 1px solid var(--cgw-border);
	border-radius: var(--cgw-radius);
	box-shadow: var(--cgw-shadow);
	color: var(--cgw-text);
}

.cgw-reservation-blocks .cgw-reservation-blocks__title {
	margin: 0 0 4px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--cgw-text);
}

.cgw-reservation-blocks .cgw-reservation-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 0;
	border-top: 1px solid #f3f4f6;
}

.cgw-reservation-blocks .cgw-reservation-row:first-of-type {
	border-top: 0;
}

.cgw-reservation-blocks .cgw-reservation-name {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 14px;
	font-weight: 500;
	color: var(--cgw-text);
}

/* (b) Urgency states, Blocks-scoped. The ticker adds
 * .cgw-timer-caution at ≤10 min and .cgw-timer-warning at ≤2 min;
 * both classes are present below 2 min, so warning comes last. */
.cgw-reservation-blocks .cgw-reservation-timer.cgw-timer-caution,
.cgw-reservation-timer.cgw-reservation-timer--mini-cart.cgw-timer-caution {
	color: #92400e;
	background: #fef3c7;
	border-color: #fde68a;
}

.cgw-reservation-blocks .cgw-reservation-timer.cgw-timer-warning,
.cgw-reservation-timer.cgw-reservation-timer--mini-cart.cgw-timer-warning {
	color: #991b1b;
	background: var(--cgw-red-bg);
	border-color: #fecaca;
}

/* (c) Mini-cart chip: compact, sits under the item name in the
 * drawer. Resets §4's inline left margin (meant for the classic
 * item-name context). */
.cgw-reservation-timer.cgw-reservation-timer--mini-cart {
	margin: 4px 0 0;
	padding: 3px 9px;
	font-size: 12px;
}

/* ------------------------------------------------------------------
 * 8. COD-guard notices (Blocks checkout payment area)
 *
 * Shared §3 already styles all three states (base = amber
 * COD-blocked; .cgw-checkout-blocked red; .cgw-partial-cod blue)
 * for classic AND Blocks. This section adds ONLY the flex layout
 * and the icon badge for Blocks notices. The
 * .cgw-cod-guard-blocks qualifier (added in cod-guard-blocks.js)
 * keeps these rules off the classic renders, which now also carry
 * .cgw-cod-notice (Worker 2) but never .cgw-cod-guard-blocks.
 * ------------------------------------------------------------------ */
.cgw-cod-notice.cgw-cod-guard-blocks {
	display: flex;
	gap: 10px;
	align-items: flex-start;
}

.cgw-cod-notice.cgw-cod-guard-blocks::before {
	content: "!";
	display: inline-flex;
	flex: 0 0 20px;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin-top: 1px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	color: #fff;
	background: var(--cgw-amber);
	border-radius: 50%;
}

.cgw-cod-notice.cgw-cod-guard-blocks.cgw-checkout-blocked::before {
	background: var(--cgw-red);
}

.cgw-cod-notice.cgw-cod-guard-blocks.cgw-partial-cod::before {
	content: "i";
	background: var(--cgw-blue);
}

/* ------------------------------------------------------------------
 * 9. Mobile (max-width: 600px) — single column, full-width buttons,
 * no horizontal overflow. Table scrolls inside its wrapper (§5).
 * Chip + COD notice mobile sizing comes from shared §7.
 * ------------------------------------------------------------------ */
@media (max-width: 600px) {
	.cgw-gifting-blocks,
	.cgw-reservation-blocks {
		padding: 16px;
	}

	.cgw-gifting-blocks .cgw-copy-card {
		padding: 14px;
	}

	.cgw-gifting-blocks .cgw-copy-card .cgw-field--half {
		flex-basis: 100%;
	}

	.cgw-gifting-blocks button.cgw-btn {
		width: 100%;
		margin-left: 0;
		margin-bottom: 8px;
	}

	/* Round 20: the desktop pair-gap rule (button + button,
	 * specificity 0,3,2) beats the single-button rule above
	 * (0,2,1) regardless of source order, so the second
	 * full-width button kept an 8px left margin and overflowed
	 * by 8px. Match the desktop selector to reset it. */
	.cgw-gifting-blocks button.cgw-btn + button.cgw-btn {
		margin-left: 0;
	}

	.cgw-gifting-blocks button.cgw-btn:last-of-type {
		margin-bottom: 0;
	}

	.cgw-reservation-blocks .cgw-reservation-row {
		flex-direction: column;
		align-items: flex-start;
	}

	.cgw-gifting-blocks .cgw-assign__title {
		font-size: 14px;
	}
}

/* 7. Media queries (shared + classic; Blocks carries its own) */
@media (max-width: 600px) {
	.cgw-reservation-timer {
		font-size: 12px;
		padding: 5px 10px;
	}

	.cgw-cod-notice {
		padding: 12px 14px;
	}

	.cgw-gifting-panel {
		padding: 16px;
	}

	.cgw-gifting-panel .cgw-copy-card {
		padding: 16px;
	}

	.cgw-gifting-panel .cgw-addr-grid {
		grid-template-columns: 1fr;
	}

	.cgw-gifting-panel .cgw-panel__actions {
		flex-direction: column;
	}

	.cgw-gifting-panel .cgw-panel__actions .cgw-btn.cgw-btn {
		width: 100%;
	}

	.cgw-gifting-panel .cgw-copy-card__actions .cgw-btn.cgw-btn {
		width: 100%;
	}
}
