/* Section 05 Review. OWNER: rails/sources/review worker. */
/* Cards live in a fixed-height track (--card-h) and are placed by translateX(--slot): adding, resolving or paging cards
   never changes the section height. Every block inside a card has a fixed height so nothing can push the card open. */
.review-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; height: 40px; }
.review-banner { margin: 0; font: 400 var(--t-xs) var(--f-mono); line-height: 16px; color: var(--grey-t); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-pager { display: flex; align-items: center; gap: 10px; }
.rv-page { width: 32px; height: 32px; border-radius: 16px; border: 1px solid var(--hair); font: 500 var(--t-md) var(--f-mono); line-height: 1; display: grid; place-items: center; transition: border-color .2s, opacity .2s; }
.rv-page:hover:not(:disabled) { border-color: var(--ink); }
.rv-page:disabled { opacity: .35; cursor: default; }
.rv-range { font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); min-width: 9ch; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }

.cards {
  --vis: 3; --gap: 28px; --card-h: 540px;
  position: relative; height: var(--card-h); margin-top: 8px;
  border-top: 1px solid var(--ink);
  overflow-x: clip; overflow-y: visible;
}
.card {
  position: absolute; top: 0; left: 0; box-sizing: border-box;
  width: calc((100% - (var(--vis) - 1) * var(--gap)) / var(--vis)); height: var(--card-h);
  padding: 20px 0 0;
  transform: translateX(calc(var(--slot, 0) * (100% + var(--gap))));
  transition: transform .6s var(--expo), opacity .35s, scale .35s var(--ease);
}
.card::after { content: ''; position: absolute; top: 22px; bottom: 26px; right: calc(var(--gap) / -2); width: 1px; background: var(--hair); }
.card.fresh { opacity: 0; transition: none; }
.card.leaving { opacity: 0; scale: .97; pointer-events: none; }
.card.busy { cursor: progress; }
.card.busy .btn-solid { opacity: .55; }
html[data-motion="off"] .card { transition: none; }

.card-meta { margin: 0; height: 16px; font: 400 var(--t-xs) var(--f-mono); line-height: 16px; color: var(--grey-t); display: flex; gap: 10px; white-space: nowrap; overflow: hidden; }
.card-meta .bank { color: var(--ink); }
.status-tag { color: var(--red-t); }
.card-merchant { margin: 12px 0 0; height: 24px; font-size: var(--t-lg); line-height: 24px; font-weight: 600; font-stretch: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-amt { margin: 8px 0 0; height: 40px; font-size: 40px; font-weight: 700; font-stretch: 68%; line-height: 40px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.card-why { list-style: none; padding: 0; margin: 12px 0 0; height: 48px; overflow: hidden; font: 400 var(--t-xs) var(--f-mono); line-height: 16px; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.card-why li { display: inline; }
.card-why li + li::before { content: ' · '; }
.card-why li:first-child::before { content: ''; display: inline-block; width: 5px; height: 5px; background: var(--red); margin-right: 8px; vertical-align: 1px; }
.card-ref { margin: 6px 0 0; height: 16px; font: 400 var(--t-xs) var(--f-mono); line-height: 16px; color: var(--grey-t); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .field { margin: 12px 0 0; height: 62px; }
.card .field .label { display: block; height: 16px; line-height: 16px; margin-bottom: 6px; }
.card .sel-btn { font-size: var(--t-sm); }
.card .sel-btn { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card .sel-btn:disabled { color: var(--grey-t); cursor: default; }
.card .sel-btn[aria-invalid="true"] { border-bottom: 2px solid var(--red); }
.card .sel-list { z-index: 6; }
.card-refund { visibility: hidden; opacity: 0; transition: opacity .25s; }
.card-refund.on { visibility: visible; opacity: 1; }
.card .err { margin: 6px 0 0; height: 32px; line-height: 16px; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-actions { display: flex; gap: 18px; align-items: center; margin-top: 10px; height: 40px; }
.rv-link { font: 500 var(--t-xs) var(--f-mono); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--mute); padding: 4px 0; }
.rv-link:hover:not([aria-disabled="true"]) { text-decoration-color: var(--red); }
.card [data-act][aria-disabled="true"] { cursor: progress; }

.card-stamp {
  position: absolute; inset: 0 0 0 0; display: grid; align-content: center; gap: 10px;
  background: var(--paper); pointer-events: none;
  clip-path: inset(0 100% 0 0); transition: clip-path .45s var(--expo);
}
.card-stamp b { font-size: var(--t-2xl); font-weight: 720; font-stretch: 62%; line-height: 1; }
.card-stamp span { font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); }
.card-stamp i { display: block; height: 2px; background: var(--red); width: 48px; }
.card.stamped .card-stamp { clip-path: inset(0 0 0 0); }

.cards-empty { position: absolute; left: 0; top: 0; right: 0; padding: 26px 0 0; }
.cards-empty[hidden] { display: none; }
.cards-empty b { display: block; font-size: var(--t-xl); font-weight: 600; font-stretch: 85%; }
.cards-empty span { display: block; margin-top: 8px; font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); }

/* Unassigned source emails. `.panel` is Relay's class name (tests); undo the shell's side-panel geometry for it. */
#review .panel.unassigned-sources {
  position: static; inset: auto; z-index: auto; width: auto; transform: none; transition: none; overflow: visible;
  background: transparent; border-left: 0; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--ink);
}
.un-head { display: flex; align-items: baseline; gap: 12px; height: 28px; }
.un-head h3 { margin: 0; font-size: var(--t-lg); font-weight: 600; font-stretch: 90%; line-height: 28px; }
.un-count { font: 500 var(--t-xs) var(--f-mono); color: var(--grey-t); font-variant-numeric: tabular-nums; }
.un-note { margin: 8px 0 0; font: 400 var(--t-xs) var(--f-mono); line-height: 16px; color: var(--grey-t); max-width: 80ch; }
.un-body { position: relative; min-height: calc(3 * 44px); margin-top: 12px; }
.un-list { border-top: 1px solid var(--hair); }
/* The expanded body floats over what follows (like a popover) instead of pushing the ledger down. */
.source-review { position: relative; border-bottom: 1px solid var(--hair); }
.source-review[open] { z-index: 8; }
.source-body {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 8; margin-top: -1px;
  background: var(--paper); border: 1px solid var(--ink); padding: 16px 16px 4px 0;
  box-shadow: 0 18px 40px -18px rgba(13, 13, 13, .35);
}
.source-review summary { height: 44px; display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--t-sm); }
.source-review summary::-webkit-details-marker { display: none; }
.source-review summary::before { content: '+'; flex: none; width: 14px; font: 500 var(--t-sm) var(--f-mono); color: var(--grey-t); }
.source-review[open] summary::before { content: '−'; }
.source-review[data-source-kind="icloud-discovery"] summary { color: var(--ink); }
.source-review p { margin: 0 0 10px 24px; font: 400 var(--t-xs) var(--f-mono); line-height: 18px; color: var(--grey-t); max-width: 80ch; overflow-wrap: anywhere; }
.source-review p:last-child { margin-bottom: 16px; }
.source-review .review-meta { color: var(--ink); }
.un-empty { position: absolute; top: 0; left: 0; right: 0; height: 44px; margin: 0; display: flex; align-items: center; font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); border-top: 1px solid var(--hair); }
.un-empty[hidden] { display: none; }

@media (max-width: 1099px) {
  .cards { --vis: 2; }
}
@media (max-width: 760px) {
  .review-head { grid-template-columns: 1fr; grid-template-rows: 16px 36px; gap: 6px; height: 58px; }
  .rv-pager { justify-content: flex-start; }
  .cards { --vis: 1; --gap: 24px; }
  .card::after { display: none; }
}
