/* Phase 3 — cart modal (centered, Rozetka-inspired) + shared cart panel + suggestions.
 * Self-contained, theme-consistent (btn_blue, #2f7fd1 accent). runbook_cart.md.
 * The modal keeps the id #aitas-cart-drawer (JS is layout-agnostic — it toggles
 * body.aitas-cart-open + [hidden] and lets CSS own the open/close transition).
 * r2: 1.5× wider, bigger imagery/text, single big total, per-item select + saved
 * stash, low-stock hint, Rozetka qty stepper, swipable suggestion carousel.
 * r3 (owner feedback): pinned footer + pinned compact 3-up suggestions with ONLY
 * the lines list scrolling; footer bar rebuilt (tight, big CTA, note under button);
 * bigger/denser line list + struck sale price; "Обрано X з Y" header counter. */

:root {
	--aitas-cart-accent:#2f7fd1; --aitas-cart-accent-dk:#2467ab;
	--aitas-cart-line:#e6ebf2; --aitas-cart-ink:#1a2230; --aitas-cart-mut:#7a8699;
	--aitas-cart-tint:#eef4fb; --aitas-cart-tint-line:#d7e6f7;
	--aitas-cart-pick:#28a745; --aitas-cart-warn:#cf6f60; --aitas-cart-sale:#e0483a;
}

/* the trailing WC "View cart" link is redundant — the modal replaces it */
.added_to_cart.wc-forward { display: none !important; }

/* ---------- overlay ---------- */
.aitas-cart-overlay {
	position: fixed; inset: 0; background: rgba(16,22,33,.5);
	opacity: 0; transition: opacity .22s ease; z-index: 100000;
}
body.aitas-cart-open .aitas-cart-overlay { opacity: 1; }
.aitas-cart-overlay[hidden] { display: none; }

/* ---------- centered modal shell (wide; height follows content, caps at 92vh) ---------- */
.aitas-cart-drawer {
	position: fixed; left: 50%; top: 50%;
	transform: translate(-50%, -48%) scale(.96);
	width: min(960px, calc(100vw - 28px));
	max-height: min(92vh, 1000px);
	background: #fff; border-radius: 16px;
	box-shadow: 0 24px 70px rgba(16,22,33,.28);
	opacity: 0; z-index: 100001;
	display: flex; flex-direction: column; overflow: hidden;
	transition: opacity .22s ease, transform .24s cubic-bezier(.2,.75,.3,1);
	will-change: transform, opacity;
}
body.aitas-cart-open .aitas-cart-drawer { transform: translate(-50%, -50%) scale(1); opacity: 1; }
body.aitas-cart-open { overflow: hidden; }
/* closed = removed from the a11y tree + tab order (JS sets [hidden] on transitionend,
 * so the close transition still runs). Author rule beats the base display:flex. */
.aitas-cart-drawer[hidden] { display: none; }

.aitas-cart-drawer__head {
	display: flex; align-items: center; justify-content: space-between; gap: 14px;
	padding: 16px 20px; border-bottom: 1px solid var(--aitas-cart-line); flex: 0 0 auto;
}
.aitas-cart-drawer__heading { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex-wrap: wrap; }
.aitas-cart-drawer__title { margin: 0; font-size: 21px; font-weight: 700; color: var(--aitas-cart-ink); }
.aitas-cart-drawer__count { font-size: 13.5px; color: var(--aitas-cart-mut); font-weight: 500; }
.aitas-cart-drawer__count:empty { display: none; }
.aitas-cart-drawer__close {
	position: relative; width: 36px; height: 36px; border: 0; background: transparent;
	cursor: pointer; border-radius: 50%; transition: background .15s; flex: 0 0 auto;
}
.aitas-cart-drawer__close:hover { background: #f0f3f8; }
.aitas-cart-drawer__close span {
	position: absolute; top: 50%; left: 50%; width: 18px; height: 2px; background: var(--aitas-cart-ink);
	border-radius: 2px;
}
.aitas-cart-drawer__close span:first-child { transform: translate(-50%,-50%) rotate(45deg); }
.aitas-cart-drawer__close span:last-child { transform: translate(-50%,-50%) rotate(-45deg); }

/* ---------- drawer scroll model (owner r6.1). Two nested scrolls with native
 * scroll-chaining:
 *   • the CART PANE (.aitas-cart-scroll = lines + footer) is exactly one viewport
 *     tall minus a peek, so the footer (total · Оформити · Продовжити) stays pinned
 *     at the fold and ONLY the lines list scrolls inside it;
 *   • the whole __body is an OUTER scroll holding [cart pane][suggestions]. Scrolling
 *     past the end of the product list chains into the outer scroll and pulls the
 *     «З цим товаром купують» strip up — it sits BELOW the footer and peeks under the
 *     «Продовжити покупки» button, signalling there's more to swipe to.
 * A small cart stays content-sized: the pane's % height resolves to auto (the body
 * is only a definite height once the shell hits its 92vh cap), so nothing scrolls
 * and the footer + full strip are simply visible. */
.aitas-cart-drawer__scroll { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.aitas-cart-panel--drawer { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.aitas-cart-panel--drawer .aitas-cart-panel__body {
	flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0;
	overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
	/* keep the swipe inside the cart: once this scroll hits its end, don't chain past
	 * the drawer to scroll the page behind it (owner r7.3). lines→body chaining (the
	 * suggestions reveal) is unaffected — that's governed by the lines list, not this. */
	overscroll-behavior: contain;
	/* hide the OUTER scrollbar so desktop doesn't show two side-by-side bars — the
	 * peek is its affordance; the inner lines list keeps its own scrollbar. */
	scrollbar-width: none;
}
.aitas-cart-panel--drawer .aitas-cart-panel__body::-webkit-scrollbar { width: 0; height: 0; }
.aitas-cart-panel--drawer .aitas-cart-count { display: none; }           /* mirrored into the header instead */
.aitas-cart-panel--drawer .aitas-cart-scroll {
	position: relative;                                              /* anchor for the scroll indicator (owner r7.4) */
	display: flex; flex-direction: column; flex: 0 0 auto;
	/* one viewport-minus-(header+peek) tall — a DEFINITE length (the shell is
	 * height:auto+max-height, so a % here would collapse to auto). Under this cap the
	 * pane holds its content (small cart = no scroll); over it the lines list scrolls
	 * inside while the footer stays pinned and the strip below peeks by ~60px. */
	max-height: calc(min(92vh, 1000px) - 130px);
}
.aitas-cart-panel--drawer .aitas-cart-lines { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 0 20px; }
.aitas-cart-panel--drawer .aitas-cart-foot { flex: 0 0 auto; padding-top: 14px; }
.aitas-cart-panel--drawer .aitas-cart-suggest-slot { flex: 0 0 auto; }
.aitas-cart-panel--drawer .aitas-cart-empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---------- panel body (page context keeps simple padding) ---------- */
.aitas-cart-panel__body { padding: 14px 20px 22px; }
/* the lines+footer wrapper only exists to form the scrollable "cart pane" in the
 * drawer (see above). Everywhere else it's transparent, so the /cart/ page grid
 * and the plain page flow place lines/footer exactly as before. */
.aitas-cart-scroll { display: contents; }
/* custom scroll indicator: only meaningful in the drawer where the lines list scrolls
 * internally, and only on mobile where native scrollbars are invisible overlays. Hidden
 * everywhere else (desktop drawer keeps its native inner bar; /cart/ scrolls as a page). */
.aitas-cart-scrollbar { display: none; }
.aitas-cart-panel__body.is-loading { display: flex; align-items: center; justify-content: center; min-height: 240px; }
.aitas-cart-loader { width: 34px; height: 34px; border: 3px solid #e2e8f2; border-top-color: var(--aitas-cart-accent); border-radius: 50%; animation: aitas-cart-spin .8s linear infinite; }
@keyframes aitas-cart-spin { to { transform: rotate(360deg); } }

/* inline SKU counter (shown on the /cart/ page; drawer mirrors it into the header) */
.aitas-cart-count { font-size: 14px; color: var(--aitas-cart-mut); font-weight: 500; margin: 2px 0 10px; }

/* empty state */
.aitas-cart-empty { text-align: center; padding: 52px 10px; }
.aitas-cart-empty__icon { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: #f0f4fa; position: relative; }
.aitas-cart-empty__icon::before { content: "🛒"; font-size: 30px; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.aitas-cart-empty__msg { color: var(--aitas-cart-mut); margin: 0 0 20px; font-size: 15px; }

/* ---------- line items — mobile: a 2-row grid (owner r6.3). Row 1 = checkbox ·
 * thumb · title · remove. Row 2 = the ± counter under the thumb, price to its
 * right. `__main` is display:contents so its title + qty/price row drop straight
 * into the line grid; ≥640 restores the single-row flow. */
.aitas-cart-lines { list-style: none; margin: 0; padding: 0; }
.aitas-cart-line {
	display: grid;
	grid-template-columns: 24px 84px 1fr auto;
	grid-template-areas:
		"pick thumb title  remove"
		"pick row   row    remove";
	gap: 8px 12px; align-items: start;
	padding: 14px 0; border-bottom: 1px solid var(--aitas-cart-line); position: relative;
	transition: opacity .2s;
}
.aitas-cart-line:last-child { border-bottom: 0; }
.aitas-cart-line.is-busy { opacity: .5; pointer-events: none; }
.aitas-cart-line__pick   { grid-area: pick; }
.aitas-cart-line__thumb  { grid-area: thumb; }
.aitas-cart-line__main   { display: contents; }
.aitas-cart-line__title  { grid-area: title; }
.aitas-cart-line__remove { grid-area: remove; }
.aitas-cart-line__thumb img { width: 84px; height: 84px; object-fit: contain; border-radius: 10px; background: #f7f9fc; display: block; }
.aitas-cart-line__title { font-size: 16px; font-weight: 500; line-height: 1.35; margin-bottom: 0; color: var(--aitas-cart-ink); overflow-wrap: anywhere; min-width: 0; }
.aitas-cart-line__title a { color: inherit; text-decoration: none; }
.aitas-cart-line__title a:hover { color: var(--aitas-cart-accent); }
.aitas-cart-line__title .variation { margin: 4px 0 0; font-size: 12.5px; color: var(--aitas-cart-mut); font-weight: 400; }
/* mobile: row 2 spans thumb+title columns — counter on the left (under the thumb),
 * price on the right (owner r6.3). Becomes an inline part of the single row at ≥640. */
.aitas-cart-line__row { grid-area: row; display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.aitas-cart-line__qtywrap { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; position: relative; }
.aitas-cart-line__price { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; position: relative; }
.aitas-cart-line__price-now { font-weight: 700; color: var(--aitas-cart-ink); white-space: nowrap; font-size: 19px; }
.aitas-cart-line__price-now.is-sale { color: var(--aitas-cart-sale); }
.aitas-cart-line__price-old { font-size: 13px; color: var(--aitas-cart-mut); text-decoration: line-through; white-space: nowrap; margin-bottom: 1px; }
.aitas-cart-line__stock { margin: 0; font-size: 12.5px; font-weight: 600; }
/* owner r8 — colour split into a panel-scoped rule with a concrete fallback so the
 * warn colour can never lose to a host page's equal-specificity <p> colour (which
 * varies with Rocket's per-page CSS concat order) nor drop to inherited black if the
 * custom property is ever unresolved. */
.aitas-cart-panel .aitas-cart-line__stock { color: var(--aitas-cart-warn, #cf6f60); }
/* the element carries only the number; the label prefix comes from CSS so it can read
 * full «Залишок:» where there's room (desktop) and abbreviate «Залиш.:» where it's tight
 * (mobile, tucked left of the counter — owner r7.2). */
.aitas-cart-line__stock::before { content: "\0417\0430\043B\0438\0448\043E\043A:\00A0"; }
.aitas-cart-line__saved-hint { margin: 0; font-size: 12px; color: var(--aitas-cart-mut); }
/* mobile: pin the low-stock / "не в замовленні" hint just under the ± counter and
 * OUT of flow, so the price stays vertically centred on the counter instead of
 * being dragged down by the hint (owner r6.3). The line gets a touch more bottom
 * room to seat it. Scoped <640 so the ≥640 drawer/page rules are untouched. */
@media (max-width: 639.98px) {
	/* nudge the ± counter right so the − sits roughly under the middle of the photo
	 * (owner r7.1); the price stays pinned right — there's ample room between them. */
	.aitas-cart-line__qtywrap { margin-left: 26px; }
	/* low-stock hint now tucks to the LEFT of the − , inline with the counter + price
	 * (owner r7.2). Absolute so it never shifts the counter off centre; the abbreviated
	 * «Залиш.:» keeps it narrow enough to sit under the left of the photo. */
	.aitas-cart-line__stock {
		position: absolute; right: 100%; top: 50%; transform: translateY(-50%);
		margin: 0 7px 0 0; font-size: 11px; line-height: 1.15; white-space: nowrap;
	}
	.aitas-cart-line__stock::before { content: "\0417\0430\043B\0438\0448.:\00A0"; }
	/* the "не в замовленні" hint (saved lines only, never coincides with a stock hint)
	 * still sits under the qty. */
	.aitas-cart-line__saved-hint { position: absolute; top: 100%; left: 0; margin-top: 3px; white-space: nowrap; }
	.aitas-cart-line:has(.aitas-cart-line__saved-hint) { padding-bottom: 26px; }

	/* minimalist scroll indicator on the right of the product list — a persistent
	 * affordance that the list scrolls when it overflows (owner r7.4). JS sizes the
	 * track/thumb and toggles .is-active only while the list actually overflows. */
	.aitas-cart-panel--drawer .aitas-cart-scrollbar {
		display: block; position: absolute; right: 3px; width: 4px;
		border-radius: 4px; background: rgba(26,34,48,.06);
		opacity: 0; transition: opacity .25s ease; pointer-events: none; z-index: 3;
	}
	.aitas-cart-panel--drawer .aitas-cart-scrollbar.is-active { opacity: 1; }
	.aitas-cart-panel--drawer .aitas-cart-scrollbar__thumb {
		position: absolute; left: 0; top: 0; width: 4px; border-radius: 4px;
		background: rgba(47,127,209,.5);
	}
}
.aitas-cart-line__remove {
	align-self: start; width: 28px; height: 28px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center; color: var(--aitas-cart-mut);
	font-size: 22px; line-height: 1; text-decoration: none; transition: all .15s;
}
.aitas-cart-line__remove:hover { background: #fdecec; color: #e0483a; }

/* select checkbox (green tick = will be ordered) */
.aitas-cart-line__pick { align-self: start; display: inline-flex; padding-top: 2px; cursor: pointer; }
.aitas-cart-line__pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.aitas-cart-line__tick {
	width: 23px; height: 23px; border: 2px solid #cdd7e4; border-radius: 6px; background: #fff;
	position: relative; transition: background .15s, border-color .15s; flex: 0 0 auto;
}
.aitas-cart-line__pick:hover .aitas-cart-line__tick { border-color: var(--aitas-cart-pick); }
.aitas-cart-line__pick input:checked + .aitas-cart-line__tick { background: var(--aitas-cart-pick); border-color: var(--aitas-cart-pick); }
.aitas-cart-line__pick input:checked + .aitas-cart-line__tick::after {
	content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
	border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.aitas-cart-line__pick input:focus-visible + .aitas-cart-line__tick { box-shadow: 0 0 0 3px rgba(47,127,209,.3); }

/* saved (deselected) line — greyed, kept in view, re-checkable */
.aitas-cart-line.is-saved .aitas-cart-line__thumb,
.aitas-cart-line.is-saved .aitas-cart-line__main { opacity: .55; }
.aitas-cart-line.is-saved .aitas-cart-line__price-now { font-weight: 600; }

/* qty stepper — Rozetka 1:1: plain grey −, bordered number box, blue + */
.aitas-cart-qty { display: inline-flex; align-items: center; gap: 6px; }
.aitas-cart-qty__btn {
	width: 34px; height: 38px; border: 0; background: transparent; font-size: 24px; line-height: 1;
	cursor: pointer; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
	transition: background .15s, color .15s;
}
.aitas-cart-qty__dec { color: #9aa6b6; }
.aitas-cart-qty__inc { color: var(--aitas-cart-accent); }
.aitas-cart-qty__btn:hover:not(:disabled) { background: #eef4fb; }
.aitas-cart-qty__btn:disabled { opacity: .35; cursor: default; }
/* flex-lock + !important: the theme has a global input width rule that otherwise
 * stretches this field and blows out the stepper. */
.aitas-cart-qty__val {
	flex: 0 0 54px; width: 54px !important; min-width: 54px; height: 38px; padding: 0; box-sizing: border-box;
	border: 1px solid #d5deea; border-radius: 8px; background: #fff; text-align: center; font-size: 16px;
	color: var(--aitas-cart-ink); -moz-appearance: textfield;
}
.aitas-cart-qty__val::-webkit-outer-spin-button, .aitas-cart-qty__val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.aitas-cart-qty__fixed { font-size: 14px; color: var(--aitas-cart-mut); }

/* ---------- footer: continue (left) + [ total + CTA in one centered row, note under ] ---------- */
.aitas-cart-foot { margin-top: 14px; padding: 0 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.aitas-cart-checkout-box {
	order: 1;
	display: flex; flex-direction: column; gap: 8px;
	background: var(--aitas-cart-tint); border: 1px solid var(--aitas-cart-tint-line);
	border-radius: 14px; padding: 16px 18px;
}
/* total + CTA share ONE row so the sum is vertically centered against the button
 * (owner r4.6); the note sits beneath. Mobile stacks the total (centered, over the
 * full-width button — owner r6.2); ≥640 switches back to the side-by-side row. */
.aitas-cart-checkout-top { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.aitas-cart-total { display: flex; align-items: baseline; }
.aitas-cart-total__val { font-size: 37px; font-weight: 800; color: var(--aitas-cart-ink); line-height: 1; letter-spacing: -.5px; white-space: nowrap; }
.aitas-cart-total__val .amount, .aitas-cart-total__val bdi { white-space: nowrap; }
.aitas-cart-checkout.btn_blue {
	width: 100%; min-height: 60px; padding: 0 34px;
	display: inline-flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 17px; border-radius: 12px;
	box-shadow: 0 8px 20px rgba(47,127,209,.4);
	transition: box-shadow .18s ease, transform .06s ease;
}
.aitas-cart-checkout.btn_blue:hover { box-shadow: 0 11px 26px rgba(47,127,209,.52); }
.aitas-cart-checkout.btn_blue:active { transform: translateY(1px); }
.aitas-cart-checkout.is-disabled {
	width: 100%; min-height: 60px; padding: 0 34px;
	display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
	border-radius: 12px; background: #b9c6d6; box-shadow: none; cursor: not-allowed; color: #fff;
}
/* «Продовжити покупки» scaled up ~1.35× incl. font (owner r4.5) */
.aitas-cart-continue--ghost {
	order: 2;
	display: inline-flex; align-items: center; justify-content: center;
	width: 100%; min-height: 60px; padding: 0 34px;
	border: 1px solid #d5deea; border-radius: 12px; background: #fff;
	color: var(--aitas-cart-ink); text-decoration: none; font-weight: 600; font-size: 18px;
	transition: border-color .15s, color .15s;
}
.aitas-cart-continue--ghost:hover { border-color: var(--aitas-cart-accent); color: var(--aitas-cart-accent); }
.aitas-cart-summary__note { margin: 0; font-size: 12.5px; color: var(--aitas-cart-mut); text-align: center; }

/* ---------- suggestions: compact swipable carousel (owner r3.1 — smaller, 3-up) ---------- */
.aitas-cart-suggest { margin: 0; padding: 14px 20px 4px; border-top: 1px solid var(--aitas-cart-line); }
.aitas-cart-suggest__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.aitas-cart-suggest__title { font-size: 15px; font-weight: 700; margin: 0; color: var(--aitas-cart-ink); }
.aitas-cart-suggest__nav { display: flex; gap: 8px; flex: 0 0 auto; }
.aitas-cart-suggest__arrow {
	width: 32px; height: 32px; border: 1px solid #d5deea; background: #fff; border-radius: 50%;
	cursor: pointer; font-size: 20px; line-height: 1; color: var(--aitas-cart-ink);
	display: inline-flex; align-items: center; justify-content: center; transition: border-color .15s, color .15s, opacity .15s;
}
.aitas-cart-suggest__arrow:hover:not(:disabled) { border-color: var(--aitas-cart-accent); color: var(--aitas-cart-accent); }
.aitas-cart-suggest__arrow:disabled { opacity: .35; cursor: default; }
/* position:relative (v1.11.1): WC price-range markup puts absolutely-positioned
 * 1px .screen-reader-text spans in each card; with a STATIC scroll container their
 * containing block is the document, they escape the clip and stretch the /cart/
 * page sideways on mobile (real horizontal scroll — verify 2026-07-11). As the
 * containing block, the viewport keeps them clipped + scrolling with the cards. */
.aitas-cart-suggest__viewport { position: relative; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.aitas-cart-suggest__viewport::-webkit-scrollbar { display: none; }
.aitas-cart-suggest__track { list-style: none; margin: 0; padding: 0; display: flex; gap: 12px; }
/* compact card: horizontal thumb + text, so the whole strip is ~half as tall */
.aitas-cart-suggest__card {
	flex: 0 0 calc(33.333% - 8px); scroll-snap-align: start; box-sizing: border-box;
	border: 1px solid var(--aitas-cart-line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column;
}
.aitas-cart-suggest__link { text-decoration: none; color: var(--aitas-cart-ink); display: flex; align-items: center; gap: 10px; flex: 1 1 auto; }
.aitas-cart-suggest__thumb { flex: 0 0 auto; }
.aitas-cart-suggest__thumb img { width: 54px; height: 54px; object-fit: contain; display: block; border-radius: 8px; background: #f7f9fc; margin: 0; }
.aitas-cart-suggest__name { font-size: 12.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.aitas-cart-suggest__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.aitas-cart-suggest__price { font-weight: 800; font-size: 14px; }
.aitas-cart-suggest__price .crypt_product_meta_row_label { display: none; }
.aitas-cart-suggest__price del { font-weight: 500; font-size: 12px; color: var(--aitas-cart-mut); }
/* owner r8 — the sale (current) price shows red like the cart lines; the struck
 * regular price stays muted. Non-sale prices (no <ins>) keep the default ink. */
.aitas-cart-suggest__price ins,
.aitas-cart-suggest__price ins .amount { color: var(--aitas-cart-sale, #e0483a); text-decoration: none; font-weight: 800; }
.aitas-cart-suggest__add.loop-btn { min-width: 40px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1; padding: 0; flex: 0 0 auto; }

/* transient notice */
.aitas-cart-notice { margin: 0 20px 12px; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.aitas-cart-notice.is-error { background: #fdecec; color: #c23b2c; }
.aitas-cart-notice.is-ok { background: #eef6ee; color: #2c7a2c; }

/* ============================================================
 * ≥640px — modal is wide: line items become one row; footer becomes
 * [ continue ] .......... [ big total | big CTA + note under ].
 * ============================================================ */
@media (min-width: 640px) {
	.aitas-cart-drawer__head { padding: 18px 26px; }
	.aitas-cart-panel--drawer .aitas-cart-lines { padding: 4px 28px; }
	.aitas-cart-panel__body { padding: 12px 28px 28px; }

	/* back to ONE row: checkbox · thumb · [title + qty/price via __main] · remove */
	.aitas-cart-line { grid-template-columns: 26px 100px 1fr auto; grid-template-areas: "pick thumb main remove"; gap: 14px 20px; align-items: center; padding: 16px 0; }
	.aitas-cart-line__pick, .aitas-cart-line__remove { align-self: center; grid-row: 1; }
	.aitas-cart-line__thumb img { width: 100px; height: 100px; }
	.aitas-cart-line__main { grid-area: main; display: flex; align-items: center; gap: 20px; }
	.aitas-cart-line__title { flex: 1 1 auto; min-width: 0; margin-bottom: 0; font-size: 17px; }
	.aitas-cart-line__row { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 16px; }
	.aitas-cart-line__qtywrap { align-items: center; }
	.aitas-cart-line__price { align-items: flex-end; text-align: right; min-width: 80px; }
	.aitas-cart-line__price-now { font-size: 21px; }
	/* discounted line: the struck regular price floats ABOVE the sale price, so the
	 * sale price stays vertically aligned with the ± widget exactly like an
	 * undiscounted line (owner r4.2). Drawer only — the /cart/ page stacks in flow. */
	.aitas-cart-panel--drawer .aitas-cart-line__price-old { position: absolute; bottom: 100%; right: 0; margin-bottom: 0; }
	/* …and float the low-stock / "не в замовленні" hint BELOW the stepper so it doesn't
	 * inflate the qty column and shove the price down — every line (sale, stock-hint or
	 * plain) then keeps its price level with the ± widget (owner r4.2 consistency). */
	.aitas-cart-panel--drawer .aitas-cart-line__qtywrap { position: relative; }
	.aitas-cart-panel--drawer .aitas-cart-line__stock,
	.aitas-cart-panel--drawer .aitas-cart-line__saved-hint { position: absolute; top: 100%; left: 0; right: 0; text-align: center; margin: 4px 0 0; white-space: nowrap; }

	.aitas-cart-panel--drawer .aitas-cart-foot {
		flex-direction: row; align-items: stretch; justify-content: space-between; gap: 20px;
		margin-top: 0; padding: 14px 28px 20px;
	}
	.aitas-cart-panel--drawer .aitas-cart-continue--ghost { order: 0; width: auto; flex: 0 0 auto; align-self: center; }
	.aitas-cart-panel--drawer .aitas-cart-checkout-box {
		order: 1; flex: 0 1 auto; align-items: stretch; gap: 6px; padding: 12px 20px;
	}
	/* total + button in one row → sum centered against the button (owner r4.6) */
	.aitas-cart-panel--drawer .aitas-cart-checkout-top { flex-direction: row; align-items: center; gap: 22px; }
	.aitas-cart-panel--drawer .aitas-cart-total { flex: 0 0 auto; }
	.aitas-cart-panel--drawer .aitas-cart-checkout.btn_blue,
	.aitas-cart-panel--drawer .aitas-cart-checkout.is-disabled { width: auto; flex: 0 0 auto; }
	.aitas-cart-panel--drawer .aitas-cart-summary__note { text-align: right; }
}

/* ============================================================
 * /cart/ page — the SAME panel, page-sized (two columns on desktop).
 * ============================================================ */
.aitas-cart-page .aitas-cart-panel--page { max-width: 1180px; margin: 0 auto; }
@media (min-width: 992px) {
	.aitas-cart-panel--page .aitas-cart-panel__body {
		display: grid; grid-template-columns: minmax(0,1fr) 380px;
		grid-template-areas: "count count" "lines foot" "suggest suggest";
		gap: 0 46px; align-items: start; padding: 8px 0 40px;
	}
	.aitas-cart-panel--page .aitas-cart-count { grid-area: count; }
	.aitas-cart-panel--page .aitas-cart-lines { grid-area: lines; }
	.aitas-cart-panel--page .aitas-cart-suggest-slot { grid-area: suggest; }
	.aitas-cart-panel--page .aitas-cart-foot { grid-area: foot; position: sticky; top: 20px; margin-top: 0; padding: 0; flex-direction: column; gap: 14px; }
	.aitas-cart-panel--page .aitas-cart-suggest { padding-left: 0; padding-right: 0; margin-top: 8px; }
	/* the page is wide — show four cards per view, still swipable for the rest */
	.aitas-cart-panel--page .aitas-cart-suggest__card { flex: 0 0 calc(25% - 9px); }
	.aitas-cart-panel--page .aitas-cart-line__thumb img { width: 104px; height: 104px; }
	.aitas-cart-panel--page .aitas-cart-line { grid-template-columns: 24px 104px 1fr auto; align-items: start; }
	/* the lines column is narrower than the modal — stack title over qty+price so
	 * the name gets full width instead of being squeezed into a sliver. */
	.aitas-cart-panel--page .aitas-cart-line__main { display: block; }
	.aitas-cart-panel--page .aitas-cart-line__title { margin-bottom: 12px; }
	.aitas-cart-panel--page .aitas-cart-line__row { flex-direction: row; align-items: center; justify-content: flex-start; gap: 24px; }
	.aitas-cart-panel--page .aitas-cart-line__price { align-items: flex-start; text-align: left; min-width: 0; }
	.aitas-cart-panel--page .aitas-cart-line__pick, .aitas-cart-panel--page .aitas-cart-line__remove { align-self: start; }
	/* footer stacks vertically in the narrow sticky column */
	.aitas-cart-panel--page .aitas-cart-checkout-box { flex-direction: column; align-items: stretch; gap: 14px; }
	.aitas-cart-panel--page .aitas-cart-checkout.btn_blue,
	.aitas-cart-panel--page .aitas-cart-checkout.is-disabled { width: 100%; min-width: 0; }
}

/* ============================================================================
 * Shop-wide add-to-cart control (owner r8)
 * A secondary «В кошик» affordance beside the primary «Купити» on every product
 * card (shop / category / related / home offer blocks / search / recently-viewed
 * — all render content-product.php) and on the single product page. «Купити»
 * keeps its behaviour (add + open the drawer); «В кошик» quiet-adds (no drawer),
 * morphs to a green «В кошику» + tick, and a 2nd click goes to the cart. All the
 * visuals live here so no theme CSS is touched. js/crypt-filter.js mirrors the
 * markup for AJAX-rendered grid cards; js/aitas-cart.js wires the behaviour.
 * ========================================================================== */
.product_block .aitas-buy-row { display: flex; align-items: stretch; gap: 8px; margin: 0 10px 8px; }
/* the lone «Купити» button is pinned position:absolute;width:90% at the card
 * bottom by the theme (archive / category / related). Inside the row it must flow
 * again; 4-class specificity beats those 3-class rules without !important. */
.product_block .aitas-buy-row .btn_blue.loop-btn {
	position: static; width: auto; bottom: auto; left: auto; right: auto;
	margin: 0; flex: 0 1 47%; white-space: nowrap;
}
/* «Купити» is now the narrower half; the «В кошик» control takes the rest of the row
 * and centres its icon+label within it, so the pair reads balanced (owner r9 mockup). */
.product_block .aitas-buy-row .aitas-atc { flex: 1 1 auto; justify-content: center; }
/* …and where the lone button was absolute-bottom, seat the whole ROW there. */
.main_catalog .product_block .aitas-buy-row,
.archive .product_block .aitas-buy-row,
.single-product .product_block .aitas-buy-row {
	position: absolute; left: 0; right: 0; bottom: 15px; margin: 0 5%;
}

.aitas-atc {
	--atc-idle: #5b6b86; --atc-done: #1f9d4d;
	flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
	padding: 6px 2px; background: none; border: 0; cursor: pointer;
	color: var(--atc-idle); text-decoration: none; line-height: 1;
	-webkit-tap-highlight-color: transparent; transition: color .28s ease;
}
.aitas-atc:hover, .aitas-atc:focus { color: var(--atc-idle); }
.aitas-atc.is-added { color: var(--atc-done); }
.aitas-atc.is-loading { pointer-events: none; opacity: .55; }
.aitas-atc__ic { position: relative; flex: 0 0 auto; width: 26px; height: 26px; display: inline-block; }
.aitas-atc__cart { width: 26px; height: 26px; display: block; fill: none; stroke: currentColor; transition: transform .2s ease; }
.aitas-atc.is-added .aitas-atc__cart { transform: scale(1.05); }
.aitas-atc__check {
	position: absolute; right: -3px; top: -4px; width: 13px; height: 13px; border-radius: 50%;
	background: var(--atc-done); display: flex; align-items: center; justify-content: center;
	opacity: 0; transform: scale(0); transition: opacity .2s ease, transform .3s cubic-bezier(.2,1.4,.5,1);
}
.aitas-atc__check svg { width: 9px; height: 9px; stroke: #fff; fill: none; }
.aitas-atc.is-added .aitas-atc__check { opacity: 1; transform: scale(1); }
/* cross-fade «В кошик» → «В кошику» with no width jump (the grid stack sizes to
 * the wider word, so «Купити» doesn't shift when the label changes). */
.aitas-atc__txt { display: inline-grid; font-size: 15px; font-weight: 600; }
.aitas-atc__t { grid-area: 1 / 1; white-space: nowrap; text-decoration: underline; text-underline-offset: 2px; transition: opacity .26s ease; }
.aitas-atc__t--done { opacity: 0; }
.aitas-atc.is-added .aitas-atc__t--idle { opacity: 0; }
.aitas-atc.is-added .aitas-atc__t--done { opacity: 1; }
/* the first membership sync on page load toggles is-added WITHOUT replaying the
 * morph (owner r9): suppress transitions on the controls while this flag is set, so
 * already-in-cart items appear green instantly instead of "re-adding" on every load. */
.aitas-atc-no-anim .aitas-atc,
.aitas-atc-no-anim .aitas-atc * { transition: none !important; }

/* narrow cards (2-up mobile grid): keep the control from crowding «Купити». */
@media (max-width: 480px) {
	.product_block .aitas-buy-row { gap: 6px; }
	.aitas-atc { gap: 5px; padding: 6px 0; }
	.aitas-atc__ic, .aitas-atc__cart { width: 24px; height: 24px; }
	.aitas-atc__txt { font-size: 13.5px; }
}

/* single product page: the control sits where «Купити в один клік» used to, just
 * after the main button inside the add-to-cart row. */
.crypt_product_meta_row_add_to_cart { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-start; gap: 12px; }
/* left-aligned, snug to «Купити», and scaled up — there's ample room here so the
 * buy button keeps its natural width (owner r9.5). The theme pins a big right margin
 * on the button via a 7-class selector (…entry-summary .cart button.single_add_to_cart_button.button.alt);
 * only !important can zero it, leaving the 12px flex gap alone so the control sits close.
 * margin-right:auto on the control pins the pair left even where a theme rule centres it. */
.crypt_product_meta_row_add_to_cart .single_add_to_cart_button { margin-right: 0 !important; }
.crypt_product_meta_row_add_to_cart .aitas-atc { flex: 0 0 auto; padding: 8px 2px; gap: 9px; margin-right: auto; }
.crypt_product_meta_row_add_to_cart .aitas-atc__ic,
.crypt_product_meta_row_add_to_cart .aitas-atc__cart { width: 30px; height: 30px; }
.crypt_product_meta_row_add_to_cart .aitas-atc__txt { font-size: 17px; }
/* phones: «Купити» spans the row and the control wraps beneath it — keep it directly
 * under the button's left edge (the 15px matches the button's left inset), not centred. */
@media (max-width: 540px) {
	.crypt_product_meta_row_add_to_cart .aitas-atc { margin-left: 15px; }
}

/* ==========================================================================
 * r10 — optimistic add: the drawer opens the instant an add starts, showing the
 * current lines plus this shimmering placeholder where the new item will land.
 * The add's fragment swap replaces the whole panel body, so the ghost never
 * needs explicit cleanup. Placed last so the flex display wins the base grid
 * (same specificity — source order decides). Drawer-only by usage (JS appends
 * it there); the /cart/ page never renders one.
 * ========================================================================== */
.aitas-cart-line--ghost { display: flex; align-items: center; gap: 14px; pointer-events: none; }
.aitas-cart-ghost__thumb { width: 84px; height: 84px; border-radius: 10px; flex: 0 0 auto; }
.aitas-cart-ghost__main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; }
.aitas-cart-ghost__bar { height: 13px; border-radius: 7px; width: 78%; }
.aitas-cart-ghost__bar--short { width: 42%; }
.aitas-cart-ghost__thumb, .aitas-cart-ghost__bar {
	background: linear-gradient(90deg, #edf1f6 25%, #f8fafc 40%, #edf1f6 55%);
	background-size: 300% 100%;
	animation: aitas-cart-ghost 1.1s linear infinite;
}
@keyframes aitas-cart-ghost { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* r10.1 — no skeleton on buy-again: when the added product already has a line on
 * screen, its qty bumps optimistically and this soft pulse points the eye at it
 * (the old always-ghost version flashed a block that vanished into nothing). The
 * box-shadow spread extends the tint past the line's content box; border-radius
 * only rounds the tint, no reflow. */
.aitas-cart-line.is-bump { border-radius: 12px; animation: aitas-cart-bump .95s ease-out; }
@keyframes aitas-cart-bump {
	0%, 30% { background-color: #eaf3fd; box-shadow: 0 0 0 8px #eaf3fd; }
	100% { background-color: transparent; box-shadow: 0 0 0 8px transparent; }
}

/* r10.1 — first add of a session: the loading body now hosts a ghost line list
 * instead of the bare centered spinner (owner: "loads with this empty block").
 * The is-loading flexbox would center+shrink the list — pin it full-width, top. */
.aitas-cart-panel__body.is-loading .aitas-cart-lines { width: 100%; align-self: flex-start; }

/* ==========================================================================
 * v1.11.0 — variable products (1C vargroups): the variation quick-picker.
 * A small fixed-position popover anchored by JS to the clicked «Купити» /
 * «В кошик» control (cards, suggestion strip). z-index above the drawer
 * (100001) so suggestion-card picks work inside it. Visuals mirror the
 * drawer's design tokens; the option list scrolls past ~6 entries.
 * ========================================================================== */
.aitas-var-picker {
	position: fixed; z-index: 100010; box-sizing: border-box;
	width: 264px; max-width: calc(100vw - 16px);
	background: #fff; border-radius: 12px; padding: 8px;
	box-shadow: 0 10px 32px rgba(26, 34, 48, .20), 0 2px 8px rgba(26, 34, 48, .10);
}
.aitas-var-picker__title {
	padding: 6px 10px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
	text-transform: uppercase; color: var(--aitas-cart-mut, #7a8699);
}
.aitas-var-picker__list { max-height: 268px; overflow-y: auto; overscroll-behavior: contain; }
.aitas-var-picker__opt {
	display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px;
	/* 12px vertical padding (v1.11.1): 12+12+17.4 line = 41.4px ≥ the 40px touch floor */
	padding: 12px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer;
	font-size: 14.5px; line-height: 1.2; color: var(--aitas-cart-ink, #1a2230); text-align: left;
	-webkit-tap-highlight-color: transparent;
}
.aitas-var-picker__opt:hover, .aitas-var-picker__opt:focus { background: var(--aitas-cart-tint, #eef4fb); outline: none; }
.aitas-var-picker__lbl { flex: 1 1 auto; }
.aitas-var-picker__price { flex: 0 0 auto; font-weight: 700; white-space: nowrap; }
.aitas-var-picker__more {
	display: block; padding: 9px 10px 5px; font-size: 13px; text-decoration: none;
	color: var(--aitas-cart-accent, #2f7fd1); border-top: 1px solid var(--aitas-cart-line, #e6ebf2); margin-top: 4px;
}
.aitas-var-picker__more:hover { text-decoration: underline; color: var(--aitas-cart-accent-dk, #2467ab); }
/* product page: «В кошик» clicked with no variation chosen — spotlight the selector */
.aitas-var-nudge { outline: 2px solid var(--aitas-cart-accent, #2f7fd1) !important; outline-offset: 2px; border-radius: 6px; }
