/*
 * Easy Digital Downloads → ChiseikoTech theme styling.
 * Loaded after EDD's frontend + block CSS so these rules win. Two surfaces:
 *   1. Checkout — EDD's block checkout (.wp-block-edd-checkout). The two-column
 *      layout is EDD-native (block "layout":"two-thirds"); here we theme the
 *      card, totals, fields, gateways, and buttons to match the marketing pages.
 *   2. Account / login / history / profile — EDD shortcode markup (legacy IDs).
 */

/* ── Buttons: EDD submit (purchase / login / profile / register) ─────────────── */
.edd-submit,
.edd-submit.button,
#edd-purchase-button,
#edd_login_form input[type="submit"],
#edd_register_form input[type="submit"],
#edd_profile_editor_form input[type="submit"] {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
	padding: 0.85rem 1.6rem !important;
	border: 1px solid transparent !important;
	border-radius: 999px !important;
	background: var(--ch-ink) !important;
	color: #fff !important;
	font-weight: 700 !important;
	line-height: 1.2;
	height: auto;
	box-shadow: none !important;
	text-shadow: none !important;
	cursor: pointer;
	transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.edd-submit:hover,
#edd-purchase-button:hover {
	transform: translateY(-1px);
	background: #232734 !important;
	box-shadow: 0 10px 22px rgba(17, 19, 25, 0.18) !important;
}

/* ══ Block checkout ════════════════════════════════════════════════════════════ */
.wp-block-edd-checkout {
	gap: var(--ch-space-5, 2rem);

	--edd-blocks-light-grey: var(--ch-line);
}

/* Order-summary column → a sticky card. */
.wp-block-edd-checkout .edd-blocks__cart {
	align-self: start;
}

@media (min-width: 782px) {
	.wp-block-edd-checkout:not(.edd-checkout__layout--full) .edd-blocks__cart {
		position: sticky;
		top: var(--ch-space-5, 2rem);
	}
}

.wp-block-edd-checkout .edd-blocks-form__cart #edd_checkout_cart {
	border: 1px solid var(--ch-line) !important;
	border-radius: var(--ch-radius-md);
	overflow: hidden;
	background: var(--ch-surface-strong);
}

.wp-block-edd-checkout .edd-blocks-cart__row,
.wp-block-edd-checkout .edd_cart_footer_row {
	padding: 1rem 1.25rem !important;
}

.wp-block-edd-checkout .edd-blocks-cart__row-header {
	background: transparent;
	font-size: 0.78rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--ch-muted);
}

.wp-block-edd-checkout .edd_cart_total,
.wp-block-edd-checkout .edd_cart_total .edd_cart_amount {
	font-size: 1.2rem;
	font-weight: 800;
	color: var(--ch-ink);
}

/* Discount / coupon — the code input only (the Apply submit is styled below, so
   it is excluded here to avoid inheriting the input's flex/border). */
.wp-block-edd-checkout .edd-discount-code-field-wrap input[type="text"] {
	flex: 1 1 12rem;
	min-width: 0;
	padding: 0.55rem 0.7rem !important;
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-sm);
	font: inherit;
}

.edd-button-secondary {
	border-radius: 999px !important;
	border: 1px solid var(--ch-line) !important;
	background: #fff !important;
	font-weight: 600;
}

/* Purchase form panel + fields */
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form {
	border: 1px solid var(--ch-line) !important;
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	padding: var(--ch-space-5, 2rem) !important;
}

.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form legend,
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form__group > label {
	font-weight: 600;
	color: var(--ch-ink);
}

.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form input[type="text"],
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form input[type="email"],
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form input[type="tel"],
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form input[type="password"],
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form select {
	padding: 0.6rem 0.75rem !important;
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-sm);
	background: #fff;
	font: inherit;
	color: var(--ch-ink);
}

/* ── JS-enhanced fields ───────────────────────────────────────────────────────
   The country uses the Chosen library and the phone uses intl-tel-input; both
   replace the native control with their own markup, so they need matching rules
   to look like the fields above. */

/* Chosen single-select (Billing Country). */
.wp-block-edd-checkout .chosen-container {
	width: 100% !important;
	font: inherit;
}

.wp-block-edd-checkout .chosen-container-single .chosen-single {
	display: flex;
	align-items: center;
	height: auto;
	min-height: 2.7rem;
	padding: 0.6rem 0.75rem !important;
	border: 1px solid var(--ch-line) !important;
	border-radius: var(--ch-radius-sm) !important;
	background: #fff !important;
	box-shadow: none !important;
	color: var(--ch-ink);
	line-height: 1.3;
}

.wp-block-edd-checkout .chosen-container-active.chosen-with-drop .chosen-single {
	border-color: var(--ch-ink) !important;
	border-bottom-left-radius: 0 !important;
	border-bottom-right-radius: 0 !important;
}

.wp-block-edd-checkout .chosen-container .chosen-drop {
	border-color: var(--ch-ink) !important;
	border-radius: 0 0 var(--ch-radius-sm) var(--ch-radius-sm);
	box-shadow: 0 10px 24px rgba(17, 19, 25, 0.12);
}

.wp-block-edd-checkout .chosen-container .chosen-results li.highlighted {
	background: var(--ch-ink) !important;
	color: #fff;
}

.wp-block-edd-checkout .chosen-container-single .chosen-search input[type="text"] {
	border: 1px solid var(--ch-line) !important;
	border-radius: var(--ch-radius-sm);
}

/* intl-tel-input (Phone Number) — full-width wrapper, flag button flush in the
   bordered field, themed dropdown. */
.wp-block-edd-checkout .iti {
	display: block;
	width: 100%;
}

.wp-block-edd-checkout .iti__selected-country {
	border-radius: var(--ch-radius-sm) 0 0 var(--ch-radius-sm);
}

.wp-block-edd-checkout .iti__dropdown-content {
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-sm);
	box-shadow: 0 10px 24px rgba(17, 19, 25, 0.12);
}

.wp-block-edd-checkout .iti__country.iti__highlight {
	background: var(--ch-surface-strong);
}

/* Applied discount (Discount Pro adds it as a cart fee, not a coupon field). */
.wp-block-edd-checkout .edd_cart_fee {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	color: var(--ch-ink);
}

.wp-block-edd-checkout .edd_cart_fee .edd_cart_fee_amount {
	font-weight: 700;
	color: #1f7a44;
	white-space: nowrap;
}

/* Payment-method options */
.wp-block-edd-checkout #edd-payment-mode-wrap label.edd-gateway-option.edd-gateway-option-selected {
	border-color: var(--ch-ink) !important;
	background: var(--ch-surface-strong) !important;
}

/* ══ Checkout enterprise polish — order summary, billing, payment, place order ══ */

/* Order summary — line items: title carries the weight; price + remove align. */
.wp-block-edd-checkout .edd_checkout_cart_item_title {
	font-weight: 600;
	color: var(--ch-ink);
}

.wp-block-edd-checkout .edd_cart_item_price {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	white-space: nowrap;
}

/* Remove-line-item: EDD ships it as a screen-reader-only link — render a visible
   × control (matches the discount/coupon remove) so a line item can be removed. */
.wp-block-edd-checkout .edd-blocks-cart__action-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.2rem;
	height: 1.2rem;
	border-radius: 50%;
	background: var(--ch-line);
	color: var(--ch-ink);
	line-height: 1;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.wp-block-edd-checkout .edd-blocks-cart__action-remove::before {
	content: "\00d7"; /* × */
	font-size: 0.85rem;
}

.wp-block-edd-checkout .edd-blocks-cart__action-remove:hover,
.wp-block-edd-checkout .edd-blocks-cart__action-remove:focus-visible {
	background: var(--ch-danger, #8c2131);
	color: #fff;
}

/* Order summary — totals: label ↔ amount on opposite ends; subtotal/tax sit
   quieter; the order total stands apart above a divider. Scoped to the amount
   rows so the discount-code form row (a plain footer row) keeps its own layout. */
.wp-block-edd-checkout .edd_cart_subtotal_row > div,
.wp-block-edd-checkout .edd_cart_tax_row > div,
.wp-block-edd-checkout .edd_cart_fees_row > div,
.wp-block-edd-checkout .edd_cart_total_row > div {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
}

.wp-block-edd-checkout .edd_cart_subtotal_row,
.wp-block-edd-checkout .edd_cart_tax_row {
	padding-top: 0.45rem !important;
	padding-bottom: 0.45rem !important;
	color: var(--ch-muted);
}

.wp-block-edd-checkout .edd_cart_total_row {
	border-top: 1px solid var(--ch-line);
}

/* Billing fields — vertical rhythm, clear labels, full-width inputs, a visible
   focus ring, muted help text, and a coloured required marker. */
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form__group {
	margin-bottom: var(--ch-space-3, 1rem);
}

.wp-block-edd-checkout #edd_purchase_form .edd-label {
	display: block;
	margin-bottom: 0.3rem;
}

.wp-block-edd-checkout #edd_purchase_form .edd-input,
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form input[type="text"],
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form input[type="email"],
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form select {
	width: 100%;
	box-sizing: border-box;
}

.wp-block-edd-checkout #edd_purchase_form .edd-input:focus,
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form input:focus,
.wp-block-edd-checkout #edd_purchase_form .edd-blocks-form select:focus {
	outline: none;
	border-color: var(--ch-ink) !important;
	box-shadow: 0 0 0 3px rgba(207, 139, 44, 0.18);
}

.wp-block-edd-checkout #edd_purchase_form .edd-description {
	margin: 0.3rem 0 0;
	font-size: 0.82rem;
	color: var(--ch-muted);
}

.wp-block-edd-checkout #edd_purchase_form .edd-required-indicator {
	margin-left: 0.15rem;
	color: var(--ch-danger, #8c2131);
}

/* Payment method — each gateway reads as a selectable card (only rendered when
   more than one gateway is enabled; a single gateway hides this selector). */
.wp-block-edd-checkout #edd-payment-mode-wrap label.edd-gateway-option {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem !important;
	border-color: var(--ch-line) !important;
	border-radius: var(--ch-radius-sm) !important;
	cursor: pointer;
}

/* Place order — a single, full-width primary CTA at the end of the form. */
.wp-block-edd-checkout #edd-purchase-button {
	width: 100%;
	margin-top: var(--ch-space-3, 1rem);
}

/* ══ Account area (/account/) — tabbed, WooCommerce-My-Account style ════════════ */
.chiseiko-account--guest {
	display: grid;
	gap: var(--ch-space-5, 2rem);
}

@media (min-width: 760px) {
	.chiseiko-account--guest {
		grid-template-columns: 1fr 1fr;
		align-items: start;
	}
}

.chiseiko-account-col {
	padding: var(--ch-space-5, 2rem);
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
}

.chiseiko-account-col h3 {
	margin-top: 0;
}

.chiseiko-account-cta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.chiseiko-account--member {
	display: grid;
	gap: var(--ch-space-5, 2rem);
}

@media (min-width: 820px) {
	.chiseiko-account--member {
		grid-template-columns: 230px minmax(0, 1fr);
		align-items: start;
	}
}

.chiseiko-account-tabs {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 0.5rem;
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
}

@media (min-width: 820px) {
	.chiseiko-account-tabs {
		position: sticky;
		top: var(--ch-space-5, 2rem);
	}
}

.chiseiko-account-tab {
	display: block;
	padding: 0.6rem 0.9rem;
	border-radius: var(--ch-radius-sm);
	font-weight: 600;
	color: var(--ch-ink);
	text-decoration: none;
}

.chiseiko-account-tab:hover {
	background: var(--ch-surface-strong);
}

.chiseiko-account-tab.is-active {
	background: var(--ch-ink);
	color: #fff;
}

.chiseiko-account-tab--logout {
	margin-top: 0.4rem;
	border-top: 1px solid var(--ch-line);
	color: var(--ch-amber-deep);
}

.chiseiko-account-panel {
	min-width: 0;
	padding: var(--ch-space-5, 2rem);
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
}

.chiseiko-account-panel > h3:first-child {
	margin-top: 0;
	padding-bottom: 0.6rem;
	margin-bottom: var(--ch-space-3, 1rem);
	border-bottom: 1px solid var(--ch-line);
}

/* ══ Login + register + profile (shortcode markup) ═════════════════════════════ */
/* ══ EDD blocks shared primitives — receipt, license table, generic rows ═══════ */
.entry-content .wp-block-edd-receipt .edd-blocks-receipt__totals,
.entry-content .wp-block-edd-receipt .edd-blocks-receipt__items {
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	overflow: hidden;
}

.entry-content .wp-block-edd-receipt .edd-blocks-receipt__items {
	margin-top: var(--ch-space-3, 1rem);
}

/* Generic label/value rows (receipt + any EDD block row not in a grid above). */
.entry-content .wp-block-edd-receipt .edd-blocks__row {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.7rem 1.1rem;
	border-bottom: 1px solid var(--ch-line);
}

.entry-content .wp-block-edd-receipt .edd-blocks__row:last-child {
	border-bottom: 0;
}

.entry-content .wp-block-edd-receipt .edd-blocks__row-header {
	background: var(--ch-surface-strong);
	font-weight: 700;
	color: var(--ch-ink);
}

.entry-content .wp-block-edd-receipt .edd-blocks__row-label {
	color: var(--ch-muted);
}

.entry-content .wp-block-edd-receipt .edd-blocks__row-value {
	font-weight: 600;
	color: var(--ch-ink);
	text-align: right;
}

/* "Completed"/active states read as success. */
.entry-content .edd_receipt_payment_status.complete,
.entry-content .edd_sl_license_status.edd-sl-active {
	color: #1f7a44;
	font-weight: 700;
}

/* License key value reads as a monospace token. */
.entry-content .edd_sl_license_key {
	padding: 0.3rem 0.5rem;
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-sm);
	background: #fff;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--ch-ink);
}

/* ══ Account: EDD orders + downloads blocks (Orders & downloads view) ══════════ */
.chiseiko-account-panel .wp-block-edd-orders .edd-blocks__orders-grid {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.chiseiko-account-panel .edd-blocks-orders__order {
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	padding: 1.1rem 1.25rem;
}

.chiseiko-account-panel .edd-blocks-orders__order-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 0.5rem;
}

.chiseiko-account-panel .edd-blocks-orders__order-id {
	font-weight: 700;
	color: var(--ch-ink);
}

.chiseiko-account-panel .edd-blocks-orders__order-status {
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	background: var(--ch-surface-strong);
	color: var(--ch-muted);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.chiseiko-account-panel .edd-blocks-orders__order-status.complete {
	background: rgba(31, 122, 68, 0.12);
	color: #1f7a44;
}

.chiseiko-account-panel .edd-blocks-orders__order-data {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.75rem;
	color: var(--ch-muted);
	font-size: 0.9rem;
}

.chiseiko-account-panel .edd-blocks-orders__order-details {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1rem;
	font-size: 0.9rem;
}

.chiseiko-account-panel .edd-blocks-orders__order-details a {
	color: var(--ch-ink);
	font-weight: 600;
}

.chiseiko-account-panel .wp-block-edd-user-downloads {
	margin-top: var(--ch-space-5, 2rem);
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-md);
	overflow: hidden;
}

.chiseiko-account-panel .wp-block-edd-user-downloads .edd-blocks__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	padding: 0.85rem 1.1rem;
	border-bottom: 1px solid var(--ch-line);
}

.chiseiko-account-panel .wp-block-edd-user-downloads .edd-blocks__row:last-child {
	border-bottom: 0;
}

.chiseiko-account-panel .wp-block-edd-user-downloads .edd-blocks__row-header {
	background: var(--ch-surface-strong);
	color: var(--ch-muted);
	font-size: 0.78rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.chiseiko-account-panel .edd-order-item__file-link {
	color: var(--ch-ink);
	font-weight: 600;
}

/* ══ Login + register + profile (shortcode markup) ═════════════════════════════ */
#edd_login_form,
#edd_register_form {
	display: grid;
	gap: var(--ch-space-3, 1rem);
	max-width: 34rem;
}

#edd_login_form input[type="text"],
#edd_login_form input[type="password"],
#edd_register_form input[type="text"],
#edd_register_form input[type="email"],
#edd_register_form input[type="password"],
#edd_profile_editor_form input[type="text"],
#edd_profile_editor_form input[type="email"],
#edd_profile_editor_form input[type="password"] {
	width: 100%;
	box-sizing: border-box;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-sm);
	background: #fff;
	font: inherit;
	color: var(--ch-ink);
}

#edd_login_form label,
#edd_register_form label,
#edd_profile_editor_form label {
	font-weight: 600;
}

/* ══ Purchase / download history tables ════════════════════════════════════════ */
#edd_user_history,
table.edd-table {
	width: 100%;
	border-collapse: collapse;
}

#edd_user_history th,
#edd_user_history td,
table.edd-table th,
table.edd-table td {
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--ch-line);
	text-align: left;
	vertical-align: middle;
}

#edd_user_history thead th,
table.edd-table thead th {
	background: var(--ch-surface-strong);
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.edd_purchase_link a,
.edd-purchase-history a {
	color: var(--ch-amber-deep);
}

/* ══ Notices ═══════════════════════════════════════════════════════════════════ */
.edd_errors,
.edd-alert-error {
	border: 1px solid #f5c6c2;
	background: #fdecea;
	color: #a3231b;
	border-radius: var(--ch-radius-sm);
	padding: 0.7rem 1rem;
}

.edd_success,
.edd-alert-success {
	border: 1px solid #b6e0c4;
	background: #e7f6ec;
	color: #1c6b3a;
	border-radius: var(--ch-radius-sm);
	padding: 0.7rem 1rem;
}

/* ══ Checkout: order-summary title, coupon label, agreement note ═══════════════ */
.wp-block-edd-checkout .edd-blocks__cart::before {
	content: "Order summary";
	display: block;
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--ch-ink);
	margin-bottom: 0.85rem;
}

.chiseiko-checkout-agreement {
	margin: 0 0 var(--ch-space-3, 1rem);
	font-size: 0.88rem;
	line-height: 1.5;
	color: var(--ch-muted);
}

.chiseiko-checkout-agreement a {
	color: var(--ch-amber-deep);
	text-decoration: underline;
}

/* ══ Account details: read-only view + per-section edit ════════════════════════ */
.chiseiko-acct-section {
	padding: var(--ch-space-4, 1.5rem);
	margin-bottom: var(--ch-space-4, 1.5rem);
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-md);
	background: #fff;
}

.chiseiko-acct-section:last-child {
	margin-bottom: 0;
}

.chiseiko-acct-section__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.chiseiko-acct-section__head h4 {
	margin: 0;
}

.chiseiko-acct-edit {
	min-height: auto;
	padding: 0.35rem 0.95rem;
}

.chiseiko-acct-dl {
	display: grid;
	gap: 0.55rem;
	margin: var(--ch-space-3, 1rem) 0 0;
}

.chiseiko-acct-dl > div {
	display: grid;
	grid-template-columns: 160px 1fr;
	gap: 1rem;
}

@media (max-width: 520px) {
	.chiseiko-acct-dl > div {
		grid-template-columns: 1fr;
		gap: 0.15rem;
	}
}

.chiseiko-acct-dl dt {
	margin: 0;
	color: var(--ch-muted);
	font-weight: 600;
}

.chiseiko-acct-dl dd {
	margin: 0;
	color: var(--ch-ink);
}

.chiseiko-acct-form {
	display: grid;
	gap: var(--ch-space-3, 1rem);
	margin-top: var(--ch-space-3, 1rem);
	max-width: 30rem;
}

/* The [hidden] attribute must beat the explicit display rules so the read-only
   view and the edit form stay mutually exclusive. */
.chiseiko-acct-form[hidden],
.chiseiko-acct-view[hidden] {
	display: none !important;
}

.chiseiko-acct-field {
	display: grid;
	gap: 0.3rem;
}

.chiseiko-acct-field span {
	font-weight: 600;
}

.chiseiko-acct-field input {
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-sm);
	background: #fff;
	font: inherit;
	color: var(--ch-ink);
}

.chiseiko-acct-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.chiseiko-acct-muted {
	margin: 0;
	color: var(--ch-muted);
	font-size: 0.9rem;
}

.chiseiko-account-notice {
	padding: 0.7rem 1rem;
	margin-bottom: var(--ch-space-4, 1.5rem);
	border-radius: var(--ch-radius-sm);
}

.chiseiko-account-notice--ok {
	background: #e7f6ec;
	border: 1px solid #b6e0c4;
	color: #1c6b3a;
}

.chiseiko-account-notice--err {
	background: #fdecea;
	border: 1px solid #f5c6c2;
	color: #a3231b;
}

/* Coupon: a clean COLLAPSIBLE disclosure. EDD's "Enter a discount code" button
   (#edd_show_discount → .edd_discount_link) toggles the field open/closed via its
   own checkout JS; we keep that collapsible behaviour and just style both states
   so nothing is forced open, double-labelled, or offset. (EDD only outputs this
   form when the cart has a total AND an active discount exists in the store.) */
.wp-block-edd-checkout .edd-blocks-cart__discount {
	margin-top: 0.5rem;
}

/* Collapsed: the toggle reads as a tidy secondary control (it already carries
   .edd-button-secondary for the pill styling). */
.wp-block-edd-checkout .edd_discount_link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0.95rem !important;
	cursor: pointer;
}

/* Expanded: input + Apply on one row, equal height, wrapping cleanly on narrow
   widths rather than overflowing. */
.wp-block-edd-checkout #edd-discount-code-wrap {
	margin-top: 0.6rem;
}

.wp-block-edd-checkout .edd-discount-code-field-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: stretch;
}

/* Apply shares EDD's .edd-submit class (the 3rem pill purchase-button style) —
   bring it back to a compact control sized to match the input. */
.wp-block-edd-checkout .edd-apply-discount {
	flex: 0 0 auto;
	min-height: 0 !important;
	padding: 0.55rem 1.15rem !important;
	border: 0 !important;
	border-radius: var(--ch-radius-sm) !important;
	background: var(--ch-ink) !important;
	color: #fff !important;
	font-weight: 600 !important;
	cursor: pointer;
}

.wp-block-edd-checkout .edd-apply-discount:hover {
	background: var(--ch-amber-deep) !important;
}

/* Applied discount(s): a clearly styled chip with a visible remove control, so
   customers can remove an existing coupon or swap it for another. EDD renders
   the remove link (.edd_discount_remove) as screen-reader-only by default. */
.wp-block-edd-checkout .edd_cart_discount {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 0.6rem;
	align-items: center;
}

.wp-block-edd-checkout .edd_discount {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.25rem 0.5rem 0.25rem 0.7rem;
	background: var(--ch-surface-strong, #f3eee3);
	border: 1px solid var(--ch-line);
	border-radius: 999px;
	font-weight: 600;
}

.wp-block-edd-checkout .edd_discount_rate {
	color: var(--ch-muted);
	font-weight: 500;
}

.wp-block-edd-checkout .edd_discount_remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.25rem;
	height: 1.25rem;
	border-radius: 50%;
	background: var(--ch-ink);
	color: #fff;
	line-height: 1;
	text-decoration: none;
	transition: background 0.15s ease;
}

.wp-block-edd-checkout .edd_discount_remove::before {
	content: "\00d7"; /* × */
	font-size: 0.95rem;
}

.wp-block-edd-checkout .edd_discount_remove:hover,
.wp-block-edd-checkout .edd_discount_remove:focus-visible {
	background: var(--ch-danger, #8c2131);
}

/* ══ Checkout: trust/reassurance + marketing consent ═══════════════════════════ */
.chiseiko-checkout-trust {
	list-style: none;
	margin: 0 0 var(--ch-space-3, 1rem);
	padding: 0;
	display: grid;
	gap: 0.4rem;
}

.chiseiko-checkout-trust li {
	position: relative;
	padding-left: 1.5rem;
	font-size: 0.9rem;
	line-height: 1.4;
	color: var(--ch-ink);
}

.chiseiko-checkout-trust li::before {
	content: "\2713"; /* check mark */
	position: absolute;
	left: 0;
	top: 0;
	color: var(--ch-amber-deep);
	font-weight: 800;
}

.chiseiko-checkout-trust a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.chiseiko-marketing-optin {
	margin: 0 0 var(--ch-space-3, 1rem);
}

.chiseiko-marketing-optin label,
.chiseiko-acct-checkbox {
	display: flex;
	gap: 0.55rem;
	align-items: flex-start;
	font-size: 0.92rem;
	line-height: 1.45;
	cursor: pointer;
}

.chiseiko-marketing-optin input[type="checkbox"],
.chiseiko-acct-checkbox input[type="checkbox"] {
	margin-top: 0.2rem;
	flex: 0 0 auto;
}

/* Free download = email-only: hide the billing-address fieldset on $0 carts. */
.chiseiko-checkout-free .wp-block-edd-checkout .edd-blocks-form.cc-address {
	display: none !important;
}

/* Account dashboard helper links */
.chiseiko-account-help {
	color: var(--ch-muted);
	font-size: 0.92rem;
}

.chiseiko-account-help a {
	color: var(--ch-amber-deep);
	text-decoration: underline;
}

/* Account dashboard: upgrade-to-Pro card (shown to non-Pro users) */
.chiseiko-upgrade-card {
	margin-top: var(--ch-space-4, 1.5rem);
	padding: var(--ch-space-4, 1.5rem);
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-md);
	background: linear-gradient(135deg, rgba(207, 139, 44, 0.12), rgba(86, 102, 79, 0.10));
}

.chiseiko-upgrade-card h4 {
	margin: 0 0 0.4rem;
}

.chiseiko-upgrade-card p {
	margin: 0 0 0.9rem;
	color: var(--ch-muted);
}

/* Post-purchase next steps — rendered after the EDD confirmation + receipt
   (see inc/commerce.php). Mirrors the content-pages styling so it reads the
   same on the EDD pages, which load this stylesheet rather than content-pages.css. */
.chiseiko-postpurchase {
	max-width: 52rem;
	margin: var(--ch-space-5, 2rem) auto 0;
	padding: clamp(1.25rem, 3vw, 2rem);
	background: var(--ch-surface, #fff);
	border: 1px solid var(--ch-line);
	border-radius: var(--ch-radius-md);
}

.chiseiko-postpurchase h3 {
	margin-top: 0;
}

.chiseiko-postpurchase-steps {
	margin: 0;
	padding-left: 1.3rem;
	display: grid;
	gap: 0.6rem;
}

.chiseiko-postpurchase-steps li {
	line-height: 1.6;
}

.chiseiko-postpurchase-steps a {
	color: var(--ch-amber-deep);
	text-decoration: underline;
}

/* Branded fallback nav on the EDD download templates (single-download.php /
   archive-download.php) — normally unreachable behind the /downloads/ redirects,
   shown only if that redirect is ever bypassed so the page is never bare. */
.chiseiko-download-fallback {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-top: var(--ch-space-4, 1.5rem);
}

.chiseiko-download-list {
	margin: 0 0 var(--ch-space-4, 1.5rem);
	padding-left: 1.2rem;
	display: grid;
	gap: 0.4rem;
}

.chiseiko-download-list a {
	color: var(--ch-amber-deep);
	text-decoration: underline;
}
