/* The cart page (S4). Not frozen: there is no prototype for this screen, so it is built in the port from the brief and the
   S1/S2/S3 language (Atelier, tokens only: no colour, font or size that the design system does not already carry). One row per
   piece; a summary beside the rows on a wide screen and below them on a phone. */
.ct { outline: 0; padding-block: var(--ui-space-8) var(--ui-space-16); }
.ct-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--ui-space-4); flex-wrap: wrap; padding-bottom: var(--ui-space-5); }
.ct-title { margin: 0; font-family: var(--ui-font-display); font-weight: var(--ui-weight-display); letter-spacing: var(--ui-tracking-display); font-size: var(--ui-text-2xl); color: var(--ui-text); }
.ct-count { margin: 0; font-size: var(--ui-text-sm); color: var(--ui-text-muted); }
.ct-layout { display: grid; gap: var(--ui-space-8); align-items: start; }
@media (min-width: 960px) { .ct-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: var(--ui-space-12); } }
@media (min-width: 960px) { .ct-title { font-size: var(--ui-text-3xl); } }

.ct-rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ui-border); }
.ct-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: var(--ui-space-4); align-items: start; padding-block: var(--ui-space-5); border-bottom: 1px solid var(--ui-border); animation: ct-in var(--ui-dur-slow) var(--ui-ease) both; }
@media (min-width: 720px) { .ct-row { grid-template-columns: 112px minmax(0, 1fr) auto; gap: var(--ui-space-6); } }
.ct-row__media { display: block; aspect-ratio: 4 / 5; background: var(--ui-surface-3); overflow: hidden; }
.ct-row__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ct-row__blank { display: block; width: 100%; height: 100%; }
.ct-row__body { display: grid; gap: var(--ui-space-2); justify-items: start; min-width: 0; }
.ct-row__title { color: var(--ui-text); font-weight: var(--ui-weight-strong); font-size: var(--ui-text-md); text-decoration: none; overflow-wrap: anywhere; }
.ct-row__title:hover { text-decoration: underline; text-underline-offset: 3px; }
.ct-row__meta { margin: 0; display: grid; font-size: var(--ui-text-sm); color: var(--ui-text-muted); }
/* On a phone the colour and the code sit on two lines (no separator left hanging at a line's end); from 720px they share one. */
.ct-row__sep { display: none; margin-inline: 0.5em; }
.ct-row__code { display: inline-flex; flex-wrap: wrap; column-gap: 0.5ch; font-family: var(--ui-font-mono); font-size: var(--ui-text-xs); letter-spacing: var(--ui-tracking-label); }
/* A code is one token: it never breaks inside itself, it drops whole to the next line. */
.ct-row__token { white-space: nowrap; }
@media (min-width: 720px) { .ct-row__meta { display: block; } .ct-row__sep { display: inline; } }
.ct-row__gone { margin: 0; display: flex; align-items: center; gap: var(--ui-space-3); flex-wrap: wrap; font-size: var(--ui-text-sm); color: var(--ui-text-muted); }
.ct-row[data-state="sold"] .ct-row__media, .ct-row[data-state="gone"] .ct-row__media, .ct-row[data-state="over"] .ct-row__media { opacity: 0.55; }
.ct-row[data-state="sold"] .ct-row__title, .ct-row[data-state="gone"] .ct-row__title, .ct-row[data-state="over"] .ct-row__title { color: var(--ui-text-muted); }
/* A tap target of 44px, whatever the type size. */
.ct-row__remove { min-height: 44px; min-width: 44px; justify-content: center; }

.ct-summary { display: grid; gap: var(--ui-space-4); padding: var(--ui-space-6); background: var(--ui-surface-2); border: 1px solid var(--ui-border); }
@media (min-width: 960px) { .ct-summary { position: sticky; top: var(--ui-space-8); } }
.ct-sum { display: grid; gap: var(--ui-space-3); margin: 0; }
.ct-sum__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--ui-space-4); }
.ct-sum__row dt { font-size: var(--ui-text-sm); color: var(--ui-text-muted); }
.ct-sum__row dd { margin: 0; text-align: end; font-size: var(--ui-text-sm); color: var(--ui-text); }
.ct-sum__n { color: var(--ui-text-subtle); }
.ct-sum__row--total { padding-top: var(--ui-space-4); border-top: 1px solid var(--ui-border); }
.ct-sum__row--total dt { font-size: var(--ui-text-md); color: var(--ui-text); font-weight: var(--ui-weight-strong); }
.ct-held { margin: 0; font-size: var(--ui-text-sm); color: var(--ui-text-muted); }
.ct-checkout { width: 100%; min-height: 48px; justify-content: center; }
.ct-why { margin: 0; font-size: var(--ui-text-sm); color: var(--ui-text-muted); }

@keyframes ct-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ct-row { animation: none; } }

/* The one sentence after a bounce back from checkout, above the rows. */
.ct-notice { margin-bottom: var(--ui-space-5); }

/* Batch B (Member 1 under the owner's delegation, 5 Nov 2026).
   I-13: each of my open orders is one group under one header (the badge, when the payment closes, Continue to payment),
   drawn once over its held rows, never on every row. */
.ct-groups { display: grid; gap: var(--ui-space-6); min-width: 0; }
.ct-own { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ui-space-2) var(--ui-space-4); padding: var(--ui-space-3) var(--ui-space-4); background: var(--ui-surface-2); border: 1px solid var(--ui-border); border-bottom: 0; }
.ct-own__line { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--ui-space-2) var(--ui-space-3); font-size: var(--ui-text-sm); color: var(--ui-text-muted); }
.ct-own .ui-btn--link { min-height: 44px; }
/* I-18: a Reserved row keeps its price, struck through and "not counted". The strike is set on the price's own boxes as well:
   a line-through does not reach into an inline-flex or inline-block descendant. */
.ct-row__price { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: var(--ui-space-2); }
.ct-row__off, .ct-row__off * { color: var(--ui-text-muted); text-decoration: line-through; }
.ct-row__note { font-size: var(--ui-text-sm); color: var(--ui-text-muted); }
.ct-ready { margin: 0; font-size: var(--ui-text-sm); color: var(--ui-text); }

/* I-15 (batch C, 5 Nov 2026): under a reserved row's line, how soon it is usually back; the line's own size and colour. */
.ct-row__back { margin: 0; font-size: var(--ui-text-sm); color: var(--ui-text-muted); }

/* Batch D, D2.1 (ADR-0018): my one open order beside new pieces: the split under the subtotal and the three choices. */
.ct-split { margin: 0; font-size: var(--ui-text-sm); color: var(--ui-text-muted); }
.ct-replace { display: grid; gap: var(--ui-space-3); }
.ct-replace__wait { display: block; width: 100%; height: 48px; }
.ct-replace__cancel { justify-self: center; }
/* Slice 6, D1 (Member 1, 5 Nov 2026): the D2 choices carry long labels ("Add to your open order and pay ₹4,900 together"); a
   .ui-btn never wraps, so at a phone width they widened the page. Here, and only here, they wrap inside the column, as checkout.css
   does for .pay-stop; .ui-btn itself is untouched. */
.ct-replace .ct-checkout { white-space: normal; height: auto; min-height: 48px; padding-block: var(--ui-space-3); text-align: center; }
/* The text link keeps its look; its tap area is 44 px tall (the touch sweep's answer: invisible, no visual change). */
.ct-replace__cancel { min-height: 44px; }
