dialog[data-kind="trades"] {
  --deal-ink: #203e32;
  --deal-line: #d0d4c7;
  --deal-paper: #fffdf4;
  --give-ink: #81432f;
  --take-ink: #285743;
  --give-tint: #f6e9da;
  --take-tint: #e7efdf;
  width: min(980px, calc(100% - 28px));
  max-width: 100%;
  max-height: min(960px, calc(100dvh - 28px));
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid var(--deal-line);
  border-radius: 24px;
}
dialog[data-kind="trades"] .modal-head {
  margin-bottom: 22px;
}
#tradeBody .trade-peers {
  gap: 7px;
  min-width: 0;
  margin-bottom: 15px;
}
.trade-peers legend {
  padding: 0;
  margin: 0 0 8px;
  font: 700 17px/1.2 var(--serif);
}
.trade-peers label {
  flex-direction: row-reverse;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  max-width: 100%;
  padding: 5px 12px 5px 8px;
  border-radius: 100px;
  border-color: transparent;
  background: #efeee5;
}
.trade-peers .participant { gap: 5px; font-size: 14px; }
.trade-peers .participant img { width: 29px; height: 29px; }
.trade-peers input {
  position: static;
  flex: none;
  appearance: auto;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  opacity: 1;
  accent-color: var(--take-ink);
}
.trade-peers label:has(:checked) {
  border-color: var(--take-ink);
  background: #f3f4ec;
  box-shadow: none;
}
.trade-exchange {
  margin: 0;
  border: 0;
  background: transparent;
}
.trade-tabs {
  display: flex;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid var(--deal-line);
}
.trade-tabs button {
  position: relative;
  min-height: 44px;
  padding: 9px 14px;
  border: 0;
  border-radius: 0;
  font: 650 16px/1.2 var(--sans);
  color: #566055;
  background: transparent;
}
.trade-tabs button[aria-selected="true"] {
  color: #262d29;
  background: transparent;
}
.trade-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 10px -1px;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
}
.trade-tabs button:focus-visible { outline-offset: -4px; }
.trade-panel {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(18px, 3vw, 38px);
  padding: clamp(16px, 2.5vw, 25px) 0;
}
.trade-lots {
  display: grid;
  max-height: 315px;
  padding: 2px;
}
.trade-exchange .trade-lot {
  grid-template-columns: 17px minmax(0, 1fr) auto 18px;
  gap: 9px;
  min-height: 47px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-bottom-color: #d8dbd0;
  border-radius: 0;
  background: transparent;
  color: var(--deal-ink);
  font: 600 14px/1.2 var(--sans);
}
.trade-exchange button.trade-lot {
  grid-template-columns: 17px minmax(0, 1fr) auto;
}
.trade-lot > * { grid-row: 1; }
.trade-lot > i {
  grid-column: 1;
  position: relative;
  display: block;
  width: 15px;
  height: 20px;
  border: 1px solid #94a18d;
  border-top: 6px solid var(--lot);
  border-radius: 2px;
  background: #fffcf1;
}
.trade-lot > i::after {
  content: "";
  position: absolute;
  inset: 3px 2px auto;
  height: 2px;
  border-block: 1px solid #8b9986;
}
.trade-lot > span { grid-column: 2; overflow-wrap: anywhere; }
.trade-exchange .trade-lot b {
  grid-column: 3;
  font: 700 13px/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
}
.trade-lot > input {
  grid-column: 4;
  width: 17px;
  height: 17px;
  padding: 0;
  accent-color: var(--take-ink);
}
.trade-lot small { margin-top: 2px; color: #80583a; font-size: 12px; }
.trade-exchange .trade-lot.located {
  background: #eeefe6;
  border-radius: 9px;
  border-color: transparent;
}
.trade-exchange .trade-lot:has(:checked) {
  border-radius: 9px;
  border-color: var(--deal-ink);
  background: #eef2e8;
  box-shadow: inset 0 0 0 1px var(--deal-ink);
}
.trade-exchange .trade-lot:has(:disabled) {
  background: transparent;
  color: #62685d;
  cursor: default;
}
.trade-exchange .trade-lot:focus-visible,
.trade-exchange .trade-lot:has(:focus-visible) {
  outline: 2px solid #8e6428;
  outline-offset: -2px;
}
.trade-lots .muted-note {
  margin: 0;
  padding: 10px 0;
  border: 0;
  text-align: left;
  font-size: 14px;
}
.trade-picks .money-label {
  display: flex;
  margin: 12px 2px 5px;
  font: 650 14px var(--sans);
}
.trade-picks .money-label small { color: #5c6759; font-size: 12px; }
.trade-picks input[type="number"] {
  min-height: 44px;
  border-radius: 12px;
  padding-inline: 12px;
  font: 650 16px var(--sans);
}
.trade-map-column { align-self: center; }
.trade-map {
  width: min(100%, 410px);
  max-width: none;
  border-color: #55664f;
  background: #b5beaa;
}
.trade-map .map-square.located {
  z-index: 1;
  outline: 0;
}
.trade-map .map-square.located::before {
  inset: 2px;
  border: 1px dashed #253729;
  background: #ffffff27;
}
.trade-map .map-square[data-picked] {
  z-index: 2;
  outline: 2px solid #1b2f25;
  outline-offset: -1px;
  box-shadow: inset 0 0 0 3px #fffdf5;
}
.trade-map .map-square[data-picked]::before { content: none; }
.trade-map .map-square[data-picked]::after {
  display: grid;
  place-items: center;
  width: clamp(13px, 1.3vw, 18px);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #fffdf5;
  background: #1b2f25;
  color: #fffdf5;
  font: 700 clamp(10px, 1.1vw, 13px)/1 var(--sans);
}
.trade-map .map-square:focus-visible {
  z-index: 3;
  outline: 3px solid #945421;
  outline-offset: 2px;
}
@media (forced-colors: active) {
  .trade-map .map-square[data-picked] { outline: 3px solid Highlight; }
  .trade-map .map-square:focus-visible { outline: 3px dashed CanvasText; }
}
.trade-map-center { position: relative; background: #eff0e3; }
.trade-map-center img {
  position: absolute;
  opacity: .42;
  pointer-events: none;
}
.trade-map-center:has(.trade-lot-info:not(:empty)) img { opacity: .08; }
.trade-lot-info {
  position: relative;
  align-self: center;
  width: 100%;
  max-height: 100%;
  padding: clamp(7px, 1.5vw, 17px);
  overflow: auto;
  scrollbar-width: thin;
}
.trade-lot-info:empty { display: none; }
.trade-lot-info h4 {
  align-items: stretch;
  margin: 0 0 5px;
  font: 700 clamp(16px, 2vw, 23px)/1.14 var(--serif);
  overflow-wrap: anywhere;
}
.trade-lot-info h4 i { height: auto; min-height: 16px; }
.trade-exchange .trade-lot-info dl { gap: 4px; }
.trade-lot-info dl > div {
  flex-wrap: nowrap;
  font: 500 clamp(12px, 1.4vw, 14px)/1.3 var(--sans);
}
.trade-lot-info dd { flex: none; }
.trade-lot-info .trade-mortgage {
  margin: 4px 0 0;
  color: #724327;
  font: 650 12px/1.25 var(--sans);
}
.trade-totals {
  gap: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  border-top: 1px solid var(--deal-line);
  border-radius: 0;
  background: transparent;
}
.trade-totals > div, .trade-totals > div + div {
  padding: 13px 8px 4px;
  border-radius: 0;
  background: transparent;
  color: var(--deal-ink);
}
.trade-totals > div > span { font: 650 13px/1.2 var(--sans); }
.trade-totals strong {
  margin: 2px 0 5px;
  font: 700 clamp(21px, 3vw, 25px)/1.1 var(--serif);
  font-variant-numeric: tabular-nums;
}
.trade-totals small {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: #495347;
  font-size: 12px;
}
.trade-totals small span { white-space: nowrap; }
.trade-cash { margin: 10px 2px 0; font-size: 14px; }
#tradeBody .offer-card {
  padding: 0 0 20px;
  margin: 0 0 20px;
  border: 0;
  border-bottom: 1px solid var(--deal-line);
  border-radius: 0;
  background: transparent;
}
.offer-card h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
}
.offer-title small { display: block; font: 600 12px/1.2 var(--sans); color: #52634f; }
.offer-title .participant { font: 700 18px/1.15 var(--serif); }
.offer-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--take-ink);
  border-radius: 50%;
  color: var(--take-ink);
  background: var(--take-tint);
}
.offer-card[data-direction="sent"] .offer-mark {
  border-color: var(--give-ink);
  color: var(--give-ink);
  background: var(--give-tint);
}
.offer-actions { margin-top: 12px; }
.offer-actions button, #tradeForm .modal-primary {
  min-height: 44px;
  border-radius: 14px;
}
@media (max-width: 640px) {
  dialog[data-kind="trades"] {
    width: calc(100% - 12px);
    max-height: calc(100dvh - 12px);
    padding: 18px 13px;
    border-radius: 18px;
  }
  .trade-panel { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .trade-map { width: min(100%, 360px); }
  .trade-lots { max-height: 210px; }
  .trade-tabs button { flex: 1; }
}

