/**
 * 商家资金 Dashboard V2.0
 * 仅作用于只读资金中心，不覆盖充值、提现、支付或旧金币明细页面。
 */

.merchant-wallet-dashboard-active .merchant-layout-v2 .workspace-panel.lx-content {
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* 正式资金页面不展示顶部兼容余额和资金写操作入口。 */
.merchant-wallet-dashboard-active .merchant-layout-v2 .header-wallet,
.merchant-wallet-dashboard-active .merchant-layout-v2 .merchant-page-heading .summary-actions {
  display: none;
}

.merchant-wallet-dashboard-v2 {
  display: grid;
  min-width: 0;
  gap: var(--lx-space-20);
  color: var(--lx-color-text-primary);
}

.wallet-dashboard-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-16);
}

.wallet-dashboard-toolbar span,
.wallet-health-card .lx-card__header span,
.wallet-statistics-card .lx-card__header span,
.wallet-transactions-card .lx-card__header span {
  display: block;
  margin-bottom: var(--lx-space-4);
  color: var(--lx-color-text-tertiary);
  font-size: var(--lx-font-size-xs);
}

.wallet-dashboard-toolbar h2,
.wallet-health-card .lx-card__header h2,
.wallet-statistics-card .lx-card__header h2,
.wallet-transactions-card .lx-card__header h2 {
  margin: 0;
  color: var(--lx-color-text-primary);
  font-size: var(--lx-font-size-lg);
  font-weight: var(--lx-font-weight-semibold);
  letter-spacing: 0;
}

.wallet-dashboard-refresh {
  flex: 0 0 var(--lx-icon-button-size);
  color: var(--lx-color-primary);
  font-size: var(--lx-font-size-xl);
}

.wallet-assets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--lx-space-12);
  min-width: 0;
}

.wallet-asset-card {
  position: relative;
  min-width: 0;
  box-shadow: none;
}

.wallet-asset-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  border-radius: var(--lx-radius-card) 0 0 var(--lx-radius-card);
  background: var(--lx-color-border-strong);
  content: "";
}

.wallet-asset-card--available::before,
.wallet-asset-card--total::before {
  background: var(--lx-color-primary);
}

.wallet-asset-card--frozen::before {
  background: var(--lx-color-warning);
}

.wallet-asset-card--coins::before {
  background: var(--lx-color-info);
}

.wallet-asset-card--principal::before {
  background: var(--lx-color-success);
}

.wallet-asset-card .lx-card__body {
  display: grid;
  gap: var(--lx-space-8);
  min-height: 104px;
  align-content: center;
}

.wallet-asset-card__label {
  color: var(--lx-color-text-secondary);
  font-size: var(--lx-font-size-sm);
}

.wallet-asset-card__value {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: var(--lx-space-8);
  color: var(--lx-color-text-primary);
  font-family: var(--lx-font-family-mono);
  font-size: var(--lx-font-size-stat);
  font-variant-numeric: tabular-nums;
  line-height: var(--lx-line-height-tight);
}

.wallet-asset-card__value span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.wallet-asset-card__value small {
  color: var(--lx-color-text-tertiary);
  font-family: var(--lx-font-family);
  font-size: var(--lx-font-size-xs);
  font-weight: var(--lx-font-weight-medium);
}

.wallet-asset-card p {
  margin: 0;
  color: var(--lx-color-text-tertiary);
  font-size: var(--lx-font-size-xs);
}

.wallet-health-card,
.wallet-statistics-card,
.wallet-transactions-card {
  min-width: 0;
  box-shadow: none;
}

.wallet-health-card .lx-card__header,
.wallet-statistics-card .lx-card__header,
.wallet-transactions-card .lx-card__header {
  min-width: 0;
}

.wallet-statistics-card .lx-card__header > small,
.wallet-transactions-card .lx-card__header > small {
  color: var(--lx-color-text-tertiary);
  font-size: var(--lx-font-size-xs);
}

.wallet-health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--lx-space-16);
}

.wallet-health-grid > div {
  min-width: 0;
  padding-right: var(--lx-space-16);
  border-right: 1px solid var(--lx-color-divider);
}

.wallet-health-grid > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.wallet-health-grid span {
  display: block;
  margin-bottom: var(--lx-space-4);
  color: var(--lx-color-text-tertiary);
  font-size: var(--lx-font-size-xs);
}

.wallet-health-grid strong {
  color: var(--lx-color-text-primary);
  font-size: var(--lx-font-size-sm);
  font-weight: var(--lx-font-weight-semibold);
}

.wallet-realtime-source {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-8);
  color: var(--lx-color-success) !important;
}

.wallet-realtime-source i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.wallet-statistics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--lx-space-8);
}

.wallet-stat-item {
  min-width: 0;
  padding: var(--lx-space-12);
  border: 1px solid var(--lx-color-border);
  border-radius: var(--lx-radius-md);
  background: var(--lx-color-bg-subtle);
}

.wallet-stat-item span {
  display: block;
  overflow: hidden;
  color: var(--lx-color-text-secondary);
  font-size: var(--lx-font-size-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-stat-item strong {
  display: inline-block;
  margin-top: var(--lx-space-8);
  color: var(--lx-color-text-primary);
  font-family: var(--lx-font-family-mono);
  font-size: var(--lx-font-size-xl);
  font-variant-numeric: tabular-nums;
}

.wallet-stat-item small {
  margin-left: var(--lx-space-4);
  color: var(--lx-color-text-tertiary);
  font-size: var(--lx-font-size-xs);
}

.wallet-transactions-body {
  padding: 0;
}

.wallet-transactions-table {
  border: 0;
  border-radius: 0 0 var(--lx-radius-card) var(--lx-radius-card);
}

.wallet-transactions-table .lx-table {
  min-width: 720px;
}

.wallet-transactions-table th:nth-child(1),
.wallet-transactions-table td:nth-child(1) {
  width: 166px;
  white-space: nowrap;
}

.wallet-transactions-table th:nth-child(4),
.wallet-transactions-table td:nth-child(4) {
  width: 132px;
  text-align: right;
}

.wallet-transactions-table th:nth-child(5),
.wallet-transactions-table td:nth-child(5) {
  width: 112px;
}

.wallet-transaction-type {
  display: block;
  color: var(--lx-color-text-primary);
  font-weight: var(--lx-font-weight-medium);
}

.wallet-transactions-table td small {
  display: block;
  margin-top: 2px;
  color: var(--lx-color-text-tertiary);
  font-size: var(--lx-font-size-xs);
}

.wallet-business-reference {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-transaction-amount {
  color: var(--lx-color-text-primary);
  font-family: var(--lx-font-family-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--lx-font-weight-semibold);
  white-space: nowrap;
}

.wallet-transaction-amount.is-income {
  color: var(--lx-color-success);
}

.wallet-transaction-amount.is-expense {
  color: var(--lx-color-danger);
}

.wallet-transaction-cards {
  display: none;
}

.wallet-transactions-empty {
  min-height: 200px;
}

.wallet-dashboard-loading,
.wallet-dashboard-error {
  box-shadow: none;
}

.wallet-dashboard-skeleton {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--lx-space-12);
}

.wallet-dashboard-skeleton .lx-skeleton {
  width: 100%;
  height: 132px;
}

.wallet-error-request {
  display: block;
  margin-top: var(--lx-space-12);
  color: var(--lx-color-text-tertiary);
  font-family: var(--lx-font-family-mono);
  font-size: var(--lx-font-size-xs);
  overflow-wrap: anywhere;
}

@media (min-width: 1600px) {
  .wallet-assets-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1365px) {
  .wallet-statistics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .wallet-dashboard-skeleton {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .wallet-assets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wallet-health-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .wallet-health-grid > div {
    padding: 0 0 var(--lx-space-12);
    border-right: 0;
    border-bottom: 1px solid var(--lx-color-divider);
  }

  .wallet-health-grid > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }
}

@media (max-width: 767px) {
  .merchant-wallet-dashboard-v2 {
    gap: var(--lx-space-16);
  }

  .wallet-assets-grid,
  .wallet-dashboard-skeleton {
    grid-template-columns: minmax(0, 1fr);
  }

  .wallet-asset-card .lx-card__body {
    min-height: 116px;
    padding: var(--lx-space-16);
  }

  .wallet-asset-card__value {
    font-size: var(--lx-font-size-2xl);
  }

  .wallet-statistics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: var(--lx-space-12);
  }

  .wallet-transactions-table {
    display: none;
  }

  .wallet-transaction-cards {
    display: grid;
    gap: var(--lx-space-8);
    padding: var(--lx-space-12);
  }

  .wallet-transaction-card {
    box-shadow: none;
  }

  .wallet-transaction-card .lx-card__body {
    padding: var(--lx-space-12);
  }

  .wallet-transaction-card header {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--lx-space-12);
  }

  .wallet-transaction-card header > div {
    min-width: 0;
  }

  .wallet-transaction-card header strong,
  .wallet-transaction-card header small {
    display: block;
  }

  .wallet-transaction-card header strong {
    color: var(--lx-color-text-primary);
    font-size: var(--lx-font-size-sm);
  }

  .wallet-transaction-card header small {
    margin-top: var(--lx-space-4);
    color: var(--lx-color-text-tertiary);
    font-size: var(--lx-font-size-xs);
  }

  .wallet-transaction-card dl {
    display: grid;
    gap: var(--lx-space-8);
    margin: var(--lx-space-12) 0 0;
    padding-top: var(--lx-space-12);
    border-top: 1px solid var(--lx-color-divider);
  }

  .wallet-transaction-card dl > div {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--lx-space-12);
  }

  .wallet-transaction-card dt {
    color: var(--lx-color-text-tertiary);
    font-size: var(--lx-font-size-xs);
  }

  .wallet-transaction-card dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--lx-color-text-secondary);
    font-size: var(--lx-font-size-xs);
    text-align: right;
  }

  .wallet-statistics-card .lx-card__header,
  .wallet-transactions-card .lx-card__header {
    align-items: flex-start;
  }
}

@media (max-width: 389px) {
  .wallet-statistics-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wallet-dashboard-refresh {
    transition: none;
  }
}
