:root:has(.customers-workspace, .customer-profile-workspace) { scrollbar-gutter: stable; }

.customers-workspace .customers-directory {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--card-bg);
  box-shadow: 0 1px 2px #282f3c08;
  overflow: hidden;
}
.customers-directory__toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 20px; padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.customers-directory__toolbar h2 { margin: 0; font-size: 17px; line-height: 1.35; font-weight: var(--admin-weight-semibold); overflow-wrap: anywhere; }
.customers-directory__toolbar .customer-search-form { flex-basis: 385px; }
.customers-directory__toolbar .customer-search-field .form-control { background: #f8f9fb; border-color: #e5e8ef; }
.customers-directory__toolbar .customer-search-field:has(> button[hidden]) .form-control { padding-inline-end: 12px; }
.customers-directory__link {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 6px 9px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-secondary); font-size: 13px;
}
.customers-directory__link:hover { background: #e9edf2; color: var(--text-primary); }
.customers-directory__identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.customers-directory__avatar {
  display: inline-grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px;
  border-radius: 50%; color: #718096; background: #edf0f5; font-size: 11px; font-weight: var(--admin-weight-medium);
}
.customers-directory .order-list { border: 0; border-radius: 0; box-shadow: none; }
.customers-directory .order-list__table { border-radius: 0; }
.customers-directory .order-list__table :is(th,td) { padding-block: 13px; }
.customers-directory .order-list__table th { border-radius: 0; font-weight: var(--admin-weight-medium); color: var(--text-secondary); text-transform: none; letter-spacing: normal; }
.customers-directory .customer-directory-table .customer-list__date { font-size: 13px; color: var(--text-primary); }
.customers-directory__registered { display: block; margin-top: 3px; color: var(--text-tertiary); font-size: 11px; }
.customers-directory .customer-list__balance > span:not(.badge):not(.customer-list__label) { color: var(--text-secondary); }
.customers-directory .order-list__table tr:last-child td { border-radius: 0; }
.customers-directory .orders-page__footer { padding: 9px 12px 9px 18px; border-top: 1px solid var(--border); }
.customers-directory .customer-list-status { min-height: 260px; }
.customer-order-history .order-status { white-space: nowrap; flex-shrink: 0; }
.customers-directory__toolbar .customer-search-form > button { flex: 0 0 auto; }
.customers-workspace :is(button,a,summary):focus-visible { outline: 1px solid var(--admin-field-focus); outline-offset: 2px; }
.customers-workspace :is(button, a, summary),
.customer-profile-workspace :is(button, a, summary) {
  transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.customers-workspace :is(button, summary):active:not(:disabled) { transform: translateY(1px); }
.customers-workspace .customer-directory-table tbody tr { transition: background-color .15s ease; }
.customers-workspace .orders-icon-button:hover { background: #e9edf2; }
#customersResults { position: relative; }
#customersResults > :is(.order-list, .orders-page__footer) { transition: opacity .15s ease; }
#customersResults[aria-busy="true"] > :is(.order-list, .orders-page__footer) { opacity: .45; }
#customersResults[aria-busy="true"]::before {
  content: ''; position: absolute; inset-block-start: 0; inset-inline-start: 0; z-index: 2;
  width: 30%; height: 2px; border-radius: 2px; background: var(--platform-orange);
  animation: customers-loading 1s ease-in-out infinite alternate;
}
#customersResults > .order-list { animation: customers-results-enter .18s ease-out; }
@keyframes customers-loading { from { transform: translateX(0); } to { transform: translateX(230%); } }
@keyframes customers-results-enter { from { opacity: .45; } to { opacity: 1; } }
.customer-profile-workspace .orders-page__inner { container: customer-profile / inline-size; }
.client-heading { display: grid; justify-items: start; gap: 6px; margin-bottom: 20px; overflow-wrap: anywhere; }
.client-heading h1 { margin: 0; font-size: clamp(25px, 2.4vw, 34px); line-height: 1.16; letter-spacing: -.025em; }
.client-back, .client-link {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 0;
  background: transparent; border: 0; color: var(--text-secondary); font-size: 13px; text-align: start;
}
.client-back { min-height: 30px; }
.client-link { color: var(--orders-accent-ink); font-weight: var(--admin-weight-medium); }
.client-back:hover, .client-link:hover { color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; }
.client-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; color: var(--text-secondary); font-size: 12px; }
.client-meta > span { min-width: 0; }
.client-meta i { margin-inline-end: 5px; }
.customer-profile-workspace .customer-profile-summary { margin-bottom: 18px; }
.customer-profile-workspace #customerTabs {
  display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; gap: 2px;
  padding: 3px; margin: 0 0 16px; border-radius: 22px;
}
.customer-profile-workspace #customerTabs::before { border-radius: 18px; }
#customerTabs:not([data-admin-pill-ready])::before { opacity: 0; }
.customer-profile-workspace #customerTabs > .nav-link {
  display: inline-flex; align-items: baseline; justify-content: center; gap: 5px; max-width: 100%;
  min-height: 34px; padding: 7px 12px; margin: 0; border: 0; border-radius: 18px;
  white-space: normal; overflow-wrap: anywhere; text-align: center; line-height: 20px;
  color: var(--text-secondary); background: transparent; font-size: 13px; font-weight: var(--admin-weight-medium);
}
.customer-profile-workspace #customerTabs > .nav-link small { font-size: 11px; color: var(--text-secondary); }
.customer-profile-workspace #customerTabs > .nav-link:hover { background: #ffffff80; color: var(--text-primary); }
.customer-profile-workspace #customerTabs > .nav-link.active { color: var(--text-primary); background: #fff; }
.customer-profile-workspace #customerTabs > .nav-link:focus-visible { outline-offset: -2px; }
.client-panes { min-width: 0; }
.client-panes > .tab-pane { min-height: 240px; overflow-wrap: anywhere; transition: opacity .18s ease; }
.client-panes > .tab-pane:focus { outline: none; }
.client-panes > .tab-pane:focus-visible { outline: 1px solid var(--admin-field-focus); outline-offset: 3px; }
.client-panes > .tab-pane > * + * { margin-top: 12px; }
.client-panel, .client-stats, .client-panes > .tab-pane > .client-empty {
  min-width: 0; border: 1px solid var(--border); border-radius: 13px;
  background: var(--card-bg); box-shadow: 0 1px 2px #282f3c08;
}
.client-panel__head, .client-record__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
}
.client-panel__head { padding: 15px 20px; }
.client-panel__head h2 { margin: 0; font-size: 17px; font-weight: var(--admin-weight-semibold); line-height: 1.35; }
.client-panel__head > *, .client-record__head > *, .client-facts > *, .client-info > * { min-width: 0; max-width: 100%; }
.client-panel__head + *, .client-ratings + *, .client-list > li + li { border-top: 1px solid var(--border-light); }
.client-panel__body { margin: 0; padding: 14px 20px; }
.client-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr)); margin-bottom: 0;
  overflow: hidden; gap: 1px; background: var(--border-light);
}
.client-stats > div { min-width: 0; background: var(--card-bg); padding: 14px 18px; }
.client-stats dt, .client-label, .client-facts dt, .client-info dt {
  color: var(--text-secondary); font-size: 12px; line-height: 1.4; font-weight: var(--admin-weight-regular);
}
.client-stats dd { margin: 5px 0 0; font-size: clamp(17px,1.4vw,21px); line-height: 1.35; font-weight: var(--admin-weight-semibold); }
#tabBenefits > .client-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
.client-note, .client-stats .client-note { color: var(--text-secondary); font-size: 12px; font-weight: var(--admin-weight-regular); line-height: 1.5; }
.client-list, .client-facts, .client-info { list-style: none; padding: 0; margin: 0; }
.client-list > li { padding: 15px 20px; }
.client-record__head { align-items: baseline; }
.client-record__head > strong, .client-record__head > div > strong { font-weight: var(--admin-weight-medium); }
.client-record__head .orders-icon-button { align-self: center; }
.client-description, .client-reviews .reviews-entry__comment { margin: 6px 0; white-space: pre-wrap; line-height: 1.5; }
.client-reviews .reviews-entry__tags { margin-block: 6px; }
.client-list .client-meta { margin-top: 4px; }
.client-wallet__amount { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 6px; }
.client-wallet__amount strong, .client-ratings strong { font-size: 30px; line-height: 1.2; letter-spacing: -.025em; }
.client-wallet__amount span { color: var(--text-secondary); font-size: 13px; }
.client-delta { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.client-delta--plus { color: var(--success); }
.client-delta--minus { color: var(--danger); }
.client-flag { color: var(--warning); font-weight: var(--admin-weight-medium); }
.client-ratings { display: grid; grid-template-columns: minmax(110px,145px) minmax(0,260px); align-items: center; gap: 12px 24px; padding: 18px 20px; }
.client-ratings strong { display: block; margin-top: 3px; }
.client-ratings i, .client-reviews .feedback-workspace__stars { color: var(--platform-orange); }
.client-ratings strong i { font-size: 20px; vertical-align: 3px; }
.client-ratings__distribution { display: grid; gap: 3px; }
.client-ratings__distribution > div { display: grid; align-items: center; grid-template-columns: 2em 1fr 2em; gap: 6px; color: var(--text-secondary); font-size: 12px; }
.client-ratings__distribution > div > :last-child { text-align: end; }
.client-ratings progress { width: 100%; height: 5px; display: block; appearance: none; border: 0; border-radius: 4px; background: var(--surface-soft); }
.client-ratings progress::-webkit-progress-bar { background: var(--surface-soft); border-radius: 4px; }
.client-ratings progress::-webkit-progress-value { background: var(--platform-orange); border-radius: 4px; }
.client-ratings progress::-moz-progress-bar { background: var(--platform-orange); border-radius: 4px; }
.client-facts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px 18px; margin-top: 12px; }
.client-facts dd, .client-info dd { margin: 4px 0 0; }
.client-facts .customer-benefit-gift-status { min-width: 0; }
.client-facts :is(.badge,code) { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.client-panes .customer-benefit-reversed > * { opacity: 1; }
.client-info { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding-inline: 20px; gap: 0 24px; }
.client-info > div { padding-block: 12px; }
.client-info > div:nth-child(n+3) { border-top: 1px solid var(--border-light); }
.client-info dd { font-size: 14px; font-weight: var(--admin-weight-medium); }
[data-client-metrics] .client-stats { border: 0; border-radius: 0; box-shadow: none; }
[data-client-metrics] .client-stats:last-child { border-top: 1px solid var(--border-light); border-radius: 0 0 13px 13px; }
[data-client-metrics] .client-stats:last-child dd { font-size: 14px; font-weight: var(--admin-weight-medium); }
.client-empty { display: grid; justify-items: center; gap: 8px; padding: 26px 14px; text-align: center; color: var(--text-secondary); }
.client-empty i { font-size: 20px; color: var(--text-tertiary); }
.client-empty p { margin: 0; font-size: 13px; }
.client-notice { margin: 0; padding: 12px 16px; background: var(--warning-bg); color: var(--warning); border-radius: 10px; }
.client-heading + .client-notice { margin-bottom: 12px; }
.client-panel .client-notice { border-radius: 0 0 13px 13px; }
.client-dialog-note { margin: 0 0 16px; color: var(--text-secondary); font-size: 13px; }
.customer-order-history .order-list__stack small { white-space: normal; overflow-wrap: anywhere; }
@container customer-profile (max-width: 820px) {
  .client-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@container customer-profile (max-width: 590px) {
  .customer-profile-workspace #customerTabs { width: 100%; border-radius: 16px; }
  .customer-profile-workspace #customerTabs > .nav-link { flex: 1 1 auto; padding-inline: 10px; }
  .client-panel__head, .client-panel__body, .client-list > li, .client-ratings { padding: 14px; }
  .client-stats > div { padding: 12px; }
  .client-stats, #tabBenefits > .client-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  [data-client-metrics] .client-stats > div:last-child { grid-column: 1 / -1; }
  .client-info { padding-inline: 14px; }
}
@container customer-profile (max-width: 430px) {
  .client-info, .client-facts { grid-template-columns: minmax(0,1fr); }
  .client-info > div:nth-child(2) { border-top: 1px solid var(--border-light); }
  .client-ratings { grid-template-columns: minmax(0,1fr); }
  .customer-order-history tbody tr {
    grid-template-columns: minmax(0,1fr) auto; grid-template-areas: 'identity open' 'status amount' 'fulfillment fulfillment'; gap: 6px 8px;
  }
  .customer-order-history tbody .order-list__status { grid-area: status; }
  .customer-order-history .order-status { max-width: 100%; white-space: normal; text-align: start; }
  .customer-order-history tbody .order-list__amount { justify-self: end; }
  .client-record__head > .orders-icon-button { flex-shrink: 0; }
}
@container customer-profile (max-width: 290px) {
  .client-stats, #tabBenefits > .client-stats { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 950px) {
  .customers-directory .customer-directory-table tbody tr { padding: 14px 16px; gap: 6px 12px; }
  .customers-directory .customer-directory-table td { padding: 0; }
  .customers-directory .customer-list__date { align-self: end; }
  .customers-directory .customer-list__balance { text-align: end; }
}
@media (max-width: 640px) {
  .customers-workspace .orders-page__header { flex-wrap: wrap; }
  .customers-directory__toolbar { padding: 14px; }
  .customers-directory__toolbar .customer-search-form { flex-basis: 100%; flex-wrap: wrap; }
  .customers-directory__toolbar .customer-search-field { flex-basis: 100%; }
  .customers-directory__toolbar .customer-search-form > button { margin-inline-start: auto; }
  .customers-directory__avatar { display: none; }
  .customers-directory .customer-directory-table tbody tr {
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas: 'identity open' 'orders total' 'balance balance' 'date date';
    gap: 8px 10px; padding: 14px;
  }
  .customers-directory .customer-directory-table :is(.customer-list__orders,.customer-list__date,.customer-list__balance) { text-align: start; }
  .customers-directory .customer-directory-table .customer-list__date { padding-top: 6px; border-top: 1px solid var(--border-light); }
  .customers-directory .customer-directory-table .order-list__open { position: static; padding: 0; }
  .customers-directory .customer-directory-table .order-list__stack small { white-space: normal; }
  .customers-directory .orders-page__footer { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .customers-workspace *, .customer-profile-workspace * {
    animation: none !important; transition: none !important;
  }
  .customers-workspace :is(button, summary):active:not(:disabled) { transform: none; }
  #customersResults[aria-busy="true"]::before { animation: none; width: 100%; opacity: .5; }
}
