/* ===========================================================================
   CORNERPOST WORKS HQ - THE APPLICATION SHELL
   ===========================================================================

   The frame every workspace is rendered inside. UI Standard 5.2 fixes the
   hierarchy and this file implements exactly it:

       Workspace Header -> Tabs/Subnavigation -> Search/Filters -> Content

   NO VALUE IS DECIDED HERE. Every colour, space, radius, shadow and size
   comes from src/tokens.css; `check:ui` fails the build on a literal.
   =========================================================================== */

/* ---------------------------------------------------------------------------
   LAYOUT SKELETON

   Three regions, one grid:

       +-----------------------------------------------+
       |  header                                       |
       +------------+----------------------------------+
       |  sidebar   |  workspace                       |
       +------------+----------------------------------+

   THE SIDEBAR IS A COLUMN, NOT AN OVERLAY, AT EVERY WIDTH. Owner
   clarification, 24 October 2026: "In both states, the navigation sits BESIDE
   the workspace in the normal layout. Expanding the navigation pushes and
   reduces the available workspace width. It must NOT overlay the workspace as
   Field does. These rules apply on desktop, tablet, and mobile."

   SO THERE IS ONE GRID AND IT HAS TWO COLUMNS, always. The phone used to drop
   to a single column and float the navigation over it; that whole branch is
   gone. What changes below 1024px is the WIDTH of the expanded sidebar, not
   whether it is in the layout.

   minmax(0, 1fr) ON THE CONTENT COLUMN IS LOAD-BEARING. An `auto`/`1fr` grid
   track takes its automatic minimum from the MIN-CONTENT of its widest item,
   and a browser proved on 15 October that this makes the whole application as
   wide as the widest thing inside it. Once was enough.
   ------------------------------------------------------------------------ */
.app {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    'header header'
    'sidebar main';
  /* A FIXED-HEIGHT FRAME, SO EACH REGION OWNS ITS OWN SCROLL.

     IT WAS `min-height: 100vh`, WHICH MEANT THE DOCUMENT SCROLLED - one
     scrollbar for the whole application. The navigation was made to LOOK
     independent with `position: sticky`, and that is not the same thing: both
     regions moved on the same scroller, so a long workspace scrolled the
     navigation out of its own box, and the navigation could never scroll
     when IT was the taller of the two. The owner reported exactly that.

     With the height fixed and both rows `minmax(0, 1fr)`, the grid never
     exceeds the frame, so `.app` itself has nothing to scroll and no
     `overflow` of its own is needed. The sidebar and the workspace each get
     `overflow: auto` below and move independently, in both navigation states
     and at any orientation.

     `dvh` RATHER THAN `vh`, declared second. On Android Chrome `vh` is the
     viewport with the browser toolbar HIDDEN, so `100vh` is taller than what
     the person can see and the bottom of the navigation sat below the edge of
     the screen, unreachable. `dvh` is the visible viewport and tracks the
     toolbar as it moves. */
  height: 100vh;
  height: 100dvh;
}

.app-main {
  grid-area: main;
  min-width: 0;
  /* THE WORKSPACE IS ITS OWN SCROLLER. Both axes are named explicitly: if one
     axis is `visible` and the other is not, the visible one computes to
     `auto` anyway, and leaving that implicit is how a horizontal overflow
     ends up on a scrollbar nobody is measuring. */
  min-height: 0;
  overflow: auto;
  /* THE WORKSPACE IS WHAT A RECORD MEASURES ITSELF AGAINST, not the screen.
     The record layout used to collapse its summary column on
     `@media (max-width: 1023px)` - the VIEWPORT - which ignores the thing
     that actually takes the space: the persistent navigation rail. On a
     1280px tablet with navigation expanded the workspace is under 1000px and
     a 304px column beside content is too tight; with it collapsed the same
     screen has room. The viewport cannot tell those apart and a container
     can, which is the owner's instruction - "verify actual available
     workspace width at each breakpoint, not merely device screen width".
     Named, so a stray @container elsewhere cannot accidentally match it. */
  container-type: inline-size;
  container-name: workspace;
}

/* ---------------------------------------------------------------------------
   THE HEADER - branding, the sidebar toggle, search, environment, account.
   -----------------------------------------------------------------------
   IT IS GREEN, AND SO IS THE SIDEBAR, AND THE WORKSPACE IS NOT. UI Standard
   5.1: "Ordinary workspace titles/actions are not placed inside a competing
   green header." The green ground belongs to the application FRAME - the
   header and the sidebar are the frame - and to modal headers (6.2). A
   workspace title sits on the ordinary surface the frame contains.

   THE FRAME IS GREEN IN BOTH THEMES. A dark theme that moved the frame off
   brand would be the "simply inverted" result the owner ruled out; what the
   theme changes is the content the frame holds.

   IT IS STICKY, because navigation a person has to scroll back up to reach is
   navigation that gets used less.
   ------------------------------------------------------------------------ */
.app-header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: var(--layer-chrome);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: var(--chrome-height);
  padding: 0 var(--space-5);
  background: var(--surface-chrome);
  color: var(--ink-on-chrome);
  border-bottom: var(--border-width) solid var(--accent-on-chrome);
}

/* Every control that sits on the green ground. One rule, so a new header
   control cannot invent its own treatment. */
.chrome-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: var(--control-height);
  min-width: var(--control-height);
  padding: 0 var(--space-3);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-on-chrome);
  font: inherit;
  cursor: pointer;
}

.chrome-control:hover:not(:disabled) {
  background: var(--surface-chrome-raised);
  color: var(--ink-on-chrome-accent);
}

.chrome-control:disabled {
  color: var(--ink-on-chrome-muted);
  cursor: default;
}

.chrome-control[aria-expanded='true'] {
  background: var(--surface-chrome-raised);
}

/* THE WORDMARK, which is the approved brand asset rather than type. It is a
   background image on a labelled element rather than an <img>, because the
   lockup swaps with the theme and the surface it sits on - and a token is
   where that decision belongs. */
.app-brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.app-wordmark {
  display: block;
  width: var(--wordmark-width);
  height: var(--wordmark-height);
  background-image: var(--wordmark-on-chrome);
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
}

.header-spacer {
  flex: 1 1 auto;
}

/* GLOBAL SEARCH, AND IT IS HONEST ABOUT ITSELF.
   There is no global search endpoint: of 57 list endpoints exactly one
   accepts a search term, and it searches customers only. A box that looked
   ready and did nothing would be worse than no box, so this is disabled, says
   why, and is the entry point the finished one will occupy. */
.header-search {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 0 1 380px;
  min-width: 0;
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: var(--border-width) solid var(--border-chrome);
  border-radius: var(--radius);
  background: var(--surface-chrome-raised);
  color: var(--ink-on-chrome-muted);
}

.header-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink-on-chrome);
  font: inherit;
}

.header-search input::placeholder {
  color: var(--ink-on-chrome-muted);
}

.header-search input:disabled {
  cursor: not-allowed;
}

/* THE ENVIRONMENT CHIP. Development and Test say so; production says nothing,
   because a chip that is always there is a chip nobody reads. */
.environment-chip {
  display: inline-flex;
  align-items: center;
  height: var(--space-7);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: var(--border-width) solid currentColor;
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  flex: 0 0 auto;
}

.environment-chip[data-environment='development'] {
  color: var(--ink-on-chrome-accent);
}

/* BOTH CHIPS TAKE A THEMED ROLE. This one was --brand-cream, a brand
   constant drawn for a dark ground: 1.1:1 on the light frame, which is to
   say invisible. It was not caught locally because the local environment
   announces itself as 'development' and takes the line above - the defect
   existed only on the one environment the owner actually looks at. The two
   stay distinguishable by weight of colour, and 3.6 is satisfied by the word
   inside them either way. */
.environment-chip[data-environment='test'] {
  color: var(--ink-on-chrome);
}

/* ---------------------------------------------------------------------------
   THE ACCOUNT MENU - who you are, what theme you want, and the way out.
   -----------------------------------------------------------------------
   It is a popover rather than a modal: 6.3 reserves a modal for a decision
   that must be made, and choosing a theme is not one. So it closes on
   Escape, on a click outside, and on choosing - and it returns focus to the
   control that opened it, which is the part people notice when it is missing.
   ------------------------------------------------------------------------ */
.account {
  position: relative;
  flex: 0 0 auto;
}

.account-name {
  max-width: var(--identity-max);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
}

.account-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: var(--layer-chrome);
  width: var(--menu-width);
  padding: var(--space-4);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-primary);
}

.account-identity {
  padding-bottom: var(--space-4);
  border-bottom: var(--border-width) solid var(--border-subtle);
}

.account-identity-name {
  font-weight: var(--type-label-weight);
}

.account-identity-role,
.account-identity-email {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
}

.account-section {
  padding-top: var(--space-4);
}

.account-section-label {
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-bottom: var(--space-2);
}

/* A theme choice. The tick is a WORD to assistive technology (aria-checked)
   and a mark on screen - 3.6: a brand accent does not carry meaning alone. */
.theme-choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.theme-choice:hover {
  background: var(--surface-inset);
}

.theme-choice[aria-checked='true'] {
  border-color: var(--accent);
  font-weight: var(--type-strong-weight);
}

.theme-choice-label {
  flex: 1 1 auto;
}

.theme-choice-mark {
  color: var(--accent);
}

.theme-choice-detail {
  font-size: var(--type-record-secondary-size);
  color: var(--ink-muted);
  padding: var(--space-2) var(--space-3) 0;
}

/* ---------------------------------------------------------------------------
   THE SIDEBAR
   -----------------------------------------------------------------------
   UI Standard 5.2 fixes the hierarchy - workspace, then subnavigation - and
   this is that hierarchy standing up rather than lying down: a workspace
   name, and its sections nested under it.

   TWO CONTROLS PER ROW, ON PURPOSE. The name navigates; the chevron expands.
   One control that did both means you cannot look at what is inside a
   workspace without leaving the one you are in.
   ------------------------------------------------------------------------ */
.app-sidebar {
  grid-area: sidebar;
  width: var(--sidebar-width);
  /* NO `position: sticky` AND NO `height: 100vh` ANY MORE. Both existed to
     fake independence while the document scrolled: sticky kept the rail in
     view, and the explicit height gave it an internal scrollbar. Now the grid
     row IS its height, so it fills the frame exactly and scrolls its own
     content when there is more of it than fits.

     `min-height: 0` because a grid item will not shrink below its content
     unless it is told it may - the same automatic minimum that put the modal
     footer part way up the dialog. */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-4) 0 var(--space-7);
  background: var(--surface-chrome);
  color: var(--ink-on-chrome);
  border-right: var(--border-width) solid var(--border-chrome);
  scrollbar-width: thin;
}

.app[data-sidebar='collapsed'] .app-sidebar {
  width: var(--sidebar-rail);
}

.sidebar-groups,
.sidebar-entries,
.sidebar-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-group + .sidebar-group {
  margin-top: var(--space-5);
}

.sidebar-group-label {
  padding: 0 var(--space-5) var(--space-2);
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-label-weight);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-on-chrome-muted);
  white-space: nowrap;
}

/* The group labels go when there is no room to read them - the rail shows
   icons, and a 64px column cannot hold "Business operations". */
.app[data-sidebar='collapsed'] .sidebar-group-label {
  display: none;
}

.app[data-sidebar='collapsed'] .sidebar-group + .sidebar-group {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--border-chrome);
}

.sidebar-row {
  display: flex;
  align-items: stretch;
}

.sidebar-link,
.sidebar-child {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--control-height);
  padding: 0 var(--space-5);
  border: 0;
  border-left: var(--focus-ring-width) solid transparent;
  background: transparent;
  color: var(--ink-on-chrome);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sidebar-link:hover:not(:disabled),
.sidebar-child:hover:not(:disabled) {
  background: var(--surface-chrome-raised);
}

/* THE ACTIVE WORKSPACE, THREE WAYS: aria-current for assistive technology, a
   heavier weight, and a brass edge. 5.2: "Active state cannot rely on color
   alone." */
.sidebar-link[aria-current='page'],
.sidebar-child[aria-current='page'] {
  background: var(--surface-chrome-raised);
  border-left-color: var(--accent-on-chrome);
  color: var(--ink-on-chrome-accent);
  font-weight: var(--type-strong-weight);
}

/* THE WORKSPACE THAT CONTAINS THE CURRENT SECTION. A quieter version of the
   same three signals, so the eye can find where it is in one look without
   two rows competing to be the loudest. In the collapsed rail this is the
   ONLY thing on screen that says where you are. */
.sidebar-link[aria-current='true'] {
  border-left-color: var(--accent-on-chrome);
  color: var(--ink-on-chrome-accent);
  font-weight: var(--type-strong-weight);
}

.sidebar-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app[data-sidebar='collapsed'] .sidebar-label,
.app[data-sidebar='collapsed'] .sidebar-chevron,
.app[data-sidebar='collapsed'] .sidebar-children,
.app[data-sidebar='collapsed'] .sidebar-tag {
  display: none;
}

.app[data-sidebar='collapsed'] .sidebar-link {
  justify-content: center;
  padding: 0;
  gap: 0;
}

/* The chevron. Its own control, its own target, and 44px of it. */
.sidebar-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--control-height);
  min-height: var(--control-height);
  border: 0;
  background: transparent;
  color: var(--ink-on-chrome-muted);
  cursor: pointer;
}

.sidebar-chevron:hover {
  background: var(--surface-chrome-raised);
  color: var(--ink-on-chrome);
}

/* A SECTION, one level in. Indented to the width of the workspace icon plus
   its gap, so the nesting is visible without a second border.

   THE CHROME'S OWN INK, not the muted step - 4 November 2026.
   -----------------------------------------------------------------------
   EVERY CHILD USED TO BE MUTED, which was right while every child was
   operational: there was nothing to be subordinate TO. The owner's
   instruction of 4 November puts PLANNED destinations in the sidebar -
   "disabled and visually subordinate" - and a planned row cannot be
   subordinate to rows painted the same colour.

   SO AN OPERATIONAL ROW TAKES THE PRIMARY INK AND A DISABLED ONE KEEPS THE
   MUTED STEP. One token of difference, and both legible: the plan is
   information the office reads, so making it unreadable would defeat the
   reason it is on the screen. The word "Planned" beside it carries the same
   fact without relying on either colour (3.6). */
.sidebar-child {
  padding-left: calc(var(--space-5) + var(--icon-size) + var(--space-4));
  font-size: var(--type-label-size);
  color: var(--ink-on-chrome);
}

/* A WORKSPACE THAT IS NOT BUILT reads as not built. The `disabled`
   attribute is what assistive technology uses; this is what a sighted
   reader uses, and the section tags inside spell it out in words. */
.sidebar-link:disabled {
  color: var(--ink-on-chrome-muted);
  cursor: default;
}

.sidebar-link:disabled:hover {
  background: transparent;
}

/* AND A PLANNED ONE IS SUBORDINATE. 7.2: "Disabled means currently
   unavailable and is visually subdued. Use it only when showing the
   unavailable option is useful" - and here it is useful, because the plan is
   how the office knows what is coming and why it is not here yet.

   `cursor: default`, NOT `not-allowed`. A planned destination is not a
   refusal; it is a thing that does not exist yet, and the row says so in a
   word and in its title. */
.sidebar-child:disabled {
  cursor: default;
  color: var(--ink-on-chrome-muted);
}

.sidebar-child:disabled:hover {
  background: transparent;
}

/* WHAT A SECTION IS, IN A WORD. "Planned" and "Transitional" are the two
   facts a reader needs and neither is carried by colour. */
.sidebar-tag {
  flex: 0 0 auto;
  padding: 0 var(--space-2);
  border: var(--border-width) solid var(--border-chrome);
  border-radius: var(--radius-sm);
  font-size: var(--type-record-secondary-size);
  font-weight: var(--type-body-weight);
  color: var(--ink-on-chrome-muted);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   TABLET AND PHONE - the same two states, in the same layout.
   -----------------------------------------------------------------------
   NOTHING BECOMES AN OVERLAY. The navigation keeps its column; what gives is
   the EXPANDED width, because 292px of a 360px phone leaves 68px of workspace
   and that is not a layout, it is a rumour of one.

   min(292px, 44vw) IS THE WHOLE RESPONSIVE RULE. At 380px the sidebar takes
   167px and the workspace keeps 213px. THE WORKSPACE GETS THE LARGER SHARE,
   which is the point of the fraction: 52vw was tried first and gave the
   navigation 198px against the work's 182px, and a workspace application
   whose navigation is bigger than its workspace is not "preserving usable
   workspace layout" by any reading.

   At 664px and above, 44vw exceeds 292px, so the min() picks 292 and a tablet
   gets the full sidebar with nothing changed at all. There is no second
   breakpoint to remember.

   THE COLLAPSED RAIL IS 64px AT EVERY WIDTH and is never hidden: "Keep the
   icon rail visible at all times."

   AND THE STANDARD WAS AMENDED TO SAY SO. This block used to cite UI
   Standard 3.5: "Do not permanently reduce the workspace width" - which is
   exactly what a navigation column does, at every width. For a few hours that
   was an override standing against the written rule; it is not any more. 3.5
   was amended on 24 October 2026 to state HQ and Field separately: HQ is a
   persistent two-state column beside the workspace and expanding it reduces
   the workspace width deliberately, Field keeps its overlay drawer, and the
   prohibition is gone. The two breakpoints are unchanged.

   WHY NO HORIZONTAL SCROLLING. The grid is auto / minmax(0, 1fr): the sidebar
   track is bounded by the min() above and the content track is allowed to
   shrink to nothing rather than taking its min-content width. That pair is
   what keeps the document from growing wider than the window - the same fact
   a browser proved on 15 October, which is why the note at the top of this
   file calls it load-bearing.
   ------------------------------------------------------------------------ */
@media (max-width: 1023px) {
  .app-sidebar {
    width: min(var(--sidebar-width), 44vw);
  }

  /* The rail does not shrink. 64px is already the floor for a 44px target
     with air around it, and a narrower one would fail 3.3 rather than save
     anything worth having. */
  .app[data-sidebar='collapsed'] .app-sidebar {
    width: var(--sidebar-rail);
  }

  /* AND THE ROW GIVES ITS SPACING BACK TO THE LABEL.

     Expanded exists to show the names, so a row that spends its width on air
     has the priorities backwards at 167px. Of that, 3px is the active edge,
     20px the icon and 44px the chevron - all load-bearing - which left the
     label 56px with the desktop padding and gap. "Customers" needs about 70.

     8px instead of 16 and 12 takes the label to about 76px, which is the
     difference between "Custo…" and "Customers". The 44px targets are
     untouched: this moves padding INSIDE the row, not the row height.

     "Administration" still truncates, and that is the honest limit of a
     380px screen - the icon, the ellipsis and the accessible name carry it,
     and the state is one tap from being left. */
  .app[data-sidebar='expanded'] .sidebar-link,
  .app[data-sidebar='expanded'] .sidebar-child {
    padding: 0 var(--space-3);
    gap: var(--space-3);
  }
}

@media (max-width: 639px) {
  .app-header {
    gap: var(--space-2);
    padding: 0 var(--space-3);
  }

  .app-wordmark {
    width: var(--wordmark-width-small);
  }

  /* The search box goes before the wordmark does: it is the one header
     element that is not yet usable, and the phone has no room for it. */
  .header-search {
    display: none;
  }

  .account-name {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   THE WORKSPACE
   -----------------------------------------------------------------------
   One h1, workspace actions on the same header level to the right, then
   subnavigation, then the control region, then content - all sharing one
   horizontal page geometry (5.1).
   ------------------------------------------------------------------------ */
/* THE SCROLLER SPANS WHAT IT IS GIVEN. No max-width and no auto margins:
   those belong to the PAGE inside it, because a scrollbar is drawn at its own
   scroller's right edge and capping the scroller moves the scrollbar off the
   window edge. See `.workspace-page`. */
.workspace {
  width: 100%;
}

/* ---------------------------------------------------------------------------
   THE PAGE - the readable column inside the scroller.
   -----------------------------------------------------------------------
   SECTION 5.1 UNCHANGED: the header, the supporting controls and the content
   "shar[e] consistent horizontal page geometry", and one value still sets all
   three, because all three are inside this box.

   WHAT MOVED AND WHY. These three declarations were on `.workspace`, which is
   the same element as `.app-main` - the scroller. Capping a scroller caps
   where its scrollbar is drawn, so on any screen wider than the cap plus the
   sidebar the main scrollbar sat inward from the right edge by half the
   leftover width. The owner measured it at about an eighth of the screen.

   THE PAGE IS STILL CENTRED AND STILL CAPPED. Nothing about the reading
   measure changes; only the box that owns the scrollbar does. */
.workspace-page {
  /* A COLUMN, SO A CHILD CAN CLAIM THE HEIGHT THE PAGE IS NOT USING.
     -----------------------------------------------------------------------
     This is half of the repair for the owner's rejected independent
     scrolling; the rest is in components.css, under "TWO COLUMNS, TWO
     SCROLLERS". A record's two columns cannot scroll independently without a
     definite height to scroll inside, and the only box in this chain that had
     one was the scroller above.

     NO `min-height: 100%` HERE, deliberately. It was written first, to make a
     short page fill the frame, and it was doing nothing the repair needed: the
     record path sets a real `height` and overrides it, and a list page was
     the same either way. check:ui is what caught it - a min-height that is not
     a token, and it was right to ask, because the rule exists so that a
     CONTROL cannot quietly lose its 44px. The line was not worth an exception
     to that, so it is gone rather than allowed. */
  display: flex;
  flex-direction: column;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-7) var(--page-gutter) var(--space-7);
  width: 100%;
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  padding-bottom: var(--space-5);
}

.workspace-heading {
  min-width: 0;
}

.workspace-title {
  font-size: var(--type-page-size);
  font-weight: var(--type-page-weight);
}

/* A sentence under the title, where the workspace needs one. Restrained: 8.1
   asks for "contextual, restrained, and functional" copy, and that applies to
   a workspace description as much as to an empty state. */
.workspace-lede {
  margin-top: var(--space-2);
  color: var(--ink-muted);
  font-size: var(--type-label-size);
  max-width: 68ch;
}

/* Workspace-level actions. 5.2: they stay in the header; record actions stay
   with records. */
.workspace-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Breadcrumbs, above the title. 5.3: they "lead back to the appropriate
   workspace by default", and Jobs lead back through the Customer context
   because that relationship is the useful path. */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  font-size: var(--type-label-size);
  color: var(--ink-muted);
}

.breadcrumbs ol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumbs li + li::before {
  content: '/';
  color: var(--border);
}

/* ---------------------------------------------------------------------------
   SUBNAVIGATION - 5.2. Tabs change the view INSIDE a workspace; they are not
   application navigation, and on a narrow display they scroll rather than
   wrapping unpredictably or shrinking below the minimum target.
   ------------------------------------------------------------------------ */
.subnav {
  display: flex;
  gap: var(--space-1);
  border-bottom: var(--border-width) solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.subnav-item {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: 0;
  border-bottom: var(--focus-ring-width) solid transparent;
  margin-bottom: calc(-1 * var(--border-width));
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: var(--type-body-size);
  white-space: nowrap;
  cursor: pointer;
}

.subnav-item:hover {
  color: var(--ink);
}

.subnav-item[aria-current='true'] {
  color: var(--ink);
  font-weight: var(--type-strong-weight);
  border-bottom-color: var(--brand-brass);
}

.subnav-item:disabled {
  color: var(--ink-muted);
  cursor: default;
}

/* IN A WORD, NEVER IN A COLOUR. "Planned" is the explicit half of "real or
   explicitly planned": the section is in the navigation because it is the
   plan, and the word is what stops it reading as a promise. The reason is on
   the control's title. */
.subnav-tag {
  margin-left: var(--space-2);
  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;
}

/* THE SUBNAV WRAPS RATHER THAN SCROLLING AWAY. Customers carries eight
   sections, and a row that scrolls sideways hides the last of them behind a
   gesture nobody makes on a desktop. */
.subnav {
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------------
   THE CONTENT REGION
   ------------------------------------------------------------------------ */
.workspace-body {
  padding-top: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  /* IT MAY CLAIM THE HEIGHT THE PAGE IS NOT USING - 4 November 2026.
     -----------------------------------------------------------------------
     THIS IS HALF OF THE REPAIR for the owner's rejected independent
     scrolling, and the other half is on `.workspace-page` above. A record's
     two columns cannot scroll independently without a DEFINITE height to
     scroll inside, and nothing in this chain had one: the page was as tall as
     its content, the body was as tall as its content, and the only box with a
     real height was the scroller at the top.

     `flex: 1 1 auto` AND NOT `flex: 1`, which would set the basis to zero.
     With an auto basis the body is still at least as tall as its content - so
     a long list grows the page and the workspace scrolls exactly as it always
     has - and it grows into the leftover space when the content is short.
     Only a child that asks for the remainder (the record layout, which does)
     gets to divide it up. */
  flex: 1 1 auto;
  min-height: 0;
}

/* THE SAME COLUMN, WITHOUT THE REGION - 4 November 2026.
   -----------------------------------------------------------------------
   A workspace that wants the standard vertical stack for its own children
   used to reach for `.workspace-body`, which is the SHELL'S content region:
   one per screen, and it carries the region's top padding. Employee
   Onboarding did, so that padding was applied twice and two elements on one
   screen answered to the shell's own selector.

   THIS IS THE PART A WORKSPACE IS ENTITLED TO. No padding, because the region
   it sits inside has already spaced it. */
.workspace-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* A plain content panel: a bordered surface, no shadow. 3.3 - "Borders and
   spacing do most structural work." */
.panel {
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-5);
  padding-bottom: var(--space-5);
}

.panel + .panel {
  margin-top: 0;
}

/* THE NARROW GUTTERS BELONG TO THE PAGE, NOT TO THE SCROLLER - corrected
   3 November 2026, and this was a regression I shipped.
   -----------------------------------------------------------------------
   These two overrides still named `.workspace`, which is the same element as
   `.app-main`: the SCROLLER. The page geometry moved into `.workspace-page`
   when the scrollbar was put back on the window edge, and these did not come
   with it - so below 1024px the gutters were applied TWICE, once on the
   scroller and once on the page inside it.

   WHAT IT COST, MEASURED at a 900px viewport: the workspace body was 756px
   where it had been 804. FORTY-EIGHT PIXELS, which is one whole
   `--page-gutter` pair - and that was enough to drop the Service Requests
   toolbar from one row to two at the exact width the owner named it for, to
   collapse the stacked summary panel's field list to one column, and to turn
   the tablet navigation assertion. Five cases across three spec files.

   THE EIGHTEEN NEW CASES COULD NOT SEE IT. scrollgeometry.spec.mjs measures
   1024, 1280, 1400, 1920 and 2560; at exactly 1024 this query does not match,
   so the whole doubled-gutter band sat one pixel below the narrowest width
   anything new was looking at. The full suite found it. */
@media (max-width: 1023px) {
  .workspace-page {
    padding: var(--space-6) var(--space-5);
  }

  .panel {
    padding: var(--space-5);
  }
}

@media (max-width: 639px) {
  .workspace-page {
    padding: var(--space-5) var(--space-4);
  }

  /* The header stacks rather than squeezing the title: 4.2 permits a
     responsive layout to "rearrange presentation but preserve hierarchy and
     grouping", and the title stays first. */
  .workspace-header {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace-actions {
    justify-content: flex-start;
  }

  .panel {
    padding: var(--space-4);
    /* Edge-to-edge on a phone: a 4px gutter outside a 12px pad is wasted
       width, and 9.3 asks that mobile content become a usable structure
       rather than a compressed desktop. */
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
  }
}

/* ---------------------------------------------------------------------------
   SIGN IN - the one screen outside the shell.
   ------------------------------------------------------------------------ */
.signin {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--space-6);
  background: var(--surface-chrome);
}

.signin-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-primary);
  padding: var(--space-7);
}

.signin-mark {
  padding-bottom: var(--space-5);
}

/* THE APPROVED LOCKUP, not a typeset approximation of it. Green on the light
   card, khaki on the dark one - the token decides, because which lockup
   belongs on which surface is exactly the kind of thing that drifts when
   every stylesheet decides for itself. */
.signin-wordmark {
  display: block;
  width: var(--wordmark-width-large);
  height: var(--wordmark-height-large);
  margin: 0 auto;
  background-image: var(--wordmark-on-surface);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.signin-lede {
  color: var(--ink-muted);
  font-size: var(--type-label-size);
  padding-bottom: var(--space-6);
}

.signin-card .field + .field {
  margin-top: var(--space-5);
}

.signin-card .action-bar {
  padding-top: var(--space-6);
}

/* THE SIGN-IN SCREEN IS A SCREEN. Its controls were browser defaults - about
   22px tall against a required 44px - because the markup predates the shared
   components and the transitional sheet that used to style it is now scoped
   to the views it belongs to. Seen in a browser, 15 October 2026. The fix is
   the components themselves, not a second set of rules: the markup now
   carries .field, .btn and .feedback, so nothing below decides a value. */
.signin-card .password-field {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
}

.signin-card .password-field input {
  flex: 1 1 auto;
  min-width: 0;
}

.signin-card .feedback {
  margin-top: var(--space-5);
}
