.asca-arrange {
	margin: 1.5rem 0 2rem;
	padding: 1.25rem 1.25rem 1rem;
	border: 1px solid #cfcfcf;
	background: #f7f6f3;
	border-radius: 4px;
	isolation: isolate;
	position: relative;
	z-index: 2;
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.asca-arrange--cart-hint {
	margin: 0 0 1.5rem;
	padding: 1.25rem;
	border: 1px solid #d8d8d8;
	background: #fafafa;
}

.asca-arrange--cart-hint .asca-arrange__message {
	margin: 0;
}

.asca-arrange--classic {
	margin-bottom: 2.5rem;
}

.woocommerce-checkout .asca-arrange--classic {
	grid-column: 1 / -1;
}

.asca-arrange__title {
	margin: 0 0 0.5rem;
	font-size: 1.25rem;
	line-height: 1.3;
}

.asca-arrange__hint,
.asca-arrange__message {
	margin: 0 0 0.75rem;
	color: #444;
	font-size: 0.95rem;
}

.asca-arrange__scroll-hint {
	margin: 0 0 0.65rem;
	font-size: 0.8rem;
	color: #666;
}

.asca-arrange__banner {
	margin: 0 0 1rem;
	padding: 0.65rem 0.75rem;
	background: #fff8e5;
	border: 1px solid #f0d48a;
	font-size: 0.9rem;
}

.asca-arrange__list-wrap {
	position: relative;
	border: 1px solid #ddd;
	border-radius: 3px;
	background: #fff;
}

.asca-arrange__list-wrap::before,
.asca-arrange__list-wrap::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	height: 18px;
	pointer-events: none;
	z-index: 2;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.asca-arrange__list-wrap::before {
	top: 0;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
}

.asca-arrange__list-wrap::after {
	bottom: 0;
	background: linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
}

.asca-arrange__list-wrap--can-up::before,
.asca-arrange__list-wrap--can-down::after {
	opacity: 1;
}

.asca-arrange__list {
	list-style: none;
	margin: 0;
	padding: 0.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	/* Keep a fixed viewport so checkout below stays readable */
	max-height: min(55vh, 28rem);
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable;
}

.asca-arrange__auto-wrap {
	margin: 0 0 1rem;
}

.asca-arrange__auto-sort {
	margin: 0;
}

/* Custom-box checkout: show all 24 days (Bestell-Übersicht is hidden). */
.woocommerce-checkout .asca-arrange--classic .asca-arrange__scroll-hint {
	display: none;
}

.woocommerce-checkout .asca-arrange--classic .asca-arrange__list {
	max-height: none;
	overflow: visible;
	scrollbar-gutter: auto;
}

.woocommerce-checkout .asca-arrange--classic .asca-arrange__list-wrap::before,
.woocommerce-checkout .asca-arrange--classic .asca-arrange__list-wrap::after {
	display: none;
}

.asca-arrange__row {
	display: grid;
	grid-template-columns: 4.5rem 3rem minmax(0, 1fr) auto;
	gap: 0.65rem;
	align-items: center;
	padding: 0.55rem 0.65rem;
	background: #fff;
	border: 1px solid #e2e2e2;
	cursor: grab;
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
	position: relative;
	z-index: 1;
}

.asca-arrange__row:active {
	cursor: grabbing;
}

.asca-arrange__row--ghost {
	opacity: 0.45;
}

.asca-arrange__row--chosen {
	box-shadow: 0 0 0 2px #1e5a8a;
}

.asca-arrange__day {
	font-weight: 700;
	font-size: 0.9rem;
	white-space: nowrap;
}

.asca-arrange__thumb {
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 2px;
	background: #eee;
}

.asca-arrange__meta {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.asca-arrange__name {
	font-weight: 600;
	font-size: 0.95rem;
	overflow: hidden;
	text-overflow: ellipsis;
}

.asca-arrange__variation {
	font-size: 0.8rem;
	color: #666;
}

.asca-arrange__sort-cat,
.asca-arrange__sort-price {
	font-size: 0.75rem;
	line-height: 1.25;
	color: #888;
}

.asca-arrange__controls {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	justify-content: flex-end;
}

.asca-arrange__btn,
.asca-arrange__retry {
	appearance: none;
	border: 1px solid #bbb;
	background: #f7f7f7;
	color: #222;
	font-size: 0.75rem;
	line-height: 1.2;
	padding: 0.35rem 0.5rem;
	cursor: pointer;
	touch-action: manipulation;
}

.asca-arrange__btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}


.asca-arrange__btn-up,
.asca-arrange__btn-down {
	min-width: 2.25rem;
	padding: 0.35rem 0.45rem;
	font-size: 1rem;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}


.asca-arrange__handle {
	cursor: grab;
	font-weight: 700;
	letter-spacing: -0.05em;
	min-width: 2.25rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
	border: 1px solid #bbb;
	background: #f7f7f7;
	color: #222;
	font-size: 0.85rem;
	line-height: 1.2;
	padding: 0.35rem 0.5rem;
}

.asca-arrange__handle:active {
	cursor: grabbing;
}

.asca-arrange--dragging {
	cursor: grabbing;
}

/* Keep list clipped while dragging — fallback drag item is appended to body */
.asca-arrange--dragging .asca-arrange__list {
	overflow-y: auto;
	overflow-x: hidden;
}

.sortable-fallback,
.asca-arrange__row--drag {
	opacity: 0.95;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	z-index: 10000 !important;
	pointer-events: none;
}

.asca-arrange__footer {
	margin-top: 0.85rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
}

.asca-arrange__status {
	margin: 0;
	font-size: 0.85rem;
	color: #555;
	min-height: 1.2em;
}

.asca-arrange__error {
	margin: 0;
	color: #8a1f1f;
	font-size: 0.9rem;
}

.asca-arrange__link {
	font-weight: 600;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

@media (max-width: 600px) {
	.asca-arrange__list {
		max-height: min(50vh, 22rem);
	}

	.woocommerce-checkout .asca-arrange--classic .asca-arrange__list {
		max-height: none;
		overflow: visible;
	}

	.asca-arrange__row {
		grid-template-columns: 3.5rem 2.5rem minmax(0, 1fr);
		grid-template-areas:
			"day thumb meta"
			"controls controls controls";
	}

	.asca-arrange__day {
		grid-area: day;
	}

	.asca-arrange__thumb {
		grid-area: thumb;
		width: 40px;
		height: 40px;
	}

	.asca-arrange__meta {
		grid-area: meta;
	}

	.asca-arrange__controls {
		grid-area: controls;
		justify-content: stretch;
	}

	.asca-arrange__btn,
	.asca-arrange__handle {
		flex: 1 1 auto;
	}
}
