/* Scoped sales workspace: clear hierarchy, consistent controls, full-width history. */
#tradeSaleForm { padding: 28px; }
body:has(#trade.active[data-active-panel="sales"]) #pageTitle { font-family: Inter, ui-sans-serif, system-ui, sans-serif !important; font-weight: 800 !important; line-height: 1.15; font-size: clamp(28px, 3vw, 38px); letter-spacing: -.04em; }
#tradeSaleForm h3, .trade-sales-list h3 { font-family: Inter, ui-sans-serif, system-ui, sans-serif !important; font-size: 23px; font-weight: 800 !important; letter-spacing: -.03em; margin: 5px 0 8px; }
.trade-sale-heading, .trade-sale-list-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.trade-sale-heading p, .trade-sale-list-heading p { margin: 0; }
.trade-sale-tag { flex-shrink: 0; padding: 7px 12px; border-radius: 999px; background: #edf5fc; color: #456787; font-size: 12px; font-weight: 700; }
.trade-sale-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.trade-sale-fields { min-width: 0; }
#newTradeSale fieldset { min-width: 0; border: 0; padding: 0; margin: 0 0 24px; }
#newTradeSale legend { width: 100%; border-bottom: 1px solid var(--line); padding: 0 0 12px; margin-bottom: 18px; font-weight: 800; font-size: 14px; }
#newTradeSale .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
#newTradeSale label { display: grid; gap: 8px; font-size: 13px; font-weight: 700; min-width: 0; }
#newTradeSale input:not([type=checkbox]), #newTradeSale select { box-sizing: border-box; width: 100%; height: 50px; padding: 0 14px; font-size: 14px; font-family: inherit; border-radius: 10px; }
#newTradeSale select { padding-right: 32px; text-overflow: ellipsis; }
#tradeSalePaymentHint { font-size: 12px; line-height: 1.65; margin: 8px 0 18px; }
.trade-sale-summary { min-width: 0; background: #f1f7fc; border: 1px solid #d8e7f4; border-radius: 16px; padding: 23px; display: grid; gap: 10px; }
.trade-sale-summary > span { margin-top: 12px; color: var(--muted); font-size: 13px; }
.trade-sale-summary > strong { font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 30px; line-height: 1.25; letter-spacing: -.04em; color: #006eae; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.trade-sale-summary dl { border-top: 1px solid #d8e7f4; margin: 10px 0 0; padding-top: 12px; }
.trade-sale-summary dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin: 10px 0; }
.trade-sale-summary dt { color: var(--muted); }
.trade-sale-summary dd { margin: 0; font-weight: 700; text-align: right; }
.trade-sale-summary > p:last-child { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 8px 0 0; }
#newTradeSale > label { padding-top: 20px; border-top: 1px solid var(--line); }
#meteraiPostingFields { margin-top: 14px; padding: 18px; background: #f8fbfe; border: 1px solid var(--line); border-radius: 12px; }
#meteraiPostingFields label { margin-top: 15px; }
#meteraiPostingFields label:has(input[type=checkbox]) { display: flex; align-items: flex-start; line-height: 1.6; }
#meteraiPostingFields input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
#newTradeSale .form-actions { padding-top: 22px; margin-top: 24px; border-top: 1px solid var(--line); }
#newTradeSale .form-actions button, #tradeSalesToolbar button { min-height: 50px; border-radius: 10px; font-size: 14px; }
#tradeSalesToolbar .search { min-height: 50px; font-size: 14px; }
#tradeSalesToolbar { gap: 16px; margin-bottom: 20px; }
.trade-sales-list { grid-template-columns: minmax(0, 1fr) !important; }
.trade-sales-list > .card { min-width: 0; padding: 24px; }
.trade-sale-list-heading { margin-bottom: 20px; align-items: center; }
.trade-sales-table { max-height: none !important; overflow: visible !important; }
.trade-sales-table::after { display: none !important; }
.trade-sales-table table { width: 100%; min-width: 0 !important; table-layout: fixed; }
.trade-sales-table th, .trade-sales-table td { min-width: 0; padding: 16px 12px; white-space: normal; overflow-wrap: anywhere; vertical-align: top; font-size: 13px; }
.trade-sales-table th { font-size: 10px; letter-spacing: .06em; }
.trade-sales-table th:nth-child(1) { width: 16%; }
.trade-sales-table th:nth-child(2) { width: 10%; }
.trade-sales-table th:nth-child(3) { width: 11%; }
.trade-sales-table th:nth-child(4) { width: 7%; white-space: nowrap; }
.trade-sales-table th:nth-child(5) { width: 18%; }
.trade-sales-table th:nth-child(n+6):nth-child(-n+8) { width: 10%; text-align: right; }
.trade-sales-table th:last-child { width: 8%; }
.trade-sales-table td.money { font-weight: 700; font-variant-numeric: tabular-nums; }
.trade-sales-table td small { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 5px; }
.trade-sales-table td:last-child button { font-size: 11px; padding: 6px 7px; white-space: nowrap; }
.trade-sales-table th:first-child, .trade-sales-table td:first-child { position: static !important; }
.trade-sales-table td:nth-child(2) { font-size: 12px; white-space: nowrap; }
#meteraiSaleFeedback { border: 1px solid #b9dcca; border-radius: 12px; padding: 16px; margin-bottom: 18px; background: #f2faf5; font-size: 13px; line-height: 1.6; }
.trade-bank-review { padding: 18px; border: 1px solid var(--line); border-radius: 12px; margin-top: 18px; background: #f8fbfe; }
.trade-bank-review h4 { margin: 0 0 8px; }
.trade-bank-review p { font-size: 12px; line-height: 1.6; color: var(--muted); }
.trade-bank-review label { display: flex !important; align-items: flex-start; margin-top: 16px; line-height: 1.6; }
.trade-bank-review input[type=checkbox] { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; }
.trade-bank-preview-table table { width: 100%; min-width: 0; table-layout: fixed; }
.trade-bank-preview-table td, .trade-bank-preview-table th { padding: 10px 6px; min-width: 0; overflow-wrap: anywhere; white-space: normal; font-size: 11px; }
.trade-bank-preview-table th:first-child { width: 50%; }
.trade-bank-preview-table small { display: block; margin-top: 5px; color: var(--muted); }
@media (max-width: 1100px) {
  .trade-sale-layout { grid-template-columns: minmax(0, 1fr) 250px; gap: 20px; }
  .trade-sales-table table, .trade-sales-table tbody { display: block; }
  .trade-sales-table thead { display: none; }
  .trade-sales-table tbody { display: grid; gap: 12px; }
  .trade-sales-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .trade-sales-table td { display: grid; align-content: start; gap: 5px; border: 0; border-bottom: 1px solid var(--line); text-align: left !important; }
  .trade-sales-table td::before { content: attr(data-label); font-size: 10px; font-weight: 800; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
  .trade-sales-table td[colspan] { grid-column: 1/-1; }
}
@media (max-width: 760px) {
  #tradeSaleForm, .trade-sales-list > .card { padding: 18px; }
  .trade-sale-layout { grid-template-columns: minmax(0, 1fr); }
  #newTradeSale .form-grid { grid-template-columns: minmax(0, 1fr); }
  .trade-sale-summary { padding: 18px; }
  .trade-sale-heading, .trade-sale-list-heading { flex-wrap: wrap; }
  .trade-sales-table tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trade-sales-table td:nth-child(1), .trade-sales-table td:nth-child(5) { grid-column: 1/-1; }
  #newTradeSale .form-actions button { flex: 1; }
}
