.client-exchange-card {
  border-color: #cfd9e7;
  background: linear-gradient(135deg, #fff, #f7f9fc);
}

.client-exchange-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.client-exchange-head h3 {
  margin: 3px 0;
  color: #263f64;
  font-size: 24px;
}

.client-exchange-head p {
  margin: 0;
}

.client-exchange-kicker {
  color: #b93037;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
}

.client-exchange-list {
  display: grid;
  gap: 9px;
  margin-top: 17px;
}

.client-exchange-empty {
  padding: 18px;
  border: 1px dashed #cfd5de;
  border-radius: 12px;
  color: #7a828d;
  text-align: center;
}

.client-exchange {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 14px 15px;
  border: 1px solid #dfe4eb;
  border-radius: 13px;
  background: #fff;
}

.client-exchange > div:first-child {
  display: grid;
  min-width: 0;
}

.client-exchange > div:first-child > span {
  color: #8a929d;
  font-size: 9px;
  font-weight: 850;
}

.client-exchange > div:first-child > b {
  margin-bottom: 4px;
}

.client-exchange small {
  overflow: hidden;
  color: #6f7782;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-exchange-values {
  display: flex;
  gap: 12px;
}

.client-exchange-values span {
  display: grid;
  color: #858d98;
  font-size: 9px;
}

.client-exchange-values b {
  color: inherit;
  font-size: 12px;
}

.remove-client-exchange {
  padding: 7px 9px;
  color: #a5262e;
  font-size: 10px;
}

dialog:has(.exchange-modal) {
  width: min(900px, calc(100% - 24px));
}

.exchange-modal {
  max-height: 88vh;
  overflow-y: auto;
}

.exchange-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.exchange-modal-head h2 {
  margin: 3px 0;
}

.exchange-modal-head p {
  margin: 0;
}

.exchange-modal-head > button {
  padding: 5px 12px;
  font-size: 23px;
}

.exchange-side {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #e0e4ea;
  border-radius: 14px;
  background: #fafbfc;
}

.exchange-side.wanted {
  border-color: #cbd9e9;
  background: #f7faff;
}

.exchange-side h3 {
  margin-bottom: 3px;
}

.exchange-side > p {
  margin: 0 0 10px;
}

.exchange-add {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px auto;
  align-items: end;
  gap: 9px;
}

.exchange-add-auto {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.exchange-add label {
  margin: 0;
}

.exchange-side .items {
  margin-top: 12px;
}

.exchange-wanted-quantity {
  display: inline-grid;
  gap: 4px;
  margin: 5px 0 0;
  color: #727b86;
  font-size: 10px;
}

.exchange-quantity-control {
  display: inline-grid;
  grid-template-columns: 38px 68px 38px;
  align-items: center;
}

.exchange-quantity-control button {
  min-height: 38px;
  padding: 5px;
  border-radius: 8px;
  font-size: 18px;
}

.exchange-wanted-quantity input {
  width: 68px;
  padding: 7px 9px;
  text-align: center;
}

.exchange-calculation {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 17px;
}

.exchange-calculation > div {
  display: grid;
  padding: 14px;
  border-radius: 12px;
  background: #f0f2f5;
}

.exchange-calculation span {
  color: #727b86;
  font-size: 10px;
}

.exchange-calculation b {
  font-size: 18px;
}

.client-exchange-history {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.client-exchange-history > h3 {
  margin: 0 0 4px;
}

.client-exchange-history article {
  padding: 14px;
  border: 1px solid #dce3ec;
  border-radius: 13px;
  background: #f8fafc;
}

.client-exchange-history header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.client-exchange-history header div {
  display: grid;
}

.client-exchange-history header span {
  color: #87909c;
  font-size: 9px;
}

.client-exchange-history p {
  margin: 8px 0 0;
  font-size: 12px;
}

.client-exchange-history small {
  display: block;
  margin-top: 8px;
  color: #737c88;
}

@media (max-width: 700px) {
  .client-exchange-head,
  .client-exchange {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .client-exchange-head {
    display: grid;
  }

  .client-exchange-head button,
  .remove-client-exchange {
    width: 100%;
  }

  .client-exchange-values {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .client-exchange small {
    overflow: visible;
    white-space: normal;
  }

  .exchange-add,
  .exchange-calculation {
    grid-template-columns: 1fr;
  }

  .exchange-modal .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .exchange-modal .modal-actions button {
    width: 100%;
  }
}
