/* Trades, Activities and Sales: list pages of the redesign. */

/* Page head like the mock: title, one-line description, the page action on the right. */
:is(#trades-view, #activities-view, #sales-view) > .page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 14px;
}
:is(#trades-view, #activities-view, #sales-view) > .page-header > div:first-child {
  flex: 1 1 320px;
  min-width: 0;
}
:is(#trades-view, #activities-view, #sales-view) > .page-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
:is(#trades-view, #activities-view, #sales-view) > .page-header > div:first-child > .muted {
  display: block;
  margin: 3px 0 0;
  font-size: 12.5px;
}
:is(#trades-view, #activities-view, #sales-view) > .page-header > .button {
  margin: 0;
}

/* Filters at the top of a table card: search, pickers and Clear in one wrapping row. */
.list-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.list-filters > label {
  margin: 0;
}
.list-filters .search {
  flex: 1 1 200px;
  max-width: 320px;
  margin: 0;
}
/* Text fields only: an on/off switch keeps its own 34x20 size. */
.list-filters input:not(.sx-switch),
.list-filters .inventory-select-trigger {
  height: 30px;
  min-height: 30px;
  font-size: 12px;
}
.list-filters .toolbar-select > span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.list-filters .toolbar-select .inventory-select-trigger {
  min-width: 170px;
  font-size: 12.5px;
}
.list-filters--status {
  justify-content: space-between;
}
.list-filters--status .price-toolbar {
  margin-left: auto;
}
.list-filters > label[hidden] {
  display: none;
}

/* Pager under a table: summary text, then Previous and Next, on the right. */
:is(.trades-card, .sales-card, .activities-panel) > .pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
:is(.trades-card, .sales-card) > .pagination[hidden] {
  display: none;
}

/* The Workspace column only means something in All workspaces. */
body:not(.all-workspaces) :is(#trades-table, #sales-table) :is(.workspace-column, .workspace-cell),
body:not(.all-workspaces) #home-offers-table thead th:nth-child(2),
body:not(.all-workspaces) #home-offers-table .workspace-cell {
  display: none;
}

/* Awaiting 2FA approval: queue rows like the Home queue, with a Send or Sale tag. */
.send-approvals {
  margin-bottom: 14px;
}
.send-approvals .approval-kind {
  margin-right: 2px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 16px;
  text-transform: uppercase;
  vertical-align: 1px;
}

/* Approval dialog: items as rows, today's sends in a summary box, actions on the right. */
#send-approval-dialog .dialog__head .eyebrow {
  margin: 0 0 4px;
}
#send-approval-dialog .dialog__head h2 {
  font-size: 19px;
}
.approval-body .approval-summary {
  margin: 0;
  font-size: 13px;
}
.approval-body .approval-id {
  margin: 2px 0 0;
  font-size: 12px;
}
.approval-items {
  display: flex;
  flex-direction: column;
  margin: 10px 0 0;
  padding: 0;
}
.approval-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-height: 36px;
  padding: 6px 4px;
  border-bottom: 1px solid #2c2c2c;
  font-size: 12.5px;
}
.approval-item__text {
  flex: 1 1 220px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.approval-item__warning {
  display: block;
  font-size: 0.95em;
  line-height: 1.35;
}
.approval-item .approval-sale-price {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.approval-item .approval-sale-price input {
  width: 110px;
  margin: 0;
}
.approval-sale {
  margin-top: 12px;
}
.approval-usage {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid #333;
  border-radius: 8px;
  background: var(--admin-field, #1a1a1a);
  font-size: 12.5px;
}
.approval-usage[hidden] {
  display: none;
}
.approval-body .approval-note {
  margin: 10px 0 0;
  font-size: 12px;
}
.approval-body .approval-code {
  margin-top: 12px;
}
.approval-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Activities: the pager is a single Show more on the right. */
.activities-panel .list-filters .activities-help {
  font-size: 11.5px;
}
.activities-panel > .activities-more {
  display: flex;
  justify-content: flex-end;
}
.activities-panel > .activities-more:has(> button[hidden]) {
  display: none;
}

/* Sales: one row per marketplace connection, then three totals. */
.sales-providers {
  margin-bottom: 14px;
}
.sales-providers .table-card__head small {
  display: block;
  margin-top: 3px;
}
#sales-view .sales-connections {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 12px;
}
#sales-view .sales-connection {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 4px;
  border-bottom: 1px solid #2c2c2c;
  font-size: 12.5px;
}
#sales-view .sales-connection:last-child {
  border-bottom: 0;
}
.sales-connection__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sales-connection__text strong {
  font-weight: 550;
}
.sales-connection__detail {
  margin-left: 8px;
  font-size: 11px;
}
.sales-connections__empty {
  margin: 0;
  padding: 12px 4px;
  font-size: 12.5px;
}
#sales-view .sales-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}
#sales-view .sales-stats .stat-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: none;
  padding: 14px 16px;
  border-radius: 12px;
}
#sales-view .sales-stats .stat-card__label {
  color: #bdbdbd;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
#sales-view .sales-stats .stat-card__value {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
#sales-view .sales-stats .stat-card__detail {
  margin: 4px 0 0;
  color: #9c9c9c;
  font-size: 12px;
}
.sales-item__wear {
  margin-left: 8px;
  font-size: 11px;
}
.sales-purchase .text-link {
  margin-left: 8px;
  font-size: 11px;
}
@media (max-width: 760px) {
  #sales-view .sales-stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .list-filters .toolbar-select .inventory-select-trigger {
    min-width: 0;
  }
  .send-approvals .queue-row__actions {
    flex-wrap: wrap;
  }
}
#send-approval-dialog .approval-code input {
  height: 34px;
  min-height: 34px;
}
.sales-providers .table-card__head small {
  margin-left: 0;
}
#sales-view .sales-connection .button {
  height: 28px;
  min-height: 28px;
  padding: 0 12px;
}
/* Purchase, Status and Sold read left to right; only Float and Net are numeric. */
#sales-view #sales-table th:nth-child(n + 7) {
  text-align: left;
}
.activities-panel .activities-columns {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Trades table fits the page like the mock: one state badge, the bot name (ID in its title), the
   protection countdown in the badge title; price columns follow Updated. */
#trades-table .offer-countdown,
#trades-table .bot-identity__login {
  display: none;
}
#trades-table .trade-origin__actor {
  display: inline-block;
  max-width: 150px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Offer panel notices in the mock's tones: amber by default, blue for what waits on you, red for
   failures. */
#offer-detail-dialog .side-panel__notice--info,
#offer-detail-content .offer-notice--info {
  border-color: #48607f;
  background: rgb(178 203 237 / 6%);
  color: #b2cbed;
}
#offer-detail-dialog .side-panel__notice--danger {
  border-color: #7d4a4d;
  background: rgb(237 170 170 / 6%);
  color: #f0b4b4;
}
#offer-detail-content .offer-notice {
  margin: 0;
  padding: 9px 12px;
  border-width: 1px;
  border-style: solid;
  border-radius: 8px;
  font-size: 12.5px;
}

/* Offer items show recorded purchase amounts beside current market estimates. */
#offer-detail-content .offer-items {
  width: 100%;
  max-width: none;
  margin: 8px 0 0;
}
#offer-detail-content .offer-items__heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}
.offer-items__totals {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  margin: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.offer-items__totals dt {
  color: var(--muted);
}
.offer-items__totals dd {
  margin: 0;
  text-align: right;
}
.offer-items__net {
  color: #8a8a8a;
  font-variant-numeric: tabular-nums;
}
.offer-items__rows {
  display: flex;
  flex-direction: column;
}
.offer-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 4px;
  border-bottom: 1px solid #2c2c2c;
  font-size: 12.5px;
}
.offer-item-row__copy {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.offer-item-row__name {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text, #e7e7e7);
  font: inherit;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}
button.offer-item-row__name:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.offer-item-row__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.offer-item-row__title .offer-item-row__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* One-click copy icon next to item and bot names (copy-name.js). */
.copy-name {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border-radius: 4px;
  color: #8a8a8a;
  vertical-align: middle;
  cursor: pointer;
}
.copy-name svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.copy-name:hover,
.copy-name:focus-visible {
  background: #2f2f2f;
  color: var(--text, #e7e7e7);
}
.copy-name:focus-visible {
  outline: 1px solid #5a5a5a;
}
.copy-name--copied,
.copy-name--copied:hover {
  color: #7fd19b;
}
.offer-item-row__facts {
  display: inline;
  margin-left: 8px;
  color: #a3a3a3;
  font-size: 11px;
}
.offer-item-row__side {
  flex: none;
  color: #8a8a8a;
  font-size: 12px;
}
.offer-item-row__amounts {
  flex: 0 1 auto;
  min-inline-size: 0;
  max-inline-size: 62%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.offer-item-row__cost {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px 8px;
  overflow-wrap: anywhere;
}
.offer-item-row__cost-label {
  color: var(--muted);
}
@media (max-width: 480px) {
  .offer-item-row--purchase {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .offer-item-row--purchase .offer-item-row__copy {
    flex-basis: 100%;
  }
  .offer-item-row__amounts {
    max-inline-size: none;
    flex-basis: 100%;
    text-align: left;
  }
  .offer-item-row__cost {
    justify-content: flex-start;
  }
}
.item-purchase-cost {
  padding: 12px;
  margin-block: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.item-purchase-cost h3,
.item-purchase-cost p {
  margin: 0;
}
.item-purchase-cost p {
  margin-block-start: 4px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.item-purchase-cost dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  margin: 10px 0 0;
}
.item-purchase-cost dl div {
  display: contents;
}
.item-purchase-cost dt {
  color: var(--muted);
}
.item-purchase-cost dd {
  margin: 0;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}
.offer-item-row__value--sold {
  color: #7fd19b;
  font-weight: 600;
  text-align: right;
}
.offer-item-row__estimate {
  display: block;
  color: #8a8a8a;
  font-size: 11px;
  font-weight: 400;
}
.offer-items__net--sold {
  color: #7fd19b;
}
.offer-item-row__value {
  flex: none;
  min-width: 56px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.trade-quote {
  margin: 5px 0 8px;
  padding: 8px 12px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.trade-quote p {
  margin: 0 0 4px;
}
.trade-quote p:last-child {
  margin-bottom: 0;
}
.trade-quote .trade-quote__price {
  color: var(--text);
  font-weight: 550;
}
.trade-quote summary {
  cursor: pointer;
  width: fit-content;
  padding: 4px 0;
}
#offer-detail-content .trade-quote .trade-facts {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 8px 0;
}
#offer-detail-content .trade-quote .trade-facts > div {
  display: grid;
  grid-template-columns: minmax(100px, 28%) minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
}
#offer-detail-content .trade-quote .trade-facts dd {
  margin: 0;
  font-weight: 400;
}
.trade-quote h4 {
  margin: 16px 0 4px;
  color: var(--text);
}

/* An incoming offer's acceptance: the mock's amber box with the action on the right. */
#offer-detail-dialog .offer-acceptance {
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #7a6440;
  border-radius: 8px;
  background: rgb(221 194 143 / 6%);
  color: #e2c99d;
  font-size: 12.5px;
}
#offer-detail-dialog .offer-acceptance strong {
  font-weight: 600;
}
#offer-detail-dialog .offer-acceptance p {
  margin: 2px 0 0;
  color: #e2c99d;
  opacity: 0.85;
}
#offer-detail-dialog .offer-acceptance .button {
  height: 28px;
  min-height: 28px;
  padding: 0 12px;
  font-size: 12px;
}
#offer-detail-dialog .offer-acceptance--success {
  border-color: #4f7a5d;
  background: rgb(161 210 178 / 6%);
  color: #a9d6b8;
}
#offer-detail-dialog .offer-acceptance--danger {
  border-color: #7d4a4d;
  background: rgb(237 170 170 / 6%);
  color: #f0b4b4;
}
#offer-detail-dialog .offer-acceptance:is(.offer-acceptance--success, .offer-acceptance--danger) p {
  color: inherit;
}

/* Activities: what each row did, after its title (mock subline); the routine polling switch. */
.runtime-activity__description {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}
.activities-panel .activities-routine {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

/* Composer bot items: one line per item like the mock (name with ellipsis, status, Buy price), so
   names and badges are never cut at the card edge, at any width. */
#trade-dialog #trade-bot-items-body tr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
}
#trade-dialog #trade-bot-items-body td {
  display: block;
  width: auto;
  min-width: 0;
  padding-right: 0;
  padding-left: 0;
}
#trade-dialog #trade-bot-items-body td:first-child {
  flex: none;
}
#trade-dialog #trade-bot-items-body td:nth-child(2) {
  flex: 1 1 auto;
  overflow: hidden;
}
#trade-dialog #trade-bot-items-body td:nth-child(3) {
  flex: none;
  order: 2;
  width: auto;
  text-align: right;
}
#trade-dialog #trade-bot-items-body td:nth-child(4) {
  flex: none;
  order: 1;
  width: auto;
  overflow: visible;
}
#trade-dialog #trade-bot-items-body td.empty-table {
  flex: 1;
}
#trade-dialog #trade-bot-items-body .item-identity,
#trade-dialog #trade-bot-items-body .item-copy,
#trade-dialog #trade-bot-items-body .item-heading {
  display: block;
  min-width: 0;
  overflow: hidden;
}
#trade-dialog #trade-bot-items-body .item-heading {
  display: flex;
  align-items: center;
}
#trade-dialog #trade-bot-items-body .item-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#trade-dialog #trade-bot-items-body td:nth-child(5) {
  display: none;
}
#trade-dialog #trade-bot-items-body .price-directions {
  display: block;
}
#trade-dialog #trade-bot-items-body .price-trigger {
  display: inline-flex;
  gap: 4px;
  padding: 0;
}
#trade-dialog #trade-bot-items-body .price-trigger > :nth-child(n + 3) {
  margin-left: 0;
}

/* Composer item rows, both sides, like the mock: one line with a small thumbnail beside the name,
   status and a single Buy price. The row carries the divider, not each cell. */
#trade-dialog #trade-bot-items-body tr,
#trade-dialog #partner-items-body tr {
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}
#trade-dialog #trade-bot-items-body td,
#trade-dialog #partner-items-body td {
  border-bottom: 0;
}
#trade-dialog #trade-bot-items-body .item-identity,
#trade-dialog #partner-items-body .item-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
#trade-dialog #trade-bot-items-body .item-icon,
#trade-dialog #partner-items-body .item-icon {
  flex: none;
  width: 40px;
  height: 30px;
  padding: 2px;
  object-fit: contain;
}
#trade-dialog #trade-bot-items-body .item-copy,
#trade-dialog #partner-items-body .item-copy {
  flex: 1 1 auto;
  min-width: 0;
}
#trade-dialog #trade-bot-items-body .price-trigger[data-price-direction='sell'],
#trade-dialog #partner-items-body .price-trigger[data-price-direction='sell'] {
  display: none;
}
