@scope (.customers-page) {
  :scope {
    --_border: var(--color-border-muted);
    --_ink: var(--color-text-heading);
    --_surface: var(--color-surface);
    container-type: inline-size;
    display: flex;
    gap: var(--space-xl);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .list-page__content {
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  .customers-page__masthead {
    padding-block: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--_border);
  }

  .customers-page__eyebrow,
  .customers-page__metric-label {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    letter-spacing: var(--tracking-widest);
    text-transform: uppercase;
  }

  .customers-page__title {
    margin-top: var(--space-xs);
    color: var(--_ink);
    font-size: clamp(var(--text-heading-2), 3vw, var(--text-heading-1));
    font-weight: var(--font-semibold);
  }

  .customers-page__thesis {
    max-inline-size: 44rem;
    margin-top: var(--space-sm);
    color: var(--color-text-secondary);
    font-size: var(--text-body);
  }

  .customers-page__summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--_border);
    border-radius: var(--radius-xl);
    background: var(--_surface);
    box-shadow: var(--shadow-xs);
  }

  .customers-page__metric {
    display: grid;
    align-content: start;
    gap: var(--space-xs);
    min-inline-size: 0;
    padding: var(--space-lg);
    border-inline-end: 1px solid var(--_border);
  }

  .customers-page__metric:last-child {
    border-inline-end: 0;
  }

  .customers-page__metric--income {
    background: var(--color-primary-muted);
  }

  .customers-page__metric-value {
    overflow: hidden;
    color: var(--_ink);
    font-family: var(--font-mono);
    font-size: var(--text-heading-3);
    font-variant-numeric: tabular-nums;
    letter-spacing: var(--tracking-tighter);
    line-height: var(--leading-tight);
    text-overflow: ellipsis;
  }

  .customers-page__metric-detail {
    color: var(--color-text-muted);
    font-size: var(--text-caption);
  }

  .customers-page__toolbar {
    padding-bottom: 0;
  }

  .customers-page__new {
    white-space: nowrap;
  }

  .customers-page__directory {
    overflow: hidden;
    border: 1px solid var(--_border);
    border-radius: var(--radius-xl);
    background: var(--_surface);
    box-shadow: var(--shadow-xs);
  }

  .customers-page__directory-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: var(--space-lg);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--_border);
  }

  .customers-page__directory-header h2 {
    margin-top: var(--space-2xs);
    color: var(--_ink);
    font-size: var(--text-heading-5);
  }

  .customers-page__directory-count {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-caption);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .customers-directory:empty {
    display: none;
  }

  .customer-row {
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) minmax(9rem, 0.45fr) auto;
    align-items: center;
    gap: var(--space-xl);
    padding: var(--space-lg);
    border-block-end: 1px solid var(--_border);
    background: var(--_surface);
    transition: background-color 0.18s ease;
  }

  .customer-row:last-child {
    border-block-end: 0;
  }

  .customer-row:hover,
  .customer-row:focus-within {
    background: var(--color-surface-muted);
  }

  .customer-row__identity {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-inline-size: 0;
  }

  .customer-row__monogram {
    display: grid;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    border-radius: var(--radius-md);
    background: var(--color-primary-muted);
    color: var(--color-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
  }

  .customer-row__identity-copy {
    min-inline-size: 0;
  }

  .customer-row__head {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
  }

  .customer-row__name {
    min-width: 0;
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--text-heading-5);
    font-weight: var(--font-semibold);
    letter-spacing: var(--tracking-tight);
  }

  .customer-row__name a {
    display: block;
    overflow: hidden;
    color: var(--_ink);
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .customer-row__name a:hover {
    color: var(--color-primary);
  }

  .customer-row__name a:focus-visible,
  .customer-row a.badge:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
  }

  .customer-row__facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-2xs);
  }

  .customer-row .badge {
    --_bg: var(--color-surface-muted);
    --_text: var(--color-text-secondary);
    --_size: var(--text-body-sm);
    max-inline-size: 100%;
    min-height: 1.75rem;
    padding-inline: var(--space-md);
    gap: var(--space-xs);
    border: none;
    font-weight: var(--font-medium);
    text-decoration: none;
  }

  .customer-row .badge .icon {
    width: 1em;
    height: 1em;
  }

  .customer-row .badge--info {
    --_bg: var(--color-info-muted);
    --_text: var(--color-info-text);
  }

  .customer-row .badge--success {
    --_bg: var(--color-success-muted);
    --_text: var(--color-success-text);
  }

  .customer-row .badge--warning {
    --_bg: var(--color-warning-muted);
    --_text: var(--color-warning-text);
  }

  .customer-row__place {
    --_bg: var(--color-primary-muted);
    --_text: var(--color-primary);
  }

  .customer-row a.badge:hover {
    color: var(--_text);
    filter: brightness(0.96);
  }

  .customer-row__document {
    font-family: var(--font-mono);
    letter-spacing: var(--tracking-wide);
  }

  .customer-row__doc-kind {
    font-size: var(--text-caption);
    font-weight: var(--font-semibold);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
  }

  .customer-row__doc-number {
    font-variant-numeric: tabular-nums;
  }

  .customer-row__document--empty {
    --_bg: var(--color-surface-muted);
    --_text: var(--color-text-muted);
    font-family: var(--font-body);
    letter-spacing: var(--tracking-normal);
  }

  .customer-row__origin {
    flex-shrink: 0;
    max-inline-size: 20ch;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .customer-row__income {
    display: grid;
    gap: var(--space-2xs);
    align-content: center;
    min-inline-size: 0;
    padding-inline-start: var(--space-lg);
    border-inline-start: 1px solid var(--_border);
  }

  .customer-row__income-label {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
  }

  .customer-row__income-value {
    color: var(--_ink);
    font-family: var(--font-mono);
    font-size: var(--text-heading-5);
    font-variant-numeric: tabular-nums;
    letter-spacing: var(--tracking-tighter);
  }

  .customer-row__income-hint {
    color: var(--color-text-muted);
    font-size: var(--text-caption);
  }

  .customer-row__income--missing .customer-row__income-value {
    color: var(--color-text-muted);
  }

  .customer-row__actions {
    display: flex;
    align-items: center;
    justify-content: end;
    gap: var(--space-xs);
    white-space: nowrap;
  }

  .customer-row__actions form {
    display: inline-flex;
  }

  .customers-directory__empty {
    flex-direction: column;
    gap: var(--space-md);
    text-wrap: pretty;
  }

  @container (width < 48rem) {
    .customers-page__summary {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .customers-page__metric:nth-child(2) {
      border-inline-end: 0;
    }

    .customers-page__metric:nth-child(-n + 2) {
      border-bottom: 1px solid var(--_border);
    }

    .customer-row {
      grid-template-columns: minmax(0, 1fr) auto;
      gap: var(--space-lg);
    }

    .customer-row__income {
      grid-column: 1 / -1;
      padding-inline-start: 0;
      border-top: 1px solid var(--_border);
      border-inline-start: 0;
      padding-top: var(--space-md);
    }
  }

  @container (width < 28rem) {
    .customers-page__summary {
      grid-template-columns: 1fr;
    }

    .customers-page__metric {
      border-inline-end: 0;
      border-bottom: 1px solid var(--_border);
    }

    .customers-page__metric:last-child {
      border-bottom: 0;
    }

    .customers-page__directory-header {
      align-items: start;
      flex-direction: column;
    }

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

    .customer-row__actions {
      justify-content: start;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .customer-row {
      transition: none;
    }
  }

  @media (prefers-contrast: more) {
    .customers-page__summary,
    .customers-page__directory,
    .customer-row {
      border-width: 2px;
    }
  }
}
