/*
  The desktop workspace (desktop audit 2026-10-19, docs/audits/desktop-2026-10-19.md): tables where owners compare
  records, the record beside its list, the page's buttons at the right of its title, and no page that scrolls
  sideways. Phones are untouched: every rule here is for 768px and up (the side-menu frame), most for 1024px and up
  (LB.WIDE_TABLE in table.js). Same look as the rest: white page, cards #f3f5fc, accent #1F3BD1.
*/

/* ---------- a scroller never lets its hidden words out ----------
   A table that scrolls sideways inside its box (.inv-tablewrap, .rtable-wrap) held a screen-reader-only label
   (position: absolute) whose box was the page, not the scroller: the whole page scrolled 66 to 206px sideways on the
   Reorder list at 1024 to 1100px. Positioned scrollers keep them in. */
.inv-tablewrap, .rtable-wrap, .dt-wrap { position: relative; }

/* ---------- the title row: the page's buttons on the right ---------- */
@media (min-width: 768px) and (min-height: 501px), (min-width: 768px) and (pointer: fine) {
  .head-row.has-actions { flex-wrap: wrap; row-gap: 8px; }
  .head-row.has-actions > .page-titles, .head-row.has-actions > h1 { flex: 1 1 16rem; }
  .page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
  .page-actions .btn { min-height: var(--h-regular); }
  .page-actions .btn > span svg { width: 16px; height: 16px; }
  .head-row[data-lifted]:not(:has(> :not(h1))) { display: none; }
}
/* A page's own title row outside a work area (Settings), with only its buttons: they sit on the right. */
.pane > .staff-head { justify-content: flex-end; }
/* Team → Staff as a table: the page's width, a face by each name. */
@media (min-width: 1024px) {
  .view > .area-body.pane:has(.dt-wrap), .pane:has(> div > .dt-wrap) { max-width: var(--w-wide); }
  .view > .area-body.pane:has(.dt-wrap) > .page-sub { max-width: var(--w-read); }
}
.dt-person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.dt-person > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.dt-person .avatar { flex: none; width: 28px; height: 28px; font-size: var(--t-caption1); }

/* ---------- a table (LB.dataTable) ---------- */
.dt-wrap { container-type: inline-size; container-name: dt; min-width: 0; }
.dt { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: var(--t-callout); background: var(--card); border-radius: var(--r); }
.dt caption { caption-side: top; }
.dt th, .dt td { padding: 9px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--sep); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt tbody tr:last-child > * { border-bottom: 0; }
.dt thead th { white-space: normal; line-height: 1.2; }
.dt thead th { position: sticky; top: var(--bar-h, 0px); z-index: 2; padding-top: 10px; padding-bottom: 8px; background: var(--card); font-size: var(--t-caption1); font-weight: 600; color: var(--fade); letter-spacing: .02em; }
.dt thead th:first-child { border-top-left-radius: var(--r); }
.dt thead th:last-child { border-top-right-radius: var(--r); }
.dt .num { text-align: right; font-variant-numeric: tabular-nums; }
.dt tbody th { font-weight: 400; }
.dt-sort { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-height: 28px; margin: -4px -6px; padding: 0 6px; border: 0; border-radius: 6px; background: none; font: inherit; color: inherit; letter-spacing: inherit; cursor: pointer; }
.dt-sort > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.dt th.num .dt-sort { flex-direction: row-reverse; }
.dt-arrow { min-width: .7em; color: var(--ink); }
@media (hover: hover) { .dt-sort:hover { color: var(--ink); background: var(--fill); } }
th[aria-sort="ascending"] .dt-sort, th[aria-sort="descending"] .dt-sort { color: var(--ink); }
/* A row that opens its record: the name is the button (keyboard, screen readers); the whole row takes the click. */
.dt-opens tbody tr { cursor: pointer; }
@media (hover: hover) { .dt-opens tbody tr:hover > * { background: color-mix(in srgb, var(--tint) 6%, var(--card)); } }
.dt-opens tbody tr.is-open > * { background: color-mix(in srgb, var(--tint) 12%, var(--card)); }
.dt-opens tbody tr.is-open > :first-child { box-shadow: inset 3px 0 0 var(--tint); }
.dt-open { display: block; width: 100%; max-width: 100%; min-height: 28px; margin: -4px 0; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; border-radius: 4px; }
.dt-open:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.dt .tags { display: inline-flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; }
.dt .badge { flex: none; }
.dt small { display: block; color: var(--fade); font-size: var(--t-caption1); overflow: hidden; text-overflow: ellipsis; }
.dt .neg { color: var(--bad); }
.dt-wrap > .empty { margin: 12px 0 0; }
.dt-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.dt-pager .dt-count { margin: 0; }
/* Narrow (beside an open record, or a small window): the less important columns go first, never a sideways scroll. */
@container dt (max-width: 760px) { .dt .dt-hide-m { display: none; } }
@container dt (max-width: 540px) { .dt .dt-hide-s { display: none; } }

/* A list's tools over its table: the search, its filters and the count, on one line. */
.dt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.dt-tools .dt-search { flex: 1 1 18rem; max-width: 28rem; }
.dt-tools select { width: auto; min-width: 9rem; max-width: 16rem; }
.dt-tools .dt-total { margin-left: auto; }

/* ---------- Clients: the table and the record beside it ---------- */
@media (min-width: 1024px) {
  /* The table takes the page's width (a phone-wide list of 780px floated in 1100px of white). */
  .view-clients:has(.dt-wrap) > * { max-width: var(--w-wide); }
  .view-clients > .area-body:has(.dt-wrap) > :is(.fade.small, .stack) { max-width: var(--w-read); }
}
/* The record is open beside the list (a side panel from 1200px): the list makes room, so nothing is under it. */
@media (min-width: 1200px) {
  body:has(.shade.side:not(.leaving)) .view-clients { padding-right: 436px; }
  body:has(.shade.side:not(.leaving)) .view-clients .page-actions .btn:not(.go) { display: none; }
}
/* A record beside its page (a client, a booking on the calendar) starts under the top bar: the search, the bell, Help
   and the account stay in reach while it is open. */
@media (min-width: 1100px) {
  .shade.side { padding-top: calc(var(--bar-h, 0px) + 4px); }
  .shade.side .sheet { height: calc(100vh - var(--bar-h, 0px) - 16px); height: calc(100dvh - var(--bar-h, 0px) - 16px); }
}

/* ---------- Checkout and Payments tables ---------- */
@media (min-width: 1024px) {
  .co-table .dt td, .pay-table .dt td { white-space: nowrap; }
  .pay-table .dt td.pay-what { white-space: nowrap; color: var(--fade); }
}

/* ---------- a list's search box is a search box, not a 1000px bar ---------- */
@media (min-width: 1024px) {
  main.view .area-body input[type="search"], main.view > .stack input[type="search"] { max-width: 32rem; }
}

/* ---------- a menu row never runs past the menu ----------
   The phone's dock icons are min-content wide (app.css .nav button); in the side menu a long part with a count
   ("Products and inventory" and its 3) grew past the menu's edge and was cut. On a computer the row is the menu's width
   and its words end in "…". */
@media (min-width: 768px) and (min-height: 501px), (min-width: 768px) and (pointer: fine) {
  .side:not(.shade) .nav button { min-width: 0; }
}

/* ---------- Team → Schedule: a long name ends in "…" (it was cut mid-letter: "Maya-Gabrielle Tı") ---------- */
.sched-row > b { display: block; align-content: center; }

/* ---------- words stay readable on a wide page: about 75 characters a line ---------- */
@media (min-width: 1024px) {
  main.view .area-body > p.fade, main.view .pane > p.fade, main.view .pane > .page-sub, main.view > p.fade { max-width: 46rem; }
}
