.clients-page { max-width: none; }
.clients-page > .page-header .page-header__identity { flex: 0 0 auto; }
.clients-page > .page-header .page-header__actions { flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; }
.clients-page > .page-header .page-header__actions > .button, .client-sheet-search > .text-link { flex-shrink: 0; }
.client-sheet-search { min-width: 0; width: auto; margin: 0; }

.client-sheet-name { display: flex; align-items: center; width: 100%; min-height: var(--row-height); }
.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-profile .order-workspace { display: block; }
.client-profile-section:last-child { margin-bottom: 0; }
.client-profile-section h2 { margin: 0 0 var(--space-4); font-family: var(--sans); font-size: var(--title-section); font-weight: 600; }
.client-details > h2 { margin-bottom: var(--space-2); }
.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 var(--space-2); }
.client-details-ledger dd p:last-child { margin-bottom: 0; }
.client-profile-form { margin-top: 0; }
.client-profile-form > .button { margin-top: var(--space-4); }
.client-profile-form [aria-invalid="true"] { border-color: var(--red); }
.client-reference-list { list-style: none; padding: 0; margin: var(--space-2) 0 0; }
.client-reference-list li { padding: var(--space-3) 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; }

/* 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; border-left: 0; }
.client-scroll-hint { margin: 0 0 var(--space-2); }

/* Keep resting rows compact; show the full name while editing. */
.client-sheet-name textarea.client-name-input { field-sizing: fixed; height: var(--row-height); min-height: var(--row-height); resize: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-sheet-name textarea.client-name-input:focus { field-sizing: content; height: auto; white-space: pre-wrap; overflow-wrap: anywhere; text-overflow: clip; }
@supports not (field-sizing: content) {
  .client-sheet-name textarea.client-name-input:focus { min-height: calc(2 * var(--line-body) + 2 * var(--cell-padding-y) + 2px); }
}

.client-sheet-search .text-input { --input-height: var(--control-height); }
@media (max-width: 760px) {
  .client-sheet-search .search-control { width: auto; min-width: 0; }
  .client-sheet-search .text-input { min-width: 0; }
}
.client-profile-form .form-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
@media (min-width: 1280px) {
  .client-scroll-hint { display: none; }
}

.client-profile-section .section-heading h2 { margin: 0; }
.order-panel .client-profile .workspace-section { margin: 0; padding-block: var(--space-4); }
.order-panel .client-profile .order-workspace__main { padding: 0; }


.client-order-history__row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--row-height); padding: 0; border: 0; color: var(--ink); text-decoration: none; }
.client-order-history__row + .client-order-history__row { border-top: 1px solid var(--line-soft); }
.client-order-history__row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.client-order-history__row .stage-marker { flex-shrink: 0; font-size: var(--text-meta); }
.client-order-history__row:hover { background: var(--hover); }

.client-sheet-row { cursor: pointer; }
.client-sheet-number .client-column-sort { justify-content: flex-end; }
.client-sheet-table thead .client-sheet-internal, .client-sheet-table .client-sheet-row > .client-sheet-internal { background-color: var(--private-tint); }
.order-panel .client-profile .workspace-section.client-profile-section--private { margin-inline: calc(-1 * var(--panel-gutter)); padding-inline: var(--panel-gutter); background: var(--private-tint); }
.client-profile-section--private .text-input { background: var(--surface); }
