body.ch-qvo-modal-open { overflow: hidden; }

.ch-qvo-open-button { cursor: pointer; }

.ch-qvo-overlay {
	position: fixed;
	inset: 0;
	z-index: 999990;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, .28);
	box-sizing: border-box;
}
.ch-qvo-overlay.is-open { display: flex; }

.ch-qvo-modal {
	position: relative !important;
	width: min(1080px, calc(100vw - 32px));
	max-height: min(86vh, 820px);
	overflow: hidden;
	background: #fff;
	color: #222;
	border: 1px solid #222;
	border-radius: 3px;
	box-shadow: 0 12px 42px rgba(0, 0, 0, .22);
	outline: none;
	box-sizing: border-box;
}

.ch-qvo-close {
	position: absolute !important;
	top: 12px !important;
	right: 12px !important;
	left: auto !important;
	bottom: auto !important;
	z-index: 1000000 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 38px !important;
	height: 38px !important;
	min-width: 38px !important;
	min-height: 38px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 1px solid #d7d7d7 !important;
	border-radius: 50% !important;
	background: #fff !important;
	color: #777 !important;
	font-family: Arial, sans-serif !important;
	font-size: 27px !important;
	font-weight: 300 !important;
	line-height: 1 !important;
	text-align: center !important;
	box-shadow: none !important;
	cursor: pointer !important;
	box-sizing: border-box !important;
}
.ch-qvo-close:hover { color: #111 !important; border-color: #999 !important; }

.ch-qvo-content { max-height: inherit; }
.ch-qvo-loading, .ch-qvo-error {
	padding: 56px 24px;
	text-align: center;
	font-size: 14px;
}
.ch-qvo-error { color: #a00; }

.ch-qvo-layout {
	display: flex;
	gap: 24px;
	padding: 24px 48px 22px 24px;
	box-sizing: border-box;
	max-height: min(86vh, 820px);
}
.ch-qvo-product {
	flex: 0 0 170px;
	width: 170px;
	min-width: 0;
	align-self: flex-start;
	padding-top: 2px;
}
.ch-qvo-gallery {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 4px;
	margin-bottom: 16px;
}
.ch-qvo-gallery img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background: #f7f7f7;
	border-radius: 2px;
}
.ch-qvo-gallery img:only-child { grid-column: 1 / -1; }
.ch-qvo-product-title {
	margin: 0 0 8px;
	font-size: 22px;
	font-weight: 500;
	line-height: 1.3;
}
.ch-qvo-product-price { margin: 0 0 16px; font-size: 14px; }
.ch-qvo-product-price del { opacity: .55; margin-right: 5px; }
.ch-qvo-product-price ins { text-decoration: none; }
.ch-qvo-full-details { color: inherit; font-size: 13px; text-decoration: underline; }

.ch-qvo-main {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	padding-top: 24px;
}
.ch-qvo-table-head, .ch-qvo-row {
	display: grid;
	grid-template-columns: minmax(150px, 1fr) 112px minmax(105px, 135px) minmax(105px, 135px);
	gap: 12px;
	align-items: center;
	box-sizing: border-box;
}
.ch-qvo-table-head {
	flex: 0 0 auto;
	padding: 10px 8px;
	border-bottom: 1px solid #ddd;
	color: #777;
	font-size: 10px;
	letter-spacing: 1.1px;
}
.ch-qvo-table-head span:not(:first-child) { text-align: center; }
.ch-qvo-rows {
	min-height: 80px;
	max-height: min(49vh, 510px);
	overflow: auto;
	scrollbar-width: thin;
}
.ch-qvo-row {
	min-height: 48px;
	padding: 7px 8px;
	border-bottom: 1px solid #e2e2e2;
	font-size: 13px;
}
.ch-qvo-row.is-unavailable { opacity: .55; }
.ch-qvo-variant {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}
.ch-qvo-variant img {
	width: 32px;
	height: 32px;
	flex: 0 0 32px;
	object-fit: contain;
	background: #fafafa;
}
.ch-qvo-variant-label { overflow-wrap: anywhere; }
.ch-qvo-stock { display: block; flex-basis: 100%; color: #777; font-size: 10px; }
.ch-qvo-quantity {
	display: flex;
	align-items: stretch;
	justify-content: center;
	height: 36px;
}
.ch-qvo-quantity button, .ch-qvo-quantity input {
	margin: 0 !important;
	border: 1px solid #ccc !important;
	border-radius: 0 !important;
	background: #fff !important;
	color: #333 !important;
	box-shadow: none !important;
	font-size: 13px !important;
	line-height: 1 !important;
	text-align: center !important;
	box-sizing: border-box !important;
}
.ch-qvo-quantity button {
	width: 27px;
	min-width: 27px;
	padding: 0 !important;
	cursor: pointer;
}
.ch-qvo-quantity button:disabled { cursor: not-allowed; opacity: .4; }
.ch-qvo-quantity input {
	width: 38px;
	min-width: 38px;
	padding: 0 2px !important;
	-moz-appearance: textfield;
}
.ch-qvo-quantity input::-webkit-outer-spin-button,
.ch-qvo-quantity input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ch-qvo-quantity button:first-child { border-radius: 4px 0 0 4px !important; }
.ch-qvo-quantity button:last-child { border-radius: 0 4px 4px 0 !important; }
.ch-qvo-price { text-align: center; white-space: nowrap; }
.ch-qvo-price del { opacity: .5; margin-right: 4px; }
.ch-qvo-price ins { text-decoration: none; }
.ch-qvo-row-total { text-align: center; white-space: nowrap; }
.ch-qvo-status { min-height: 18px; padding: 6px 8px 0; color: #26733c; font-size: 12px; }
.ch-qvo-footer {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: end;
	gap: 18px;
	padding: 14px 8px 0;
	border-top: 1px solid #ddd;
}
.ch-qvo-view-cart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 0 16px;
	border: 1px solid #222;
	border-radius: 3px;
	color: #222;
	font-size: 13px;
	text-decoration: none;
	white-space: nowrap;
}
.ch-qvo-view-cart:hover { color: #000; }
.ch-qvo-totals {
	display: flex;
	justify-content: flex-end;
	gap: 28px;
	text-align: center;
}
.ch-qvo-totals > div { display: flex; flex-direction: column; gap: 5px; min-width: 84px; }
.ch-qvo-totals strong { font-size: 15px; font-weight: 500; }
.ch-qvo-totals span { color: #777; font-size: 11px; }
.ch-qvo-add-selected {
	min-height: 42px;
	padding: 0 16px !important;
	border: 1px solid #222 !important;
	border-radius: 3px !important;
	background: #222 !important;
	color: #fff !important;
	font-size: 11px !important;
	letter-spacing: .2px;
	white-space: nowrap;
	cursor: pointer;
}
.ch-qvo-add-selected:disabled { opacity: .35; cursor: not-allowed; }
.ch-qvo-add-selected:not(:disabled):hover { background: #444 !important; }

@media (max-width: 767px) {
	.ch-qvo-overlay { padding: 8px; align-items: center; }
	.ch-qvo-modal { width: calc(100vw - 16px); max-height: 92vh; overflow: auto; }
	.ch-qvo-close { top: 8px !important; right: 8px !important; width: 34px !important; height: 34px !important; min-width: 34px !important; min-height: 34px !important; }
	.ch-qvo-layout {
		display: block;
		padding: 16px 12px 14px;
		max-height: none;
	}
	.ch-qvo-product {
		display: grid;
		grid-template-columns: 96px minmax(0, 1fr);
		column-gap: 12px;
		width: auto;
		padding: 22px 38px 12px 0;
		border-bottom: 1px solid #ddd;
	}
	.ch-qvo-gallery {
		grid-column: 1;
		grid-row: 1 / span 3;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 3px;
		margin: 0;
		align-self: start;
	}
	.ch-qvo-product-title { grid-column: 2; font-size: 17px; margin: 0 0 6px; }
	.ch-qvo-product-price { grid-column: 2; font-size: 13px; margin: 0 0 8px; }
	.ch-qvo-full-details { grid-column: 2; align-self: start; font-size: 12px; }
	.ch-qvo-main { padding-top: 12px; }
	.ch-qvo-table-head, .ch-qvo-row {
		grid-template-columns: minmax(145px, 1fr) 100px 100px 100px;
		gap: 8px;
		min-width: 480px;
	}
	.ch-qvo-table-head { padding: 8px 4px; font-size: 9px; }
	.ch-qvo-row { min-height: 46px; padding: 6px 4px; font-size: 12px; }
	.ch-qvo-rows { max-height: 36vh; overflow: auto; }
	.ch-qvo-variant img { width: 28px; height: 28px; flex-basis: 28px; }
	.ch-qvo-footer {
		grid-template-columns: 1fr 1fr;
		gap: 10px;
		padding: 12px 2px 0;
	}
	.ch-qvo-view-cart { min-height: 38px; padding: 0 8px; font-size: 12px; }
	.ch-qvo-totals { grid-column: 1 / -1; grid-row: 1; justify-content: space-around; gap: 10px; }
	.ch-qvo-totals strong { font-size: 14px; }
	.ch-qvo-totals span { font-size: 10px; }
	.ch-qvo-add-selected { min-height: 38px; padding: 0 8px !important; font-size: 10px !important; }
}


/* Tablet layout: keep the quick-order dialog inside the viewport. */
@media (min-width: 768px) and (max-width: 1024px) {
	.ch-qvo-overlay { padding: 12px; }
	.ch-qvo-modal { width: calc(100vw - 24px); max-height: 90vh; }
	.ch-qvo-layout { gap: 16px; padding: 22px 46px 18px 18px; }
	.ch-qvo-product { flex-basis: 145px; width: 145px; }
	.ch-qvo-table-head, .ch-qvo-row {
		grid-template-columns: minmax(120px, 1fr) 100px minmax(85px, 105px) minmax(85px, 105px);
		gap: 7px;
	}
	.ch-qvo-row { font-size: 12px; }
}

/* Small-screen layout: no forced 480px-wide table; each variation becomes a compact card. */
@media (max-width: 767px) {
	.ch-qvo-overlay { padding: 6px; align-items: center; }
	.ch-qvo-modal { width: calc(100vw - 12px); max-height: 94vh; overflow: auto; border-radius: 8px; }
	.ch-qvo-close { top: 7px !important; right: 7px !important; width: 34px !important; height: 34px !important; min-width: 34px !important; min-height: 34px !important; }
	.ch-qvo-layout { display: block; padding: 12px 10px 10px; max-height: none; }
	.ch-qvo-product {
		display: grid;
		grid-template-columns: 84px minmax(0, 1fr);
		column-gap: 10px;
		width: auto;
		padding: 22px 34px 10px 0;
		border-bottom: 1px solid #ddd;
	}
	.ch-qvo-gallery { grid-column: 1; grid-row: 1 / span 3; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; margin: 0; align-self: start; }
	.ch-qvo-product-title { grid-column: 2; font-size: 16px; margin: 0 0 5px; overflow-wrap: anywhere; }
	.ch-qvo-product-price { grid-column: 2; font-size: 12px; margin: 0 0 6px; }
	.ch-qvo-full-details { grid-column: 2; align-self: start; font-size: 11px; }
	.ch-qvo-main { padding-top: 10px; }
	.ch-qvo-table-head { display: none; }
	.ch-qvo-rows { min-height: 0; max-height: 42vh; overflow-x: hidden; overflow-y: auto; }
	.ch-qvo-row {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 112px;
		gap: 6px 8px;
		min-width: 0;
		min-height: 0;
		padding: 9px 3px;
		font-size: 12px;
	}
	.ch-qvo-variant { grid-column: 1 / -1; grid-row: 1; flex-wrap: wrap; }
	.ch-qvo-variant img { width: 28px; height: 28px; flex-basis: 28px; }
	.ch-qvo-quantity { grid-column: 1; grid-row: 2 / span 2; justify-content: flex-start; height: 32px; }
	.ch-qvo-quantity button { width: 28px; min-width: 28px; }
	.ch-qvo-quantity input { width: 34px; min-width: 34px; }
	.ch-qvo-price { grid-column: 2; grid-row: 2; text-align: right; white-space: normal; font-size: 11px; }
	.ch-qvo-price::before { content: "Price: "; color: #777; font-size: 10px; }
	.ch-qvo-row-total { grid-column: 2; grid-row: 3; text-align: right; white-space: normal; font-size: 11px; }
	.ch-qvo-row-total::before { content: "Total: "; color: #777; font-size: 10px; }
	.ch-qvo-footer { display: grid; grid-template-columns: 1fr; gap: 9px; padding: 10px 2px 0; }
	.ch-qvo-totals { grid-column: 1; grid-row: 1; justify-content: space-around; gap: 8px; }
	.ch-qvo-totals > div { min-width: 0; }
	.ch-qvo-totals strong { font-size: 13px; }
	.ch-qvo-totals span { font-size: 10px; }
	.ch-qvo-view-cart { grid-column: 1; grid-row: 2; min-height: 36px; padding: 0 8px; font-size: 12px; }
	.ch-qvo-add-selected { grid-column: 1; grid-row: 3; width: 100%; min-height: 38px; padding: 0 8px !important; font-size: 10px !important; white-space: normal; }
}
