.customer-sales-page {
  display: grid;
  gap: 16px;
  max-width: 1480px;
  margin-inline: auto;
  padding-bottom: 28px;
  color: #142a3f;
}

.customer-sales-page button,
.customer-sales-page input {
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.customer-sales-page button:active {
  transform: translateY(1px) scale(.985);
}

.customer-sales-page button:focus-visible,
.customer-sales-page input:focus-visible,
.customer-sales-table-wrap:focus-visible {
  outline: 3px solid rgba(230, 0, 18, .18);
  outline-offset: 2px;
}

.customer-sales-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 28px;
  min-height: 186px;
  padding: 28px 30px 22px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 8% 12%, rgba(93, 130, 163, .32), transparent 32rem),
    linear-gradient(120deg, #061a2d 0%, #0a2540 66%, #163e60 100%);
  border-radius: 20px 20px 9px 9px;
  box-shadow: 0 22px 48px -30px rgba(5, 22, 39, .68);
}

.customer-sales-hero::after {
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  width: 38%;
  height: 4px;
  content: "";
  background: #e60012;
}

.customer-sales-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.customer-sales-eyebrow,
.customer-directory-head > div > span,
.customer-sales-ledger header span,
.customer-sales-panel header span {
  display: block;
  margin-bottom: 4px;
  color: #788a9c;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.customer-sales-eyebrow {
  color: #f4bd65;
}

.customer-sales-hero h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.75rem, 4vw, 2.65rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.04em;
  text-wrap: balance;
}

.customer-sales-hero p {
  max-width: 58ch;
  margin: 9px 0 0;
  color: #c7d6e4;
  font-size: .82rem;
  line-height: 1.8;
  text-wrap: pretty;
}

.customer-sales-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
}

.customer-sales-action {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 9px;
  font-size: .74rem;
  font-weight: 800;
}

.customer-sales-action.secondary {
  color: #e2ebf3;
  background: rgba(255, 255, 255, .07);
}

.customer-sales-action.primary {
  color: #fff;
  border-color: #e60012;
  background: #e60012;
  box-shadow: 0 10px 20px -14px rgba(230, 0, 18, .9);
}

.customer-sales-action:hover {
  border-color: rgba(255, 255, 255, .42);
  transform: translateY(-1px);
}

.customer-sales-range {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  display: flex;
  width: max-content;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 9px;
  background: rgba(2, 15, 28, .28);
}

.customer-sales-range button {
  min-height: 34px;
  padding: 6px 14px;
  color: #adc0d1;
  border-radius: 6px;
  font-size: .69rem;
  font-weight: 800;
}

.customer-sales-range button:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.customer-sales-range button.active {
  color: #0a2540;
  background: #fff;
  box-shadow: 0 4px 12px rgba(2, 14, 26, .16);
}

.customer-sales-metrics {
  display: grid;
  grid-template-columns: 1.25fr repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.customer-sales-metric {
  position: relative;
  min-height: 118px;
  padding: 15px 16px 17px;
  overflow: hidden;
  border: 1px solid #dce4eb;
  border-top: 3px solid #7d91a5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 37, 64, .045);
}

.customer-sales-metric::after {
  position: absolute;
  inset-inline-end: -24px;
  bottom: -35px;
  width: 86px;
  height: 86px;
  content: "";
  border: 17px solid rgba(61, 83, 104, .045);
  border-radius: 50%;
}

.customer-sales-metric.metric-net { border-top-color: #087f5b; }
.customer-sales-metric.metric-count { border-top-color: #315f82; }
.customer-sales-metric.metric-average { border-top-color: #8b6a24; }
.customer-sales-metric.metric-credit { border-top-color: #b56b1c; }
.customer-sales-metric.metric-returns { border-top-color: #c73542; }

.customer-sales-metric span {
  color: #6b7d8e;
  font-size: .68rem;
  font-weight: 800;
}

.customer-sales-metric strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 10px;
  color: #10283e;
  font: 800 clamp(.98rem, 1.8vw, 1.35rem)/1.25 'Cairo', sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.025em;
}

.customer-sales-metric small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 4px;
  color: #8a97a4;
  font-size: .61rem;
}

.customer-sales-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(290px, .72fr);
  gap: 12px;
  align-items: start;
}

.customer-sales-ledger,
.customer-sales-panel,
.customer-directory {
  border: 1px solid #dce4eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 9px 26px rgba(15, 37, 64, .045);
}

.customer-sales-ledger {
  min-width: 0;
  overflow: hidden;
}

.customer-sales-ledger > header,
.customer-sales-panel > header,
.customer-directory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid #e3e9ee;
}

.customer-sales-ledger h3,
.customer-sales-panel h3,
.customer-directory h3 {
  margin: 0;
  color: #10283e;
  font-size: .98rem;
  line-height: 1.3;
}

.customer-sales-ledger header button {
  color: #315f82;
  font-size: .7rem;
  font-weight: 800;
}

.customer-sales-ledger header button:hover {
  color: #e60012;
}

.customer-sales-search-wrap,
.customer-directory-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f7f9fb;
  border-bottom: 1px solid #e5ebf0;
}

.customer-sales-search-wrap input,
.customer-directory-search input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  color: #21384e;
  border: 1px solid #ccd7e0;
  border-radius: 7px;
  background: #fff;
  font-size: .72rem;
}

.customer-sales-search-wrap > span,
.customer-directory-search > span {
  flex: none;
  color: #7a8998;
  font-size: .65rem;
  font-weight: 800;
}

.customer-sales-table-wrap {
  max-width: 100%;
  overflow: auto;
}

.customer-sales-table {
  width: 100%;
  min-width: 790px;
  border-collapse: collapse;
  font-size: .7rem;
}

.customer-sales-table th {
  padding: 9px 12px;
  color: #68798a;
  border-bottom: 1px solid #dfe6ec;
  background: #f4f7f9;
  text-align: right;
  font-size: .62rem;
  font-weight: 800;
}

.customer-sales-table td {
  padding: 11px 12px;
  color: #42586c;
  border-bottom: 1px solid #edf1f4;
  vertical-align: middle;
}

.customer-sales-table tbody tr:last-child td {
  border-bottom: 0;
}

.customer-sales-table tbody tr:hover {
  background: #f9fbfc;
}

.customer-sales-table td strong,
.customer-sales-table td small {
  display: block;
}

.customer-sales-table td strong {
  color: #1b334a;
  font-size: .71rem;
}

.customer-sales-table td small {
  margin-top: 2px;
  color: #8a97a4;
  font-size: .6rem;
}

.customer-sales-invoice-link {
  display: block;
  color: #c81221;
  font: 800 .7rem/1.3 monospace;
  direction: ltr;
  text-align: right;
}

.customer-sales-invoice-link:hover {
  text-decoration: underline;
}

.customer-sales-payment {
  display: inline-flex;
  padding: 4px 7px;
  color: #315f82;
  border-radius: 5px;
  background: #eaf0f5;
  font-size: .61rem;
  font-weight: 800;
}

.customer-sales-payment.credit {
  color: #8d540f;
  background: #fff1d8;
}

.customer-sales-amount {
  color: #10283e !important;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.customer-sales-empty {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 30px;
  color: #8392a1;
  text-align: center;
}

.customer-sales-empty strong {
  color: #40576c;
  font-size: .82rem;
}

.customer-sales-empty span {
  margin-top: 4px;
  font-size: .68rem;
}

.customer-sales-insights {
  display: grid;
  gap: 12px;
}

.customer-sales-payment-list,
.customer-sales-top-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 5px 15px 12px;
}

.customer-sales-payment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 30px;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f4;
}

.customer-sales-payment-row:last-child {
  border-bottom: 0;
}

.customer-sales-payment-row > div:first-child span,
.customer-sales-payment-row > div:first-child strong {
  display: block;
}

.customer-sales-payment-row > div:first-child span {
  color: #6c7d8d;
  font-size: .64rem;
}

.customer-sales-payment-row > div:first-child strong {
  margin-top: 2px;
  color: #1f374d;
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
}

.customer-sales-payment-track {
  height: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: #e8edf1;
}

.customer-sales-payment-track i {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: #315f82;
}

.customer-sales-payment-row > small {
  color: #6c7d8d;
  text-align: left;
  font: 700 .61rem/1 monospace;
}

.customer-sales-top-list {
  list-style: none;
}

.customer-sales-top-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #edf1f4;
}

.customer-sales-top-list li:last-child {
  border-bottom: 0;
}

.customer-sales-top-list li > b {
  color: #8d9aa7;
  font: 700 .65rem/1 monospace;
}

.customer-sales-top-list li div strong,
.customer-sales-top-list li div small {
  display: block;
}

.customer-sales-top-list li div strong {
  overflow: hidden;
  color: #1b334a;
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-sales-top-list li div small {
  margin-top: 2px;
  color: #8a97a4;
  font-size: .59rem;
}

.customer-sales-top-list li > span {
  color: #10283e;
  font-size: .67rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.customer-sales-panel-empty {
  margin: 0;
  padding: 24px 15px;
  color: #8392a1;
  text-align: center;
  font-size: .67rem;
}

.customer-directory {
  overflow: hidden;
}

.customer-directory-head .flex {
  flex-wrap: wrap;
}

.customer-directory > .overflow-x-auto,
.customer-directory > div[role="region"] {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .customer-sales-metric:hover,
  .customer-sales-ledger:hover,
  .customer-sales-panel:hover,
  .customer-directory:hover {
    border-color: #bdcad5;
    box-shadow: 0 16px 34px -26px rgba(10, 37, 64, .36);
    transform: translateY(-1px);
  }
}

@media (max-width: 1180px) {
  .customer-sales-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .customer-sales-workspace {
    grid-template-columns: minmax(0, 1.45fr) minmax(270px, .72fr);
  }
}

@media (max-width: 900px) {
  .customer-sales-workspace {
    grid-template-columns: 1fr;
  }

  .customer-sales-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .customer-sales-page {
    gap: 12px;
  }

  .customer-sales-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 22px 18px 18px;
    border-radius: 17px 17px 8px 8px;
  }

  .customer-sales-hero-actions {
    justify-content: stretch;
  }

  .customer-sales-action {
    flex: 1;
  }

  .customer-sales-range {
    width: 100%;
  }

  .customer-sales-range button {
    flex: 1;
    padding-inline: 8px;
  }

  .customer-sales-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .customer-sales-metric {
    min-height: 106px;
    padding: 13px;
  }

  .customer-sales-metric:first-child {
    grid-column: 1 / -1;
  }

  .customer-sales-insights {
    grid-template-columns: 1fr;
  }

  .customer-sales-search-wrap,
  .customer-directory-search {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-sales-search-wrap > span,
  .customer-directory-search > span {
    align-self: flex-end;
  }

  .customer-directory-head {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-directory-head .flex {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .customer-sales-metrics {
    grid-template-columns: 1fr 1fr !important;
  }

  .customer-sales-hero-actions {
    flex-direction: column-reverse;
  }

  .customer-sales-action {
    width: 100%;
  }

  .customer-directory-head .flex {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .customer-sales-page *,
  .customer-sales-page *::before,
  .customer-sales-page *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
