.ccfg,
form.ccfg-form {
	--ccfg-border: #e3ddd2;
	--ccfg-bg: #fff;
	--ccfg-muted: #f6f3ee;
	--ccfg-text: #222;
	--ccfg-accent: #1f4d3a;
	margin: 0 0 1.25rem;
	color: var(--ccfg-text);
}

.ccfg-piece {
	position: relative;
	margin: 0 0 1rem;
	padding: 1rem 1.1rem 1.1rem;
	border: 1px solid var(--ccfg-border);
	background: var(--ccfg-bg);
}

.ccfg-piece[hidden] { display: none; }

.ccfg-piece legend {
	padding: 0 .4rem;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 1.15rem;
}

.ccfg-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: .75rem;
	margin-bottom: .75rem;
}

.ccfg-row--full { grid-template-columns: 1fr; }

.ccfg-field label {
	display: block;
	margin-bottom: .3rem;
	font-size: .75rem;
	font-weight: 600;
}

.ccfg-field select,
.ccfg-field input {
	width: 100%;
	min-height: 42px;
	padding: .5rem .65rem;
	border: 1px solid var(--ccfg-border);
	background: #fff;
	font-size: .85rem;
	box-sizing: border-box;
}

.ccfg-field select:focus,
.ccfg-field input:focus {
	outline: 2px solid var(--ccfg-accent);
	outline-offset: 1px;
}

.ccfg-color { position: relative; }

.ccfg-swatch {
	position: absolute;
	left: .65rem;
	bottom: 14px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, .2);
	background: conic-gradient(#e74c3c, #f1c40f, #2ecc71, #3498db, #9b59b6, #e74c3c);
	pointer-events: none;
}

.ccfg-color select { padding-left: 2rem; }

.ccfg-roman {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .65rem .8rem;
	background: var(--ccfg-muted);
	border: 1px solid var(--ccfg-border);
	font-size: .85rem;
}

.ccfg-roman span {
	font-size: .65rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	opacity: .7;
}

.ccfg-roman-value { letter-spacing: .05em; }

.ccfg-add-second,
.ccfg-remove-second {
	cursor: pointer;
	border: 1px dashed var(--ccfg-accent);
	background: transparent;
	color: var(--ccfg-accent);
	font-size: .85rem;
}

.ccfg-add-second {
	width: 100%;
	margin-bottom: 1rem;
	padding: .75rem;
}

.ccfg-add-second[hidden] { display: none; }

.ccfg-remove-second {
	position: absolute;
	top: -.2rem;
	right: .8rem;
	padding: .25rem .6rem;
	border-style: solid;
	background: #fff;
	font-size: .75rem;
}

.ccfg-piece-price {
	margin: .25rem 0 0;
	font-size: .85rem;
	font-weight: 600;
	text-align: right;
}

.ccfg-total {
	margin: .5rem 0 0;
	font-size: 1rem;
}

/* ---- Helper links ------------------------------------------------- */

.ccfg a.ccfg-link {
	display: inline-block;
	margin-top: .35rem;
	font-size: .72rem;
	color: var(--ccfg-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.ccfg-links {
	margin: 0 0 .25rem;
	font-size: .72rem;
	opacity: .9;
}

/* ---- Stack the form (theme sets form.cart to a flex row) ---------- */

form.cart.ccfg-form {
	display: flex !important;
	flex-direction: column !important;
	flex-wrap: nowrap !important;
	align-items: stretch !important;
	gap: 12px;
	width: 100%;
}

form.cart.ccfg-form > * {
	width: 100% !important;
	max-width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	float: none !important;
}


/* ---- Quantity row ------------------------------------------------- */

.ccfg-qty-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .25rem 0;
}

.ccfg-qty-label { font-size: .85rem; }

.ccfg-qty-row .quantity {
	display: inline-flex !important;
	align-items: stretch;
	margin: 0 !important;
	float: none !important;
	border: 1px solid var(--ccfg-border);
	background: #fff;
}

.ccfg-qty-row .quantity input.qty {
	width: 52px !important;
	height: 44px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	text-align: center;
	font-size: .95rem;
	-moz-appearance: textfield;
	appearance: textfield;
}

.ccfg-qty-row .quantity input.qty::-webkit-outer-spin-button,
.ccfg-qty-row .quantity input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.ccfg .ccfg-qty-btn,
.ccfg-qty-row .ccfg-qty-btn {
	width: 44px !important;
	min-height: 44px;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: #fff !important;
	color: var(--ccfg-text) !important;
	font-size: 1.15rem;
	line-height: 1;
	cursor: pointer;
}

/* ---- Buttons ------------------------------------------------------ */

form.cart.ccfg-form .ccfg-buy-now,
form.cart.ccfg-form button.single_add_to_cart_button {
	display: block !important;
	min-height: 58px;
	padding: .9rem 1rem !important;
	border-radius: 0 !important;
	font-size: 1rem !important;
	font-weight: 600 !important;
	letter-spacing: .01em;
	text-transform: none !important;
	box-shadow: none !important;
	cursor: pointer;
	transition: background-color .15s, color .15s;
}
/* Hide the native Add to bag button; Buy it now is the only button. */
form.cart.ccfg-form button.single_add_to_cart_button {
	display: none !important;
}

form.cart.ccfg-form .ccfg-buy-now {
	background: var(--ccfg-accent) !important;
	color: #fff !important;
	border: 1px solid var(--ccfg-accent) !important;
}

form.cart.ccfg-form .ccfg-buy-now:hover { background: #163a2b !important; }

form.cart.ccfg-form button.single_add_to_cart_button {
	background: #fff !important;
	color: var(--ccfg-text) !important;
	border: 1px solid #222 !important;
}

form.cart.ccfg-form button.single_add_to_cart_button:hover { background: var(--ccfg-muted) !important; }

.ccfg-buy-note {
	margin: 0;
	font-size: .72rem;
	text-align: center;
	opacity: .75;
}

/* Theme button styles leak into these; keep them small. */
.ccfg button.ccfg-add-second,
.ccfg button.ccfg-remove-second {
	min-height: 0 !important;
	line-height: 1.3 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	text-transform: none !important;
	font-weight: 500 !important;
	background: transparent !important;
	color: var(--ccfg-accent) !important;
}

.ccfg button.ccfg-add-second {
	padding: .75rem !important;
	border: 1px dashed var(--ccfg-accent) !important;
	font-size: .85rem !important;
}

.ccfg button.ccfg-remove-second {
	top: .9rem;
	right: 1rem;
	padding: .2rem .4rem !important;
	border: 0 !important;
	color: #b3202a !important;
	font-size: .75rem !important;
	text-decoration: underline;
}

@media (max-width: 480px) {
	.ccfg-row { grid-template-columns: 1fr; }
}

.ccfg-from {
	font-size: .7em;
	font-weight: 400;
	opacity: .75;
	margin-right: .15em;
}
