/* Affiliate page (owner only): stats, buy / bargain preview, trades, offers, history */
.aff-stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.section-title .st-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chip.kind { min-width: 62px; justify-content: center; }
/* History: a native disclosure, its section title is the summary */
.aff-hist summary { justify-content: flex-start; list-style: none; cursor: pointer; border-radius: 8px; -webkit-tap-highlight-color: transparent; }
.aff-hist:not([open]) summary { margin-bottom: 0; }
.aff-hist summary::-webkit-details-marker { display: none; }
.aff-hist summary::before { content: ""; width: 7px; height: 7px; margin: 0 4px 0 2px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .2s var(--ease); }
.aff-hist[open] summary::before { transform: translateY(-2px) rotate(45deg); }
.aff-hist summary:hover h2 { color: var(--accent); }
.aff-hist summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.modal-body .box.aff-lines { white-space: pre-line; font-variant-numeric: tabular-nums; }

/* item thumbnails (itemThumb): fixed box, neutral placeholder when there is no image */
.thumb {
  flex: none; display: inline-grid; place-items: center; overflow: hidden; border-radius: 7px;
  background: radial-gradient(circle at 50% 40%, #262a31, var(--surface-2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
}
.thumb img { max-width: 94%; max-height: 94%; object-fit: contain; }
.item-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.item-text { min-width: 0; }
.item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-cell .small { font-size: 11.5px; }
.state-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
td .state-cell .small { font-size: 11.5px; }
td.result { white-space: normal; min-width: 160px; max-width: 320px; }
.result-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.result-cell .err { color: var(--neg); font-size: 12.5px; line-height: 1.4; overflow-wrap: anywhere; }
.result-cell .err.warn-text { color: var(--warn); }

/* links out to CSFloat, copyable float */
.item-link { color: inherit; text-decoration: none; transition: color .15s; }
.item-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.item-link:focus-visible, .copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.copy { padding: 0; border: 0; background: none; color: var(--text); cursor: copy; }
.copy:hover { color: var(--accent); }

/* lookup + preview */
.lookup-err { color: var(--neg); font-size: 12.5px; margin-top: 8px; }
.lookup-err:empty { display: none; }
.pv-info { padding: 10px 12px; border-radius: 8px; color: var(--accent); background: rgba(138, 180, 255, .07); border: 1px solid rgba(138, 180, 255, .25); }
.pv-info .link-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.bought { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 8px; color: var(--pos); background: rgba(62, 207, 142, .08); border: 1px solid rgba(62, 207, 142, .25); font-weight: 500; }
.lookup { display: flex; gap: 8px; }
.lookup input { flex: 1; }
.preview { display: flex; gap: 24px; margin-top: 18px; padding-top: 20px; border-top: 1px solid var(--border); animation: rise .3s var(--ease) both; }
.big-thumb {
  flex: none; width: 260px; height: 195px; border-radius: 12px;
  background: radial-gradient(circle at 50% 42%, #2a2f37, var(--surface-2) 70%);
  display: grid; place-items: center; overflow: hidden;
}
.big-thumb img { max-width: 90%; max-height: 90%; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .45)); }
.pv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.preview .name { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.preview .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -4px; }
.pv-warn { padding: 10px 12px; border-radius: 8px; color: var(--warn); background: rgba(232, 176, 75, .08); border: 1px solid rgba(232, 176, 75, .3); }
.pv-warn strong { font-weight: 600; }

.float { max-width: 420px; }
.float-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.fbar { position: relative; display: flex; height: 6px; border-radius: 3px; overflow: visible; gap: 2px; }
.fbar .band { height: 100%; background: var(--surface-3); border-radius: 2px; }
.fbar .band.on { background: rgba(138, 180, 255, .45); }
.fbar .mark {
  position: absolute; top: -4px; width: 3px; height: 14px; margin-left: -1.5px; border-radius: 2px;
  background: var(--text); box-shadow: 0 0 0 2px var(--surface);
}

.pv-prices { display: flex; gap: 28px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.pv-prices .label { color: var(--muted); font-size: 12px; }
.pv-prices .big { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.pv-prices > div > div:last-child:not(.big) { margin-top: 6px; }

.buy-actions { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-start; margin-top: 4px; }
.buy-btn { min-height: 38px; }
.offer-form { display: flex; flex-direction: column; gap: 8px; }
.offer-row { display: flex; gap: 8px; }
.quick { display: flex; gap: 4px; flex-wrap: wrap; }
.quick .btn { border-color: var(--border); }
.readout { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--muted); min-height: 19px; }
.money-input { position: relative; display: flex; align-items: center; }
.money-input span { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.money-input input { padding-left: 22px; width: 140px; }

@media (max-width: 720px) {
  .aff-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .big-thumb:empty { display: none; }
  .section-title .seg { width: 100%; }
  .preview { flex-direction: column; gap: 16px; }
  .big-thumb { width: 100%; height: 200px; }
  .lookup { flex-wrap: wrap; }
  .lookup input { flex: 1 1 200px; }
  .buy-actions, .buy-btn, .offer-form { width: 100%; }
  .money-input { flex: 1 1 120px; }
  .money-input input { width: 100%; }
  .quick .btn { flex: 1; }
  .item-name { white-space: normal; }
  .aff-hist summary { min-height: 40px; }
  /* compact rows (base.css .dt-x): price + status chip under the item, Cancel offer at the right; the meaning line shows on expand */
  .aff-dt .table-wrap tr[aria-expanded="false"] { align-items: center; }
  .aff-dt .table-wrap tr[aria-expanded="false"] .state-cell .small { display: none; }
  .aff-dt .table-wrap td.act { margin-left: auto; }
  .aff-dt .table-wrap td.result { flex: 1 1 100%; }
  .table-wrap td.result { max-width: none; }
}
