/* ===========================================================================
   CORNERPOST WORKS HQ - SHARED COMPONENTS
   ===========================================================================
   Buttons, fields, collections, pagination, modals, feedback and states.
   Every value from src/tokens.css.
   =========================================================================== */

/* ===========================================================================
   BUTTONS AND ACTION ROLES - UI Standard 4
   ===========================================================================
   ONE RADIUS AND ONE HORIZONTAL PADDING for every role (4.2): "Primary,
   secondary, neutral, and destructive buttons share base geometry." The role
   changes the colour and the border, never the shape - which is what makes a
   row of mixed roles read as one group.
   =========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font-family: inherit;
  font-size: var(--type-body-size);
  font-weight: var(--type-strong-weight);
  line-height: var(--type-line-tight);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

/* PRIMARY - the one commit action on a screen. UI-001 requirement 8: "one
   clearly identifiable primary action per screen." */
/* THE GROUND IS GREEN IN BOTH THEMES, so the ink is --ink-on-green rather
   than --ink-on-chrome: the frame's ink follows the frame, and the frame is
   light in Light. See the token's own note - this read 1.09:1 in Light. */
.btn-primary {
  background: var(--brand-charcoal-green);
  border-color: var(--brand-charcoal-green);
  color: var(--ink-on-green);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-green);
  border-color: var(--brand-green);
}

/* SECONDARY - a real action that is not the commit. */
.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--brand-brass);
}

/* NEUTRAL - Cancel, Close, and anything that steps back. */
.btn-neutral {
  background: transparent;
  border-color: transparent;
  color: var(--ink-muted);
}

.btn-neutral:hover:not(:disabled) {
  background: var(--surface-inset);
  color: var(--ink);
}

/* DESTRUCTIVE - 4.2 requires it to be "spatially separated from the normal
   Cancel/Save group", which .action-bar does. The role itself is outlined
   rather than filled: a filled red button beside a filled commit button reads
   as the louder of two primaries. */
.btn-destructive {
  background: var(--surface);
  border-color: var(--state-error);
  color: var(--state-error);
}

.btn-destructive:hover:not(:disabled) {
  background: var(--state-error-surface);
}

/* BRASS - 4.2: "an approved exceptional action role used sparingly to make a
   deliberately exceptional, consequential business action more visually
   significant. It is not a second ordinary primary style and 'important'
   alone is not sufficient justification."
   A brass action must carry a documented functional reason, and
   `check:ui` refuses one that does not: the markup has to state
   data-brass-reason. Send Proposal is the approved example. */
.btn-brass {
  background: var(--brand-brass);
  border-color: var(--brand-brass);
  color: var(--brand-green);
}

.btn-brass:hover:not(:disabled) {
  /* BRAND ON BRAND, and theme-independent on purpose: the ground here is a
     fixed brand brown, not the themed chrome, so the text that reads on it
     is khaki in every theme. */
  background: var(--brand-deep-brown);
  color: var(--khaki);
}

/* DISABLED - 7.2: "Disabled means currently unavailable and is visually
   subdued. Use it only when showing the unavailable option is useful. Do not
   use Disabled as an implementation shortcut for Read-only." */
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* WORKING - 8.2: the initiating commit action "enters a working state and
   prevents duplicate/conflicting submissions", and 8.5: a short operation
   shows it on the control itself, e.g. Saving... */
.btn[data-working='true'] {
  cursor: progress;
  opacity: 0.7;
}

/* ICON-ONLY - 3.7 reserves this for "conventional, contextually unmistakable
   actions such as close or copy", and it must keep an accessible name,
   keyboard operation and the canonical focus treatment. The target stays
   44px even though the glyph is small, which is 3.4's rule exactly: "A small
   visible symbol does not by itself justify an 18x18px hit target." */
.btn-icon {
  width: var(--control-height);
  min-width: var(--control-height);
  padding: 0;
  font-size: var(--type-section-size);
}

/* ---------------------------------------------------------------------------
   ACTION BAR - 4.2 ordering, in one place so no screen has to remember it.
   Cancel then Primary with the primary rightmost; destructive separated left.
   ------------------------------------------------------------------------ */
/* AND IT WRAPS, BECAUSE .btn DOES NOT.
   ------------------------------------------------------------------------
   `.btn` sets `white-space: nowrap`, so a button's min-content width is its
   whole label and a flex row of them cannot shrink to fit: past the
   container's width the items simply hang out of it. Found on the deployed
   sign-in card during owner acceptance, 1 November 2026 - "I have a one-time
   code" stood 72px beyond the card's right edge at 1440px AND at 768px, and
   "Back to signing in" stood 51px beyond it on the code panel. Neither showed
   below 640px, where the rule further down turns this into a stretched
   column - which is why a phone never revealed it and a desktop always did.
   WRAPPING, NOT SHRINKING, IS THE FIX. 4.2 governs the ORDER of a
   Cancel/Primary group and wrapping preserves it, where shrinking would
   either clip a label or need a width this rule cannot know. It changes
   nothing that already fits: a row with room lays out identically either
   way. */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.action-bar-destructive {
  margin-right: auto;
}

@media (max-width: 639px) {
  /* Reversed column order keeps the primary commit nearest the thumb while
     preserving hierarchy - 4.2 permits rearrangement, not reordering of
     importance. */
  .action-bar {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .action-bar .btn {
    width: 100%;
  }

  .action-bar-destructive {
    margin-right: 0;
    margin-top: var(--space-4);
  }
}

/* ===========================================================================
   FIELDS - UI Standard 7, and the form standard of 2 November 2026
   ===========================================================================
   Label identifies, helper text instructs. The label is always visible: 7.3 -
   "Placeholders never replace visible labels."

   EVERY FIELD IS THREE ROWS, IN THIS ORDER:

     1  the label, with the required or optional mark
     2  the control
     3  helper text and validation text

   HELPER TEXT IS BELOW THE CONTROL. It used to be above, and that is the
   defect: a one-line hint on the left beside a two-line hint on the right
   started the two controls at different heights, so the row of boxes somebody
   is typing into stepped down the screen. Below the control nothing a helper
   does can move the control, because the control is already placed.

   STANDALONE, THIS IS A PLAIN COLUMN and behaves exactly as the flex column
   it replaces - a dialog or the sign-in card needs no alignment because it has
   one column to align. The row-sharing is declared by `.form-grid` further
   down, where there is a second column for a field to line up WITH.
   =========================================================================== */
.field {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: var(--field-gap);
  align-content: start;
}

/* The label and its mark sit on one line, with the mark pushed to the end so
   a long label wraps against the text rather than against the word Optional. */
.field-label {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  color: var(--ink);
}

.field-label-text {
  min-width: 0;
}

/* REQUIRED - 7.1: "* immediately after the field label", one meaning
   system-wide, and the semantics exist programmatically too (the control
   carries `required`, not just this mark). */
.field-required {
  color: var(--state-error);
  margin-left: calc(var(--space-2) * -1);
}

/* OPTIONAL IS SAID IN WORDS, and quietly - it is information, not emphasis.
   Unmarked-means-optional only works for somebody who already knows the
   convention, and the person filling in an onboarding form for the only time
   in their employment does not. It is set to one side of the label because it
   is a property of the field rather than part of its name. */
.field-optional {
  margin-left: auto;
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-body-weight);
  color: var(--ink-muted);
  white-space: nowrap;
}

/* THE SUPPORT ROW - helper text and validation text together, as one row, so
   a field that gains an error does not grow a fourth row and knock the field
   beside it out of alignment. It is present even when it is empty. */
.field-support {
  display: flex;
  flex-direction: column;
  gap: var(--field-gap);
}

.field-support:empty {
  display: none;
}

/* A control that is more than one element - the lookup's value, box and
   suggestion list - is still ONE row. */
.field-control-group {
  display: flex;
  flex-direction: column;
  gap: var(--field-gap);
  min-width: 0;
}

.field-helper {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* A CHECKBOX AND ITS OWN LABEL, with whatever explains it beneath.
   DELIBERATELY NOT A THREE-ROW FIELD: a checkbox's label sits beside the box,
   so there is no label row for it to share with the field next to it and
   nothing for the subgrid to align. It spans the row instead, because the
   sentence that explains a tick is almost always longer than half a form. */
.field-choice {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--field-gap);
  min-width: 0;
}

/* A CHECKBOX IS NOT A TEXT BOX, and this selector used to catch one. With no
   type filter, `width: 100%` and a 44px min-height turned a tick into a
   full-width 44px slab - which is the oversized native control the owner
   photographed in New Customer. The approved binaries have their own
   components and their own sizing (.checkbox and .switch below); anything
   that still lands inside a .field must not be deformed by this rule. */
.field-control,
.field input:not([type='checkbox']):not([type='radio']),
.field select,
.field textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--type-body-size);
  color: var(--ink);
}

/* TEXTAREA - 7.3: it "represent[s] narrative or naturally multiline
   information and begin[s] at a useful height", and Enter makes a new line
   rather than submitting. */
.field textarea {
  min-height: calc(var(--control-height) * 2);
  padding: var(--space-4);
  line-height: var(--type-line);
  resize: vertical;
}

.field select {
  /* A select's own padding differs from a text input's because the platform
     draws the arrow inside the box. Component geometry, 3.4. */
  padding-right: var(--space-7);
}

/* A field may change its border on focus - 3.1 permits that - but it does NOT
   replace the canonical ring, which :focus-visible in tokens.css supplies. */
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: var(--brand-brass);
}

/* READ-ONLY IS NOT DISABLED. 7.2: read-only information "remains legible and
   available for reference/copy; it should not look unavailable." So it keeps
   full-contrast ink and loses only the affordance. */
.field input[readonly],
.field textarea[readonly] {
  background: var(--surface-inset);
  border-color: var(--border-subtle);
  color: var(--ink);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: var(--surface-inset);
  color: var(--ink-muted);
  cursor: not-allowed;
}

/* A MACHINE-GENERATED VALUE, which is a different kind of content from a name
   or an address.
   ------------------------------------------------------------------------
   A one-time code is read off one screen and typed into another, so its
   glyphs have to be unambiguous - 0/O and 1/l/I are the entire difficulty,
   and the base64url alphabet the server generates contains all six.
   IT COSTS A LITTLE WIDTH RATHER THAN SAVING ANY, which is worth writing down
   because the opposite is the natural assumption. Measured on the 43-character
   code the TE owner account issued: 431px of text in the proportional face at
   16px, 438px in mono at 14px. Base64url is mixed-case alphanumerics, which a
   proportional face sets narrower than any fixed advance can. The 7px buys
   six characters nobody has to guess at, and is accepted deliberately.
   THE FIELD IS STILL ALLOWED TO SCROLL rather than being widened to suit it.
   No card width makes 43 characters fit on a 390px phone - at 298px of usable
   box it would need a ~6.9px glyph - and a width that nearly works is worse
   than one that honestly scrolls. `box-sizing: border-box` and the
   `width: 100%` above keep the box inside its container at every width, which
   is the property that actually matters.
   AND THE SELECTOR HAS TO BE THIS SHAPE, which is worth a line because the
   first version was simply `.field-code` and did nothing at all. The base
   control rule above is
   `.field input:not([type='checkbox']):not([type='radio'])` - specificity
   (0,3,1) - and it sets BOTH `font-family: inherit` and the body font size,
   so a bare class at (0,1,0) lost the cascade silently and the field stayed
   in the sans face. The browser case caught it; nothing reading the source
   would have. Mirroring the base selector's shape is how a component sheet
   overrides its own standardized control, and the trailing bare class keeps
   `.field-code` working outside a `.field` wrapper. */
.field input.field-code:not([type='checkbox']):not([type='radio']),
.field textarea.field-code,
.field-code {
  font-family: var(--font-mono);
  font-size: var(--type-label-size);
  letter-spacing: 0.01em;
}

/* FIELD-LEVEL VALIDATION - 8.3's first of three levels. Colour is never the
   only cue: the border changes, the text appears, and the control is
   aria-invalid. */
.field[data-invalid='true'] input,
.field[data-invalid='true'] select,
.field[data-invalid='true'] textarea {
  border-color: var(--state-error);
}

.field-error {
  display: flex;
  gap: var(--space-2);
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
  color: var(--state-error);
}

.field-error::before {
  content: '!';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-5);
  min-width: var(--space-5);
  height: var(--space-5);
  border-radius: 50%;
  background: var(--state-error);
  color: var(--surface);
  font-size: var(--type-record-secondary-size);
}

/* ---------------------------------------------------------------------------
   SWITCH - 7.4: "the preferred Works control for true binary
   properties/states: Taxable, Active, Billable, Enabled/Disabled."
   Checkboxes are reserved for acknowledgment and selection, which is why
   there is a switch role here at all.
   ------------------------------------------------------------------------ */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--control-height);
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  width: calc(var(--space-7) * 2);
  height: var(--space-7);
  border-radius: var(--space-7);
  background: var(--border);
  border: var(--border-width) solid var(--border);
  transition: background-color 120ms ease;
  flex: 0 0 auto;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: var(--space-1);
  left: var(--space-1);
  width: var(--space-5);
  height: var(--space-5);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
  transition: transform 120ms ease;
}

.switch input:checked + .switch-track {
  background: var(--state-success);
  border-color: var(--state-success);
}

.switch input:checked + .switch-track::after {
  transform: translateX(var(--space-7));
}

.switch input:focus-visible + .switch-track {
  box-shadow: var(--focus-ring);
}

/* The state is readable as text, not only as a position - 2's "readable
   state" and 8.3's "meaning never relies on color alone". */
/* ---------------------------------------------------------------------------
   CHECKBOX - 7.4, for acknowledgment and for selection. Not the default
   binary-property control.
   ------------------------------------------------------------------------ */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--control-height);
  cursor: pointer;
}

.checkbox input {
  width: var(--space-6);
  height: var(--space-6);
  min-height: 0;
  margin: 0;
  accent-color: var(--brand-charcoal-green);
}

/* ===========================================================================
   THE CONTROL REGION - UI Standard 5.2 and 9.4
   ===========================================================================
   "Search, Filters, and view/sort controls live in a dedicated region below
   the workspace header." One region, so a workspace cannot scatter them.
   =========================================================================== */
.controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  border-bottom: var(--border-width) solid var(--border-subtle);
}

/* ===========================================================================
   THE LAYOUT STRATEGY, stated once and the same in every workspace.

     search · primary filters · sort · more filters · clear

   ONE FLOW, NOT TWO GROUPS. This region used to be two boxes - the search
   and filters in one, sort and the buttons in another pushed right with
   margin-left: auto - and that is the architectural cause of two workspaces
   looking different at the same width. Whether the right-push happened
   depended on how many filters a workspace had: with one primary filter
   everything fitted and the toolbar read as a single row; with two the
   search had taken 484px of 900, the filter wrapped to the left of row two,
   and Sort stayed pinned at the right with about 370px of nothing between
   them. A workspace cannot inherit a layout whose character changes with its
   own control count.

   SO NOTHING IS PUSHED RIGHT, at any width. Every control is a sibling in
   one wrapping flow, in one order. Wrapping is still expected and still
   correct - five controls genuinely do not fit across a tablet - but it now
   happens the same way everywhere: the next control that does not fit starts
   the next row, hard against the left. Customers with one filter and Service
   Requests with two are then the same layout with a different number of
   cells in it, which is what "predictable in the number of controls" has to
   mean.

   AND THE BREAKPOINT THAT DISSOLVED THE GROUPING IS GONE WITH IT. There is
   no grouping left to dissolve, so the 1024 rule that existed only to undo
   margin-left: auto has nothing to do. One flow at every width is one fewer
   arrangement to keep consistent.

   WHAT REPLACES THE GROUPS IS A SIZING POLICY PER CONTROL, below: the search
   is the only control that grows, every picker sizes to its content and
   stops, and the buttons never shrink. That policy is what the two groups
   were approximating.
   =========================================================================== */
.controls-primary {
  display: grid;
  /* THE TRACKS ARE SET BY THE COMPONENT, which is the only thing that knows
     how many filters this collection has. See controlRegion: each track
     carries a measured FLOOR and a share of the leftover, so five controls
     are sized as one row rather than five boxes taking what they like. The
     declaration here is the fallback a browser gets before any script runs
     and is the two-row form, because a toolbar that is merely less tight is
     a better failure than one that overflows. */
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  /* end, NOT center. The cells stretch to the tallest, and a centred 44px
     button in a 70px labelled-field row floats 13px above the selects beside
     it - measured. The labelled fields put their CONTROL at the bottom of
     their box, so the controls line up only if the row does too. */
  align-items: end;
  /* 12px, UNCHANGED. The gap is part of the budget - four of them is 48px
     of the row - and tightening it was the obvious place to find width.
     It was not needed: the floors and the gaps together come to 789px for
     Service Requests, which the owner's 868px tablet row holds with 79px to
     spare. Spending that margin on denser spacing would have bought nothing
     and changed the rhythm every other control region is set to. */
  gap: var(--space-4) var(--space-4);
}

/* THE CHOSEN FALLBACK, when one row genuinely will not hold five controls.

   The search takes a row of its own and the pickers and buttons share the
   next one. That is a decision, and it is the reason this is not a wrap:
   wrapping breaks at the LAST control, which strands More filters by itself
   - the specific arrangement the owner ruled out - whereas this breaks at
   the one control that can use a whole row, and keeps the controls that
   belong together on one line.

   It needs 577px for Service Requests, so it holds all the way down to the
   640 tier where the controls become a single column. */
.controls-primary[data-toolbar='stacked'] > .controls-search {
  grid-column: 1 / -1;
}

/* THE LAST RESORT: one control per row.

   Reached by MEASUREMENT, not by a breakpoint - see fit() in components.js.
   It is the same arrangement the 639px tier gives a phone, and it is now
   also what a collection gets whenever it is genuinely narrow, whatever the
   window is doing. A workspace beside an expanded navigation at 800px is
   508px wide and needs this exactly as a 380px phone does.

   EVERY CONTROL SPANS, including the search, so nothing is stranded in a
   half-width cell beside nothing. */
.controls-primary[data-toolbar='column'] > * {
  grid-column: 1 / -1;
}

/* A CELL MAY BE NARROWER THAN THE TEXT INSIDE IT.

   This is what makes the floors mean anything. A grid track sized
   minmax(132px, 1fr) still refuses to go below the INTRINSIC width of its
   contents unless the contents say they may be narrowed - and a search
   placeholder reading "Number, what was said, or the caller's name or
   phone" is 386px of intrinsic width. Without this the track's floor would
   quietly become 386px and the row would overflow at the exact width the
   floors were chosen to survive. */
.controls-search,
.controls-filter,
.controls-sort {
  min-width: 0;
}

/* THE BUTTONS NEVER SHRINK. A "More filters" squeezed to fit is unreadable
   before it is narrow, and 9.4 - "Clear Filters does not clear Search" -
   depends on the label being legible enough to tell them apart. Their track
   is max-content, and this keeps the button filling it rather than sitting
   in a corner of it. */
.controls-primary > .controls-more,
.controls-primary > .btn {
  white-space: nowrap;
  justify-self: stretch;
}

/* The way to the rest of the filters. It is a control in the same row as the
   ones it extends, not a second permanent toolbar. */
.controls-more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

/* WHILE ANYTHING IS FILTERED, the control that contains Clear Filters is
   marked - because somebody whose only narrowing is a primary filter can see
   the filter but not the way to undo it, and has no other reason to open
   this.

   A BORDER AND THE INK, NOT A FILL. A filled button here would read as the
   primary action of the screen, which it is not; 8 gives one primary action
   per screen and this is not it. */
.controls-more[data-filtered='true'] {
  border-color: var(--accent);
  color: var(--ink-accent);
}

.controls-more:hover {
  background: var(--surface-inset);
  border-color: var(--brand-brass);
}

/* THE COUNT IS WHY A SHORT LIST IS SHORT. A collapsed row that is still
   narrowing the collection is the one way this pattern lies, so the number
   stays visible while the row is shut - and it is a NUMBER, not a dot, so a
   screen reader reads it too (3.6). */
.controls-more-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-1);
  border-radius: 10px;
  background: var(--brand-brass);
  color: var(--brand-green);
  font-size: var(--type-record-secondary-size);
  font-weight: 700;
}

.controls-more-chevron {
  color: var(--ink-muted);
}

/* THE EXPANDED ROW IS IN FLOW. It pushes the collection down instead of
   floating over it: a filter panel that covers the records hides the thing it
   is filtering.

   AND IT MOVES, which is the owner's requirement: "Opening More Filters must
   expand the filter area naturally and push the customer list downward.
   Closing it must reverse that movement."

   IT USED TO BE hidden, TOGGLED BY A FULL RE-RENDER - so nothing moved and
   nothing was pushed: the list below was destroyed and a new one built with
   the row already open. Now the row stays mounted and animates its own
   height, and the list below follows because it is a sibling in normal flow.

   THE HEIGHT IS THE CONTENT'S OWN. grid-template-rows 0fr -> 1fr animates
   to whatever the row needs at whatever width it is - no max-height guessed
   at one breakpoint and clipping at another, which is the usual way this
   pattern breaks on a tablet. The inner element carries overflow:hidden
   and min-height:0, without which a grid row will not collapse below its
   content.

   A CLOSED ROW IS NOT MERELY INVISIBLE: inert is set on it in JS, so its
   four selects are out of the tab order exactly as hidden used to put
   them. */
/* CLEAR FILTERS, inside the area whose filters it clears.

   It sits at the end of the extra filter row, on the same baseline as the
   fields beside it - .controls-more-inner already aligns its children to
   flex-end, which is what puts a 44px button level with the CONTROL of a
   labelled field rather than with the top of its box.

   IT IS NOT PUSHED TO THE RIGHT. Same rule as the primary row: a control
   pinned to the far side of a wrapping row leaves a hole the width of
   whatever did not fit. It follows the last filter. */
.controls-clear {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* THAT THE COLLECTION IS FILTERED, said beside the count of what is left.

   Restrained on purpose: this is a statement of fact next to another
   statement of fact, not a warning. It carries the brass because brass is
   what this interface uses to mean "the system did something here", and it
   is the only mark on a line that is otherwise muted. */
.controls-filtered {
  margin-left: var(--space-3);
  padding-left: var(--space-3);
  border-left: var(--border-width) solid var(--border-subtle);
  color: var(--ink-accent);
  font-weight: var(--type-label-weight);
}

.controls-more-row {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 160ms ease,
    opacity 160ms ease;
}

.controls[data-more-open='true'] .controls-more-row {
  grid-template-rows: 1fr;
  opacity: 1;
}

.controls-more-inner {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  flex-wrap: wrap;
  min-height: 0;
  overflow: hidden;
}

/* The padding and the surface belong to the INNER element, because a
   collapsing grid row cannot collapse past its own padding. */
.controls[data-more-open='true'] .controls-more-inner {
  padding: var(--space-4);
  background: var(--surface-inset);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
}

/* REDUCED MOTION IS ALREADY ANSWERED, globally, in tokens.css: every
   transition in the shell is reduced to 0.01ms for somebody who has asked
   their system for less motion. The row still opens and the list is still
   pushed down - it simply happens at once. A second rule here would be a
   second place for that promise to be kept.
   3.2, and UI Standard 2's "calm". */

/* 8.2: "Refresh keeps existing content visible when reasonable." A sort or a
   filter re-reads the collection, and what the office sees while it does is
   the list it already had, marked as working - not an empty region and a
   spinner where the records were. The marking is restrained on purpose: the
   records stay legible, because the usual case is that most of them come
   back. */
.collection-results[data-busy='true'] {
  opacity: 0.6;
  transition: opacity 160ms ease;
}

/* The applied-state summary: how many records matched, and what is narrowing
   them. Reads from the API envelope, never from a client-side count. */
/* The count and the working mark are SIBLINGS, not parent and child: the
   summary's text is the count and nothing else, because it is read through
   aria-live and copied by people. */
.controls-status {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  width: 100%;
}

.controls-summary {
  margin: 0;
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* 8.2: a refetch says so without the list being thrown away first. */
.controls-busy {
  margin: 0;
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
  font-style: italic;
}

/* THE DEDICATED SORT CONTROL, AT EVERY WIDTH.

   The owner chose Option B: clickable column headings AND a sort control for
   the fields that have no column. Four of the nine keys have a heading to
   click; first name, business name, service address and best-match do not, so
   on a wide screen they were unreachable without it.

   It is also 9.3 on a narrow screen, where the columnar header collapses and
   "sorting moves into the control region instead" - so one control serves
   both, and the two never disagree because both read the key the ENVELOPE
   says was applied. */
.controls-sort {
  min-width: 0;
}

/* ONE CONTROL TO A LINE, below 640 - 3.5.

   A phone is not a narrow desktop. Five controls across 358px would be five
   unreadable controls, so the tracks stop applying and every control takes
   the full width: the grid becomes one column, which also puts the buttons
   at thumb width instead of leaving them the size of their labels.

   THE OVERRIDE HAS TO WIN AGAINST AN INLINE STYLE, because the component
   writes grid-template-columns onto the element - it is the only thing that
   knows the filter count. An inline style cannot be outranked any other
   way, so the keyword here is not a shortcut around specificity - the
   alternative is the component owning a breakpoint, which belongs in the
   stylesheet. */
@media (max-width: 639px) {
  .controls-primary {
    grid-template-columns: 1fr !important;
  }

  .controls-more-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* A collection workspace: the control region, then the collection. One
   rule, shared, because every list-based workspace has this same body and
   CSS-001 4 makes Customers the reference the others copy. */
.collection-workspace {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ===========================================================================
   COLLECTIONS - UI Standard 9
   ===========================================================================
   9.6: "Customers establishes the canonical primary collection-record
   treatment. Other primary collections may vary their grid tracks and
   information grouping to fit their business data, but they share the same
   visual and behavioral system." This IS that system.
   =========================================================================== */
.collection {
  display: block;
}

/* ---------------------------------------------------------------------------
   THE COLLECTION HEADER - 9.6 and the v1.6 canonical-header clarification.
   "A collection header describes and controls the records beneath it; it is
   not itself a record", so record hover, focus, navigation, brass edge, lift
   and background treatments must NOT apply to it.
   ------------------------------------------------------------------------ */
.collection-header {
  display: grid;
  gap: var(--space-6);
  align-items: center;
  padding: var(--space-3) var(--space-6);
  border-bottom: var(--border-width) solid var(--border);
  background: var(--surface-inset);
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* THE SORT CONTROL - 3.4's approved inline-affordance exception: "Column sort
   controls are an approved inline-affordance exception. The exception does
   not create a general compact-control category." Hover and focus belong to
   this control, not to the surrounding header (9.6). */
.sort-control {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--space-7);
  padding: var(--space-1) var(--space-2);
  margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-2));
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}

.sort-control:hover {
  color: var(--ink);
  background: var(--surface);
}

.sort-control[aria-sort='ascending'],
.sort-control[aria-sort='descending'] {
  color: var(--ink);
}

/* The direction is a glyph AND aria-sort - never colour alone. */
.sort-control-direction {
  font-size: var(--type-record-secondary-size);
  color: var(--brand-brass);
}

/* THE RESTING AFFORDANCE. Muted, so it reads as "this can be sorted"
   rather than competing with the column that IS the sort. */
.sort-control-hint {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
  opacity: 0.55;
}

.sort-control:hover .sort-control-hint {
  opacity: 1;
}

/* ---------------------------------------------------------------------------
   THE COLLECTION RECORD - 9.6, verbatim where it gives numbers.
   "Primary collection records use a transparent resting background, a bottom
   divider, the standard focus ring, and the established record hover
   treatment. Hover may introduce a temporary surface change and brass
   edge/lift... the resting row does not become a separate white card merely
   by default."
   "16px vertical and 20px horizontal padding with a 20px inter-region gap as
   the baseline rhythm. The minimum interactive target remains 44px. Record
   height is not fixed."
   ------------------------------------------------------------------------ */
.record-list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.record {
  display: block;
  border-bottom: var(--border-width) solid var(--border-subtle);
}

.record:last-child {
  border-bottom: 0;
}

/* Whole-record activation uses a real button - 4.3: "Prefer a native semantic
   element appropriate to the action; do not reproduce button or link
   behavior incompletely with pointer-only handlers." */
.record-activate {
  display: grid;
  gap: var(--space-6);
  align-items: center;
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-5) var(--space-6);
  border: 0;
  border-left: var(--focus-ring-width) solid transparent;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  transition: background-color 120ms ease, border-color 120ms ease;
}

/* ONLY A BUTTON GETS THE HAND, and only a button gets the brass bar. Both are
   promises that the row itself opens something, and a collection whose row
   holds several named destinations instead - Jobs - makes neither. It keeps
   the quiet hover, which helps the eye hold a seven-column line and claims
   nothing about clicking. */
button.record-activate {
  cursor: pointer;
}

.record-activate:hover {
  background: var(--surface-inset);
}

button.record-activate:hover {
  border-left-color: var(--brand-brass);
}

/* THE NAME OF A RECORD YOU CAN OPEN, when the row around it is the control.
   Same ink as .record-open below, because they are the same thing in two
   shapes - and the accent at REST is what makes a reference legible on a
   tablet, where there is no hover to discover it with.

   THE UNDERLINE COMES FROM THE ROW. The reference is not focusable itself;
   the row is, so the row's hover and focus are what confirm it. */
.record-ref {
  color: var(--ink-accent);
}

.record-activate:hover .record-ref,
.record-activate:focus-visible .record-ref {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* A NAME THAT OPENS THE RECORD IT NAMES.
   4.3: "Prefer a native semantic element appropriate to the action" - so this
   is a real button, a tab stop with a name, and it takes the shell's one
   focus ring like everything else.

   NO UNDERLINE AT REST. A job row carries three of these, and fifteen rows of
   underlined text is a screenful of rules competing with the words they are
   under; the office is scanning names, not links. The underline arrives on
   hover and on focus, where it answers "is this one of the ones I can click"
   at the moment the question is asked.

   IT IS NOT COLOUR ALONE (3.6). The brass ink distinguishes it at rest, the
   underline confirms it on approach, and the accessible name says which
   record it opens - three signals, none of them required on its own. */
/* A CARD HEADING THAT IS THE WAY IN - 4 November 2026.
   ==========================================================================
   OWNER INSTRUCTION: "Clicking a functional card header opens its
   workspace." So the heading's text is a button, and it must look like the
   heading rather than like a button sitting in one: `font: inherit` takes the
   heading's size and weight, and everything a browser draws around a button
   comes off.

   NO `min-height`. The 44px rule is for controls a thumb has to find; this is
   a line of heading text, and giving it a touch-target height would push the
   card's own title off its baseline. The pressable area is the full width of
   the title line, which is larger than 44px in the direction that matters.

   THE SAME HOVER AND FOCUS TREATMENT AS .record-open below, because they are
   the same kind of thing - a name you can press to go where it names - and
   two different treatments for one idea is how a screen stops teaching. */
.section-card-open {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.section-card-open:hover,
.section-card-open:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.record-open {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink-accent);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.record-open:hover,
.record-open:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.record-primary {
  font-size: var(--type-record-primary-size);
  font-weight: var(--type-record-primary-weight);
  color: var(--ink);
}

.record-secondary {
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-record-secondary-weight);
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------------------
   CONTROLLED WRAPPING - 9.3, measured on the owner's landscape tablet.

   AT 1024px THE JOBS LIST IS 684px WIDE and holds seven columns, so a cell is
   53 to 112 pixels. Measured there: rows 226 to 274 pixels tall, with 57
   wrapped primary lines across fifteen rows - three rows visible on a 768px
   screen, where the same list on a desktop shows twelve.

   TWO LINES, AND THE REST IS ONE CLICK AWAY. Nothing is removed from the
   document: the full value is still in the DOM and still read aloud by a
   screen reader, and the row opens the record where it is shown in full. That
   is the accessible way to read what a clamp hides, and it is the reason a
   title attribute is not used - invisible to touch and to a keyboard, which
   this stylesheet has rejected once already for metric reasons.

   ANYWHERE, NOT BREAK-WORD. "NGW012 Customer 1792034764735" is one 13-digit
   token; without this it overflows its column rather than wrapping inside it.

   IT IS SCOPED TO THE TEXT, not the region. A status chip is a direct child
   of .record-primary in some rows, and -webkit-box would make a flex chip a
   box item.
   ------------------------------------------------------------------------ */
/* :not(.cell-narrow-only) BECAUSE A CLAMP SETS display, and so does the
   utility that hides a folded column's other copy. Both are one class, the
   clamp's selector is more specific, and it won - so an invoice row drew its
   job number TWICE on a desktop: once in the Related job column and once in
   the copy that is only meant to appear when that column stands down.
   Measured by looking at it. The exclusion is here rather than an
   !important on the utility, because the utility is the simpler rule and
   should stay the simpler rule. */
.record-primary > span:not(.cell-narrow-only),
.record-secondary > span:not(.cell-narrow-only),
.record-primary > .record-open > span,
.record-secondary > .record-open > span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* A REASON IS NOT A LIST ENTRY, AND MUST NOT BE CLAMPED.
   ------------------------------------------------------------------------
   The two-line clamp above is right for a collection: fifteen rows of
   wrapping text is a page nobody can scan. It is wrong for a sentence whose
   whole purpose is to be read.

   THE DEFECT. An invoice's tax review lists the gates that refuse issuance,
   each one a sentence the backend wrote. On the rendered record the third
   read "...so the jurisdiction cannot be…" and stopped. The owner's standing
   instruction from the sorting refinement is explicit: "Do not truncate
   operationally important information without an accessible way to read it."
   A blocking reason is as operationally important as text on this screen
   gets, and there was no way to read the rest of it - no tooltip, no
   expansion, no second surface.

   SO A LIST MAY DECLARE ITSELF A LIST OF REASONS, and its rows wrap in full.
   It is opt-in rather than a change to the clamp, because the clamp is right
   everywhere it is already applied. */
.record-reasons .record-primary > span,
.record-reasons .record-secondary > span {
  display: block;
  -webkit-line-clamp: none;
  overflow: visible;
}


/* 9.6: "Status represents the state of the record as a whole and, when
   present in a columnar primary collection, aligns to the trailing edge of
   its region for consistent scanning." */
.record-status {
  /* MORE THAN ONE CHIP IS ALLOWED HERE, and the canonical record is where
     that first mattered: a property carries its own status AND whether this
     customer is billed for it AND whether the relationship has ended. They
     are facts about the record as a whole, which is what 9.6 reserves this
     region for - so the region holds them in a row rather than making the
     record invent a second one. */
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-self: end;
  justify-content: flex-end;
}

/* Record actions stay with the record (5.2), and an interactive control
   inside a record must not also trigger record navigation (4.3) - which is
   why they live OUTSIDE .record-activate rather than inside it. */
.record-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-6) var(--space-5);
}

/* ---------------------------------------------------------------------------
   AN ENTRY THAT STACKS: A LINE, ITS FIELDS, AND ITS OWN CONTROL
   (10 November 2026, the payment record)

   WHY THIS EXISTS. The payment record was written against two class names
   that were never in this file - `.record-compact` and `.record-main` - so
   its entries rendered as a bare `.record`: a bottom border, no padding, no
   alignment, and a run of inline spans that wrapped into a paragraph. The
   owner read it on deployed Test and asked for spacing, alignment, and the
   refund's facts as readable fields.

   IT IS NOT A CARD. No background, no border of its own, no icon, no
   shadow: the `.record-list` around it already draws the container and the
   `.record` separator already divides the entries. This adds padding on the
   container's own scale, a baseline-aligned first line, and a field list
   underneath - which is the treatment every other record in HQ uses for
   labelled facts.
--------------------------------------------------------------------------- */
.record-stacked {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
}

/* THE LINE THAT SAYS WHAT THE ENTRY IS: the amount and its one status
   word, on a baseline so the chip sits with the figure rather than
   above it. */
.record-stacked > .record-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* THE FIELDS BELOW IT inherit the shared field-list treatment and need no
   padding of their own - the entry has it. */
.record-stacked > .field-list {
  margin: 0;
}

/* AND THE CONTROL SITS UNDER THE ENTRY IT BELONGS TO, which is the whole
   of "position Record this refund clearly within its corresponding refund
   entry". `.record-actions` carries the card padding for a row at the
   bottom of a card; inside an entry the entry supplies it. */
.record-stacked > .record-actions {
  padding: 0;
}

/* ---------------------------------------------------------------------------
   ONE MATERIAL, ONE LINE (requirement 7, 28 October 2026).

   The row was a three-column activation block with a primary AND a secondary
   line in each column, plus an actions block beneath - five text rows and a
   button row for one fitting. Eight materials was a page of scrolling to read
   eight quantities.

   This is one flex row: quantity, what it is, what it comes to, and the acts
   that change that. The quantity leads because it is what the office is
   checking, and it is a FIXED column so eight rows of numbers line up -
   ragged quantities are the thing that makes a list of materials hard to
   total by eye.

   THE ASIDE CARRIES WHAT IS TRUE AND IS ABSENT OTHERWISE. Item number, which
   visit supplied it, what a waived line normally sells for, and why - one
   muted line, or no line at all, which is the ordinary case.

   NOTHING IS HIDDEN TO ACHIEVE THIS. Needs pricing keeps its warning
   treatment, a waived line still says what was given away, and both keep
   their actions. Compactness bought space, not silence.

   CSS-001: every value is a token.
   --------------------------------------------------------------------------- */
.material-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
}

.material-quantity {
  /* FIXED, SO THE NUMBERS LINE UP. Tabular figures for the same reason: a
     list of quantities is read as a column even though it is laid out as a
     row of rows. */
  flex: 0 0 5.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: var(--type-label-weight);
  color: var(--ink);
}

.material-what {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.material-description {
  color: var(--ink);
  /* A long description truncates rather than wrapping the row onto a second
     line, which is what the compactness is for. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-aside {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── THE RECORDED COST AND THE UNIT SELLING PRICE (15 November 2026).

   The owner asked for four figures on each material row: quantity and
   unit, the recorded unit cost, the customer unit selling price, and the
   extended selling amount. The first and last were already here; these
   two are the ones that came down on every line and were drawn nowhere.

   A LABEL ABOVE A FIGURE, not beside it, so two of them occupy the width
   of one short column rather than half the row - the compactness
   requirement of 28 October is still in force. Tabular figures and right
   alignment for the same reason as the quantity: a list of these is read
   as a column even though it is laid out as a row of rows. */
.material-money {
  display: flex;
  flex: 0 0 auto;
  gap: var(--space-3);
}

.material-figure {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  /* FIXED, LIKE THE QUANTITY COLUMN BESIDE IT and for the same reason: the
     figures line up down the list. A flex basis rather than a min-width,
     which is this file’s own idiom and what the geometry rule accepts. */
  flex: 0 0 4.5rem;
}

.material-figure-label {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

.material-figure-value {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.material-state {
  flex: 0 0 auto;
  text-align: right;
}

.material-charge {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.material-actions {
  display: flex;
  flex: 0 0 auto;
  gap: var(--space-2);
}

/* ON A NARROW SCREEN THE ROW BECOMES TWO. Below the phone breakpoint a
   quantity, a description, a figure and two buttons do not fit on one line
   at a readable size - and the answer is to wrap, not to shrink the text. */
@media (max-width: 640px) {
  .material-row {
    flex-wrap: wrap;
  }

  /* THE TWO FIGURES KEEP THEIR OWN LINE rather than being squeezed beside
     a wrapped description. Left-aligned there, because at the start of a
     line a right-aligned pair reads as drifting. */
  .material-money {
    flex: 1 1 100%;
    gap: var(--space-4);
  }

  .material-figure {
    align-items: flex-start;
  }

  .material-what {
    flex: 1 1 100%;
    order: -1;
  }

  .material-actions {
    margin-left: auto;
  }
}

/* ---------------------------------------------------------------------------
   SELECTING RECORDS (requirement 8, 27 October 2026).

   THE CHECKBOX IS IN THE GUTTER, NOT IN THE GRID. A leading track would mean
   every workspace's column definition had to know whether selection is
   available in this environment - five definitions, each able to disagree
   with its own rows. Instead the row keeps its tracks and grows padding on
   the left, and the box is positioned into the space that opens up. One
   class, and nothing a workspace has to restate.

   AND IT IS A SIBLING OF THE ACTIVATION BUTTON. The record is a real button;
   a checkbox inside one is invalid HTML and would make one click mean two
   things (UI Standard 4.3).

   CSS-001: every value below is a token or derived from one. */
.record.is-selectable,
.collection-header.is-selectable {
  position: relative;
}

.record-select {
  position: absolute;
  left: var(--space-5);
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* The touch target, not the box: a 16px checkbox is not something a finger
     can land on, and 9.6 rows are read on tablets.

     AND IT IS A <label>, WHICH IS WHAT MAKES THAT TRUE. This was a div for
     its whole life: correctly sized at 44px, and dead everywhere except the
     central 16px where the checkbox itself sits. Measured on a 1024x768 touch
     tablet against deployed TEST, 30 October 2026 - a tap 14px below centre
     landed on this element and selected nothing. A label forwards the
     activation from every pixel without a line of JavaScript. */
  width: var(--control-height);
  height: var(--control-height);
  transform: translateY(-50%);
  /* THE POINTER OVER THE WHOLE TARGET, not just over the box, because a
     cursor that changes only in the middle tells the reader the truth about
     where the control was and nothing about where it is now. */
  cursor: pointer;
}

.record.is-selectable > .record-activate,
.collection-header.is-selectable {
  padding-left: calc(var(--space-6) + var(--control-height));
}

.record-select-input {
  width: var(--space-5);
  height: var(--space-5);
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.record-select-input:focus-visible {
  /* THE SAME RING EVERY FOCUSABLE THING IN HQ WEARS - a box-shadow token
     rather than an outline, so one definition governs the colour and the
     width (tokens.css --focus-ring). */
  outline: none;
  box-shadow: var(--focus-ring);
}

/* THE BAR, which exists only while something is selected. It sits above the
   list so that what it acts on is in view, and it is a region rather than a
   toolbar - the count is a live status, because the number changes under the
   reader's hands. */
.selection-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-inset);
}

.selection-bar-count {
  margin: 0;
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  color: var(--ink);
}

.selection-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* ---------------------------------------------------------------------------
   THE NARROW DESKTOP TIER - 9.3's "responsive column priorities", for the
   width between a phone and a desk.

   WHY IT EXISTS, measured on the owner's landscape tablet. At 1024px the
   sidebar is still 292px, so a collection gets 684px. Five columns fit there
   - Customers measures 171/119/136/77/56. Seven do not: Jobs gave its four
   NAME columns 43 to 49 pixels each, which is not a column, it is a word
   broken down a staircase.

   A COLUMN STANDS DOWN, IT DOES NOT DISAPPEAR. The value moves into a cell
   that is still on screen - the technician joins the status it belongs
   beside - so nothing is lost and nothing is hidden behind a hover. Exactly
   one of the two copies is in the document at any width, because
   display:none removes an element from the accessibility tree as well as
   from the page: a screen reader reads the technician once, wherever it is.

   IT IS DECLARED PER COLLECTION, not globally. How many columns fit depends
   on how many there are, so Jobs opts in with narrow: 'fold' on one column
   and a narrower track list; Customers needs neither.
   ------------------------------------------------------------------------ */
/* THE BOUNDARY IS 1299px, NOT 1199px, AND IT WAS MEASURED.

   At a 1200px viewport the DESKTOP tier applied, and seven columns had about
   790 pixels to share beside the sidebar: two of them came out at 25px and
   18px. 1200 was never a desktop width for this table - it only looked like
   one because the breakpoint said so.

   Seven columns need roughly 1030px of ROW, which a window reaches at about
   1300. Below that the narrow tier is what fits, and since 28 October 2026
   that tier is FOUR columns rather than six. */
@media (min-width: 640px) and (max-width: 1299px) {
  .collection-header[style*='--narrow-tracks'],
  .record-activate[style*='--narrow-tracks'] {
    grid-template-columns: var(--narrow-tracks) !important;
  }

  .cell-narrow-folded {
    display: none;
  }
}

/* THE OTHER COPY, which is in the row at every width and shown at one. It
   sits under the cell its column folded into. */
.cell-narrow-only {
  display: none;
}

@media (min-width: 640px) and (max-width: 1299px) {
  .cell-narrow-only {
    display: block;
  }
}

/* ---------------------------------------------------------------------------
   MOBILE - 9.3: "Ordinary mobile tables transform into structured stacked
   records rather than forcing horizontal scrolling. Primary identifier
   remains prominent; important information and actions remain associated with
   the record."
   ------------------------------------------------------------------------ */
@media (max-width: 639px) {
  /* The columnar header has no columns to label once the grid collapses, so
     it goes - and 9.3 moves sorting into the control region instead, which
     .controls already holds. */
  .collection-header {
    display: none;
  }

  .record-activate {
    grid-template-columns: 1fr !important;
    gap: var(--space-2);
    padding: var(--space-5);
  }

  .record-status {
    justify-self: start;
  }

  .record-actions {
    padding: 0 var(--space-5) var(--space-5);
  }

  .record-list {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
  }
}

/* ---------------------------------------------------------------------------
   STATUS - 11.1. One vocabulary, and the state is readable as a word rather
   than inferred from a colour.
   ------------------------------------------------------------------------ */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
  color: var(--ink-muted);
  white-space: nowrap;
}

.status[data-tone='success'] {
  border-color: var(--state-success);
  background: var(--state-success-surface);
  color: var(--state-success);
}

.status[data-tone='warn'] {
  border-color: var(--state-warn);
  background: var(--state-warn-surface);
  color: var(--state-warn);
}

.status[data-tone='error'] {
  border-color: var(--state-error);
  background: var(--state-error-surface);
  color: var(--state-error);
}

.status[data-tone='info'] {
  border-color: var(--state-info);
  background: var(--state-info-surface);
  color: var(--state-info);
}

/* ===========================================================================
   PAGINATION - UI Standard 9.2
   ===========================================================================
   "The standard paginator uses a restrained Previous / page position / Next
   pattern. Show the current page and total pages (for example, 1 / 4)
   together with dataset position; do not use a numbered page-button strip as
   the baseline pattern."
   "Previous and Next remain visible at the boundaries in their unavailable
   state. First/Last controls are not baseline behavior."
   "No paginator for 15 or fewer records."
   =========================================================================== */
.paginator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  /* BOTH HALVES WRAP. The position sentence beside Previous / Page 1 / Next
     is about 215px that cannot break, which fitted while the workspace had
     the whole window and did not once the navigation started taking a column
     beside it (24 October 2026). */
  flex-wrap: wrap;
  padding: var(--space-5) var(--space-6);
  border-top: var(--border-width) solid var(--border);
  background: var(--surface);
}

.paginator-position {
  font-size: var(--type-label-size);
  color: var(--ink-muted);
}

.paginator-controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.paginator-page {
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 639px) {
  .paginator {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-4);
  }

  .paginator-controls {
    justify-content: space-between;
  }
}

/* ===========================================================================
   STATES - UI Standard 8.1, 8.2, 8.5
   =========================================================================== */

/* 8.1: "Distinguish nonexistent record, no search/filter match, and nothing
   requiring action. Empty-state copy is contextual, restrained, and
   functional." The component takes the words; it does not supply them. */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-7);
  text-align: center;
  color: var(--ink-muted);
}

.state-title {
  font-size: var(--type-body-size);
  font-weight: var(--type-strong-weight);
  color: var(--ink);
}

.state-detail {
  font-size: var(--type-label-size);
  max-width: 48ch;
}

/* 8.2: "Initial loading does not unnecessarily destroy workspace structure.
   Refresh keeps existing content visible when reasonable." So loading is a
   restrained strip, not a screen takeover. */
.loading {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  font-size: var(--type-label-size);
  color: var(--ink-muted);
}

/* 8.5: "Indeterminate operation: restrained spinner/progress indicator plus
   useful text" and "Never animate fake percentages." Indeterminate only. */
.spinner {
  width: var(--space-5);
  height: var(--space-5);
  border: 2px solid var(--border);
  border-top-color: var(--brand-brass);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===========================================================================
   FEEDBACK - UI Standard 8.3 and 8.4
   ===========================================================================
   THREE LEVELS, AND THEY ARE DIFFERENT PLACES. 8.3: "field validation,
   form/action error, workspace/system error." The old HQ had one global
   banner doing all three, which is why a form error appeared 2098px away from
   the form.
   =========================================================================== */
/* AND A MESSAGE MAY CONTAIN SOMETHING THAT DOES NOT BREAK.
   ------------------------------------------------------------------------
   A refusal often quotes the thing refused - a one-time code, an email
   address, an item number - and those have no spaces in them. A text run with
   no break opportunity has a min-content width equal to its whole length, so
   it cannot be made to fit: it ran 28px past the sign-in card at EVERY width
   and, on a 390px phone, took the whole document 37px sideways, which is
   worse than the overflow the owner reported. Found while reviewing the
   validation messages they asked about, 1 November 2026.
   `overflow-wrap: anywhere` rather than `break-word`, because only `anywhere`
   also shrinks the min-content width used by flex and grid layout - which is
   the half of the problem that moved the card. Ordinary prose is unaffected;
   it only ever breaks a word with nowhere else to break. */
.feedback {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border: var(--border-width) solid var(--border);
  border-left-width: var(--focus-ring-width);
  border-radius: var(--radius);
  font-size: var(--type-label-size);
  overflow-wrap: anywhere;
}

.feedback[data-tone='error'] {
  border-color: var(--state-error);
  background: var(--state-error-surface);
  color: var(--state-error);
}

.feedback[data-tone='warn'] {
  border-color: var(--state-warn);
  background: var(--state-warn-surface);
  color: var(--state-warn);
}

.feedback[data-tone='success'] {
  border-color: var(--state-success);
  background: var(--state-success-surface);
  color: var(--state-success);
}

.feedback[data-tone='info'] {
  border-color: var(--state-info);
  background: var(--state-info-surface);
  color: var(--state-info);
}

.feedback-body {
  flex: 1 1 auto;
}

/* 8.4: "Toasts are non-modal, concise, accessible, and do not replace
   validation or persistent errors." They sit above the content and never over
   a modal's actions. */
.toasts {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: min(380px, calc(100vw - var(--space-7) * 2));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  box-shadow: var(--shadow-primary);
  background: var(--surface);
}

@media (max-width: 639px) {
  .toasts {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    width: auto;
  }
}

/* ===========================================================================
   MODALS - UI Standard 6
   ===========================================================================
   6.2 gives the visual contract numerically: "Cornerpost green background,
   Cornerpost khaki (#d8c792) title, brass bottom border, title left, close
   right" for the header; "normal modal surface, subtle top divider, standard
   spacing, actions right aligned, Cancel before primary, destructive action
   separated left" for the footer; "Modal stays within the usable viewport.
   Header and footer remain visible; only the body vertically scrolls."
   6.1: "Clicking the backdrop/outside never closes a modal."
   =========================================================================== */
.modal {
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-primary);
  background: var(--surface);
  color: var(--ink);
  /* 6.2: "Large displays use one standard modal size", not a Small/Medium/
     Large family. */
  width: min(560px, calc(100vw - var(--space-7) * 2));
  max-height: calc(100vh - var(--space-7) * 2);
  /* See the note on .modal-frame: on Android Chrome `vh` is the viewport
     with the toolbar hidden, and `dvh` is the one being looked at. */
  max-height: calc(100dvh - var(--space-7) * 2);
  /* `clip`, NOT `hidden`, AND THAT IS THE FOOTER DEFECT.

     `overflow: hidden` still makes an element a SCROLL CONTAINER. It stops
     the person scrolling it; it does not stop the BROWSER scrolling it to
     bring a focused element into view. Switching on "Add a service location
     now" put focus on the switch, the form below it grew, and Chrome scrolled
     the DIALOG by 115px to keep that switch visible - measured
     `dialog.scrollTop = 115` against `scrollHeight 835 / clientHeight 720`.

     The frame went up with it, so Cancel and Create customer sat part way up
     the dialog with a blank band beneath them, which is the owner's
     screenshot. Rotating the tablet relaid out and reset scrollTop to 0,
     which is why rotating appeared to fix it.

     `clip` creates NO scroll container, so there is nothing to scroll and no
     state to get wrong. The body keeps `overflow-y: auto` and still scrolls
     to the field being typed in, which is the behaviour that was wanted - the
     dialog was never meant to scroll at all ("ONLY THE BODY SCROLLS", 6.2).

     `hidden` is declared first so a browser without `clip` keeps the old
     clipping rather than none. */
  overflow: hidden;
  overflow: clip;
}

.modal::backdrop {
  background: rgb(23 28 23 / 55%); /* Cornerpost green, dimmed */
}

.modal-frame {
  display: grid;
  /* `minmax(0, 1fr)`, NOT `1fr`, AND THIS IS THE FOOTER DEFECT.

     `1fr` means `minmax(auto, 1fr)`, and `auto` as a MINIMUM is the row's
     content height. So the body row refused to shrink below the form inside
     it: with "Add a service location now" switched on, the content became
     1510px and the row's minimum went with it. The frame then overflowed the
     dialog - measured scrollHeight 835 against clientHeight 720 - and the
     dialog, which is itself a scroll container, got scrolled to 115 by the
     browser revealing the switch that had just been clicked.

     THE RESULT WAS THE OWNER'S SCREENSHOT: the frame sat 115px up, so Cancel
     and Create customer appeared part way up the dialog with a blank band
     below them. Rotating the tablet relaid everything out and reset
     scrollTop, which is exactly why rotating "fixed" it - and why a layout
     that is only correct after rotating is the defect, not the workaround.

     `overflow: hidden` on .modal does NOT prevent this: it stops the USER
     scrolling, not the browser scrolling to reveal a focused element. The
     cure is for there to be nothing to scroll, which is what a row that can
     shrink gives. */
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - var(--space-7) * 2);
  /* ANDROID CHROME COUNTS `vh` AGAINST THE LARGEST VIEWPORT - the one with
     the toolbar hidden - so `100vh` can exceed what the person can actually
     see. `dvh` is the visible viewport and changes as the toolbar moves.
     Declared second so a browser without it keeps the line above. */
  max-height: calc(100dvh - var(--space-7) * 2);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--surface-chrome);
  border-bottom: var(--focus-ring-width) solid var(--brand-brass);
}

.modal-title {
  flex: 1 1 auto;
  font-size: var(--type-section-size);
  font-weight: var(--type-section-weight);
  color: var(--ink-on-chrome-accent);
  min-width: 0;
}

/* The close control sits on the green ground, so it takes chrome ink rather
   than body ink - 6.2: "Header controls must maintain sufficient contrast
   against the green ground; use shared tokens rather than local
   approximations." */
.modal-close {
  color: var(--ink-on-green);
  border-color: transparent;
  background: transparent;
}

.modal-close:hover {
  background: var(--surface-chrome-raised);
  color: var(--ink-on-chrome-accent);
}

/* ONLY THE BODY SCROLLS. 6.2. */
.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  /* THE ITEM'S OWN AUTOMATIC MINIMUM, which is the same trap as the row's
     above: a grid item will not shrink below its content unless it is told
     it may. Both are needed - the row to allocate less space, the item to
     accept it. */
  min-height: 0;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-top: var(--border-width) solid var(--border-subtle);
  background: var(--surface);
}

@media (max-width: 639px) {
  /* 6.2: "On smaller displays the same modal architecture becomes
     CONTENT-RESPONSIVE; avoid arbitrary Small/Medium/Large width families and
     unnecessary horizontal scrolling."

     IT USED TO SAY `height: 100vh` HERE, AND THAT IS THE DEFECT THE OWNER
     REPORTED: "Correct modal height and footer positioning. Eliminate the
     large empty area below the footer."

     A dialog with a definite height and `grid-template-rows: auto 1fr auto`
     gives the whole remainder to the body. Measured on a 380x760 phone, the
     two-line confirmation "Delete this customer?" was 760px tall with 86px of
     text in a 560px body - four hundred and seventy pixels of nothing between
     the sentence and the buttons. The same dialog on a desktop was 234px.

     FULL WIDTH IS KEPT, because a sheet that spans the screen is the mobile
     architecture and the standard asks for it. The HEIGHT comes from the
     content and `max-height` is a CAP rather than an instruction, which is
     what "content-responsive" says. A tall form still fills the screen and
     still scrolls its body only - that part was never wrong. */
  .modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-frame {
    max-height: 100vh;
  }

  .modal-body,
  .modal-footer {
    padding: var(--space-5) var(--space-4);
  }
}

/* ---------------------------------------------------------------------------
   RECORD DETAIL - 10.1's missing-value vocabulary lives in format.js; this is
   the presentation. A field list NEVER omits a row: the old panel() dropped
   empty values, which made "not provided" indistinguishable from "not a
   field".
   ------------------------------------------------------------------------ */
/* A LIST OF PAIRS, and each pair carries its own label/value grid.

   IT WAS ONE GRID with the labels in column one and the values in column
   two, which reads well and can only ever be one pair per row. The owner's
   tablet in portrait leaves 476px of workspace, the record layout stacks,
   and the summary panel became a 641px wall above the first section - "the
   primary details panel expands across the available width instead of
   adapting appropriately".

   Splitting the pairs lets a narrow panel flow them two-up, which is
   density rather than disclosure: nothing is hidden and nothing scrolls
   sideways. At the default width the result is identical to before. */
.field-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4) var(--space-6);
  margin: 0;
}

.field-pair {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  column-gap: var(--space-6);
  align-items: baseline;
  min-width: 0;
}



.field-list dt {
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  color: var(--ink-muted);
}

.field-list dd {
  margin: 0;
}

/* A missing value is muted and italic, so it reads as an absence rather than
   as content. 10.1 forbids showing null, undefined, NaN or Invalid Date. */
.value-missing {
  color: var(--ink-muted);
  font-style: italic;
}

@media (max-width: 639px) {
  /* ON A PHONE THE LABEL GOES ABOVE THE VALUE, because 140px of label
     against 240px of screen leaves a column too narrow for an address.

     AND THE RULE HAS TO NAME THE PAIR NOW. It used to say `.field-list`
     alone and that was enough, because the list WAS the two-track grid. The
     density pass moved those tracks onto `.field-pair` - a 1fr column of
     pairs, each pair a label and a value - so collapsing the LIST stopped
     collapsing the pair inside it, and the 140px label minimum survived onto
     a 380px screen. The customer record's activity note overflowed its
     section by exactly that, which is how this was found: a browser case
     measuring what escapes its box, not a source gate. */
  .field-list {
    grid-template-columns: 1fr;
    gap: var(--space-1) 0;
  }

  .field-pair {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
  }

  .field-list dd {
    padding-bottom: var(--space-4);
  }
}

/* ===========================================================================
   THE OVERVIEW PRIMITIVES - section cards, attention rows, figures, tiles.
   ===========================================================================

   These come from the approved Today mockup, and they live HERE rather than
   in a Today stylesheet because they are not Today's. A section card with a
   heading, a count and a "view all" link is what Customers, Jobs and
   Invoices will each want; UI Standard 16 asks for shared primitives BEFORE
   workspace-specific implementations, and this is that order being kept.

   No value is decided here. Every one comes from tokens.css.
   ------------------------------------------------------------------------ */

/* The region grid. Two columns where there is room, one where there is not. */
.overview {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* EACH CARD IS ITS OWN HEIGHT. The default stretches every card in a row to
     match the tallest, so a short "nothing needs attention" card became a
     metre of white space beside a busy day. The mockup aligns them at the
     top and lets them end where their content ends. */
  align-items: start;
}

.overview > .section-card-wide {
  grid-column: 1 / -1;
}

/* THE WORKSPACE DECIDES, NOT THE SCREEN - corrected 3 November 2026, and for
   the reason shell.css already records for the record layout: the viewport
   "ignores the thing that actually takes the space: the persistent navigation
   rail". At a 1024px screen with the sidebar expanded this query did not
   match, so two columns were drawn into a 732px workspace - the same arithmetic
   that crushed `.day-work` to 29 pixels. The NUMBER is the approved
   breakpoint; what changes is what it measures. */
@container workspace (max-width: 1023px) {
  .overview {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------ an area overview's cards */

/* WHAT IT IS, AND WHAT STATE IT IS IN, on one line. The tag sits after the
   sentence rather than beside the heading: the heading is the destination's
   name, and "Planned" is a fact about the destination rather than part of it. */
.overview-card-state {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.overview-card-state > .admin-group-note {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}

/* THE ONE REAL FIGURE. Larger than the sentence above it because it is the
   thing somebody came to read, and quiet enough not to read as a headline:
   it is a count of records, not a metric. */
.overview-figure {
  margin-top: var(--space-4);
  color: var(--ink);
  font-size: var(--type-section-size);
}

/* --------------------------------------------------------------- the card */
.section-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
}

/* THE ATTENTION TONE IS AN EDGE, NOT A FILL. 3.6: a brand or state colour
   marks a thing without shouting over the content inside it, and a red card
   would be a card nobody can read anything else on. */
.section-card[data-tone='attention'] {
  border-left: var(--focus-ring-width) solid var(--state-error);
}

.section-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  /* THE TITLE AND ITS ACTIONS WRAP ONTO TWO LINES rather than pushing each
     other off the card. One row of title-plus-select is about 340px that
     cannot break, which fitted while the workspace had the whole phone and
     did not once the navigation took a column beside it (24 October 2026). */
  flex-wrap: wrap;
  /* TIGHTER INSIDE, GENEROUS OUTSIDE - the mockup's rhythm. 16/20 inside a
     card that already has a page gutter around it read as two margins. */
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border-width) solid var(--border-subtle);
}

.section-card-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-card[data-tone='attention'] .section-card-title {
  color: var(--state-error);
}

/* The count beside the heading. A number, in a shape, with its own label for
   a screen reader - never a bare digit floating next to words. */
.section-card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--space-7);
  height: var(--space-7);
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--state-error-surface);
  color: var(--state-error);
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
}

.section-card-spacer {
  flex: 1 1 auto;
}

.section-card-body {
  padding: var(--space-5);
}

.section-card-body-flush {
  padding: 0;
}

/* --------------------------------------------------- a row that leads away */
.attention-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.attention-list > li + li {
  border-top: var(--border-width) solid var(--border-subtle);
}

.attention-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-4) var(--space-6);
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.attention-row:hover {
  background: var(--surface-inset);
}

.attention-row-text {
  flex: 1 1 auto;
  min-width: 0;
}

/* BLOCK, because they are two lines. As inline spans the headline and the
   detail ran together into "8 estimate follow-ups overdueWaiting on a
   customer answer", which is the kind of thing that only shows up when you
   look at it. */
.attention-row-headline {
  display: block;
  font-size: var(--type-record-primary-size);
  font-weight: var(--type-record-primary-weight);
}

.attention-row-detail {
  display: block;
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

.attention-row-chevron {
  flex: 0 0 auto;
  color: var(--ink-muted);
}

/* ------------------------------------------------------------- a figure */
.figure-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.figure {
  min-width: 0;
}

.figure-value {
  font-size: var(--type-page-size);
  font-weight: var(--type-page-weight);
  line-height: var(--type-line-tight);
}

.figure-label {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* ------------------------------------------------- the Administration index */
.admin-group-note {
  margin-bottom: var(--space-4);
  color: var(--ink-muted);
  font-size: var(--type-record-secondary-size);
}

.admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ONE ROW IS ONE ACTIVATION TARGET - 9.6's rule, for the same reason: a row
   that is only clickable in one corner is a row most people will not click.
   44px even when it is disabled, because a planned destination is read as
   often as a working one. */
.admin-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--type-body-size);
  text-align: left;
  cursor: pointer;
}

.admin-link:disabled {
  color: var(--ink-muted);
  cursor: default;
}

.admin-link:not(:disabled):hover {
  background: var(--surface-inset);
}

.admin-link-label {
  flex: 1 1 auto;
  min-width: 0;
}

.planned-reason {
  padding: 0 var(--space-3) var(--space-3);
  color: var(--ink-muted);
  font-size: var(--type-record-secondary-size);
}

.admin-tag {
  flex: 0 0 auto;
  padding: 0 var(--space-2);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-size: var(--type-record-secondary-size);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-link .icon {
  flex: 0 0 auto;
  color: var(--ink-muted);
}

/* THE MOCKUP'S HORIZONTAL COMPOSITION for the day: the ring and its legend
   on the left, the work on the right, a divider between them. Below 1024 the
   two stack, because a 132px ring and two lists do not share a tablet. */
.day-split {
  display: flex;
  gap: var(--space-5);
  min-width: 0;
}

.day-work {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding-left: var(--space-5);
  border-left: var(--border-width) solid var(--border-subtle);
}

/* THE WORKSPACE DECIDES, NOT THE SCREEN - corrected 3 November 2026.
   -----------------------------------------------------------------------
   THIS WAS `@media (max-width: 1023px)`, THE VIEWPORT, which is the exact
   mistake shell.css already records for the record layout: the viewport
   "ignores the thing that actually takes the space: the persistent
   navigation rail", and the owner's instruction is to "verify actual
   available workspace width at each breakpoint, not merely device screen
   width".

   WHAT IT COST, MEASURED. At a viewport of exactly 1024px the media query
   does not match, so the split stayed side by side - in a workspace only
   732px wide, because the expanded sidebar takes 292px of it. `.day-work`
   was crushed to 29 PIXELS with 148px of content in it, and the card
   overflowed its own body by 105px. Same defect class as the Jobs list's
   "severely compressed record values" at 14px.

   1023px IS KEPT AS THE NUMBER because that is the approved breakpoint; what
   changes is WHAT IT MEASURES. A 1400px screen with the sidebar expanded has
   a 1108px workspace and stays split; a 1024px screen has 732px and stacks,
   which is what the number was always meant to express. */
@container workspace (max-width: 1023px) {
  .day-split {
    flex-direction: column;
  }
  .day-work {
    padding-left: 0;
    padding-top: var(--space-5);
    border-left: 0;
    border-top: var(--border-width) solid var(--border-subtle);
  }
}

/* The day: the ring, and the list that carries its facts. */
.day-shape {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-width: 0;
}

.day-shape-key {
  flex: 1 1 auto;
  min-width: 0;
}

.day-shape-note {
  margin-top: var(--space-4);
}

@media (max-width: 639px) {
  .day-shape {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Two period summaries, clearly separated - the mockup's month comparison. */
/* STACKED, AS THE MOCKUP DRAWS THEM - one period above the other with a
   rule between. Side by side put two columns inside a quarter-width panel,
   and "Not available yet" broke across a line mid-word. */
.compare {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.compare-period {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.compare-period + .compare-period {
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--border-subtle);
}

.compare-when {
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-strong-weight);
}

.compare-note {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  /* IT WRAPS, AND IT MAY SHRINK. A period select beside a button is 302px
     of unbreakable row, which was invisible while the workspace had a whole
     phone to itself and became the widest thing on the page the moment the
     navigation started taking a column beside it (24 October 2026).

     min-width: 0 IS THE OTHER HALF. A flex item refuses to go below its
     content width unless it is told it may, so wrapping alone moved the row
     onto its own line and left it just as wide. Both are needed, and the
     pair costs nothing at any width where this already fitted. */
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

/* THE REPORTING PERIOD. A select outside a .field still has to be a Works
   control: 44px, the shared border and radius, and the canonical focus ring
   from tokens.css. */
.period-select,
.period-select select {
  /* A SELECT DOES NOT SHRINK BELOW ITS LONGEST OPTION unless it is told it
     may. "October 2026" plus 48px of padding is 175px that sat outside a
     182px workspace once the navigation took its column (24 October 2026).
     max-width lets it give way; the option text is still readable because
     the control keeps its own ellipsis. */
  max-width: 100%;
  min-width: 0;
}

.period-select select {
  min-height: var(--control-height);
  padding: 0 var(--space-7) 0 var(--space-4);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--type-body-size);
  color: var(--ink);
  cursor: pointer;
}

/* --------------------------------------------------------- paired bars */
/* EVERY SERIES ON ITS OWN SCALE, and the value printed above each bar - so
   the number is read rather than inferred from a height. */
.bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.bars-plot {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  min-width: 0;
  height: 132px;
}

.bars-column {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
  height: 100%;
}

.bars-stack {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-1);
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}

.bars-pair {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  min-width: 0;
  height: 100%;
}

.bars-bar {
  width: 100%;
  min-height: var(--space-1);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* The mockup's pairing: neutral khaki for counts, Cornerpost green for
   money. The same two tones the proportion bar and the donut use. */
.bars-bar[data-tone='count'] {
  background: var(--khaki);
}
.bars-bar[data-tone='money'] {
  background: var(--brand-green);
}

.bars-value {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
  white-space: nowrap;
}

.bars-label {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
  white-space: nowrap;
}

.bars-caption {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* ------------------------------------------------------------- the donut */
/* THE MOCKUP'S RING. An addition to the numbers, never a replacement: the key
   beside it writes out every segment, so the ring carries the glance and the
   list carries the fact (3.6). */
.donut-figure {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-width: 0;
}

.donut-ring {
  position: relative;
  flex: 0 0 auto;
  width: 132px;
  height: 132px;
}

.donut {
  width: 100%;
  height: 100%;
  /* Start the arcs at twelve o'clock rather than at three. */
  transform: rotate(-90deg);
}

.donut-track,
.donut-part {
  fill: none;
  stroke-width: 14;
}

.donut-track {
  stroke: var(--border-subtle);
}

/* THE SAME FOUR TONES THE PROPORTION BAR USES, so the ring and the bar never
   disagree about which colour means which thing. */
.donut-part[data-tone='done'] {
  stroke: var(--brand-green);
}
.donut-part[data-tone='active'] {
  stroke: var(--brand-brass);
}
.donut-part[data-tone='current'] {
  stroke: var(--khaki);
}
.donut-part[data-tone='overdue'] {
  stroke: var(--state-error);
}

/* The count in the middle. aria-hidden, because the ring's own label says the
   whole thing in a sentence and a screen reader should hear it once. */
.donut-middle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.donut-total {
  font-size: var(--type-page-size);
  font-weight: var(--type-page-weight);
  line-height: var(--type-line-tight);
}

.donut-caption {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* ON A PHONE THE RING GOES ABOVE THE LIST rather than beside it - 132px and a
   key of three rows do not share 380px minus the gutters. */
@media (max-width: 639px) {
  .donut-figure {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ------------------------------------------------- panels inside a region */
/* THE MOCKUP'S UNIT OF COMPOSITION. "Where Cornerpost stands" is ONE region
   carrying four subjects, so a card is a region and a panel is a subject
   inside one. Four tracks at desktop, which is the mockup's arrangement;
   two when the page is narrower than that arrangement reads in; one on a
   phone, where every panel is full width and nothing is squeezed. */
/* INTRINSIC TRACKS, NOT A COLUMN COUNT. The first attempt wrote four
   columns and then two more breakpoints to climb down from them - and 3.5
   gives Works exactly two, 640 and 1024, which `check:ui` enforces. A
   minimum track width says the thing that actually matters: a panel holding
   "$4,954.75" and a proportion bar needs about 240px, and however many of
   those fit is the right number. Four across the mockup's width, two at a
   tablet, one on a phone - the same arrangement, arrived at honestly. */
.panel-band {
  display: grid;
  gap: var(--space-5);
  /* minmax(min(N, 100%), 1fr), NOT minmax(N, 1fr). A bare minimum cannot
     shrink below itself, so a container narrower than one track overflows it
     rather than fitting - which is what happened the moment the navigation
     started taking a column beside the workspace on a phone (24 October
     2026). The min() lets the track give way when, and only when, there is
     less room than the track asks for; at every width where it already fitted
     the result is byte-identical. */
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  align-items: start;
}

/* THE MOCKUP'S PROPORTIONS, at the width it was drawn for. One wide panel
   carrying the chart and three narrower ones beside it - which is a RATIO
   rather than a count, so it holds at 1024px and at 1920px without a third
   breakpoint. Below 1024 the intrinsic tracks above take over and the panels
   find their own number. */
@media (min-width: 1024px) {
  .panel-band {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-5);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
}

/* THE MOCKUP'S WIDE LEFT PANEL IS NOT CLAIMED YET. It is wide because it
   holds a six-month chart, and that chart is unavailable - so a panel that
   reserved two tracks would be reserving them for a sentence. `span` is
   honoured where it is asked for and nothing asks for it today; Jobs &
   Revenue takes it back when it has something to draw. */
.panel[data-span='2'] {
  grid-column: span 2;
}

@media (max-width: 1023px) {
  .panel[data-span='2'] {
    grid-column: auto;
  }
}

.panel-title {
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* A SUBJECT UNDER A SUBJECT. The mockup puts maintenance beneath accounts
   receivable rather than beside it - related enough to share a panel, its own
   thing enough to need a rule and a name. A second bordered box inside the
   first would be three borders deep; a divider is one. */
.panel-nested {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--border-subtle);
}

.panel-nested-title {
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ----------------------------------------------- a metric, in three states */
/* Owner decision D-9. A value, a VERIFIED ZERO, or UNAVAILABLE - and the
   last of those is drawn so differently that it cannot be mistaken for the
   second. See metric() in components.js, which refuses to build one that has
   not decided which it is. */
.metric {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.metric-label {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

.metric-value {
  font-size: var(--type-section-size);
  font-weight: var(--type-page-weight);
  line-height: var(--type-line-tight);
  /* AT WORDS, NOT INSIDE THEM. `anywhere` was meant for one long unbroken
     figure and it also licensed "Not availab / le yet" in a narrow panel. */
  overflow-wrap: break-word;
}

.metric[data-emphasis='true'] .metric-value {
  font-size: var(--type-page-size);
}

.metric-detail {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* A ZERO IS A VALUE and is drawn as one: "0 overdue" is an answer, and
   muting it would file a fact under doubt. The attribute exists so a test
   can tell the two apart, not so the eye has to. */

/* UNAVAILABLE IS DIFFERENT ON PURPOSE, and in three ways at once - a dashed
   edge, muted type, and the words. 3.6: never by colour alone, which is why
   "Not available yet" is written out and the reason sits under it. */
.metric[data-state='unavailable'] {
  padding-left: var(--space-4);
  border-left: var(--border-width) dashed var(--border);
}

.metric[data-state='unavailable'] .metric-value {
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  font-style: italic;
  color: var(--ink-muted);
}

.metric-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

/* THE INFORMATION CONTROL. A full 44px target even though the glyph is small
   - 3.4 has no compact variant - achieved with negative margin so the row
   does not grow around it. */
.metric-why {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height);
  height: var(--control-height);
  margin: calc(-1 * var(--space-4)) 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}

.metric-why:hover {
  color: var(--ink);
}

.metric-reason {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* A panel that is entirely unavailable says so once, quietly, rather than
   repeating the dashed edge for every figure it would have carried. */
.panel[data-tone='unavailable'] {
  background: transparent;
  border-style: dashed;
}

/* A PROPORTION, SHOWN AS A BAR AND SAID IN WORDS. 3.6 and 5.2: a
   visualisation may not be the only carrier of the fact, so every segment
   below is also written out underneath. The bar is the glance; the list is
   the answer. */
.proportion {
  display: flex;
  height: var(--space-3);
  margin-top: var(--space-5);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-inset);
}

.proportion-part {
  height: 100%;
}

.proportion-part[data-tone='overdue'] {
  background: var(--state-error);
}

.proportion-part[data-tone='current'] {
  background: var(--brand-khaki);
}

.proportion-part[data-tone='done'] {
  background: var(--state-success);
}

.proportion-part[data-tone='active'] {
  background: var(--brand-sage-gray);
}

.proportion-key {
  list-style: none;
  margin: 0;
  padding: var(--space-4) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.proportion-key li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--type-label-size);
}

.proportion-swatch {
  flex: 0 0 auto;
  width: var(--space-3);
  height: var(--space-3);
  border-radius: 50%;
}

.proportion-key-label {
  flex: 1 1 auto;
}

.proportion-key-value {
  font-weight: var(--type-strong-weight);
}

/* ------------------------------------------------------- the work list */
.work-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.work-list > li + li {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: var(--border-width) solid var(--border-subtle);
}

.work-line {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
}

.work-when {
  flex: 0 0 auto;
  font-weight: var(--type-strong-weight);
  font-variant-numeric: tabular-nums;
}

.work-who {
  flex: 1 1 auto;
  min-width: 0;
}

.work-elapsed {
  flex: 0 0 auto;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.work-detail {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

.subheading {
  padding-top: var(--space-6);
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: var(--space-3);
}

.subheading + .work-list {
  padding-bottom: var(--space-5);
}

/* ------------------------------------------------------- the quick tiles */
.tile-row {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
}

/* THE BRASS EDGE IS THE MOCKUP'S, and it is the one decorative flourish in
   the page. It sits on the bottom so it reads as a base rather than as a
   state: a left edge means "attention" elsewhere in this stylesheet and two
   meanings for one mark would be worse than no mark. */
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: calc(var(--control-height) * 2);
  padding: var(--space-6) var(--space-5);
  border: var(--border-width) solid var(--border);
  border-bottom: var(--focus-ring-width) solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: var(--type-strong-weight);
  cursor: pointer;
}

.tile:hover:not(:disabled) {
  background: var(--surface-inset);
}

.tile:disabled {
  color: var(--ink-muted);
  border-bottom-color: var(--border);
  cursor: default;
}

.tile-icon {
  color: var(--ink-muted);
}

/* ---------------------------------------------------- the workspace stamp */
.workspace-stamp {
  text-align: right;
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
  line-height: var(--type-line-tight);
  white-space: nowrap;
}

.workspace-stamp-when {
  font-weight: var(--type-label-weight);
  color: var(--ink);
}

@media (max-width: 639px) {
  .workspace-stamp {
    text-align: left;
    white-space: normal;
  }
}

/* WHAT A CAPPED LIST SAYS ABOUT THE REST OF ITSELF.
   Progressive disclosure, and the owner asked for it by name: a dashboard
   that lists every active job is a dashboard nobody reads to the bottom. The
   cap is stated rather than silent - "and 3 more" is information; a list
   that simply stops is a list that has lied about the day. */
.more-line {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--type-label-size);
  cursor: pointer;
}

.more-line:hover {
  color: var(--ink);
}

/* ===========================================================================
   THE CANONICAL RECORD - Increment 2 of Customers & Properties.

   Two columns and ONE SCROLL. The owner's requirement is a persistent summary
   on the left and a continuous scrollable record on the right, and the
   instruction with it names the trap: "Do not introduce two independent
   scroll regions." So neither column scrolls. The PAGE scrolls, and the left
   column is STICKY - it stays while the sections pass it, and when the
   viewport is too short to hold it the page simply carries it along, which is
   how a sticky element with nowhere to stick behaves anyway.

   See src/customerrecord.js for what goes in it and src/recordcard.js for the
   collapsing. These rules are the shape; the sections are a workspace's.
   ======================================================================== */
.record-layout {
  display: grid;
  grid-template-columns: var(--record-summary-width) minmax(0, 1fr);
  gap: var(--space-4) var(--space-6);
  align-items: start;
}

/* THE SECTION BAR SPANS BOTH COLUMNS. The owner's instruction: "Align the top
   of the persistent summary panel with the Customer Information card." It
   used to sit inside the right column, so the right column started one bar
   lower than the left and the two halves of the record did not line up. */
.record-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.record-summary {
  position: sticky;
  /* THE OFFSET IS MEASURED INSIDE THE WORKSPACE NOW, not inside the document.
     It used to be `calc(var(--chrome-height) + var(--space-5))` because the
     DOCUMENT scrolled and this panel had to clear a sticky header above it.
     The workspace is its own scroll container, the header is outside it, so
     the chrome's height would be a permanent empty band at the top of the
     panel rather than a clearance. */
  top: var(--space-5);
  /* IT REACHES THE BOTTOM OF THE VIEWPORT, on the owner's instruction:
     "Extend the summary panel to the bottom of the available desktop
     viewport."

     A MINIMUM, NEVER A FIXED HEIGHT, and never a scroller. A fixed height
     would clip a long name or a do-not-contact reason, and an internal
     scrollbar is the nested scrolling the same instruction forbids - "avoid
     nested scrolling and inaccessible content". So the panel fills the
     viewport when its contents are shorter and simply grows when they are
     longer, which is the only behaviour that cannot hide anything. */
  /* `dvh`, for the reason given on `.app`: on Android Chrome `vh` counts
     the viewport with the toolbar hidden. The chrome's height is still
     subtracted because the chrome still takes that space out of the frame. */
  min-height: calc(100vh - var(--chrome-height) - var(--space-5) - var(--space-7));
  min-height: calc(100dvh - var(--chrome-height) - var(--space-5) - var(--space-7));

  /* AND NOW IT SCROLLS ITS OWN CONTENT - 3 November 2026.
     -------------------------------------------------------------------
     THE OWNER'S INSTRUCTION: "the left primary details panel must scroll
     independently from the right workspace content", the panel must stay
     positioned while the right side scrolls, its scrollbar must be
     "visually hidden", and every input method must still reach it.

     THIS REVERSES THE PARAGRAPH ABOVE, which said the panel was "never a
     scroller" on the earlier instruction to "avoid nested scrolling and
     inaccessible content". THE NEW ARRANGEMENT ANSWERS THAT OBJECTION
     RATHER THAN IGNORING IT: the panel takes focus (`recordSummary` sets
     `tabindex="0"`), so wheel, touchpad, keyboard and touch all reach it,
     and nothing is clipped - whereas the old arrangement let a long summary
     grow past the bottom of a sticky panel, which is its own kind of
     unreachable.

     THE SAME CALCULATION AS THE MINIMUM, so the panel fills the frame and
     scrolls only when its contents are taller than that - a short summary
     has no scroll at all. */
  max-height: calc(100vh - var(--chrome-height) - var(--space-5) - var(--space-7));
  max-height: calc(100dvh - var(--chrome-height) - var(--space-5) - var(--space-7));
  overflow-y: auto;
  /* VISUALLY HIDDEN, NEVER `overflow: hidden`. The scrollbar is what the
     owner asked to hide; the SCROLLING is what must keep working. */
  scrollbar-width: none;
  -ms-overflow-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
  padding: var(--space-5);
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
}

/* THE WEBKIT HALF OF "visually hidden". `scrollbar-width` is the standard
   property and Chromium only began honouring it recently; this covers the
   builds that do not. */
.record-summary::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* AND THE FOCUS RING STAYS. A panel that takes focus must show that it has
   it - the alternative is a tab stop nobody can see, which is worse than no
   tab stop at all. */
.record-summary:focus-visible {
  /* THE SHELL'S ONE FOCUS TREATMENT, which is a box-shadow ring and not an
     outline - `--focus-ring` IS a shadow value, and check:ui holds the whole
     application to a single treatment. Inset, because an outset ring on a
     sticky panel is clipped by the scroller it sits in. */
  box-shadow: inset var(--focus-ring);
  outline: none;
}

/* WHERE THE RECORD STACKS, the panel stops scrolling on its own - and that
   rule already exists at `@container workspace (max-width: 639px)` below,
   which is where the record layout goes to one column. A SECOND BREAKPOINT
   HERE WOULD HAVE BEEN WRONG: 1023px would unstick the panel at a container
   width where the approved design deliberately keeps two columns, which is
   the very mistake the 639px rule was introduced to correct. */

.record-summary-identity {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

/* The record's subject. It is an h2 because 5.5 gives the one h1 to the
   workspace, and the workspace title is already above it. */
.record-summary-name {
  font-size: var(--type-section-size);
  font-weight: var(--type-page-weight);
  line-height: var(--type-line-tight);
  overflow-wrap: break-word;
}

.record-summary-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.record-summary-type {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* DO NOT CONTACT CHANGES WHAT SOMEBODY MAY DO, so it is on the identity and
   it is not a colour alone (3.6): the words say it, and the edge marks it. */
.record-summary-flag {
  padding: var(--space-3) var(--space-4);
  border-left: var(--focus-ring-width) solid var(--state-warn);
  background: var(--state-warn-surface);
  color: var(--ink);
  font-size: var(--type-label-size);
}

.record-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* A COMPACT ACTION ROW, for a narrow identity column.
   ------------------------------------------------------------------------
   The owner asked the customer record's primary details for a "compact
   customer editing action". The controls themselves keep their full target
   size - 7.1's 44px minimum is not negotiable and is not what "compact"
   means here - so what gives is the TEXT and the row, not the hit area.

   THEY SHARE A LINE where there is room for one, and wrap where there is
   not, which is what a narrow column needs: two full-width controls stacked
   down an identity panel push every field below them off the first screen. */
.record-summary-actions.is-compact {
  gap: var(--space-2);
}

.record-summary-actions.is-compact .btn {
  flex: 1 1 auto;
  padding-inline: var(--space-3);
  font-size: var(--text-sm);
}

/* A ROUTE OUT OF THE PANEL, and a sentence about what is on the other side.
   ------------------------------------------------------------------------
   THE CLASS WAS ASKED FOR AND NEVER DEFINED. `.record-summary-route` carries
   the identity panel's "Manage contacts" control, and now the referral
   relationship's "Record who referred them" beside the award that
   relationship has already earned - and with no rule, both arrived flush
   against the field list above them with no separation at all. Measured by
   walking every class HQ asks for against every rule the six HQ stylesheets
   define (defect #194; 48 such names at the time of writing, of which this
   is one).

   IT IS SPACING AND NOTHING ELSE. A route is a line of text or a neutral
   control, and both already carry their own type and target sizes from the
   components they are built out of; what was missing is the gap that says
   this line is not another field. */
.record-summary-route {
  margin-block-start: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  font-size: var(--type-label-size);
  color: var(--ink-muted);
}


/* A narrow column makes the two-track field list unreadable long before the
   page is narrow, so the label stacks over its value here at every width. */
/* THE PANEL IS NARROW IN BOTH ARRANGEMENTS, so its pairs put the label ABOVE
   the value and flow into as many columns as will fit.

   IT WAS ONE COLUMN with `dd` padded apart, which is why the owner's
   portrait tablet showed a 641px wall above the first section - "the primary
   details panel expands across the available width instead of adapting
   appropriately". The panel is a 304px column beside the record or a 444px
   band above it; neither has room for a 140px label and a value side by
   side, and at 444px there is room for TWO stacked pairs abreast.

   AND IT HAD TO BE WRITTEN HERE. The same declaration added beside
   `.field-pair` had no effect at all: this rule has equal specificity and
   comes later, so it won, and the measurement said one 410px column where
   two were intended. Found by reading the computed grid rather than the
   source.

   NOTHING IS HIDDEN AND NOTHING SCROLLS SIDEWAYS - every row is still on
   screen. That is the density the owner's standard asks for before
   disclosure. */
.record-summary .field-list {
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  column-gap: var(--space-5);
  row-gap: var(--space-4);
}

.record-summary .field-pair {
  grid-template-columns: minmax(0, 1fr);
  column-gap: 0;
}

.record-summary .field-list dd {
  padding-bottom: 0;
}
/* ---------------------------------------------------------------------------
   THE PAYMENT RECORD SUMMARY IS SHORT, AND SAYS SO (10 November 2026)

   THE PANEL ABOVE IS A VIEWPORT-TALL SCROLLER, on two standing owner
   instructions for the customer and job records: "extend the summary panel
   to the bottom of the available desktop viewport" and "the left primary
   details panel must scroll independently from the right workspace
   content". Both remain in force for those records.

   THE PAYMENT SUMMARY HAS SIX FIELD ROWS. Against that arrangement it drew
   a column of mostly empty surface with a scroller that had nothing to
   scroll - which the owner read as "excessive empty space in the payment
   summary" and "an unnecessary nested vertical scrollbar", and both are
   fair. So THIS record sizes its summary to its content and lets the page
   scroll, narrowed by the attribute the record sets rather than by
   reversing an instruction about other screens.
--------------------------------------------------------------------------- */
.record-layout[data-record='payment'] .record-summary {
  position: static;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.record-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

/* ==========================================================================
   TWO COLUMNS, TWO SCROLLERS - 4 November 2026
   ==========================================================================

   THE OWNER REJECTED THE FIRST ATTEMPT AT THIS, on a screen recording of a
   Job, and they were right. What shipped was `position: sticky` on the panel
   plus `overflow-y: auto`, and neither delivered independence. MEASURED on
   the deployed Job record at 1400x900:

     the only scroll container          .app-main, 4957px of overflow
     .record-layout                     overflow visible, 5609px tall
     the panel                          sticky, min-height = max-height = 804px
     the panel's own overflow           0px - nothing to scroll
     the panel's top as the right side
       scrolls 0 -> 150 -> 400          280 -> 130 -> 72    (it TRAVELS 208px)
     a 500px wheel over the panel       .app-main 0 -> 500, panel 0

   SO THERE WAS ONE SCROLLER AND TWO PASSENGERS. Sticky is not independence:
   the panel rides the shared scroller until it reaches its offset, which is
   the 208px of travel the owner saw. And `overflow-y: auto` on a box whose
   max-height equals its own content height never engages, so every wheel
   event over the panel chained to the ancestor and moved the right side -
   which is the other half of what they saw.

   WHY THE TESTS MISSED IT: they asserted the declarations and the CAPACITY to
   overflow. Not one of them recorded two scroll positions and compared them.

   THE ARRANGEMENT NOW: the layout is given the height the page is not using,
   it refuses to grow past it, and each column scrolls its own content inside
   it. The workspace scroller then has nothing left to scroll on a record
   screen, so there is no ancestor for a wheel to chain into and no travel for
   the panel to do. Independence by construction rather than by appearance.

   640px IS THE SAME THRESHOLD THE STACKED CASE ALREADY USES, measured on the
   workspace and not on the window, for the reason given there: a landscape
   tablet with a rail has 960px of workspace and must keep its two columns. */
@container workspace (min-width: 640px) {
  /* THE PAGE IS EXACTLY THE FRAME ON A RECORD SCREEN, AND THAT IS THE WHOLE
     TRICK.
     -----------------------------------------------------------------------
     MY FIRST ATTEMPT AT THIS REPAIR DID NOT WORK, and the measurement said so
     immediately: `min-height: 100%` on the page is a FLOOR, not a ceiling. The
     layout grew to its content (5970px at 1400x900), `flex: 1` dutifully
     handed it all 5970 of them, neither column ever received a definite
     height, and `overflow-y: auto` still had nothing to engage on. Measured
     after that attempt: layout 5970px, both columns 5673px, workspace
     scroller still carrying 5318px of overflow. No better than sticky.

     A CEILING IS WHAT A SCROLLER NEEDS. `height: 100%` makes the page exactly
     one frame, the header takes what it needs, the body takes the rest, the
     layout takes the body, and the two columns finally have a height to
     scroll inside. The workspace scroller is then left with nothing to
     scroll, which is what removes both the panel's travel and the wheel's
     chaining target in one move.

     IT IS SCOPED TO A PAGE THAT CONTAINS A RECORD LAYOUT, because a ceiling
     on a collection page would cap it at one screenful and clip the rest -
     the thing `min-height` was chosen over `height` to avoid. `:has()` is
     the only way to say that in CSS without the shell having to know which
     workspaces are record views, and it is the same browser generation as the
     container queries this file already depends on. If it is ever
     unsupported, the selector is invalid, the rule is dropped, and the
     arrangement falls back to the one below without this cap - visibly the
     old behaviour rather than a broken screen. */
  .workspace-page:has(.record-layout) {
    height: 100%;
  }

  .record-layout {
    /* THE HEAD, THE COLUMNS, AND ANYTHING THAT FOLLOWS THEM.
       `minmax(0, 1fr)` takes what the two auto rows leave, and the 0 minimum
       is what lets it be SHORTER than its content - without it the row floors
       at the tallest column and the layout grows again.
       THE THIRD ROW IS NOT DECORATION: .record-test-removal is a grid item in
       column 2 on test records, and the owner's recording was of J-9004, a ZZ
       fixture - so on their screen there IS a third row. An `auto` row keeps
       it laid out and visible instead of clipped by the overflow rule below,
       which is the "no inaccessible content" half of the instruction. */
    grid-template-rows: auto minmax(0, 1fr) auto;
    /* THE COLUMNS FILL THE ROW instead of sitting at the top of it, which is
       what makes each one a box with a height to scroll inside. */
    align-items: stretch;
    flex: 1;
    min-height: 0;
    /* AND THE LAYOUT ITSELF NEVER SCROLLS. It is the frame the two scrollers
       live in; if this were `auto` there would be a third scrollbar, and if
       it were missing the layout would grow and hand the scrolling back to
       the workspace - which is the defect. */
    overflow: hidden;
  }

  .record-summary {
    /* NOT STICKY ANY MORE. Sticky was the mechanism that only LOOKED
       independent. A column with its own height does not need to stick to
       anything: it cannot move, because the thing it used to ride no longer
       scrolls. */
    position: static;
    top: auto;
    /* THE ROW DECIDES THE HEIGHT NOW, not the viewport. The old pair of
       calc()s pinned min and max to the same value, which is precisely why
       the panel had no overflow of its own to scroll. */
    min-height: 0;
    max-height: none;
    /* AND THE WHEEL STOPS HERE. Without this, reaching the end of the panel
       hands the rest of the gesture to the ancestor - the chaining that moved
       the right side in the 1024px measurement, where the panel had 33px of
       travel and the next wheel moved the workspace 3000px. */
    overscroll-behavior-y: contain;
  }

  .record-sections {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }
}

/* REMOVING A RECORD THAT WAS ONLY EVER A TEST.

   IT SPANS BOTH COLUMNS AND SITS AFTER EVERYTHING, like .record-head does at
   the other end, because it belongs to the ENVIRONMENT rather than to the
   record. It is deliberately not a .record-card: the bar at the top of the
   record counts those out loud, and a record that reported seven sections in
   development and six in production would be describing itself differently
   depending on which Worker somebody happened to be pointed at. Twenty
   browser cases caught that by counting, which is the argument for counting.

   IT IS DRESSED AS A WARNING AND NOT AS A SECTION. The warning surface is the
   standard's own, so this introduces no colour: a dashed edge rather than the
   solid one every card has, which reads as "not part of the record" before
   anybody gets to the heading. */
.record-test-removal {
  /* THE CONTENT COLUMN, NOT BOTH OF THEM.

     IT SPANNED 1 / -1 FIRST, like .record-head does at the other end, and that
     put it underneath the summary panel. That panel sticks, and it carries a
     `min-height: calc(100vh - ...)` so it reaches the bottom of the viewport -
     a deliberate decision - and an element a screenful tall that sticks sits
     OVER whatever spans into its column below it.

     (The property name is spelled out nowhere in this comment ON PURPOSE.
     suite-leave.mjs finds sticky rules by TEXT - every rule that sticks must
     take its offset from --chrome-height - and prose quoting the property
     made this rule look like one and failed the suite.) The button was 194x44, visible,
     enabled, and un-clickable: Playwright timed out waiting for it to receive
     a pointer event, which is exactly what a person would have experienced.

     A control that cannot be clicked is worse than one that is not offered,
     and it would have looked fine in a screenshot. So the footer goes in
     column 2, where .record-sections is, and follows them down the page. */
  /* NO `grid-column` ANY MORE - 4 November 2026. This footer is the last
     child of .record-sections now rather than a fourth item in the record
     grid, so a grid placement here would be a rule that looks like it decides
     something and does not. The reason it moved is in the record modules: as
     a sibling of the scrolling column it was a row that permanently occupied
     the frame, 209px of a 712px screen. */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: var(--state-warn-surface);
  border: var(--border-width) dashed var(--state-warn);
  border-radius: var(--radius);
  min-width: 0;
}

.record-test-removal p {
  margin: 0;
  max-width: var(--identity-max);
  font-size: var(--type-body-size);
  line-height: var(--type-line);
  color: var(--ink-muted);
}

.record-test-removal-title {
  margin: 0;
  font-size: var(--type-section-size);
  font-weight: var(--type-section-weight);
  line-height: var(--type-line-tight);
  color: var(--ink);
}


/* Expand all / Collapse all, and what it governs. It sits above the sections
   rather than in the workspace header because it acts on THEM - 5.2 keeps a
   workspace action in the header and a record's action with the record. */
.record-sections-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.record-sections-count {
  font-size: var(--type-label-size);
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------------------
   ONE COLLAPSIBLE SECTION
   ------------------------------------------------------------------------ */
.record-card {
  min-width: 0;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
}

.record-card-head {
  /* A WRAPPING ROW, NOT TWO COMPETING TRACKS.

     THIS HAS NOW BEEN WRONG IN BOTH DIRECTIONS, and the grid was the reason
     both times.

     It began as `minmax(0, 1fr) auto`. The `auto` actions track sizes to
     max-content and will not go below it, so on the job record at a 213px
     workspace the track stayed 262px wide inside a 189px card and the page
     scrolled sideways by 81px.

     So the actions track became `minmax(0, auto)` - and that handed the
     whole row to the actions instead. Measured on the owner's tablet in
     portrait: "Schedule & assignment" has three buttons, the actions track
     took 312px of 312px, and the title track resolved to ZERO. A heading in
     a zero-width box wraps at every character, which is the vertical column
     of letters in the owner's screenshot.

     A ROW THAT CAN WRAP HAS NO SUCH FIGHT. The title asks for a readable
     minimum and keeps it; the actions take what they need and drop to their
     own line when both will not fit. Neither can squeeze the other out, at
     any width, and nothing overflows. */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-5) var(--space-2) var(--space-2);
}


.record-card[data-shut='false'] .record-card-head {
  border-bottom: var(--border-width) solid var(--border-subtle);
}

.record-card-title {
  /* IT ASKS FOR ENOUGH ROOM TO READ, and gives up the rest. 12rem is about
     twenty characters at the section size - enough for every heading in this
     application to sit on one or two lines, and the floor below which the
     actions wrap instead of taking more. `min-width: 0` lets a longer
     heading shrink TO that basis rather than forcing the row wider. */
  flex: 1 1 12rem;
  min-width: 0;
}

/* THE HEADING IS THE CONTROL. A real button inside the h2, so the semantics
   and the 44px target come from the element rather than from a handler on a
   heading (4.3, 3.4). */
.record-card-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--type-section-size);
  font-weight: var(--type-section-weight);
  text-align: left;
  cursor: pointer;
}

.record-card-toggle:hover {
  background: var(--surface-inset);
}

.record-card-chevron {
  flex: 0 0 auto;
  width: var(--icon-size);
  color: var(--ink-muted);
  text-align: center;
}

.record-card-title-text {
  min-width: 0;
  overflow-wrap: break-word;
}

/* THE SUMMARY SURVIVES COLLAPSING, which is the point of being allowed to
   collapse: a shut card that says only its own name makes somebody open it
   to find out whether it was worth opening. It spans the head's full width
   so it sits under the heading rather than fighting the actions for room. */
.record-card-summary {
  /* ITS OWN LINE, which is what `grid-column: 1 / -1` meant before the head
     became a flex row. */
  flex: 1 0 100%;
  min-width: 0;
  padding: 0 var(--space-5) var(--space-3) var(--space-6);
  color: var(--ink-muted);
  font-size: var(--type-label-size);
}

/* A LONG LABEL WRAPS RATHER THAN PUSHING THE PAGE SIDEWAYS.

   `.btn` SETS `white-space: nowrap`, AND THAT IS RIGHT ALMOST EVERYWHERE: a
   toolbar control or a modal footer carries a short label, and one that broke
   across two lines would look like a mistake. It is wrong for the two places
   a long sentence ends up on a button in a narrow column.

   BOTH WERE MEASURED, not guessed, on a 380px phone with the navigation rail
   EXPANDED - the rail pushes rather than overlays, on the owner's standing
   instruction, so the workspace is 213px and this is a state a real tablet
   reaches by turning sideways with the menu open:

     "Prepare the customer summary" on the job record's billing-review card -
     262px of button in a 189px card, and the page scrolled sideways 81px. The
     card head's own grid had already been widened to let its track shrink;
     the button inside it still would not.

     "Remove this service location" in the test-record footer - 194px in a
     213px workspace, 11px over.

   THE TARGET STAYS 44px because the button grows instead of clipping, and at
   any width where the label fits on one line nothing changes at all - which
   is why this is not visible on a desktop, a tablet, or a phone with the rail
   closed. */
.record-card-actions .btn,
.record-test-removal .btn {
  max-width: 100%;
  white-space: normal;
  height: auto;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.record-card-actions {
  /* WHAT THEY NEED, NO MORE - and onto their own line when the title's
     minimum leaves no room beside it. */
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  grid-row: 1;
  grid-column: 2;
}

.record-card-body {
  /* ONE DECLARATION, SO THE NEGATIVE MARGIN BELOW CANNOT DRIFT FROM IT. The
     first version wrote the padding here and the margin there, and they were
     two values below 640px - which left every full-width list hanging 4px
     over each side of its own card on a phone. The browser suite found it;
     no source gate could. */
  --card-pad-y: var(--space-5);
  --card-pad-x: var(--space-5);
  padding: var(--card-pad-y) var(--card-pad-x);
}

/* A section whose body is one list: the list already has its own border, and
   a border inside a border inside a card is three edges deep. So it reaches
   the card's edges instead - by exactly the padding it is cancelling. */
.record-card-body > .record-list {
  border: 0;
  border-radius: 0;
  margin: calc(-1 * var(--card-pad-y)) calc(-1 * var(--card-pad-x));
}

.record-card-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

/* A sentence that qualifies what is above or below it - what a bounded list
   left out, what a figure does and does not cover. 8.1's restraint applies:
   it is there to stop a reader drawing a wrong conclusion, not to explain. */
.record-note {
  color: var(--ink-muted);
  font-size: var(--type-label-size);
  max-width: 68ch;
}

/* The note somebody typed. It is business content, so it keeps the line
   breaks they put in it. */
.record-note-body {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  max-width: 68ch;
}

/* ---------------------------------------------------------------------------
   A SEQUENCE OF THINGS THAT HAPPENED, and a list of things somebody wrote.

   Two lists rather than one, because they are read differently. A TIMELINE is
   scanned from the top for the most recent thing, so its rows are tight and
   its left edge is ruled - the eye follows the rule down. NOTES are read, so
   they are spaced like paragraphs and keep the line breaks their author put
   in them.

   NEITHER IS A RECORD LIST. .record-list is a collection's rows - keyed,
   reconciled, each one a destination. These are content inside one record,
   and giving them the collection's chrome would say they are navigable when
   they are not.
   ------------------------------------------------------------------------ */
.record-timeline,
.record-steps,
.record-notes {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.record-timeline {
  gap: var(--space-4);
}

.record-timeline > li {
  border-left: var(--border-width) solid var(--border-subtle);
  padding-left: var(--space-5);
}

.record-notes {
  gap: var(--space-5);
}

/* WORK STILL TO DO, IN ORDER - and numbered in the text rather than by a
   list marker, because the numbers are part of the sentence a reader says
   back ("three steps, one at a time") and a marker would put the count
   somewhere a screen reader reaches separately from the step it belongs to. */
.record-steps {
  gap: var(--space-4);
}

/* THE NOTE AFTER THE LIST IS NOT PART OF THE LAST STEP. Without this it
   sat flush against step two's own note at a smaller indent and read as a
   continuation of it - a sentence about the whole list, attached to one
   item of it. Seen on the deployed Test build, not in any assertion. */
.record-steps + .record-note {
  margin-top: var(--space-4);
}

.record-steps > li {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-left: var(--border-width) solid var(--border-subtle);
  padding-left: var(--space-5);
}

.record-notes > li {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ---------------------------------------------------------------------------
   A SECTION WORKS CANNOT ANSWER - 8.1's third state, for a section.

   NOT the empty state. "The collection is empty" and "there is no query" are
   opposite claims, and drawing them the same way is how an unavailable figure
   becomes a zero somebody acts on. Same treatment as an unavailable metric -
   a dashed edge, muted italic type, and the words - so the two read as the
   same kind of answer wherever they appear (3.6: never by colour alone).
   ------------------------------------------------------------------------ */
.record-notbuilt {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: var(--space-4);
  border-left: var(--border-width) dashed var(--border);
}

.record-notbuilt-title {
  color: var(--ink-muted);
  font-size: var(--type-body-size);
  font-style: italic;
}

.record-notbuilt-detail {
  color: var(--ink-muted);
  font-size: var(--type-label-size);
  max-width: 68ch;
}

/* ---------------------------------------------------------------------------
   RESPONSIVE - 3.5's two breakpoints, and nothing between them.
   ------------------------------------------------------------------------ */
/* THE SUMMARY STOPS BEING A COLUMN AND BECOMES THE TOP OF THE RECORD. A
   304px column beside content leaves neither enough room once the workspace
   is narrow, and a sticky block a third of the viewport tall is a block that
   has eaten the screen - so it releases as well as unsticks.
   
   MEASURED AGAINST THE WORKSPACE, NOT THE WINDOW. This was
   `@media (max-width: 1023px)`, so a tablet lost its summary panel even with
   the navigation collapsed and ~960px of workspace to put it in - and a
   desktop with navigation EXPANDED kept the panel in 1108px, which is the
   case that genuinely wants it. The container is `.app-main`, whose width is
   what the record actually has. */
/* 640, NOT 1024, AND MEASURED ON THE WORKSPACE.
   
   The threshold was the viewport at 1023px, which cost a landscape tablet its
   summary panel: 1024px of screen minus a 64px navigation rail is 960px of
   workspace, so the panel vanished on exactly the device the owner is
   testing on. 3.5 gives two breakpoints and 640 is the one that means "too
   narrow for two columns" - a 304px panel beside ~330px of content is the
   floor, and below it the record must stack.
   
   AND IT NOW HANDLES THE CASE THE VIEWPORT COULD NOT. Expanding the
   navigation on a portrait tablet leaves 528px of workspace; that stacks,
   because the container sees 528 where a media query would still have seen
   820 and kept two unusable columns. */
@container workspace (max-width: 639px) {
  .record-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .record-summary {
    position: static;
    /* STACKED, IT IS THE TOP OF THE RECORD rather than a column beside it, so
       a viewport-tall panel would be a screenful of summary before the first
       section. */
    min-height: 0;
    /* AND IT DOES NOT SCROLL ON ITS OWN HERE. Stacked, the panel is simply the
       first thing on the page and the workspace scrolls it like everything
       else; a capped height with a HIDDEN scrollbar on the narrowest screen
       is how content becomes unreachable, which is the thing the independent
       scrolling was asked for to avoid. */
    max-height: none;
    overflow-y: visible;
  }


  .record-summary .field-list dd {
    padding-bottom: 0;
  }


}

@media (max-width: 639px) {
  .record-summary .field-list {
    grid-template-columns: 1fr;
    gap: var(--space-1) 0;
  }

  .record-card-summary {
    padding-left: var(--space-3);
  }

  .record-card-body {
    --card-pad-x: var(--space-4);
  }
}

/* DISPATCH — the day's board.
   ------------------------------------------------------------------------
   No new primitives: the rows are collection records and the groups are
   subheadings. What this adds is the day control and the spacing between
   groups, which is the whole of what a board needs that a collection does
   not. */
.dispatch {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.dispatch-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-5);
}

.dispatch-moves {
  display: flex;
  gap: var(--space-2);
}

.dispatch-board {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
}

.dispatch-day-label {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
}

/* A GROUP THAT IS BUSY SAYS SO rather than going blank: a region that empties
   and refills reads as a failure for as long as it is empty. */
.dispatch-board[aria-busy='true'] {
  opacity: 0.6;
}

/* ---------------------------------------------------------------------------
   THE FIELD APP PAGE — a command and a digest, both of which must be read
   character by character.

   MONOSPACE IS NOT DECORATION HERE. A SHA-256 compared by eye against what
   certutil printed is the only check the person holding the tablet has that
   what downloaded is what was built, and proportional digits make that
   comparison unreliable. The digest WRAPS rather than scrolling, because a
   tablet in portrait is where it will be read and a horizontal scrollbar
   hides the half of it nobody thought to drag to.
--------------------------------------------------------------------------- */
.field-app-digest,
.field-app-command {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--type-label-size);
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface-inset);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  overflow-wrap: anywhere;
  user-select: all;
}

.field-app-digest {
  margin: var(--space-2) 0;
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------------
   A NUMBERED SEQUENCE, where `.record-steps` is a set.

   `.record-steps` sets list-style:none because its first caller — the job
   record's "Before this job can be completed" — is a SET of unmet conditions
   in no particular order. The Field app page's install instructions are the
   opposite: step three is meaningless before step two, and rendering them as
   four undifferentiated lines dropped the one piece of information the list
   was carrying. This was visible only in a browser; the markup was an <ol>
   either way and the tests counted four items either way.

   The counter is drawn rather than inherited so the number lands on the
   type scale and in the muted ink role like every other secondary mark.
--------------------------------------------------------------------------- */
.record-steps-numbered {
  counter-reset: works-step;
}

.record-steps-numbered > li {
  counter-increment: works-step;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: baseline;
  border-left: 0;
  padding-left: 0;
}

.record-steps-numbered > li::before {
  content: counter(works-step) '.';
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ===========================================================================
   INLINE EDITING — the value on the record IS the control.

   THE RESTRAINT IS HERE, NOT IN THE MARKUP. Every editable value is a real,
   focusable, labelled form control at all times, because that is what a
   screen reader and a thumb both need. What this sheet does is stop a page of
   them looking like a form: at rest they are plain text on the page
   background, with no border, no shadow and no icon. The affordance arrives
   on hover and on focus — the two moments a person has shown interest — and
   leaves again when they do.

   "Do not fill the workspace with permanent input borders, edit icons, or
   buttons. The default presentation should remain easy to read."
========================================================================== */

.inline-unit {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.inline-unit + .inline-unit {
  margin-top: var(--space-5);
}

.inline-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: var(--space-4) var(--space-6);
  align-items: baseline;
  min-width: 0;
}

/* The label matches .field-list dt exactly, because a field that became
   editable must not change shape on the page. A record where the editable
   rows sat differently from the read-only ones would be two designs. */
.inline-label {
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  color: var(--ink-muted);
}

.inline-control {
  /* 3.4: 44px MINIMUM ON DESKTOP, TABLET AND MOBILE, "with no compact
     variant". The density argument - that a column of eleven fields reads
     better at 33px with a mouse - is the one that clause exists to refuse,
     and the resting look does not change: the control is still transparent
     text, it simply occupies a target a thumb could hit. Caught by measuring
     the rendered height on TE; the gate reads declared values and a height
     that only emerges from line-height and padding is not one. */
  min-height: var(--control-height);
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  /* The negative margin cancels the padding so the resting text sits on the
     same baseline and the same left edge as a non-editable value beside it.
     Without it, editable rows are indented by two pixels and the column no
     longer reads as a column. */
  margin: calc(var(--space-1) * -1) calc(var(--space-2) * -1);
  width: 100%;
  min-width: 0;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.inline-control:hover:not([readonly]):not(:disabled) {
  border-color: var(--border);
  background: var(--surface-raised);
}

.inline-control:focus {
  border-color: var(--accent);
  background: var(--surface-raised);
  box-shadow: var(--focus-ring);
  outline: none;
}

/* READ-ONLY IS NOT GREYED OUT. The value is still the record's and still
   worth reading; what is absent is the invitation, so it simply never gains
   a border. Dimming it would make an unauthorised field look like missing
   data rather than like data someone else maintains. */
.inline-control[readonly],
.inline-control:disabled {
  cursor: default;
}

textarea.inline-control {
  resize: vertical;
  min-height: calc(var(--type-body-size) * 3);
}

/* A placeholder is an absence, and 10.1 gives absence one treatment. */
.inline-control::placeholder {
  color: var(--ink-muted);
  font-style: italic;
}

/* A hint reads the same wherever it sits; only its PLACEMENT differs. The
   typography is unscoped and the column is not, because the column only
   exists inside a row - see .inline-notice for what asking for one outside a
   row used to do. */
.inline-hint {
  margin: 0;
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

.inline-row > .inline-hint {
  grid-column: 2;
}

/* THE SECTION-LEVEL EXPLANATION. One sentence for the whole card rather than
   one beside every field - the owner read the same settled-request sentence
   five times down one screen. It spans the unit instead of asking for a
   column the unit does not have, which is the defect that collapsed every
   field beside it to 224px. */
.inline-notice {
  grid-column: 1 / -1;
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
  background: var(--surface-inset);
  border-left: var(--space-1) solid var(--border);
  border-radius: var(--radius-sm);
}

.inline-group-label {
  margin: 0;
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  color: var(--ink-muted);
}

/* THE CONTROLS SIT UNDER THE FIELD THEY BELONG TO, indented to the value
   column so there is no doubt which value they would save. A pair of buttons
   at the foot of a card carrying six fields would be the full-record form
   again, wearing smaller buttons. */
.inline-slot > .inline-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.inline-actions[hidden] {
  display: none;
}

/* A changed field is marked on its edge rather than by a colour wash, so the
   signal does not compete with the record's own content and does not rely on
   hue alone (1.4.1).

   ON THE FIELD THAT CHANGED, NOT ON ITS NEIGHBOURS. A group saves as one, so
   the CONTROLS belong to the whole unit - but the border does not. Marking
   every member drew a box around the surname and the empty company beside a
   first name somebody had corrected, which says three things were edited
   when one was. */
.inline-control[data-dirty]:not([readonly]) {
  border-color: var(--accent);
  background: var(--surface-raised);
}

.inline-slot > .inline-status {
  grid-column: 2;
  margin: 0;
  font-size: var(--type-record-secondary-size);
}

.inline-status[hidden] {
  display: none;
}

.inline-status[data-tone='busy'] {
  color: var(--ink-muted);
}

.inline-status[data-tone='ok'] {
  color: var(--state-success);
}

.inline-status[data-tone='error'] {
  color: var(--state-error);
}

/* The whole unit stops responding while a write is in flight, which is the
   visible half of "a pending save is not re-entrant". */
.inline-unit.is-saving {
  opacity: 0.72;
}

/* A phone in portrait has no room for a label column, and a 220px gutter
   beside a street address leaves the address unreadable. The same stacking
   .field-list uses, at the same breakpoint, so a record does not change its
   mind about where labels go halfway down. */
@media (max-width: 639px) {
  .inline-row {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  /* SCOPED THE SAME WAY AS THE DESKTOP RULES. An unscoped claim here was
     harmless - column 1 of a one-column grid is column 1 - but it is the
     same mistake that collapsed every field at desktop width, and leaving
     one copy of it in the sheet is leaving the next person a pattern to
     copy. */
  .inline-row > .inline-hint,
  .inline-slot > .inline-actions,
  .inline-slot > .inline-status {
    grid-column: 1;
  }

  /* The height is already --control-height at every width (3.4); what the
     narrow case adds is a wider tap area and a left edge that matches the
     stacked label above it. */
  .inline-control {
    padding: var(--space-2) var(--space-3);
    margin-inline: calc(var(--space-3) * -1);
  }
}

/* THE SUMMARY PANEL IS 304px WIDE, so an inline row inside it stacks whatever
   the viewport is doing. A 140px label gutter beside a 160px value column is
   not two columns, it is two things too narrow to read — and the identity
   panel is exactly where a customer's name is edited, so the case is not
   hypothetical. Same treatment the whole record takes below 640px, applied
   here by container rather than by viewport. */
.record-summary .inline-row {
  grid-template-columns: 1fr;
  gap: var(--space-1);
}

.record-summary .inline-row > .inline-hint,
.record-summary .inline-slot > .inline-actions,
.record-summary .inline-slot > .inline-status {
  grid-column: 1;
}

/* THE SLOT THE CONTROLS MOVE INTO.
   
   Every field has one; the single Save/Cancel pair lives in whichever belongs
   to the field being edited. An empty slot must occupy no space at all, or a
   record with eleven fields would carry eleven invisible gaps down its
   length. */
.inline-slot:empty {
  display: none;
}

.inline-slot {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: var(--space-4) var(--space-6);
  min-width: 0;
}

/* A dependent field that the rule has not asked for is not in the layout at
   all - `hidden` alone loses to `display: grid` on .inline-row. */
.inline-row[hidden] {
  display: none;
}

/* WHY A FIELD APPEARED. It sits with the dependant it explains, in the same
   muted register as any other hint, because a control that materialises with
   no explanation reads as a fault. */
.inline-dependency-why[hidden] {
  display: none;
}

.inline-row ~ .inline-dependency-why {
  grid-column: 1 / -1;
  color: var(--state-warn);
}

@media (max-width: 639px) {
  .inline-slot {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  .inline-dependency-why {
    grid-column: 1;
  }
}

/* ===========================================================================
   CREATION FORMS - UI-001 2 and 3, UI-002
   ===========================================================================
   Two deliberate columns, not one tall stack of unrelated inputs, and not a
   short input stretched across a desktop. 5.x reached the same shape years
   ago - a 2-column `.form-grid` with `.field.full` for the things that need
   the width - and this is deliberately that shape, because an office that has
   used one for a year should not have to learn a second.

   The single breakpoint is 639px, which is the one the standard already has.
   Nothing here introduces a third.
   =========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* THE ROW GAP IS THE GAP INSIDE A FIELD, not between rows of fields - see
     the subgrid block below for why, and for where the other gap went. */
  column-gap: var(--space-5);
  row-gap: var(--field-gap);
  align-items: start;
}

/* ---------------------------------------------------------------------------
   CORRESPONDING CONTROLS ALIGN HORIZONTALLY - the form standard, requirement 1
   ---------------------------------------------------------------------------
   A field spans three of the form's rows and adopts them as a subgrid, so
   every label in a visual row sits in ONE track and every control sits in the
   next. The consequence is the whole point: a two-line label or a three-line
   helper under one field makes that TRACK taller for both fields, which keeps
   them aligned, instead of making one field taller than the other, which is
   what pushed them apart.

   WHY THE ROW GAP MOVED. The three rows belong to the form now, so the form's
   row-gap falls between label and control and between control and helper.
   There is only one row-gap, so the separation BETWEEN rows of fields cannot
   also come from it - it is the padding below the support row instead, and it
   is derived (`--form-row-gap` minus what the gap already contributes) so the
   two distances are declared once each and cannot drift apart.

   The last row of fields therefore carries that padding below it too. That is
   accepted: a form ends in an action bar, and space above the buttons is not a
   defect.

   WITHOUT SUBGRID this block does nothing and every field stays the plain
   three-row column it already is - which is the pre-existing behaviour, not a
   broken one. Nothing here is the only thing keeping a field legible.
   --------------------------------------------------------------------------- */
@supports (grid-template-rows: subgrid) {
  .form-grid > .field {
    grid-row: span 3;
    grid-template-rows: subgrid;
  }

  .form-grid > .field > .field-support {
    padding-bottom: calc(var(--form-row-gap) - var(--field-gap));
  }

  /* An empty support row still has to hold the row open, so it cannot be
     display:none where it is carrying the separation. */
  .form-grid > .field > .field-support:empty {
    display: block;
  }
}

.form-grid > .full,
.form-grid > .field.full,
.form-grid > .field-section {
  grid-column: 1 / -1;
}

/* A GROUP IS A TASK, not a table. UI-001 2: "Organize forms around meaningful
   tasks rather than database structure." The rule above the legend separates
   groups without a box around each one - UI-001 4 asks for white space rather
   than borders. */
.field-section {
  display: block;
  margin: 0;
  padding: var(--space-5) 0 0;
  border: 0;
  border-top: var(--border-width) solid var(--border-subtle);
}

.record-form > .field-section:first-of-type,
.record-form-intro + .field-section {
  padding-top: 0;
  border-top: 0;
}

.field-section-legend {
  padding: 0 0 var(--space-4);
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  color: var(--ink);
}

.field-section-helper {
  margin: calc(var(--space-4) * -1) 0 var(--space-4);
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* SOMETHING THE FORM SHOWS AND DOES NOT ASK.
   Owner direction, 27 October 2026: "Present relevant request information as
   read-only context where it helps the office create the job." A disabled
   textarea would read as a field that ought to work and does not, so this is
   prose under a label - the same label type as a field so it sits in the
   column, and no box, because there is nothing to type into.
   CSS-001: every value is a token. */
.field-static {
  display: block;
}

.field-static-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  color: var(--ink-muted);
}

.field-static-value {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--surface-inset);
  font-size: var(--type-record-secondary-size);
  color: var(--ink);
  /* A long report keeps its line breaks; it was typed as prose. */
  white-space: pre-wrap;
}

/* PROGRESSIVE DISCLOSURE (UI-002). The group is inset so that what it belongs
   to is obvious: these fields are part of the choice above them, not a new
   section of the form. */
.reveal-group {
  margin-top: var(--space-4);
  padding: var(--space-5);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface-inset);
}

.reveal-group[hidden] {
  display: none;
}

/* A field's own action, beside its label - 5.x's `.field-heading-row`.
   "Create a new customer" is not a kind of customer, so it is a control here
   rather than an option in the list below. */
.field-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.field-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.record-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

.record-form-intro {
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--type-record-secondary-size);
}

/* ------------------------------------------------------------------ lookup */
/* A SEARCHABLE PICKER. Next generation had no typeahead at all, so every
   customer went into one <select> - which stops working at the point the
   business grows, not at the point somebody dislikes the styling. */
.lookup-control {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.lookup-input {
  flex: 1 1 auto;
  min-width: 0;
}

.lookup-chosen {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0 var(--space-4);
  min-height: var(--control-height);
  display: flex;
  align-items: center;
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface-inset);
  color: var(--ink);
  font-size: var(--type-body-size);
}

.lookup-chosen[hidden],
.lookup-change[hidden] {
  display: none;
}

.lookup-chosen:not([hidden]) ~ .lookup-change {
  flex: 0 0 auto;
}

.lookup-list {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  max-height: calc(var(--control-height) * 5);
  overflow-y: auto;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow-subtle);
}

.lookup-list[hidden] {
  display: none;
}

/* 44px, like every other target. A list somebody has to aim at on a phone is
   not a place to save vertical space. */
.lookup-option {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  min-height: var(--control-height);
  justify-content: center;
  cursor: pointer;
}

.lookup-option.is-active,
.lookup-option:hover {
  background: var(--surface-inset);
}

.lookup-option-primary {
  color: var(--ink);
  font-size: var(--type-body-size);
}

.lookup-option-secondary {
  color: var(--ink-muted);
  font-size: var(--type-record-secondary-size);
}

.lookup-empty {
  padding: var(--space-3) var(--space-4);
  color: var(--ink-muted);
  font-size: var(--type-record-secondary-size);
}

@media (max-width: 639px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  /* FIELDS STACK CLEANLY - the form standard, requirement 4.
     ONE COLUMN HAS NOTHING TO ALIGN WITH, so a field stops borrowing the
     form's rows and becomes the plain three-row column it is everywhere else.
     This is not a concession: keeping the subgrid here would hand the form's
     12px row-gap to the gaps INSIDE each field and pull every label away from
     its own control, which is the opposite of what the alignment is for.

     This block sits after the @supports block deliberately - @supports adds no
     specificity, so source order is what decides, and the narrow screen has
     the last word. */
  .form-grid > .field {
    grid-row: auto;
    grid-template-rows: auto auto auto;
    gap: var(--field-gap);
  }

  .form-grid > .field > .field-support {
    padding-bottom: 0;
  }

  /* With the separation no longer living here, an empty support row is just
     an empty row again and should take no space. */
  .form-grid > .field > .field-support:empty {
    display: none;
  }

  .reveal-group {
    padding: var(--space-4);
  }
}

/* ---------------------------------------------------------------------------
   A TECHNICIAN'S RECOMMENDATION, as the office reads it (requirement 3,
   28 October 2026).

   The first surface these records have ever had: the owner entered one in
   Field, it reached the database intact, and HQ had no way to ask for it.

   THE FINDING AND THE SUGGESTION READ AS TWO THINGS, because they are: what
   was seen is not what should be done about it, and the schema keeps them
   apart for that reason. The attribution line beneath them carries the
   author, the visit and the date - a finding nobody can trace to a person and
   a trip is advice from nowhere.

   CSS-001: every value is a token.
   --------------------------------------------------------------------------- */
.recommendation-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}

.recommendation-what {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: var(--space-1);
  min-width: 0;
}

.recommendation-title {
  font-weight: var(--type-label-weight);
  color: var(--ink);
}

.recommendation-finding,
.recommendation-suggestion {
  margin: 0;
  font-size: var(--type-record-secondary-size);
  color: var(--ink);
}

.recommendation-aside {
  margin: 0;
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

.recommendation-state {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: var(--space-1);
  text-align: right;
}

/* ON A PHONE THE STATE GOES ABOVE THE TEXT rather than beside it: a status
   pill and three lines of prose do not share a 360px row legibly, and the
   answer is to stack, not to shrink. */
@media (max-width: 640px) {
  .recommendation-row {
    flex-wrap: wrap;
  }

  .recommendation-state {
    flex: 1 1 100%;
    align-items: flex-start;
    text-align: left;
  }
}

/* ---------------------------------------------------------------------------
   THE CUSTOMER PAYMENT LINK (8 November 2026).

   FOUR REGIONS IN READING ORDER - what the state is, the credential, what
   it means, what can be done - and they are separated by space rather than
   by rules or boxes. The card already has a border; a second frame inside
   it would be decoration.

   THE URL IS TREATED AS A CREDENTIAL AND NOT AS PROSE. Monospace, because
   somebody may have to read it aloud or check a character; full width,
   because a 100-character link in a narrow column is unreadable; and
   `overflow-wrap: anywhere`, because a URL has no spaces and would
   otherwise push the whole record sideways - which is the one failure the
   invoice record must never have.
   --------------------------------------------------------------------------- */
.payment-link {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6) 0;
}

.payment-link-heading {
  margin: 0;
  font-size: var(--type-label-size);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* THE STATE, ON ONE LINE, with the label and the value distinguishable at a
   glance - the office reads this far and no further when the answer is
   "yes, there is a link". */
.payment-link-statusline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.payment-link-statuslabel {
  color: var(--ink-muted);
  font-size: var(--type-label-size);
}

.payment-link-statusvalue {
  color: var(--ink);
}

.payment-link-field {
  display: grid;
  gap: var(--space-1);
}

.payment-link-label {
  color: var(--ink-muted);
  font-size: var(--type-label-size);
}

/* THE CONTROL MINIMUM, FROM THE TOKEN THAT DECLARES IT: this field is
   pressed to select a long value on a tablet, so it is a control.

   IT WAS A LITERAL 44px AND check:ui REFUSED IT - correctly. A component
   that writes the number instead of reading --control-height is a
   component that keeps its own copy of a system decision. */
.payment-link-value {
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--type-label-size);
  color: var(--ink);
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.payment-link-value:focus-visible {
  outline: 3px solid var(--ink-accent);
  outline-offset: 2px;
}

/* THE ACTIONS WRAP rather than squeezing, because there are up to five of
   them and a tablet is 820px wide. */
.payment-link-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding-bottom: var(--space-2);
}

/* THE DECLARED BREAKPOINT, NOT A PHONE-ISH NUMBER I CHOSE.

   This was 700px, which check:ui refused: 3.5 declares 640 and 1024, and
   a third breakpoint invented by one component is a layout that changes
   shape at a width nothing else in Works knows about. */
@media (max-width: 640px) {
  .payment-link {
    padding: var(--space-4) var(--space-5) 0;
  }
  /* ONE CONTROL PER ROW on a phone, so no label truncates. */
  .payment-link-actions > * {
    flex: 1 1 100%;
  }
}
/* ── THE PHOTOGRAPH STRIP AND ITS VIEWER (15 November 2026).

   OWNER REPORT: "In HQ Photos & Documentation, display image thumbnails and
   provide a navigable image viewer." The section showed three headings and a
   count each, so an office could not look at the work it was billing for.

   A FIXED CELL, SO THE STRIP IS A STRIP. Photographs arrive at whatever
   aspect a tablet produced; a grid of their natural sizes is not a row. The
   cell is square and the image covers it, which crops rather than distorts -
   a cropped thumbnail opens to the whole frame, a squashed one is wrong
   everywhere. */
.media-strip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-3);
}

.media-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
}

.media-thumb {
  display: flex;
  flex: 0 0 96px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  height: 96px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--surface-2);
  cursor: pointer;
}

.media-thumb:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

.media-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A GLYPH FOR A VIDEO and a sentence for an absence - never a broken image,
   which is the whole point of the unavailable reason the endpoint returns. */
.media-thumb-glyph {
  font-size: var(--type-section-size);
  color: var(--ink-muted);
}

.media-thumb-absent {
  padding: var(--space-2);
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
  text-align: center;
}

.media-thumb-visit {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

/* ── THE VIEWER. One item, and a way through the rest. */
.media-viewer-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  /* ON THE SPACING SCALE, through arithmetic rather than a chosen pixel:
     ten of the largest step. The frame is tall enough that a portrait
     photograph does not make the dialog jump when it arrives, and the
     reading sentence that stands there first is vertically centred in
     something rather than in nothing. */
  min-height: calc(var(--space-7) * 10);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
}

.media-viewer-media {
  max-width: 100%;
  /* BOUNDED BY THE VIEWPORT, not by the image. A photograph from a tablet is
     taller than a laptop screen, and a dialog that scrolls past its own
     controls is a dialog somebody cannot navigate. */
  max-height: 60vh;
}

.media-viewer-caption {
  padding-top: var(--space-2);
  color: var(--ink);
}

.media-viewer-position {
  color: var(--ink-muted);
}

.media-viewer-controls {
  display: flex;
  gap: var(--space-3);
  padding-top: var(--space-2);
}
