/* R64 SALES ORDERS AS THE DESK (2026-11-11, the founder: "The sales order page: you've got Order, then a massive space,
   and then Status, Fulfillment, and Channel. I think all of that needs to be laid out like the platform ... All of that
   needs to look a lot more premium as well"). The platform has no sales list of its own any more (the ERP's /orders left
   on 1 Nov): "Sales orders" is the orders desk in the sales arrangement a person sets in its column chooser (Order, Order
   date, Items, Customer, Channel, Order price, Payment status, Fulfilment status, Status, Age), drawn with the desk's own
   recipe: the band head, 52px rows with the items cell's 40px picture and its card on hover, pills with dots. The
   destination and the supplier, which the arrangement hides, stay in the markup for the phone's row, stood down at the
   table's width (orders-row.tsx deskColumns); the order date, Channel and the two store statuses have no place on the
   phone's row and stand down under the table's width, as in the app. The list has no tick: it prints nothing, and its
   ten columns need the room. */

/* THE ROWS UNDER THE TABLE'S WIDTH (R64 FINAL, 2026-11-11, the founder: "everything has to be optimized for mobile,
   iPad, and all screens"). Sales orders stays Sales orders at every width: under the table's width its rows carry its
   own facts, the order date, the payment and the fulfilment (the Unfulfilled pills he asked for) and the channel, in
   the stack and phone rows' recipe (globals.css --desk-row-*: the band head, two lines, the picture at the head, pills
   at the right), where they had become the orders desk's rows (the destination and the supplier pill, which this list
   does not show, in their place). The number and the order date share one column of one width in every row (the widest,
   "AS-1020" with its copy press, is 77px), so the customer, the price and the age line up down the list. The stack:
   the number, the customer and the fulfilment; the date, the price with its payment, "N items", the channel, the age
   and the status. */
:root[data-demo-screen="sales-orders"] {
  --desk-row-cols: auto minmax(5.5rem, auto) auto auto auto minmax(0, 1fr) auto auto;
  --desk-row-areas: 'thumb number customer customer customer customer customer ful'
    'thumb date price pay name chan age status';
}
@container desk (width < 58rem) {
  /* the head's sort line says what it is, as the desk's does (its "Sort by" stood on the tick's head, which this list
     has not got), and names only what the rows show */
  :root[data-demo-screen="sales-orders"] [data-orders-table] thead th[data-col="customer"]::before {
    content: var(--desk-sort-label);
    margin-right: 0.75rem;
  }
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td):is([data-col="destination"], [data-col="supplier"]) { display: none !important; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="order-date"] > * { grid-area: date; font-size: 0.78125rem; line-height: 1.15rem; color: var(--text-muted); }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="channel"] > * {
    grid-area: chan;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.78125rem;
    line-height: 1.15rem;
    color: var(--text-muted);
  }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="payment"] > * { grid-area: pay; justify-self: start; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="fulfilment"] > * { grid-area: ful; justify-self: end; }
}
/* ON A NARROW DESK (under 38rem: a phone, a phone on its side) the two lines have no room for all of it, so the row
   takes three, as Pick and pack's phone row does: the number, the customer and the age; the order date, the price with
   its payment, and the status; the order's picture with "N items" (its card opens on a tap: the capture's phone row
   had neither, the button stood 0x0) and the fulfilment. The channel, "Shopify store" on every order, rests at the
   table's and the stack's widths. */
@container desk (width < 38rem) {
  :root[data-demo-screen="sales-orders"] [data-orders-table] tbody tr {
    grid-template-columns: minmax(5.5rem, auto) auto minmax(0, 1fr) auto;
    grid-template-areas: 'number customer customer age' 'date price pay status' 'items items . ful';
  }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="items"] > div {
    display: flex;
    grid-area: items;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    margin-top: 0.375rem;
  }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="items"] > div > span:has(> [data-product-thumb]) { display: inline-flex; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="items"] button[data-demo-pop] { display: inline-flex; }
}

/* the four sales cells come back under the table's width (the channel only from 38rem): the capture stands them down
   there with @max-index-table/desk:hidden!, an !important in the app's utilities layer, which only an !important in that
   layer answers */
@layer utilities {
  @container desk (width < 58rem) {
    :root[data-demo-screen="sales-orders"] [data-orders-table] td:is([data-col="order-date"], [data-col="channel"], [data-col="payment"], [data-col="fulfilment"]) { display: contents !important; }
  }
  @container desk (width < 38rem) {
    :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="channel"] { display: none !important; }
  }
}

/* THE COLUMNS (orders-desk-layout.ts, 10 Nov): every column as wide as its words, on one line, and the customer alone
   taking the slack, its name capped at 12rem (its card holds the whole name); where the desk has no slack at all the
   name is what gives way, never a column. The age stands at its own words ("1 d", "2 w"): the platform's 8ch box keeps a
   live clock from moving the columns, and a capture's clock never moves. */
@container desk (width >= 58rem) {
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td):not([data-col="customer"]) { width: 1px; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="customer"] { max-width: 0; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td)[data-col="items"] { min-width: 0; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="items"] { max-width: none; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="age"] > span { width: auto; }
  /* the room between columns follows the desk, as the app's own padding does (ORDERS_CELL_PADDING: a step tighter on
     the laptop beside the open rail). R64 FINAL: on that laptop (a 1258 to 1345 window) the app's 4px a side left 8px
     between "Shopify store" and the price, the price and Paid, and ran the head together ("Order price Payment status
     Fulfilment status Status"): the two status heads say "Payment" and "Fulfilment" there (their pills say the rest),
     which gives the columns 12px between them, the row's two ends 8px in, every name still whole at 1280 */
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td) { padding-inline: 0.375rem; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td):first-child { padding-left: 0.5rem; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td):last-child { padding-right: 0.5rem; }
}
@container desk (58rem <= width < 64.5rem) {
  :root[data-demo-screen="sales-orders"] [data-orders-table] thead [data-demo-head-more] { display: none; }
}
@container desk (width >= 64.5rem) {
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td) { padding-inline: 0.5rem; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td):first-child { padding-left: 0.75rem; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td):last-child { padding-right: 0.75rem; }
}
/* from a 1440 window (and the demo's own 1440 frame), the orders desk's own 12px a side */
@container desk (width >= 69rem) {
  :root[data-demo-screen="sales-orders"] [data-orders-table] :is(th, td) { padding-inline: 0.75rem; }
}

/* ON A PHONE (the desk under 30rem: the platform's two-line row) the order number keeps its own width and the age stands
   at its own words, as on the orders desk. */
@container desk (width < 30rem) {
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="number"] > [data-copyable] { min-width: max-content; }
  :root[data-demo-screen="sales-orders"] [data-orders-table] td[data-col="age"] > span { width: auto; }
}
