.clients-page { max-width: none; }
.client-sheet-tools { display: flex; align-items: center; }
.client-sheet-search { width: 100%; }
.client-sheet-table { --client-actions-width: 132px; min-width: 1148px; table-layout: fixed; }
.client-sheet-table > thead > tr > .client-sheet-actions-heading { width: var(--client-actions-width); }
.client-sheet-table > thead > tr > th:first-child { width: 224px; }
.client-sheet-table > thead > tr > th:has(.client-column-sort) { padding: 0; }
.client-sheet-table > thead > tr > th:nth-child(2) { width: 72px; }
.client-sheet-table > thead > tr > th:nth-child(3) { width: 120px; }
.client-sheet-table > thead > tr > th:nth-child(4) { width: 144px; }
.client-sheet-table > thead > tr > th:nth-child(5) { width: 164px; }
.client-sheet-table > thead > tr > th:nth-child(6) { width: 132px; }
th[aria-sort] .client-column-sort { color: var(--accent); }
.client-column-sort span { color: var(--accent); }

.client-sheet-name { display: flex; align-items: center; width: 100%; min-height: var(--row-height); }
.client-sheet-name > strong { min-width: 0; flex: 1; align-self: center; padding: var(--cell-padding-y) var(--cell-padding-x); font-weight: 500; white-space: normal; overflow-wrap: anywhere; }
.client-sheet-number, .client-sheet-date { font-variant-numeric: tabular-nums; }
.client-sheet-date { white-space: nowrap; }
.client-sheet-date--overdue { color: var(--red-ink); }
.client-cell-muted { color: var(--muted); font-size: var(--text-meta); }
.client-sheet-finishes { white-space: normal; overflow-wrap: anywhere; }
.client-profile .order-workspace { display: block; border-top: 1px solid var(--line); }
.client-profile-section:last-child { margin-bottom: 0; }
.client-profile-section h2 { margin: 0 0 16px; font-family: var(--sans); font-size: var(--title-section); font-weight: 600; }
.client-details > h2 { margin-bottom: 8px; }
.client-details-empty { color: var(--muted); font-size: var(--text-dense); }
.client-details-ledger dd { margin: 0; }
.client-details-ledger dd p { margin: 0 0 8px; }
.client-details-ledger dd p:last-child { margin-bottom: 0; }
.client-profile-form { margin-top: 20px; }
.client-profile-form > .button { margin-top: 20px; }
.client-profile-form [aria-invalid="true"] { border-color: var(--red); }
.client-reference-list { list-style: none; padding: 0; margin: 10px 0 0; }
.client-reference-list li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: var(--text-dense); overflow-wrap: anywhere; }
.client-reference-list li:first-child { padding-top: 0; }
.client-reference-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.client-reference-list p { margin: 0; }
@media (max-width: 760px) {
  .client-sheet-table > thead > tr > th:first-child { width: 200px; }
  .client-sheet-table { min-width: 1124px; }
}
@media (max-width: 540px) {
  .client-details-ledger { grid-template-columns: 1fr; }
  .order-panel .client-details-ledger .detail-ledger__item { padding-right: 0; }
}

/* Keep actions in the scrollable grid and contain their absolute accessible label. */
.clients-page .client-sheet-table :is(th, td).data-grid__actions { position: relative; }
.client-sheet-table > thead > tr > th:nth-child(7) { width: 160px; }
.client-scroll-hint { margin: 0 0 8px; }
@media (min-width: 641px) and (max-width: 1200px) {
  .client-sheet-table { min-width: 1012px; --client-actions-width: 112px; }
  .client-sheet-table > thead > tr > th:nth-child(7) { width: 128px; }
  .client-sheet-table > thead > tr > th:first-child { width: 180px; }
  .client-sheet-table > thead > tr > th:nth-child(3) { width: 104px; }
  .client-sheet-table > thead > tr > th:nth-child(4) { width: 132px; }
}
@media (max-width: 640px) {
  .client-scroll-hint { display: none; }
  .client-sheet-scroll { overflow: clip; }
  .client-sheet-table { min-width: 0; table-layout: auto; }
  .client-sheet-table, .client-sheet-table > tbody { display: block; width: 100%; }
  .client-sheet-table > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .client-sheet-table .client-sheet-row { display: block; padding: 12px; border-bottom: 1px solid var(--line); }
  .client-sheet-table .client-sheet-row:last-child { border-bottom: 0; }
  .clients-page .client-sheet-table .client-sheet-row > td { display: flex; align-items: center; gap: 12px; width: 100%; height: auto; min-height: 36px; padding: 6px 0; box-shadow: none; border: 0; background: transparent; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .client-sheet-table .client-sheet-row > td[data-label]::before { content: attr(data-label); flex: 0 0 124px; color: var(--muted); font-size: var(--text-meta); }
  .client-sheet-table .client-sheet-row > .client-sheet-identity { padding: 0 0 8px; }
  .client-sheet-table .client-sheet-name { min-width: 0; }
  .client-sheet-table .client-name-input { border: 1px solid var(--input-line); border-radius: var(--radius-control); font-weight: 600; }
  .client-sheet-table .client-sheet-actions { justify-content: flex-end; padding: 8px 0 0; }
  .client-sheet-table .client-sheet-finishes { text-overflow: clip; }
}

/* Long names remain legible in the same explicit-save editor. */
.client-sheet-name textarea.client-name-input { field-sizing: content; height: auto; min-height: var(--row-height); resize: vertical; white-space: pre-wrap; overflow-wrap: anywhere; text-overflow: clip; }
@supports not (field-sizing: content) {
  .client-sheet-name textarea.client-name-input { min-height: calc(2 * var(--line-body) + 2 * var(--cell-padding-y) + 2px); }
}
