[x-cloak] { display: none !important; }

.mkt-page {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.mkt-kicker {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mkt-browse-panel,
.mkt-mine-panel {
  min-width: 0;
}

/* GH-123. The bar is search + sort + the Filters trigger; the facets sit in
   the shared cc-filters panel (theme.css), which is a full-width sibling
   that wraps onto its own line, as does the active-filter row. */
.mkt-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}
.mkt-filter--search { flex: 1 1 160px; }
.mkt-filter--sort { flex: 0 1 170px; }
.mkt-filter-trigger { min-height: 42px; }
.mkt-price-range { gap: 10px; }
.mkt-price-range .mkt-filter--price { flex: 0 1 132px; }

.mkt-filter {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.mkt-filter span {
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 700;
}

.mkt-filter input,
.mkt-filter select,
.mkt-form input,
.mkt-form select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  padding: 8px 10px;
}

.mkt-btn,
.mkt-tab-link {
  min-height: 40px;
}

.mkt-tab-link.active {
  border-color: color-mix(in srgb, var(--brand) 70%, var(--border));
}

.mkt-btn--primary {
  border-radius: var(--radius-pill);
}

.mkt-btn--sm { min-height: 32px; padding: 4px 10px; font-size: .82rem; }

.mkt-sale-feed,
.mkt-skeleton-list {
  display: grid;
  gap: 12px;
}

.mkt-listing-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(100px, 130px);
  gap: 14px;
  align-items: start;
  padding: 12px;
}

.mkt-cover {
  display: block;
  width: 72px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}

.mkt-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mkt-cover__fallback {
  display: block;
  width: 100%;
  height: 100%;
}

.mkt-listing-main {
  min-width: 0;
}

.mkt-listing-topline {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.mkt-listing-title {
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.mkt-listing-title:hover { text-decoration: underline; }

.mkt-condition,
.mkt-side,
.mkt-cond {
  font-size: .78rem;
  padding: 2px 8px;
}

.mkt-listing-meta,
.mkt-note,
.mkt-empty,
.mkt-subtle,
.mkt-spread {
  color: var(--text-muted);
}

.mkt-listing-meta {
  margin: 6px 0 0;
  font-size: .92rem;
}

/* GH-193: where a book ships from, and whether it can be collected. Sits
   under the byline as a second-rank fact — the buyer reads the title and the
   price first, and this only ever appears when the seller declared it. */
.mkt-listing-geo {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: .86rem;
}

/* Two checkboxes stacked, unlike the price row's side-by-side pair: these are
   independent questions and reading them as a pair invites treating them as
   opposites. */
.mkt-geo-filters {
  display: grid;
  gap: 8px;
}

.mkt-filter--check {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The label sits beside the box, so it must not inherit .mkt-filter span's
   form-label weight. */
.mkt-filter--check span {
  font-size: .92rem;
  font-weight: 400;
  color: var(--text);
}

.mkt-filter--check input:disabled + span {
  color: var(--text-muted);
}

.mkt-filter-help {
  margin: 0;
  color: var(--text-muted);
  font-size: .82rem;
}

.mkt-note {
  margin: 8px 0 0;
}

.mkt-listing-price {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.mkt-listing-price strong,
.mkt-price {
  font-variant-numeric: tabular-nums;
}

.mkt-listing-price strong {
  font-size: 1.55rem;
}

/* GH-178: a swap card has no number where the price goes, so the word carries
   the slot instead. Sized down from the price because a word at 1.55rem reads
   as a shout, and tinted with the brand so the two kinds of listing are
   distinguishable at a glance without relying on reading the label. */
.mkt-listing-price strong.mkt-swap-badge {
  font-size: 1.05rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand);
}

.mkt-swap-seeking {
  color: var(--text-muted);
  font-size: .86rem;
  max-width: 22ch;
  text-align: right;
  /* The seeking summary is free text a member wrote, so it has no length the
     card can rely on. Two lines, then ellipsis -- the listing page carries
     the whole of it. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mkt-inline-error,
.mkt-error {
  color: var(--danger, #d33);
  margin: 8px 0;
}

.mkt-empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.mkt-empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.mkt-empty-state p {
  margin: 0;
  color: var(--text-muted);
}

/* GH-186: the browse grid is paged, so it ends in a count and a Load more. */
.mkt-browse-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 0 4px;
}

.mkt-browse-count {
  margin: 0;
  color: var(--text-muted);
  font-size: .9rem;
}

.mkt-listing-card--skeleton {
  min-height: 122px;
  opacity: .55;
  background: linear-gradient(90deg, rgba(127,127,127,.10), rgba(127,127,127,.18), rgba(127,127,127,.10));
}

.mkt-section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.mkt-section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.mkt-book {
  width: min(1120px, calc(100vw - 32px));
  margin: 28px auto;
}

.mkt-book__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.mkt-spread {
  margin: 6px 0 0;
}

.mkt-book__head h2,
.mkt-col h3 {
  margin: 0;
}

.mkt-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mkt-form {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 10px;
  background: var(--surface);
}

.mkt-form__head,
.mkt-form__actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.mkt-form label {
  display: grid;
  gap: 5px;
}

/* "Who can see this?" — the public/private choice on a want. Options are
 * inline rows (not the grid the other labels use) so the radio sits beside
 * its text; the ? trigger opens the shared cc-explainer bubble. */
.mkt-visibility {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.mkt-visibility legend {
  padding: 0;
  margin-bottom: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.mkt-form .mkt-visibility__option {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 400;
}
.mkt-form .mkt-visibility__option input {
  width: auto;
  margin: 0;
}
.mkt-visibility__trigger {
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: 600 .7rem/1 var(--font-body, system-ui, sans-serif);
  opacity: .75;
}
.mkt-visibility__trigger:hover,
.mkt-visibility__trigger:focus-visible { opacity: 1; }
.mkt-visibility__help .cc-explainer__bubble { font-weight: 400; text-align: left; }
.mkt-notice {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--status-success-fg, #2e7d32) 12%, transparent);
  color: var(--text);
  font-size: .9rem;
}
/* The seller-side listing-contact warning (GitHub #195): same shape as a
   notice, warning-tinted, since it names a restriction the seller chose. */
.mkt-notice--warn {
  background: color-mix(in srgb, var(--status-warning-fg, #724400) 14%, transparent);
}
.mkt-notice--warn a { color: inherit; text-decoration: underline; }

.mkt-form--shelf {
  position: fixed;
  z-index: 1060;
  right: 20px;
  bottom: max(20px, var(--safe-bottom));
  width: min(420px, calc(100vw - 24px));
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
}

.mkt-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.mkt-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.mkt-user-list,
.mkt-feed,
.mkt-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mkt-user-entry,
.mkt-feed li,
.mkt-col li {
  display: flex;
  gap: .65rem;
  align-items: baseline;
  flex-wrap: wrap;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
}

.mkt-user-entry > a {
  flex: 1 1 220px;
  min-width: 0;
}

.mkt-mine { font-weight: 700; }

.mkt-list-modal {
  position: fixed;
  inset: 0;
  z-index: 1070;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .46);
}

.mkt-list-modal__panel {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: inherit;
  box-shadow: 0 24px 80px rgba(0,0,0,.38);
  padding: 18px;
}

.mkt-list-modal__panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
}

.mkt-list-step {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.mkt-source-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mkt-source-panel {
  display: grid;
  gap: 12px;
}

.mkt-list-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.mkt-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.mkt-picker-row {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: inherit;
  padding: 8px;
  text-align: left;
}

.mkt-selected-book {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.mkt-bundle-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(140px, .8fr) minmax(0, 1.6fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  padding: 10px;
}

.mkt-bundle-item__fields {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.mkt-bundle-item__fields label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.mkt-bundle-item__fields input,
.mkt-bundle-item__fields select {
  width: 100%;
  min-width: 0;
}

.mkt-picker-row:hover {
  border-color: color-mix(in srgb, var(--brand) 70%, var(--border));
}

/* GH-178: a book already in the bundle says so. The chosen ground is
   --surface-2 rather than a brand tint because the ink ramp is measured
   against that surface and against no mixed one, so the state word stays a
   solved pair. --border-strong carries the edge, never the words. */
.mkt-picker-row.is-chosen {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.mkt-picker-state {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.mkt-picker-row.is-chosen .mkt-picker-state {
  color: var(--text);
  font-weight: 600;
}

.mkt-picker-cover {
  display: block;
  width: 48px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.mkt-picker-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mkt-picker-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.mkt-picker-main strong,
.mkt-picker-main small {
  overflow-wrap: anywhere;
}

.mkt-picker-main small {
  color: var(--text-muted);
}

.mkt-shipping {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.2;
}

.mkt-listing-price .mkt-shipping {
  display: block;
  margin-top: 0.2rem;
}

.mkt-form--inline {
  margin-top: 0;
}

/* GH-178: the swap half of the listing modal. Boxed away from the shared
   description/note fields below it, because "what you are offering" and
   "what you want back" are the two halves a reader must not conflate. */
.mkt-swap-form {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
  margin: 12px 0;
  display: grid;
  gap: 10px;
}

.mkt-swap-heading {
  margin: 0;
  font-size: 1rem;
}

.mkt-swap-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mkt-swap-sought {
  display: grid;
  gap: 8px;
}

/* A sought book is a pointer at an edition, not a book in hand: no condition,
   no price, so its row is narrower than an offered one. */
.mkt-bundle-item--sought .mkt-picker-main {
  min-width: 0;
}

.mkt-form-fields {
  display: contents;
}

/* ============================================================
   Cover stack — fanned thumbnails for bundle/lot listings.
   Final geometry wired in Task 16; this establishes the class.
   ============================================================ */
.mkt-cover-stack {
  position: relative;
  display: flex;
  align-items: flex-end;
}

/* ============================================================
   Listing detail seller-photo inspection tray.
   The listing page loads this sheet before listing_detail.css so the
   contact-sheet vocabulary stays shared without disturbing its layout.
   ============================================================ */
.mkt-photo-inspection {
  position: relative;
  z-index: 1;
  width: min(100%, 370px);
  display: grid;
  gap: 12px;
}

.mkt-photo-inspection__main {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  aspect-ratio: 4 / 5;
  border: 1px solid color-mix(in srgb, var(--text) 18%, var(--border));
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-2) 88%, transparent), var(--surface));
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .55);
}

.mkt-photo-inspection__main > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mkt-photo-inspection__stamp {
  position: absolute;
  z-index: 1;
  top: 10px;
  left: 10px;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--text) 28%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.mkt-photo-inspection__tray {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.mkt-photo-inspection__choice,
.mkt-photo-inspection__catalog {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  padding: 5px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .66rem;
  letter-spacing: .04em;
  text-align: center;
}

.mkt-photo-inspection__choice {
  cursor: pointer;
  transition:
    border-color var(--motion-fast, 140ms) var(--ease-standard, ease),
    box-shadow var(--motion-fast, 140ms) var(--ease-standard, ease),
    transform var(--motion-fast, 140ms) var(--ease-standard, ease);
}

.mkt-photo-inspection__choice:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--text) 34%, var(--border));
}

.mkt-photo-inspection__choice[aria-pressed="true"] {
  border-color: hsl(var(--pub-h, 265) 58% 48%);
  color: var(--text);
  box-shadow:
    0 0 0 2px color-mix(in srgb, hsl(var(--pub-h, 265) 58% 48%) 28%, transparent),
    0 6px 14px -10px rgba(0, 0, 0, .6);
}

.mkt-photo-inspection__choice:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.mkt-photo-inspection__choice img,
.mkt-photo-inspection__catalog img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 2px;
  margin-bottom: 5px;
}

.mkt-photo-inspection__choice span,
.mkt-photo-inspection__choice small,
.mkt-photo-inspection__catalog figcaption {
  display: block;
  line-height: 1.25;
}

.mkt-photo-inspection__choice span {
  color: inherit;
  font-weight: 800;
  text-transform: uppercase;
}

.mkt-photo-inspection__choice small {
  color: var(--text-dim);
  font-size: .6rem;
  margin-top: 2px;
}

.mkt-photo-inspection__catalog {
  border-style: dashed;
  color: var(--text-dim);
}

@media (max-width: 460px) {
  .mkt-photo-inspection {
    width: min(100%, 340px);
  }

  .mkt-photo-inspection__main {
    min-height: 240px;
  }

  .mkt-photo-inspection__tray {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ============================================================
   Lot pill badge
   ============================================================ */
.mkt-lot-pill {
  padding: 2px 8px;
  font-size: .75rem;
}

/* ============================================================
   Public-profile "On the marketplace" — cover gallery grid.
   Reuses the marketplace cover-stack / lot-pill / condition
   vocabulary; tiles carry the site publisher tint (pub-tint).
   ============================================================ */
.pp-mkt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.pp-mkt-tile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
}

.pp-mkt-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
}

.pp-mkt-tile:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.pp-mkt-tile__cover {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--surface-2);
  overflow: hidden;
}

.pp-mkt-tile__cover > img,
.pp-mkt-tile__fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Tinted placeholder when an edition has no cover image. */
.pp-mkt-tile__fallback {
  background:
    linear-gradient(135deg, hsl(var(--pub-h, 265) 40% 50% / .35), transparent 80%),
    var(--surface-2);
}

/* Bundle: fan the first three covers across the cover box. */
.pp-mkt-tile__cover .mkt-cover-stack {
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
}

.pp-mkt-tile__cover .mkt-cover-stack__img {
  position: absolute;
  bottom: 8px;
  width: 56%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
}

.pp-mkt-tile__cover .mkt-cover-stack__img:nth-child(1) { left: 8%;  transform: rotate(-7deg); z-index: 1; }
.pp-mkt-tile__cover .mkt-cover-stack__img:nth-child(2) { left: 22%; transform: rotate(-1deg); z-index: 2; }
.pp-mkt-tile__cover .mkt-cover-stack__img:nth-child(3) { left: 36%; transform: rotate(6deg);  z-index: 3; }

.pp-mkt-tile__cover .mkt-lot-pill {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 4;
  font-size: .68rem;
}

/* Side badge: For Sale (ask) vs Wanted (bid). */
.pp-mkt-tile__side {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 4;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .01em;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.pp-mkt-tile__side--ask { background: #1f9e5a; }
.pp-mkt-tile__side--bid { background: #d69014; }

.pp-mkt-tile__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 8px 10px 10px;
}

.pp-mkt-tile__price {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1rem;
}

.pp-mkt-tile__price strong { font-weight: 800; }

.pp-mkt-tile__foot .mkt-shipping {
  font-size: .72rem;
  color: var(--text-muted);
}

.pp-mkt-tile__foot .mkt-condition {
  font-size: .68rem;
  padding: 1px 7px;
}

.pp-mkt-tile__title {
  flex-basis: 100%;
  min-width: 0;
  color: var(--text-muted);
  font-size: .8rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 767.98px) {
  .mkt-page {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }
  .mkt-book__head,
  .mkt-form__head,
  .mkt-form__actions {
    align-items: stretch;
    flex-direction: column;
  }
  .mkt-book {
    width: min(100% - 20px, 1120px);
  }
  .mkt-cols {
    grid-template-columns: 1fr;
  }
  .mkt-listing-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }
  .mkt-cover {
    width: 58px;
  }
  .mkt-listing-price {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .mkt-section-head,
  .mkt-user-entry {
    align-items: stretch;
    flex-direction: column;
  }
  .mkt-list-search {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .mkt-list-modal {
    align-items: end;
    padding: 10px;
  }
  .mkt-list-modal__panel {
    max-height: calc(100vh - 20px);
    padding: 14px;
  }
  .mkt-bundle-item {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: start;
  }
  .mkt-bundle-item__fields {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: 1fr;
  }
  .mkt-bundle-item > .mkt-btn {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (max-width: 640px) {
  .mkt-form--shelf {
    left: 10px;
    right: 10px;
    bottom: max(10px, var(--safe-bottom));
    width: auto;
  }
}

/* Modal containment: the shared edition detail modal has a narrower content
   box than the viewport, so the per-book marketplace pane must size against
   its parent instead of the full page. */
.edition-view--modal .mkt-book {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 1rem 0 0;
}

.edition-view--modal .mkt-book__head,
.edition-view--modal .mkt-cols,
.edition-view--modal .mkt-col,
.edition-view--modal .mkt-offer__main,
.edition-view--modal .mkt-form,
.edition-view--modal .mkt-form__head,
.edition-view--modal .mkt-form__actions {
  min-width: 0;
}

/* ============================================================
   Edition order book (_edition_marketplace_book.html) — bring the
   per-book ask/bid board up to the .mkt-listing-card vocabulary
   used on the main marketplace page, plus an at-a-glance market
   summary line built on the existing muted .mkt-spread treatment.
   ============================================================ */

/* Market summary — small stat chips, ask in brand, bid in scarlet. */
.mkt-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mkt-stat {
  align-items: baseline;
  gap: 6px;
  font-size: .85rem;
  padding: 3px 11px;
}

.mkt-stat strong {
  color: var(--text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.mkt-stat--ask strong { color: var(--brand); }
.mkt-stat--bid strong { color: var(--accent-interest); }

/* Columns are compact ledger panels — one bordered panel per side
   with hairline-divided single-line rows. Denser than separate cards
   and keeps the two sides visually distinct. */
.mkt-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  padding: 0;
  min-width: 0;
  overflow: hidden;
  align-self: start;
}

.mkt-col__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}

.mkt-col__head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: .95rem;
}

.mkt-count {
  font-size: .76rem;
  padding: 1px 9px;
  min-width: 22px;
  text-align: center;
}

.mkt-col ul { display: block; }

.mkt-col .mkt-empty { padding: 12px; margin: 0; }

/* Offer row — one compact line that wraps on narrow widths. The
   `li.mkt-offer` selector (0,0,3) beats the generic `.mkt-col li`
   (0,0,2) flex-row rule. */
.mkt-col li.mkt-offer {
  display: flex;
  align-items: center;
  gap: 7px 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.mkt-col li.mkt-offer:last-child { border-bottom: 0; }
.mkt-col li.mkt-offer:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

.mkt-offer__main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 7px 10px;
  flex-wrap: wrap;
}

.mkt-offer__price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mkt-offer__price strong {
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.mkt-offer__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  font-size: .88rem;
  color: var(--text-muted);
}

.mkt-offer .mkt-cond {
  font-size: .74rem;
  padding: 1px 8px;
}

.mkt-offer__by .mkt-user {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.mkt-offer__by .mkt-user:hover { text-decoration: underline; }

.mkt-offer__price .mkt-shipping {
  font-size: .82rem;
  color: var(--text-dim);
}

.mkt-offer__side {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.mkt-offer__side .mkt-btn {
  white-space: nowrap;
  min-height: 30px;
  padding: 4px 12px;
  font-size: .85rem;
}

/* Bundle / lot — compact full-width addendum below the main row. */
.mkt-offer .mkt-bundle {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1px;
}

.mkt-bundle-label {
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}

.mkt-offer .mkt-cover-stack__img {
  width: 22px;
  height: 33px;
  object-fit: cover;
  border-radius: 3px;
  border: 2px solid var(--surface);
  margin-left: -10px;
}

.mkt-offer .mkt-cover-stack__img:first-child { margin-left: 0; }

@media (max-width: 575.98px) {
  /* actions drop to their own full-width line so nowrap labels never
     overflow the row. */
  .mkt-offer__side { margin-left: 0; flex-basis: 100%; }
  .mkt-offer__side .mkt-btn { flex: 1; }
}

/* Empty floor — the whole book has no asks and no bids. Replaces the
   two panels with one inviting call to set the first price. Built on
   the existing dashed .mkt-empty-state. */
.mkt-loading {
  padding: 18px 0;
  text-align: center;
}

.mkt-empty-state--book {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: clamp(30px, 6vw, 48px) 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.mkt-empty-state--book h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3.2vw, 1.7rem);
}

.mkt-empty-state--book p {
  margin: 0;
  max-width: 48ch;
  color: var(--text-muted);
}

.mkt-empty-hint strong {
  color: var(--brand);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.mkt-empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

/* ---- Trade matches tab (GH-179) ---------------------------------------- */
/* The section's `mkt-matches-panel` class is a hook only: a `*-panel` rule
   here would register as a local primitive in audit_css_building_blocks. */

.mkt-matches-lede,
.mkt-matches-meta {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: .92rem;
}

.mkt-matches-meta {
  margin-top: 16px;
}

.mkt-match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.mkt-match {
  padding: 16px 18px;
  border-radius: 14px;
}

.mkt-match-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mkt-match-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.mkt-match-who {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 200px;
  min-width: 0;
}

.mkt-match-name {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mkt-match-name:hover {
  text-decoration: underline;
}

.mkt-match-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mkt-match-sides {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.mkt-match-side h3 {
  margin: 0 0 8px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mkt-match-books {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.mkt-match-book {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.mkt-match-book-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.mkt-match-book-link:hover span {
  text-decoration: underline;
}

.mkt-match-cover {
  width: 34px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  flex: 0 0 auto;
  background: var(--surface-2);
}

.mkt-match-note {
  font-size: .78rem;
  color: var(--text-muted);
}

.mkt-match-compose {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.mkt-match-compose-label {
  display: grid;
  gap: 6px;
  font-size: .85rem;
  color: var(--text-muted);
}

.mkt-match-compose textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.mkt-match-compose-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* The shelf-visibility prompt (GH-179 follow-through). Deliberately no fill
   of its own -- cc-surface carries the background, so no ink token has to be
   re-solved against a new colour; the accent is an edge, which is what
   --action may carry without becoming a text-contrast question. */

.mkt-shelf-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  padding: 16px 18px;
  border-radius: 14px;
  border-left: 3px solid var(--action);
}

.mkt-shelf-prompt__body {
  flex: 1 1 320px;
  min-width: 0;
}

.mkt-shelf-prompt__head {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
}

.mkt-shelf-prompt__text {
  margin: 0 0 6px;
  font-size: .95rem;
}

.mkt-shelf-prompt__help {
  margin: 0;
  color: var(--text-muted);
  font-size: .86rem;
}

.mkt-shelf-prompt__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.mkt-shelf-prompt__link {
  color: var(--text-muted);
  font-size: .86rem;
}

@media (max-width: 575.98px) {
  .mkt-shelf-prompt {
    padding: 14px;
  }

  .mkt-shelf-prompt__actions {
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  .mkt-match {
    padding: 14px;
  }

  .mkt-match-actions {
    width: 100%;
  }
}

/* Saved searches (GH-187). The row sits under the active-filter chips and is
   the only always-visible statement of what a member has subscribed to. */
.mkt-saved-searches {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.mkt-saved-searches-label {
  color: var(--text-muted);
  font-size: .82rem;
}

.mkt-saved-search {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.mkt-saved-search-bell,
.mkt-saved-search-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 32px: a tap target that still reads as an affordance on the chip it
     follows, rather than a second chip beside it. */
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  /* --border-strong, never --text-dim: these are small graphical marks, and
     the ink tiers are for words (see the theme contrast ramp). */
  color: var(--border-strong);
  cursor: pointer;
}

.mkt-saved-search-bell[aria-pressed="true"] {
  color: var(--brand);
}

.mkt-saved-search-bell:hover,
.mkt-saved-search-remove:hover {
  background: var(--surface-2);
  color: var(--text);
}

.mkt-saved-searches-error {
  width: 100%;
  margin: 0;
  color: var(--text-muted);
  font-size: .82rem;
}


/* --- Seller storefront (GH-194) -------------------------------------------
   A member's live listings on one page. The grid itself is `.mkt-sale-feed`
   and `.mkt-listing-card`, unchanged — this is only the header, the side tabs
   and the chip's link affordance. */

.mkt-storefront {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: grid;
  gap: 18px;
}

.mkt-storefront__head {
  padding: 18px;
  display: grid;
  gap: 6px;
}

.mkt-storefront__kicker {
  margin: 0;
  color: var(--text-muted);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mkt-storefront__name {
  margin: 0;
  font-size: 1.6rem;
}

.mkt-storefront__identity {
  margin: 0;
  color: var(--text-muted);
  font-size: .9rem;
}

.mkt-storefront__rep {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* The full sentence beside the pill. The pill is the compact form of the same
   block, so this never re-phrases it — it prints `label` verbatim. */
.mkt-storefront__rep-full {
  color: var(--text-muted);
  font-size: .9rem;
}

/* Seller time away (GH-626): `_marketplace_away_notice.html`. */
.mkt-away-notice {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
}

.mkt-away-notice p {
  margin: 0;
}

.mkt-away-notice__title {
  font-weight: 600;
}

.mkt-away-notice__message {
  margin-top: 6px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.mkt-away-notice__hint {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: .9rem;
}

.mkt-storefront__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* GH-194. The standing chip is the way to a seller's other books, so it has to
   read as a control without turning into a second link colour beside the
   byline: the pill keeps `cc-pill--muted`'s ink and gains only an underline on
   hover. */
.mkt-rep--link {
  text-decoration: none;
}

.mkt-rep--link:hover,
.mkt-rep--link:focus-visible {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  text-decoration: underline;
}

.listing-storefront-link {
  margin: 6px 0 0;
  font-size: .9rem;
}

@media (max-width: 640px) {
  .mkt-storefront {
    padding: 16px 12px 36px;
  }
}

/* Collection-first seller shortlist: a quiet, editorial row of real books. */
.mkt-seller-view { padding-block: 2rem; }
.mkt-seller-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.mkt-seller-privacy { color: var(--text-muted); font-family: var(--font-mono); font-size: .75rem; letter-spacing: .04em; }
.mkt-seller-heading h2 { font-family: var(--font-display); }
.mkt-seller-list { display: grid; gap: .75rem; margin-block: 1.5rem; }
.mkt-seller-row { display: flex; align-items: center; gap: 1rem; padding: 1rem; }
.mkt-seller-select { display: grid; place-items: center; min-width: 44px; min-height: 44px; }
.mkt-seller-cover { width: 56px; height: 80px; object-fit: contain; flex-shrink: 0; }
.mkt-seller-copy { min-width: 0; overflow-wrap: anywhere; }
.mkt-seller-copy h3 { font-size: 1.1rem; margin: 0 0 .5rem; }
.mkt-seller-copy p { margin-block: .5rem; }
.mkt-seller-review { padding: 1rem; display: grid; gap: .75rem; }
.mkt-seller-review label { display: flex; align-items: center; gap: .75rem; min-height: 44px; }
@media (max-width: 640px) {
  .mkt-seller-heading { flex-direction: column; }
  .mkt-seller-row { align-items: start; gap: .5rem; padding: .75rem; }
  .mkt-seller-cover { width: 40px; height: 60px; }
}
