/* ============================================================
   Sales floor — listed machines + customer offers.
   ============================================================ */
/* ============================================================
   Boutique storefront — warm cozy shop look. The stage itself is
   the wooden window frame; the awning sits across the top, an OPEN
   sign sways in the corner, and the interior holds a warm wall, a
   spotlight rail, the display shelves, and a wooden plank floor.
   ============================================================ */
:root {
  --shop-wood-1:   #8b5e3c;
  --shop-wood-2:   #5f3c22;
  --shop-wood-dk:  #4a2f19;
  --shop-wall-top: #f3e9d8;
  --shop-wall-bot: #e7d8bd;
  --shop-shelf-1:  #b07c4f;
  --shop-shelf-2:  #835832;
  --shop-shelf-edge: #6b4324;
  --shop-floor-1:  #a06f42;
  --shop-floor-2:  #875b34;
  --shop-card:     #fbf6ec;
  --shop-card-line:#e4d6bd;
  --shop-ink:      #3a2c1c;
  --shop-ink-dim:  #7a6850;
  --awning-cream:  #f4ead6;
  --awning-terra:  #c1644a;
}
.storefront-stage {
  position: relative;
  border-radius: 14px;
  padding: 14px;
  min-height: 70vh;
  background: linear-gradient(180deg, var(--shop-wood-1), var(--shop-wood-2));
  box-shadow: 0 18px 50px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(0,0,0,0.25);
}
.storefront-stage::before {   /* wood-grain on the frame */
  content: "";
  position: absolute; inset: 0; border-radius: 14px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,0.06) 0 3px, transparent 3px 9px);
  pointer-events: none;
}

/* ---------- Awning ---------- */
.shop-awning {
  position: relative;
  height: 52px;
  margin: -2px -2px 0;
  border-radius: 12px 12px 0 0;
  background: repeating-linear-gradient(90deg,
    var(--awning-cream) 0 44px,
    var(--awning-terra) 44px 88px);
  box-shadow: inset 0 -6px 12px rgba(0,0,0,0.22), 0 6px 10px rgba(0,0,0,0.3);
  z-index: 3;
}
.shop-awning::after {   /* scalloped lower edge */
  content: "";
  position: absolute; left: 0; right: 0; bottom: -13px; height: 16px;
  background: radial-gradient(circle at 22px 0, var(--awning-cream) 0 13px, transparent 14px) 0 0 / 44px 16px repeat-x;
  filter: drop-shadow(0 3px 2px rgba(0,0,0,0.25));
}
.shop-awning-name {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: 2px; font-size: 17px;
  color: #5f3c22; text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

/* ---------- OPEN sign ---------- */
.shop-open-sign {
  position: absolute; top: 60px; right: 34px; z-index: 6;
  text-align: center;
  transform-origin: top center;
  animation: shopSignSway 3.6s ease-in-out infinite;
}
.shop-open-sign .sos-string { display: block; width: 2px; height: 16px; background: #3a2c1c; margin: 0 auto; }
.shop-open-sign .sos-plate {
  display: inline-block;
  background: linear-gradient(180deg,#2e7d52,#1f5c3b);
  color: #fff5d6; font-weight: 800; font-size: 12px; letter-spacing: 2px;
  padding: 5px 12px; border-radius: 6px;
  border: 2px solid #fff5d6;
  box-shadow: 0 5px 10px rgba(0,0,0,0.4);
}
@keyframes shopSignSway { 0%,100% { transform: rotate(-4deg);} 50% { transform: rotate(4deg);} }

/* ---------- Interior ---------- */
.shop-interior {
  position: relative;
  border-radius: 0 0 8px 8px;
  padding: 40px 26px 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--shop-wall-top) 0%, var(--shop-wall-bot) 70%);
  box-shadow: inset 0 8px 18px rgba(0,0,0,0.18);
}
.shop-interior::before {   /* warm spotlight pools + full-height beams */
  content: "";
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background:
    /* strong pools right beneath each lamp on the rail */
    radial-gradient(130px 240px at 16% -4%, rgba(255,205,120,0.38), transparent 70%),
    radial-gradient(130px 240px at 48% -4%, rgba(255,205,120,0.38), transparent 70%),
    radial-gradient(130px 240px at 80% -4%, rgba(255,205,120,0.38), transparent 70%),
    /* soft beams that wash the FULL wall height under each lamp so lower
       shelf rows stay warmly lit in a full showroom, not just the top row */
    radial-gradient(230px 100% at 16% 0%, rgba(255,205,120,0.13), transparent 72%),
    radial-gradient(230px 100% at 48% 0%, rgba(255,205,120,0.13), transparent 72%),
    radial-gradient(230px 100% at 80% 0%, rgba(255,205,120,0.13), transparent 72%);
  pointer-events: none;
}
/* lamp rail along the top, with warm down-lights */
.shop-interior .ceiling {
  position: absolute;
  top: 8px; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(180deg, #6f4827, #4a2f19);
  z-index: 2;
}
.shop-interior .spot {
  position: absolute;
  top: 6px;
  width: 30px;
  height: 12px;
  margin-left: -15px;
  background: linear-gradient(180deg, #d9b070, #8a6a3c);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 14px rgba(255,196,110,0.55);
}
.shop-interior .pegwall {
  position: relative;
  z-index: 2;
  margin: 26px 0 0;
  /* Bottom padding gives the LAST grid row's shelf board (::after at
     -14px, +4px edge) and its buyer chips (-52px) clearance before the
     wooden floor below — otherwise the bottom shelf kisses the floor
     when the showroom is full (10-20 machines at L2/L3). */
  padding: 6px 4px 22px;
  background: none;
  border: 0;
  box-shadow: none;
}
.shop-interior .store-floor {
  position: relative;
  margin: 30px -26px 0;
  height: 72px;
  background:
    repeating-linear-gradient(90deg, var(--shop-floor-2) 0 1px, transparent 1px 92px),
    linear-gradient(180deg, var(--shop-floor-1), var(--shop-floor-2));
  box-shadow: inset 0 8px 14px rgba(0,0,0,0.35);
}
.shop-interior .store-floor::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.10) 0 1px, transparent 1px 34px);
}
.peg-wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 64px 18px;
  align-items: end;
}
.sale-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand-color, var(--border-strong));
  border-radius: var(--r-md);
  padding: var(--sp-3);
}
.sc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-2);
  gap: var(--sp-2);
}
.sc-title {
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
}
.sc-meta {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  margin-top: 3px;
}
.sc-listing,
.sc-listed {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-card);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-2);
}
.sc-listing label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-dim);
}
.sc-listing input { width: 90px; }
.sc-listed { justify-content: space-between; }

.customer-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.customer-row {
  display: grid;
  /* Two rows: the customer's identity (icon + name + blurb) gets the
     full drawer width on top; the offer / rent-math block and the
     action buttons sit below. A single-row layout otherwise crushes
     the name + blurb to an unreadable sliver next to a renter's
     rent-math block. */
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon  body   body"
    ".     right  actions";
  gap: var(--sp-1) var(--sp-2);
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-card);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-sm);
  min-width: 0;
}
.customer-row .cust-icon { grid-area: icon; align-self: start; }
.customer-row .cust-body { grid-area: body; min-width: 0; }
.customer-row .cust-offer,
.customer-row .cust-rent-math { grid-area: right; }
.customer-row .cust-actions { grid-area: actions; }
.customer-row .cust-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Flavour occupation, shown as a dim suffix after the customer's name. */
.customer-row .cust-occ {
  font-weight: 400;
  color: var(--text-dim);
}
.customer-row .cust-blurb {
  /* Wrap to at most two lines instead of clipping at a column edge. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.customer-row.new-arrival,
.customer-browser.new-arrival {
  animation: customerSlide 320ms var(--ease);
}
.customer-row.new-arrival-left,
.customer-browser.new-arrival-left {
  animation: customerSlideLeft 320ms var(--ease);
}
.customer-row.new-arrival-right,
.customer-browser.new-arrival-right {
  animation: customerSlide 320ms var(--ease);
}
@keyframes customerSlide {
  0%   { transform: translateX(40px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes customerSlideLeft {
  0%   { transform: translateX(-40px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.cust-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.cust-name {
  font-weight: var(--fw-semi);
  font-size: var(--fs-sm);
}
.cust-blurb {
  color: var(--text-dim);
  font-size: var(--fs-xs);
  margin-top: 2px;
}
.cust-offer {
  text-align: right;
  min-width: 90px;
}
.cust-offer-val {
  font-weight: var(--fw-bold);
  color: var(--money);
  font-size: var(--fs-lg);
}
.cust-offer-diff {
  font-size: var(--fs-xs);
  color: var(--text-dim);
}
.cust-offer-diff .ok  { color: var(--good); }
.cust-offer-diff .bad { color: var(--bad); }
.cust-rival-mod {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
}
.cust-rival-mod.bad {
  color: var(--bad);
  background: rgba(232,80,58,0.16);
}
.cust-rival-mod.ok {
  color: var(--good);
  background: rgba(76,175,80,0.16);
}
.cust-patience {
  font-size: var(--fs-micro);
  color: var(--text-dim);
  margin-top: 2px;
}
.cust-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cust-actions button {
  padding: 4px 8px;
  font-size: var(--fs-xs);
  white-space: nowrap;
}

/* ===== peg display (one per listed machine) ===== */
.peg-display {
  position: relative;
  background: var(--shop-card);
  border: 1px solid var(--shop-card-line);
  border-top: 4px solid var(--brand-color, var(--border-strong));
  border-radius: 8px 8px 6px 6px;
  padding: 16px 12px 14px 12px;
  box-shadow: 0 14px 22px rgba(60,40,20,0.30);
  color: var(--shop-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 0;
}
/* Wooden shelf board the display rests on + a soft grounding reflection. */
.peg-display::after {
  content: "";
  position: absolute;
  left: -6px; right: -6px; bottom: -14px;
  height: 14px;
  background: linear-gradient(180deg, var(--shop-shelf-1), var(--shop-shelf-2));
  border-radius: 3px;
  border-bottom: 4px solid var(--shop-shelf-edge);
  box-shadow: 0 10px 14px rgba(0,0,0,0.28);
  z-index: 0;
}
/* Cards now sit on a shelf rather than hang on a hook. */
.peg-hook { display: none; }
.peg-cpap {
  width: 80%;
  margin-bottom: 6px;
}
.peg-cpap .mini-cpap {
  width: 100%;
  height: auto;
}
.peg-name {
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  color: var(--bg-inset);
  line-height: 1.1;
}
.peg-meta {
  font-size: var(--fs-xs);
  color: #5a6470;
  margin-top: 2px;
  margin-bottom: 6px;
}
.peg-id {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.85em;
  font-weight: 500;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}
.peg-display > .brand-tag {
  margin-bottom: 6px;
}

/* "Ready" listing form. Children stack vertically now that the form
   carries multiple rows (mode chips, sale input, optional rent row,
   List button) — the old row-only layout overflowed the peg card. */
.peg-listing {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-top: 4px;
  width: 100%;
}
.peg-listing input {
  width: 100%;
  background: #fff;
  color: var(--bg-inset);
  border: 1px solid var(--bg-inset);
}
.peg-listing button { padding: 4px 10px; font-size: var(--fs-xs); }
.peg-listing-sale {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* `hidden` attribute must override the explicit display:flex above —
   author rules win over the UA `[hidden]{display:none}` unless we
   reassert it ourselves. Without this, clicking the Rent / Sale chips
   wouldn't actually hide the irrelevant block. */
.peg-listing-sale[hidden],
.peg-listing-rent[hidden] { display: none !important; }

/* Inline label + input row used for "Buy $___" and "Rent $___ /day".
   The label is a small fixed-width chip on the left, the input grows
   to fill the rest of the card. */
.peg-listing-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.peg-listing-label {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  /* Peg-display has a near-white background (#fff/0.94), so the
     label needs to be a dark color — not var(--text), which is the
     light text used elsewhere on the dark app chrome. */
  color: var(--bg-inset);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  min-width: 34px;
}
.peg-listing-suffix {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  /* Same rationale as the label — dim-but-readable against the white
     peg-display background. */
  color: #3a4a5a;
}
.peg-listing-row input[type="number"] {
  flex: 1;
  min-width: 0;
  width: auto;
}
/* Sale-card price-preset chips (SC4) */
.peg-listing-presets {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.peg-listing-presets .preset-chip {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(60, 80, 110, 0.06);
  border: 1px solid rgba(60, 80, 110, 0.30);
  border-radius: 3px;
  color: #3a4a5a;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.peg-listing-presets .preset-chip:hover {
  background: rgba(60, 80, 110, 0.14);
  border-color: rgba(60, 80, 110, 0.5);
}
.peg-listing-presets .preset-chip.is-active {
  background: rgba(79, 195, 247, 0.18);
  border-color: rgba(79, 195, 247, 0.7);
  color: #1d3247;
}
.peg-listing-presets .preset-rival {
  background: rgba(232, 80, 58, 0.10);
  border-color: rgba(232, 80, 58, 0.45);
  color: #7a2a1a;
}
.peg-listing-presets .preset-rival:hover {
  background: rgba(232, 80, 58, 0.20);
}

/* "List all Ready" batch-list button in the sales tab header. */
.sales-batch-list {
  margin-left: var(--sp-3);
  padding: 6px 14px;
  font-size: var(--fs-sm);
}

/* Swing price tag — pinned just inside the top-right of the display on a
   short string, swaying gently like a boutique price ticket. Kept inside
   the card frame so it never overhangs the shelf above. */
.price-tag-store {
  position: absolute;
  top: 12px;
  right: 10px;
  background: linear-gradient(180deg, #fbe08e, var(--price-tag));
  color: #5b4410;
  font-weight: 800;
  border: 1px solid var(--price-tag-border);
  border-radius: 7px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.30);
  padding: 5px 10px 5px 14px;
  font-size: var(--fs-md);
  transform: rotate(-6deg);
  transform-origin: top center;
  z-index: 5;
  animation: priceTagSway 4.2s ease-in-out infinite;
}
.price-tag-store::before {   /* punched hole near the string */
  content: "";
  position: absolute;
  top: 7px;
  left: 6px;
  width: 5px;
  height: 5px;
  background: #5f3c22;
  border-radius: 50%;
}
.price-tag-store::after {   /* short string up to the card's top edge */
  content: "";
  position: absolute;
  top: -10px;
  left: 8px;
  width: 2px;
  height: 12px;
  background: #5f3c22;
}
@keyframes priceTagSway {
  0%, 100% { transform: rotate(-6deg); }
  50%      { transform: rotate(-1deg); }
}

/* Mode tag — mirrors the corner price tag (top-LEFT, opposite tilt) on
   any listing that's available for rent. Sale-only listings don't get
   this chip; the lone yellow price tag is signal enough. Rent-only
   shows "📅 RENT $Y/d" in amber; Both mode shows "📅 +RENT $Y/d" in
   a green-amber split so the player can scan a mixed showroom and
   tell rent-only from sale-or-rent at a glance. */
.mode-tag {
  position: absolute;
  top: -10px;
  left: -10px;
  color: var(--bg-inset);
  font-weight: 800;
  border: 2px solid #b8861a;
  border-radius: 4px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
  padding: 3px 7px;
  font-size: var(--fs-xs);
  transform: rotate(-6deg);
  z-index: 3;
  white-space: nowrap;
}
.mode-tag::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: #2a3340;
  border-radius: 50%;
}
.mode-tag-rent { background: #ffd66e; }
.mode-tag-both {
  background: linear-gradient(135deg, #ffd66e 0%, #ffd66e 48%, #b8d97a 52%, #b8d97a 100%);
  border-color: #6f8b34;
}

/* At-a-glance top-border accent on the peg-display itself, so a
   showroom of mixed listings reads as colored stripes from across
   the screen. Sale uses the brand color (existing default). */
.peg-display.is-listed.mode-rent { border-top-color: #d68f1d; }
.peg-display.is-listed.mode-both {
  border-top: 3px solid;
  border-image: linear-gradient(90deg, var(--brand-color, var(--border-strong)) 0%, var(--brand-color, var(--border-strong)) 50%, #d68f1d 50%, #d68f1d 100%) 1;
}

/* ===== customer browsers under each peg display ===== */
/* Buyers stand on the floor just in front of the display shelf, so they
   sit below the shelf board (which is at bottom:-14px) with a higher
   z-index than the shelf. */
.peg-browsers {
  position: absolute;
  bottom: -52px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  z-index: 4;
}
.peg-browsers-empty {
  font-size: 10px;
  color: #7a6850;
  font-style: italic;
}
/* Each buyer is a self-contained chip: offer pill above a little
   figure that "stands" on the floor. Because the offer is in normal
   flow (not absolutely positioned over a 22px figure) the chips no
   longer overlap or spill past the card — they space out and wrap. */
.customer-browser {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease);
}
.customer-browser:hover {
  transform: translateY(-2px);
}
.customer-browser .cb-figure {
  position: relative;
  width: 22px;
  height: 24px;
  border-radius: 5px 5px 2px 2px;
}
.customer-browser .cb-head {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: #d8b890;
  border: 1px solid #8d6e4e;
  border-radius: 50%;
}
.customer-browser .cb-offer {
  background: #fff;
  color: var(--shop-ink);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  white-space: nowrap;
  border: 1px solid #76808e;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
/* "+N more buyers" chip when the queue exceeds the preview cap. Clicking
   it falls through to the listing's offer drawer (shows the full list). */
.cb-more {
  align-self: flex-end;
  margin-bottom: 1px;
  background: rgba(255,255,255,0.92);
  color: var(--shop-ink);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 10px;
  border: 1px solid #76808e;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  cursor: pointer;
}

/* ===== offer popover (anchored next to the clicked peg-display) ===== */
/* `top` and `left` are set inline by openOfferDrawer at click-time from
   the anchor element's bounding rect; this rule just sets the look and
   the open/close transitions. */
.offer-drawer {
  position: fixed;
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: 60vh;
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--dur-mid) var(--ease),
              transform var(--dur-mid) var(--ease);
  z-index: 150;
  overflow-y: auto;
  pointer-events: none;
}
.offer-drawer.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.drawer-content { padding: var(--sp-2) var(--sp-3); }
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-2);
}
.drawer-title {
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  color: var(--text-strong);
}
.drawer-sub {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  margin-top: 2px;
}
.drawer-actions {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.drawer-actions .btn-secondary {
  padding: 4px 8px;
  font-size: var(--fs-xs);
}
.drawer-close {
  background: transparent;
  color: var(--text-dim);
  padding: 4px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
}
.drawer-close:hover {
  background: var(--bg-card);
  color: var(--text);
}
.drawer-customers {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.wear-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--premium);
  margin-bottom: 4px;
}
.wear-hint .wear-icon svg { width: 12px; height: 12px; }

/* Listing mode toggle */
.peg-listing-modes {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.peg-listing-modes .mode-chip {
  flex: 1;
  padding: 4px 6px;
  font-size: var(--fs-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.peg-listing-modes .mode-chip.is-active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
/* Rent rate + term inputs (revealed when Rent/Both is active).
   Two stacked rows: $/day input on top, then 3 term chips below
   filling the card width evenly. Stacking keeps the form inside
   the narrow peg-display card. */
.peg-listing-rent {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}
.peg-listing-rent input[type="number"] {
  width: 100%;
  min-width: 0;
}
.rent-term-chips {
  display: flex;
  gap: 4px;
}
.rent-term-chips .term-chip {
  flex: 1;
  padding: 4px 6px;
  font-size: var(--fs-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.rent-term-chips .term-chip.is-active {
  background: var(--accent-2);
  color: var(--on-accent);
  border-color: var(--accent-2);
}

.customer-row.is-renter {
  background: linear-gradient(180deg, rgba(95,163,122,0.06), transparent 60%);
}
.cust-rent-math {
  /* Wide enough that the flex space-between on each .rm-line actually
     has room to push the label and the dollar value apart. */
  min-width: 150px;
  font-size: var(--fs-micro);
  color: var(--text-dim);
  text-align: right;
  line-height: 1.35;
}
.cust-rent-math .rm-line {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.cust-rent-math .rm-total {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-weight: var(--fw-bold);
  font-size: var(--fs-xs);
}
.cust-rent-math .rm-hint {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
  color: var(--text-dim);
  font-style: italic;
  font-size: var(--fs-micro);
}

/* Rented machines stay visible on the showroom as a greyed-out peg
   with a centered overlay so the player knows the slot is theirs but
   the unit is currently out with a customer. */
.peg-display.is-rented {
  /* Greyed enough to read as "inactive slot" but not so much that the
     machine name and test score become unreadable. */
  opacity: 0.72;
  filter: grayscale(0.3);
}
.peg-rented-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(8,16,24,0.35);
  border-radius: inherit;
}
.peg-rented-overlay .pro-badge {
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  color: #ffd66e;
  text-shadow: 0 2px 4px rgba(0,0,0,0.7);
}
.peg-rented-overlay .pro-sub {
  font-size: var(--fs-xs);
  color: #e6e6e6;
  margin-top: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}

/* ===========================================================
   Collector customer card — gold border + ✨ Collector inline
   badge. Spawned only on listings that still carry custom
   parts; pays a clear premium.
   =========================================================== */
.customer-row.is-collector {
  background: linear-gradient(180deg, rgba(249,200,80,0.10), rgba(249,200,80,0.02));
  box-shadow: 0 0 0 1px rgba(249,200,80,0.30), 0 6px 14px rgba(0,0,0,0.35);
}
.customer-row.is-collector .cust-icon {
  box-shadow: 0 0 0 1px rgba(249,200,80,0.55);
}
.cust-collector-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 1px 6px 1px 5px;
  border-radius: 3px;
  background: linear-gradient(180deg, #f8d36a 0%, #d99b2a 100%);
  color: #3a2a05;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.45);
  vertical-align: 2px;
}

/* Counter-offer inline input — sits under the customer row when the
   player clicks Counter. Hidden by default; revealed by the toggle. */
.cust-counter-input {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}
.cust-counter-input input {
  flex: 1;
  min-width: 70px;
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-sm);
}
.cust-counter-input button { padding: 4px 10px; font-size: var(--fs-sm); }

/* Regular customer chip — sits next to the buyer's name when c.isRegular
   is true. Smaller and less ornate than the Collector badge so the two
   read as different things. */
.cust-regular-chip {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(120, 200, 255, 0.18);
  border: 1px solid rgba(120, 200, 255, 0.45);
  color: #c8e6ff;
  vertical-align: 2px;
}

/* ===========================================================
   Parent customer treatment (parent_buyer / parent_renter)
   ─────────────────────────────────────────────────────────────
   Dedicated chip on the name line + structured child sub-line
   below the blurb + a soft pink left-edge accent on the card.
   The chip pulls "Worried Parent" out of the blurb prefix; the
   sub-line surfaces the spawn-time childName / childAge /
   condition fields so the player can scan the case at a glance.
   =========================================================== */
.customer-row.is-parent {
  border-left-color: #d97a9c;
  background: linear-gradient(90deg, rgba(217,122,156,0.06), transparent 35%);
}
.cust-parent-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 8px;
  background: rgba(217, 122, 156, 0.15);
  border: 1px solid rgba(217, 122, 156, 0.45);
  border-radius: 10px;
  color: #f0c2d3;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  vertical-align: 1px;
}
.cust-child-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 4px 10px;
  background: rgba(217, 122, 156, 0.08);
  border-left: 2px solid rgba(217, 122, 156, 0.55);
  border-radius: 3px;
  color: #f0c2d3;
  font-size: var(--fs-xs);
  line-height: 1.35;
}
.cust-child-line .cl-icon { font-size: 14px; }
.cust-child-line .cl-name { font-weight: 700; color: #fff; }
.cust-child-line .cl-age  { color: #d97a9c; font-weight: 600; }
.cust-child-line .cl-cond { color: var(--text-dim); font-style: italic; }
.cust-child-line .cl-cond::before { content: "— "; opacity: 0.6; }


/* SOLD! rubber-stamp pop for marquee-tier sales (Phase 2 P2.5).
   Rotated red ink stamp that crashes onto the peg-display, holds,
   then fades. Echoes the workshop's other stamp/postit aesthetic. */
.sold-stamp {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) rotate(-12deg) scale(0);
  font-family: "Impact", "Arial Black", sans-serif;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 3px;
  color: rgba(232, 80, 58, 0.92);
  text-shadow: 1px 1px 0 rgba(120, 20, 12, 0.45);
  border: 4px solid rgba(232, 80, 58, 0.85);
  padding: 4px 14px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
  z-index: 50;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
  animation: soldStamp 1.4s cubic-bezier(.34,1.56,.64,1) forwards;
  opacity: 0;
}
@keyframes soldStamp {
  0%   { transform: translateX(-50%) rotate(-12deg) scale(2.4); opacity: 0; }
  15%  { transform: translateX(-50%) rotate(-12deg) scale(1.0); opacity: 1; }
  70%  { transform: translateX(-50%) rotate(-12deg) scale(1.0); opacity: 1; }
  100% { transform: translateX(-50%) rotate(-12deg) scale(1.0); opacity: 0; }
}

/* Reputation-gate warning chip on listed peg-displays. Tells the
   player why their high-end listing is silent — model has a
   minCustomerRepTier above their current reputation. Amber sticker
   styling, pinned to the top of the peg-display. */
.peg-display .peg-rep-warn {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  background: linear-gradient(180deg, #f6c84a, #d39314);
  color: #2a1f08;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid #8a5e0e;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  z-index: 6;
  pointer-events: auto;
  cursor: help;
  /* Reuse the existing price-swing micro-animation so the chip feels
     pinned-on rather than statically placed. */
  animation: repWarnIdle 3.4s ease-in-out infinite;
  transform-origin: top center;
}
@keyframes repWarnIdle {
  0%, 100% { transform: translateX(-50%) rotate(-2deg); }
  50%      { transform: translateX(-50%) rotate(-3.5deg); }
}

/* Boutique idle motion (OPEN sign + swing price tags) is decorative —
   hold it still for players who prefer reduced motion. The tags keep
   their resting tilt so they still read as hanging tickets. */
@media (prefers-reduced-motion: reduce) {
  .shop-open-sign,
  .price-tag-store { animation: none; }
}

/* Responsive: the 220px-min shelf track overflows the narrow boutique
   interior (leftnav stays 160px) below ~480px, clipping each card's right
   edge against the shop frame. Drop to a single column that tracks the
   interior width. */
@media (max-width: 480px) {
  .peg-wall-grid { grid-template-columns: 1fr; gap: 56px 0; }
}
