/*
 * Marks, trade offers, trade deliveries and auctions (client/commerce.ts), and the auction chat card
 * (client/chat.ts). client/main.ts loads this after style.css and hud.css: these rules reuse the
 * inventory screen's variables (--mc-px, --mc-slot, --mc-panel-ink) and override its generic slot
 * rules, and keeping them apart gives commerce presentation one owner.
 */
/* The inventory's Marks line wraps inside the width the slots set instead of widening the screen. */
#inventory .commerce-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mc-px);
  width: 0;
  min-width: 100%;
  margin: calc(2 * var(--mc-px)) 0;
}
:is(#inventory, #commerce-panel) .commerce-marks {
  margin-right: auto;
  color: var(--mc-panel-ink);
}
#commerce-panel {
  width: calc(176 * var(--mc-px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 6 * var(--mc-px));
  overflow: auto;
}
:is(#inventory, #commerce-panel) .commerce p {
  margin: calc(2 * var(--mc-px)) 0;
  line-height: 1.5;
}
:is(#inventory, #commerce-panel) .commerce-tabs,
:is(#inventory, #commerce-panel) .commerce-toolbar,
:is(#inventory, #commerce-panel) .commerce-actions,
:is(#inventory, #commerce-panel) .commerce-bid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mc-px);
  margin: calc(2 * var(--mc-px)) 0;
}
:is(#inventory, #commerce-panel) .commerce-toolbar > span {
  margin-right: auto;
}
:is(#inventory, #commerce-panel) .commerce-wallet,
:is(#inventory, #commerce-panel) .commerce-terms {
  color: var(--mc-panel-ink);
}
:is(#inventory, #commerce-panel) .commerce-note {
  color: #555555;
}
:is(#inventory, #commerce-panel) .commerce-hint,
:is(#inventory, #commerce-panel) .commerce-status.error {
  color: #a02020;
}
:is(#inventory, #commerce-panel) .commerce-confirm {
  flex-basis: 100%;
  color: #202020;
}
:is(#inventory, #commerce-panel) .commerce-status:empty {
  display: none;
}
:is(#inventory, #commerce-panel) .commerce-list {
  display: grid;
  gap: var(--mc-px);
  margin: calc(2 * var(--mc-px)) 0;
  padding: 0;
  list-style: none;
}
:is(#inventory, #commerce-panel) .commerce-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0 calc(3 * var(--mc-px));
  width: 100%;
  text-align: left;
}
:is(#inventory, #commerce-panel) .commerce-row > span:nth-child(2) {
  text-align: right;
}
:is(#inventory, #commerce-panel) .commerce-lot {
  display: flex;
  align-items: center;
  gap: calc(2 * var(--mc-px));
}
:is(#inventory, #commerce-panel) .commerce-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
}
:is(#inventory, #commerce-panel) .commerce .item-icon {
  width: calc(12 * var(--mc-px));
  height: calc(12 * var(--mc-px));
}
:is(#inventory, #commerce-panel) .commerce-lot-entries {
  display: grid;
  gap: var(--mc-px);
}
:is(#inventory, #commerce-panel) .commerce-entry {
  display: flex;
  align-items: flex-start;
  gap: calc(2 * var(--mc-px));
  min-width: 0;
}
:is(#inventory, #commerce-panel) .commerce-lot-entries > .commerce-entry,
:is(#inventory, #commerce-panel) .commerce-delivery {
  padding: var(--mc-px) calc(2 * var(--mc-px));
  background: #b8b8b8;
}
:is(#inventory, #commerce-panel) .commerce-entry b {
  font-weight: 400;
  color: #202020;
}
:is(#inventory, #commerce-panel) .commerce-entry b.named {
  font-style: italic;
}
:is(#inventory, #commerce-panel) .commerce-entry span {
  display: block;
  color: #555555;
}
:is(#inventory, #commerce-panel) .commerce-delivery {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--mc-px) calc(3 * var(--mc-px));
}
:is(#inventory, #commerce-panel) .commerce-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--mc-px) calc(4 * var(--mc-px));
  margin: calc(3 * var(--mc-px)) 0;
}
:is(#inventory, #commerce-panel) .commerce-facts dt {
  color: #555555;
}
:is(#inventory, #commerce-panel) .commerce-facts dd {
  margin: 0;
  color: #202020;
}
:is(#inventory, #commerce-panel) .commerce input[type='text'],
:is(#inventory, #commerce-panel) .commerce input[type='number'] {
  border: 0;
  border-radius: 0;
  background: #000000;
  box-shadow: 0 0 0 var(--mc-px) #a0a0a0;
  color: #f0f0f0;
  font-family: inherit;
  font-size: var(--mc-font-half);
  padding: var(--mc-px) calc(2 * var(--mc-px));
  margin: 0 var(--mc-px);
}
:is(#inventory, #commerce-panel) .commerce input[type='number'] {
  width: calc(16 * var(--mc-px));
}
/* Uses left on a requested tool: up to four digits (a diamond tool has 1,561). */
:is(#inventory, #commerce-panel) .commerce input[type='number'].commerce-uses {
  width: calc(26 * var(--mc-px));
}
:is(#inventory, #commerce-panel) .commerce-amount {
  width: calc(44 * var(--mc-px));
}
/* The listing form's bag: the inventory screen's slot geometry, with a picked stack framed. */
:is(#inventory, #commerce-panel) .commerce-grid {
  display: grid;
  grid-template-columns: repeat(9, var(--mc-slot));
  width: max-content;
}
:is(#inventory, #commerce-panel) .commerce-grid + .commerce-grid {
  margin-top: calc(4 * var(--mc-px));
}
:is(#inventory, #commerce-panel) .commerce-grid .slot {
  box-sizing: border-box;
  width: var(--mc-slot);
  height: var(--mc-slot);
  min-width: 0;
  padding: var(--mc-px);
}
:is(#inventory, #commerce-panel) .commerce-grid .slot .item-icon {
  width: calc(15 * var(--mc-px));
  height: calc(15 * var(--mc-px));
}
:is(#inventory, #commerce-panel) .commerce-grid .stack-count {
  right: var(--mc-px);
  bottom: 0;
  font-size: var(--mc-font);
  line-height: 1;
  color: #ffffff;
  text-shadow: var(--mc-px) var(--mc-px) 0 #3f3f3f;
}
:is(#inventory, #commerce-panel) .commerce-grid .slot.picked {
  border-color: #fcf5aa #6b6b6b #6b6b6b #fcf5aa;
  background: #6e6e6e;
}
:is(#inventory, #commerce-panel) .commerce-grid .slot:disabled {
  cursor: default;
}

/* Auction cards (spec 19): server-only events, so their accent and button can never come from typed chat. */
.chat-line.chat-auction > b {
  color: #8a6a1f;
}
.chat-line.chat-auction > b::after {
  content: '';
}
.chat-auction-view {
  flex: none;
  font: inherit;
  font-size: 11px;
  padding: 0 6px;
  color: #2f4234;
  background: #dfe5cf;
  border: 1px solid #9aa58c;
  border-radius: 0;
  cursor: pointer;
}
.chat-auction-view:hover {
  background: #eef2e0;
}
/* The log only takes clicks while chat is open, so the button is shown only then. */
.chat-layer:not(.active) .chat-auction-view {
  display: none;
}

/* Direct trade offers: section headings, and You give beside You receive for an easy comparison. */
:is(#inventory, #commerce-panel) .commerce-heading {
  margin: calc(3 * var(--mc-px)) 0 var(--mc-px);
  font-size: inherit;
  font-weight: 400;
  color: #202020;
}
:is(#inventory, #commerce-panel) .commerce-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(4 * var(--mc-px));
  margin: calc(2 * var(--mc-px)) 0;
}
:is(#inventory, #commerce-panel) .commerce-side {
  display: grid;
  align-content: start;
  gap: var(--mc-px);
}
:is(#inventory, #commerce-panel) .commerce-side > .commerce-entry {
  padding: var(--mc-px) calc(2 * var(--mc-px));
  background: #b8b8b8;
}
:is(#inventory, #commerce-panel) .commerce-recipient {
  margin-right: auto;
  color: #202020;
}
@media (max-width: 640px) {
  :is(#inventory, #commerce-panel) .commerce-sides {
    grid-template-columns: minmax(0, 1fr);
  }
}
:is(#inventory, #commerce-panel) .commerce-field {
  display: block;
  margin: var(--mc-px) 0;
}
