/* Trade optimizer styles. Split from styles.css. */

.trade-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.trade-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.trade-inputs label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.trade-inputs .trade-preset-control {
  grid-column: 1 / -1;
  grid-template-columns: minmax(180px, 260px) minmax(240px, 420px) minmax(260px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #8fc7b8;
  border-left: 4px solid var(--accent);
  background: #eef8f5;
  color: var(--text);
}

.trade-inputs .checkbox-control {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-content: start;
}

.trade-inputs .trade-option-with-hint {
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}

.trade-option-with-hint > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trade-option-with-hint small {
  margin-left: 22px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.trade-preset-control span {
  font-weight: 700;
}

.trade-preset-control small {
  color: #45615b;
  font-size: 12px;
}

.trade-result {
  border: 1px solid var(--line);
  background: #f7fbfa;
  padding: 12px;
}

.trade-result span,
.trade-result small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.trade-hourly-comparison {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0;
}

.trade-hourly-comparison strong {
  margin: 0;
}

.trade-hourly-comparison small {
  display: inline;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.trade-comparison-operator {
  display: inline;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

#tradeBestNote {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.45;
}

.trade-result .trade-usage-label {
  display: inline;
  white-space: nowrap;
  font-weight: 700;
  color: var(--text);
}

.trade-result .trade-usage-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.trade-result .trade-usage-item {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}

.trade-result .trade-usage-value {
  display: inline-flex;
  gap: 1px;
  align-items: baseline;
  white-space: nowrap;
}

.trade-result .trade-usage-under {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 4px;
  background: #fff1d6;
  color: #b45309;
  font-weight: 700;
}

.trade-result strong {
  display: block;
  margin: 4px 0;
  font-size: 28px;
}

.trade-hourly-comparison.trade-value-good strong,
.trade-hourly-comparison.trade-value-good .trade-comparison-operator {
  color: #047857;
}

.trade-hourly-comparison.trade-value-bad strong,
.trade-hourly-comparison.trade-value-bad .trade-comparison-operator {
  color: #dc2626;
}

.trade-limit-input {
  width: 72px;
  min-width: 0;
  padding: 5px 6px;
  text-align: right;
}

.trade-candidate-table {
  table-layout: auto;
}

.trade-candidate-main-table {
  width: max-content;
  min-width: 0;
}

.trade-candidate-table th,
.trade-candidate-table td {
  padding: 5px 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.trade-candidate-table thead th {
  text-align: center;
  vertical-align: middle;
}

.trade-candidate-table tbody td {
  text-align: right;
}

.trade-candidate-table tbody td:first-child {
  min-width: 140px;
  max-width: 180px;
  text-align: left;
  white-space: normal;
}

.trade-candidate-table tbody td:not(:first-child) {
  min-width: 48px;
}

.trade-candidate-table thead th.trade-group-head:last-child {
  min-width: 58px;
}

.trade-candidate-table .trade-group-head {
  padding-block: 4px;
  color: #45646a;
  font-size: 12px;
  font-weight: 800;
}

.trade-candidate-table th.trade-group-start,
.trade-candidate-table td.trade-group-start {
  border-left: 1px solid #bfd0d5;
}

.trade-candidate-table .trade-compact-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 72px;
  line-height: 1.15;
  white-space: normal;
}

.trade-candidate-table .trade-candidate-item-head {
  min-width: 190px;
  text-align: left;
}

.trade-candidate-table .trade-compact-number-head {
  width: 48px;
}

.trade-candidate-table .image-label {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
  min-height: 26px;
}

.trade-candidate-table .image-label img {
  width: 24px;
  height: 24px;
}

.trade-candidate-table .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.trade-candidate-table .trade-assumed-notes {
  max-width: 180px;
  font-size: 10px;
}

.trade-candidate-table .trade-limit-input {
  width: 56px;
  min-width: 0;
  padding-inline: 5px;
  font-variant-numeric: tabular-nums;
}

.trade-solution-result-head {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  vertical-align: top;
}

.trade-candidate-main-table .trade-solution-result-head,
.trade-candidate-main-table .trade-solution-quantity-cell {
  border-left: 1px solid rgba(165, 190, 196, 0.72);
}

.trade-solution-result-head button {
  display: grid;
  gap: 1px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1.15;
  padding: 0;
  text-align: center;
}

.trade-solution-result-head button span {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-solution-result-head button b {
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-solution-result-head button small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-solution-result-head.active,
.trade-solution-quantity-cell.active {
  background: rgba(229, 246, 243, 0.92);
  box-shadow: inset 3px 0 0 var(--accent);
}

.trade-solution-result-head.pulse,
.trade-solution-quantity-cell.pulse {
  animation: trade-solution-column-pulse 0.72s ease-out;
}

@keyframes trade-solution-column-pulse {
  0% {
    background: rgba(253, 246, 211, 0.98);
    box-shadow:
      inset 3px 0 0 #d69a2d,
      inset 0 0 0 999px rgba(247, 218, 134, 0.18);
  }
  58% {
    background: rgba(238, 250, 247, 0.98);
    box-shadow:
      inset 3px 0 0 var(--accent),
      inset 0 0 0 999px rgba(36, 139, 125, 0.07);
  }
  100% {
    background: rgba(229, 246, 243, 0.92);
    box-shadow: inset 3px 0 0 var(--accent);
  }
}

.trade-solution-quantity-cell {
  cursor: pointer;
  font-weight: 800;
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  text-align: right;
}

.trade-solution-quantity-cell:hover {
  background: rgba(242, 249, 248, 0.95);
}

.trade-candidate-summary-row td {
  border-top: 2px solid rgba(129, 166, 172, 0.58);
  background: rgba(247, 251, 250, 0.98);
}

.trade-candidate-summary-row .trade-candidate-summary-label {
  color: var(--accent-strong);
  font-weight: 900;
}

.trade-candidate-summary-row .trade-candidate-summary-muted {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.trade-candidate-summary-row .trade-solution-summary-cell {
  color: #0f5f56;
  font-weight: 900;
}

.trade-resource-usage-lines {
  display: grid;
  gap: 1px;
  justify-items: stretch;
  line-height: 1.18;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.trade-resource-usage-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(3ch, max-content);
  align-items: baseline;
  justify-items: end;
}

.trade-resource-usage-slash {
  justify-self: center;
  padding-inline: 1px;
}

.trade-resource-usage-used,
.trade-resource-usage-cap {
  text-align: right;
}

.trade-transfer-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-inline: auto;
  border: 1px solid rgba(184, 207, 211, 0.82);
  border-radius: 7px;
  background: rgba(237, 247, 245, 0.95);
}

.trade-transfer-icon-only img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.trade-transfer-none {
  color: var(--muted);
}

.trade-candidate-static-reference {
  margin-top: 8px;
}

.trade-equipment-demand-grid {
  display: grid;
  grid-template-columns: max-content minmax(520px, 1fr);
  align-items: start;
  gap: 10px;
  margin-bottom: 8px;
}

.trade-equipment-demand-panel {
  margin-bottom: 8px;
  border: 1px solid rgba(184, 207, 211, 0.86);
  border-radius: 8px;
  background: rgba(244, 250, 248, 0.94);
}

.trade-equipment-demand-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 0 12px 8px;
}

.trade-equipment-demand-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 12px;
  border: 1px solid rgba(143, 199, 184, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.trade-equipment-demand-content {
  border-top: 1px solid rgba(184, 207, 211, 0.55);
}

.trade-equipment-demand-table-wrap {
  max-height: none;
}

.trade-equipment-demand-table {
  width: max-content;
  min-width: 0;
}

.trade-equipment-demand-use-col {
  width: 128px;
}

.trade-equipment-demand-input-col {
  width: 82px;
}

.trade-equipment-demand-value-col {
  width: 66px;
}

.trade-equipment-demand-table th,
.trade-equipment-demand-table td {
  padding: 4px 5px;
}

.trade-equipment-demand-table th:first-child,
.trade-equipment-demand-table td:first-child {
  min-width: 0;
  max-width: 128px;
}

.trade-equipment-demand-table tbody td:first-child {
  min-width: 0;
  max-width: 90px;
  white-space: nowrap;
}

.trade-equipment-demand-table th:nth-child(2),
.trade-equipment-demand-table td:nth-child(2) {
  min-width: 0;
  max-width: 82px;
}

.trade-equipment-demand-table th:nth-child(n + 3),
.trade-equipment-demand-table td:nth-child(n + 3) {
  min-width: 0;
  max-width: 66px;
}

.trade-equipment-demand-table thead tr:first-child th:nth-child(n + 3) {
  width: auto;
  max-width: none;
}

.trade-equipment-demand-table thead th {
  text-align: center;
  vertical-align: middle;
}

.trade-equipment-demand-table thead th img {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

.trade-equipment-demand-table thead th span {
  display: inline-block;
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.trade-equipment-demand-table .image-label {
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 4px;
  min-height: 22px;
  max-width: 120px;
}

.trade-equipment-demand-table .image-label img {
  width: 20px;
  height: 20px;
}

.trade-equipment-demand-table .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-equipment-demand-input {
  width: 46px;
  min-width: 0;
  padding: 4px 5px;
  text-align: right;
}

.trade-equipment-demand-number {
  min-width: 54px;
  color: var(--text);
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.trade-equipment-demand-total-row th,
.trade-equipment-demand-total-row td,
.trade-equipment-demand-effective-row th,
.trade-equipment-demand-effective-row td {
  background: rgba(229, 246, 243, 0.72);
  font-weight: 800;
}

.trade-fraction-splitter-panel {
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(184, 207, 211, 0.86);
  border-radius: 8px;
  background: rgba(244, 250, 248, 0.94);
}

.trade-equipment-demand-grid .trade-equipment-demand-panel,
.trade-equipment-demand-grid .trade-fraction-splitter-panel {
  margin-bottom: 0;
}

@media (max-width: 1280px) {
  .trade-equipment-demand-grid {
    grid-template-columns: 1fr;
  }
}

.trade-fraction-splitter-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
}

.trade-fraction-splitter-head strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.trade-fraction-splitter-head span {
  color: var(--muted);
  font-size: 11px;
}

.trade-fraction-splitter-table {
  display: inline-table;
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.trade-fraction-splitter-table th,
.trade-fraction-splitter-table td {
  border: 1px solid rgba(195, 216, 220, 0.9);
  padding: 4px 5px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.trade-fraction-splitter-table th {
  background: rgba(226, 239, 241, 0.9);
  color: var(--muted-strong);
  font-weight: 800;
}

.trade-fraction-splitter-table td:first-child {
  text-align: left;
}

.trade-fraction-parent-row td {
  font-weight: 800;
}

.trade-fraction-child-row td:first-child {
  padding-left: 26px;
}

.trade-fraction-child-cell {
  position: relative;
  display: inline-flex;
}

.trade-fraction-splitter-table .trade-fraction-facility-icon {
  text-align: center;
}

.trade-fraction-splitter-table .image-label {
  gap: 4px;
}

.trade-fraction-splitter-table img {
  width: 18px;
  height: 18px;
}

.trade-fraction-splitter-table code {
  color: var(--accent-strong);
  font-weight: 800;
}

.trade-fraction-splitter-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.trade-candidate-static-reference details {
  border: 1px solid rgba(184, 207, 211, 0.86);
  border-radius: 8px;
  background: rgba(248, 251, 251, 0.92);
}

.trade-candidate-static-reference summary {
  display: flex;
  gap: 10px;
  align-items: baseline;
  cursor: pointer;
  list-style: none;
  padding: 8px 10px;
}

.trade-candidate-static-reference summary::-webkit-details-marker {
  display: none;
}

.trade-candidate-static-reference summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--accent-strong);
  transform: translateY(1px);
}

.trade-candidate-static-reference details[open] > summary::before {
  border-top: 10px solid var(--accent-strong);
  border-right: 6px solid transparent;
  border-left: 6px solid transparent;
  border-bottom: 0;
}

.trade-candidate-static-reference summary strong {
  color: var(--accent-strong);
}

.trade-candidate-static-reference summary span {
  color: var(--muted);
  font-size: 0.84rem;
}

.trade-candidate-static-table-wrap {
  border-top: 1px solid rgba(184, 207, 211, 0.7);
  max-height: 420px;
  overflow: auto;
}

.trade-candidate-static-table {
  width: max-content;
  min-width: 100%;
}

.trade-equipment-component-reference {
  border-top: 1px solid rgba(184, 207, 211, 0.7);
}

.trade-static-subhead {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 8px 10px;
  color: var(--accent-strong);
}

.trade-static-subhead span {
  color: var(--muted);
  font-size: 0.84rem;
}

.trade-equipment-component-table-wrap {
  border-top: 1px solid rgba(184, 207, 211, 0.55);
  max-height: none;
}

.trade-equipment-component-table {
  min-width: 760px;
}

.trade-compact-material-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.trade-compact-material {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 220px;
  padding: 2px 6px;
  border: 1px solid rgba(184, 207, 211, 0.86);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.trade-compact-material img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.trade-compact-material span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-compact-material b {
  color: var(--accent-strong);
}

.trade-recommendation-summary {
  margin-top: 10px;
}

.trade-recommendation-box {
  border: 1px solid #cbdde0;
  background: #f8fbfb;
}

.trade-recommendation-box > summary {
  list-style: none;
}

.trade-recommendation-box > summary::-webkit-details-marker {
  display: none;
}

.trade-recommendation-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid #d7e4e7;
  cursor: pointer;
}

.trade-recommendation-head::before {
  content: "";
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--accent-strong);
  transform: translateY(1px);
}

.trade-recommendation-box[open] .trade-recommendation-head::before {
  border-top: 10px solid var(--accent-strong);
  border-right: 6px solid transparent;
  border-left: 6px solid transparent;
  border-bottom: 0;
}

.trade-recommendation-head strong {
  color: #075e54;
}

.trade-recommendation-head span {
  color: #5f7177;
  font-size: 12px;
}

.trade-recommendation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 12px;
}

.trade-recommendation-table-wrap h4 {
  margin: 0 0 6px;
  color: #45646a;
  font-size: 13px;
}

.trade-recommendation-breakdown {
  grid-column: 1 / -1;
  overflow-x: auto;
}

.trade-recommendation-breakdown-options {
  grid-column: 1 / -1;
  border: 1px solid rgba(199, 218, 222, 0.9);
  background: rgba(244, 250, 249, 0.86);
  padding: 6px 8px;
}

.trade-recommendation-reference-breakdowns {
  grid-column: 1 / -1;
  border: 1px solid rgba(199, 218, 222, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px;
}

.trade-recommendation-reference-breakdowns > summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  list-style-position: inside;
}

.trade-recommendation-reference-breakdowns > .trade-recommendation-stage-breakdown {
  margin-top: 10px;
}

.trade-breakdown-toggle-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.trade-breakdown-toggle {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  border: 1px solid rgba(169, 201, 204, 0.86);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 3px 8px;
  white-space: nowrap;
}

.trade-breakdown-toggle input {
  margin: 0;
  width: 13px;
  height: 13px;
}

.trade-recommendation-detail-table {
  width: max-content;
  min-width: 100%;
}

.trade-recommendation-detail-table tbody td:first-child {
  min-width: 180px;
  max-width: 220px;
}

.trade-delta-summary-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
  gap: 10px;
  align-items: start;
}

.trade-recommendation-delta-section {
  grid-column: 1 / -1;
  overflow-x: auto;
}

.trade-recommendation-delta-section .trade-delta-summary-grid {
  min-width: 820px;
}

.trade-recommendation-delta-section .trade-delta-resource-table {
  min-width: 720px;
}

.trade-recommendation-delta-section .trade-delta-contribution-table {
  min-width: 980px;
}

.trade-delta-summary-table th:first-child,
.trade-delta-summary-table td:first-child {
  width: 40%;
}

.trade-delta-item-table th:first-child,
.trade-delta-item-table td:first-child {
  width: 34%;
}

.trade-delta-summary-table,
.trade-delta-item-table {
  table-layout: auto;
}

.trade-delta-thought-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.trade-delta-thought-card {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #cfe1e5;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(246, 252, 250, 0.96), rgba(238, 248, 245, 0.86));
}

.trade-delta-thought-title {
  margin-bottom: 6px;
  color: #075e54;
  font-weight: 800;
}

.trade-delta-thought-values {
  display: grid;
  gap: 4px;
  font-size: 12px;
  line-height: 1.35;
}

.trade-delta-thought-values span {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

.trade-delta-thought-values b {
  color: #64777c;
}

.trade-delta-thought-note {
  margin-top: 6px;
  color: #607278;
  font-size: 12px;
  line-height: 1.45;
}

.trade-delta-resource-table {
  margin-top: 10px;
  table-layout: auto;
}

.trade-delta-contribution-table {
  margin-top: 10px;
  table-layout: auto;
}

.trade-delta-resource-table th:first-child,
.trade-delta-resource-table td:first-child {
  min-width: 220px;
  text-align: left;
}

.trade-delta-contribution-table th:first-child,
.trade-delta-contribution-table td:first-child {
  min-width: 170px;
  text-align: left;
}

@media (max-width: 900px) {
  .trade-delta-summary-grid {
    grid-template-columns: 1fr;
  }
}

.trade-recommendation-detail-table .trade-summary-total-row {
  background: rgba(238, 248, 245, 0.9);
  font-weight: 800;
}

.trade-recommendation-detail-table .trade-summary-pool-row {
  background: rgba(255, 251, 238, 0.86);
}

.trade-recommendation-detail-table .trade-summary-pool-row td:first-child {
  font-weight: 700;
}

.trade-recommendation-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.trade-recommendation-table th,
.trade-recommendation-table td {
  padding: 5px 6px;
  border: 1px solid #d7e4e7;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.trade-recommendation-table th {
  background: #eaf3f4;
  color: #536a70;
  font-weight: 800;
}

.trade-recommendation-table th:first-child,
.trade-recommendation-table td:first-child {
  width: 44%;
  text-align: left;
}

.trade-recommendation-table .image-label {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
  min-height: 24px;
}

.trade-recommendation-table .image-label img {
  width: 24px;
  height: 24px;
}

.trade-recommendation-table .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.trade-recommendation-table .positive {
  color: #047857;
  font-weight: 800;
}

.trade-recommendation-table .negative {
  color: #dc2626;
  font-weight: 800;
}

.trade-facility-limit-table th:first-child,
.trade-facility-limit-table td:first-child {
  width: 46%;
}

.trade-facility-limit-note {
  margin: 6px 0 0;
  color: #64777c;
  font-size: 12px;
  line-height: 1.45;
}

.trade-reuse-value-list {
  display: grid;
  gap: 3px;
  min-width: 84px;
}

.trade-reuse-value-list span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}

.trade-reuse-value-list img {
  width: 20px;
  height: 20px;
}

.trade-reuse-value-list b {
  color: var(--accent-strong);
  font-size: 12px;
}

.trade-assumed-note-mark {
  margin-left: 2px;
  color: #b45309;
  font-size: 11px;
  font-weight: 800;
}

.trade-assumed-notes {
  display: grid;
  gap: 2px;
  margin-top: 4px;
  color: #8a5a12;
  font-size: 11px;
  line-height: 1.25;
}

.trade-assumed-notes > div {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 3px;
  align-items: start;
}

th.trade-recommended-count-head,
td.trade-recommended-count {
  background: rgba(238, 248, 245, 0.78);
}

th.trade-recommended-count-head {
  color: var(--accent-strong);
  font-weight: 800;
}

td.trade-recommended-count {
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 800;
  text-align: right;
}

tr:not(.target-row) td.trade-recommended-count {
  color: #6b7b7c;
  font-weight: 700;
}

.trade-constraints-debug {
  margin-top: 12px;
}

.trade-constraints-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: #20383a;
}

.trade-constraints-box summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--accent-strong);
  font-weight: 800;
}

.trade-constraints-grid {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.trade-constraints-grid h3 {
  margin: 0 0 6px;
  color: #486366;
  font-size: 13px;
}

.trade-variable-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trade-variable-list span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid #c7dadd;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.trade-constraints-box code {
  color: #0d5f59;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  white-space: normal;
}

.trade-constraints-table {
  width: auto;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.trade-constraints-table th,
.trade-constraints-table td {
  padding: 5px 8px;
  border: 1px solid #d2e0e3;
  background: rgba(255, 255, 255, 0.65);
  text-align: left;
}

.trade-constraints-table th {
  color: #34565a;
  white-space: nowrap;
}

.trade-constraints-table .trade-constraint-note {
  max-width: 360px;
  color: #5f7377;
  line-height: 1.45;
  white-space: normal;
}

.trade-inventory-transfer-summary {
  margin-top: 12px;
}

.trade-transfer-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: #20383a;
}

.trade-transfer-box summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--accent-strong);
  font-weight: 800;
}

.trade-transfer-box > p {
  margin: 0;
  padding: 0 12px 10px;
  font-size: 12px;
}

.trade-transfer-table-wrap {
  margin: 0 12px 12px;
  max-height: 54vh;
  overflow: auto;
}

.trade-transfer-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.trade-transfer-table th,
.trade-transfer-table td {
  padding: 5px 7px;
  border: 1px solid #d2e0e3;
  background: rgba(255, 255, 255, 0.7);
  text-align: right;
  white-space: nowrap;
}

.trade-transfer-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e7f1f2;
  color: #34565a;
  font-weight: 800;
}

.trade-transfer-table thead tr:nth-child(2) th {
  top: 31px;
}

.trade-transfer-table td:first-child,
.trade-transfer-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 190px;
  max-width: 230px;
  text-align: left;
}

.trade-transfer-table thead th:first-child {
  z-index: 3;
}

.trade-transfer-table .image-label {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
  min-height: 24px;
}

.trade-balance-audit {
  margin-top: 12px;
}

.trade-balance-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: #20383a;
}

.trade-balance-box summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--accent-strong);
  font-weight: 800;
}

.trade-balance-box > p {
  margin: 0;
  padding: 0 12px 10px;
  font-size: 12px;
}

.trade-balance-audit-body {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.trade-balance-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.trade-balance-placeholder,
.trade-balance-ok,
.trade-balance-summary {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #bfd8dc;
  border-radius: 999px;
  background: rgba(234, 247, 245, 0.78);
  color: #28575a;
  font-size: 12px;
  font-weight: 700;
}

.trade-balance-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #bfd8dc;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #28575a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.trade-balance-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.trade-balance-ok {
  border-color: rgba(34, 129, 114, 0.28);
  color: var(--accent-strong);
}

.trade-balance-table-wrap {
  max-height: 46vh;
  overflow: auto;
  border: 1px solid #d2e0e3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.trade-balance-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.trade-balance-table th,
.trade-balance-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #d2e0e3;
  text-align: right;
  white-space: nowrap;
}

.trade-balance-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e7f1f2;
  color: #34565a;
  font-weight: 800;
}

.trade-balance-table th:first-child,
.trade-balance-table td:first-child {
  text-align: left;
}

.trade-balance-table tbody tr:last-child td {
  border-bottom: 0;
}

.trade-balance-target-row td {
  background: rgba(0, 112, 92, 0.06);
}

.trade-balance-mismatch-row td {
  background: rgba(197, 73, 53, 0.08);
}

.trade-balance-balanced-row td {
  background: rgba(255, 255, 255, 0.5);
}

.trade-balance-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5em;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.trade-balance-kind.target {
  border: 1px solid rgba(0, 112, 92, 0.28);
  color: var(--accent-strong);
  background: rgba(234, 247, 245, 0.86);
}

.trade-balance-kind.mismatch {
  border: 1px solid rgba(197, 73, 53, 0.28);
  color: #a33e30;
  background: rgba(255, 247, 239, 0.9);
}

.trade-balance-kind.balanced {
  border: 1px solid rgba(86, 118, 125, 0.18);
  color: #45646a;
  background: rgba(247, 251, 251, 0.9);
}

.trade-balance-table .positive {
  color: var(--accent-strong);
  font-weight: 800;
}

.trade-balance-table .negative {
  color: #b94332;
  font-weight: 800;
}

.trade-transfer-table .image-label img {
  width: 24px;
  height: 24px;
}

.trade-transfer-table .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.trade-transfer-table td:nth-child(5),
.trade-transfer-table th:nth-child(5),
.trade-transfer-table td:nth-child(7),
.trade-transfer-table th:nth-child(7),
.trade-transfer-table td:last-child,
.trade-transfer-table th:last-child {
  border-left-color: #a9c9cc;
}

.trade-solution-table .image-label {
  justify-content: flex-start;
}

.trade-solution-selector {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(0, 112, 92, 0.18);
  border-radius: 8px;
  background: rgba(245, 251, 250, 0.74);
}

.trade-solution-selector-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.trade-solution-selector-head strong {
  color: var(--accent-strong);
  font-size: 1rem;
}

.trade-solution-selector-head span {
  color: var(--muted);
  font-size: 0.86rem;
}

.trade-solution-candidate-table-wrap {
  overflow-x: auto;
}

.trade-solution-candidate-table {
  width: 100%;
}

.trade-solution-candidate {
  cursor: pointer;
}

.trade-solution-candidate td {
  vertical-align: middle;
}

.trade-solution-candidate.active td {
  background: rgba(229, 246, 243, 0.86);
}

.trade-solution-candidate.active td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.trade-solution-candidate:hover td {
  background: rgba(242, 249, 248, 0.92);
}

.trade-solution-candidate-name {
  display: block;
  color: var(--accent-strong);
  font-weight: 900;
}

.trade-solution-candidate-reason {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.trade-solution-candidate-value {
  color: var(--text);
  font-weight: 800;
}

.trade-solution-composition {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-content: center;
  min-width: 0;
}

.trade-solution-composition > span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  max-width: 170px;
  padding: 2px 6px;
  border: 1px solid rgba(169, 201, 204, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}

.trade-solution-composition .image-label {
  min-width: 0;
  gap: 3px;
}

.trade-solution-composition .image-label img {
  width: 20px;
  height: 20px;
}

.trade-solution-composition .image-label span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.trade-selected-solution {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(0, 112, 92, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.trade-selected-solution-head {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(90px, 130px) minmax(260px, 1fr);
  gap: 10px;
  align-items: start;
}

.trade-selected-solution-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.trade-selected-solution-head span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.trade-selected-solution-head strong {
  color: var(--accent-strong);
  font-size: 0.98rem;
}

.trade-selected-solution-composition {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.trade-selected-solution-composition > span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  max-width: 170px;
  padding: 2px 6px;
  border: 1px solid rgba(169, 201, 204, 0.72);
  border-radius: 999px;
  background: rgba(242, 249, 248, 0.9);
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .trade-selected-solution-head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .trade-layout,
  .trade-inputs {
    grid-template-columns: 1fr;
  }

  .trade-inputs .trade-preset-control {
    grid-template-columns: 1fr;
  }
}
