/* Border-box everywhere. Without this, <button> (border-box by UA default) and
   <a> (content-box) compute `width: 100%` differently — a padded link ends up
   wider than the identical button, which pushed the caret on the non-expanding
   sidebar rows out of alignment with the rest. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* KEYWORD SIZES BECOME INTERPOLABLE (2026-09-16, added alongside the "always animate a
   size change" rule — docs/foundations.md, "Motion").
   WHAT IT DOES: lets a transition run between a length and an intrinsic KEYWORD, so
   `height: 0 -> auto` on a disclosure, or `width: 0 -> fit-content`, animates instead of
   jumping. That is the case it covers, and the whole of it.
   WHAT IT DOES NOT DO, stated because it is the obvious thing to assume: it does NOT make
   a CONTENT-DRIVEN resize animate. A multi-select restating a chosen value goes from
   `auto` to `auto` — the computed value never changes, only the used one, so there is no
   transition to run no matter what is declared. That case is a JS tween, and the system
   has one helper for it: watchSizeChanges() in js/elements.js. See the Motion section for
   which of the two any given size change is.
   IT ANIMATES NOTHING ON ITS OWN — it only changes what a declared transition CAN do, so
   an element with no size transition is unaffected, which is why it is safe at the root.
   Where it is unsupported those keyword transitions are instant again; nothing breaks. */
:root {
  interpolate-size: allow-keywords;
}

/* The browser's own [hidden] rule is display:none at the weakest specificity, so
   any class setting display (flex, grid) silently defeats it. Restore it. */
[hidden] {
  display: none !important;
}

/* Buttons
   No modifier = secondary, the default. Modifiers: --primary, --text,
   --destructive. --compact drops height to 28px. --pending disables the
   button. Icon placement is controlled by markup order (icon before text =
   left, icon after text = external-link only), not by a class. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  height: var(--control-height);
  padding: 0 var(--space-12);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-outline);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font: var(--weight-medium) var(--text-body-md) var(--font-sans);
  white-space: nowrap;
  box-shadow: var(--elevation);
  cursor: pointer;
  outline: none;
  /* A .btn is sometimes an <a> (the dashboard promo's "Start selling", any
     button-shaped link), and the UA stylesheet underlines those. No button
     is underlined at rest — .btn--text adds an underline on :hover, which
     only reads as a state change if there is none to begin with. */
  text-decoration: none;
  /* Same three properties every state below touches — background for hover,
     box-shadow + transform for the press.
     --btn-primary-glow is the fourth, and it is listed HERE rather than on
     .btn--primary so the four stay one declaration: restating the list in the
     modifier is how a transition drifts out of step with its base. It is inert
     on every other variant (nothing else declares the property), and it is a
     custom property in the list because a gradient cannot be interpolated —
     only the registered <percentage> driving it can. See @property below. */
  transition: background-color 0.12s ease, box-shadow 0.12s ease, transform 0.06s ease,
    --btn-primary-glow 0.12s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 2px;
}

/* Hover: the same tint used for every other hoverable row (a menu item, a
   clickable table row) — a button's secondary/outline state IS that surface,
   so it takes the same feedback. Press: the button sinks by 1px and drops its
   elevation, reading as pressed flush against the surface rather than still
   floating above it — instant on release since the shadow's return isn't worth
   animating separately from the position snapping back. */
.btn:hover:not(:disabled):not(.btn--pending) {
  background: var(--color-chip);
}

.btn:active:not(:disabled):not(.btn--pending) {
  transform: translateY(1px);
  box-shadow: none;
}

/* THE FILL IS TWO LAYERS, THE SAME WAY THE SIDEBAR'S IS. A translucent wash of
   the LIGHTER blue sits over the flat accent at the top of the button, falling off
   into it — so a primary button is lit from above like the rail's top section is
   (2026-09-10, request: "add a bit of a gradient to the primary buttons, matching
   the side bar style, a bit of a lighter blue, that becomes stronger on hover".
   FLAGGED AS A TRIAL by the same request — "might revert it after testing". Every
   part of it is additive: delete the @property block, this comment, the two
   --btn-primary-* lines and the background-image in both rules, and put the
   `background:` shorthands back, and the button is byte-for-byte what it was.
   NO NEW TOKEN. The lighter blue is --color-accent-secondary, which already exists
   and is already the accent pair's brighter half — not the rail's
   --color-sidebar-glow, which Light and Dark both set to `transparent` to no-op the
   rail's gradient and which would therefore have taken the button's with it.
   WHAT THIS COSTS IN DARK, stated because it is a real difference from the rail:
   Dark's accent pair is inverted (a light fill under dark ink), and there
   accent-secondary is a shade DARKER than accent-primary, so the wash is ~3 points
   of luminance and effectively invisible. That is the same no-op the rail gets from
   a transparent glow, arrived at without a [data-theme] .element rule — which
   CLAUDE.md calls a smell — and without a token only this button would use. If Dark
   should have a visible lift, that is a token decision (an accent glow name), not a
   theme override here.
   THE STRENGTHS ARE THE SECOND PASS (2026-09-10: "the changes you made to primary
   button, they are too subtle, make it a bit stronger"). 22/38 became 34/50 — the
   PEAK only; the shape below is untouched, so this is one variable and not a
   redesign. Worth knowing that the first pass was deliberately quiet ("a bit of a
   lighter blue") and this is the correction to it, so the useful record is the
   bracket: 22 at rest was too subtle to read, 34 is where it sits.
   WHAT WAS NOT USED TO GET THERE, since the peak is now close to its ceiling: the
   other two levers are holding the light longer (the mid stop, currently half the
   peak at 55%) and deepening the BOTTOM of the button, which would widen the range
   without touching the top at all. The second is tempting and was rejected —
   --color-hover-shade is the only "move within this colour" token and it is `white`
   under Dark, so a shade at the bottom would lighten the bottom there and stand the
   gradient on its head. A genuinely darker bottom in every theme needs a token that
   does not exist yet, which is a system decision.
   CONTRAST HOLDS AT BOTH STRENGTHS, and this is what caps the peak. White ink is
   7.21:1 on the flat accent; the wash lightens the top, which is the direction that
   costs contrast, so the peak is what has to be measured. At rest 34% is 5.35:1 and
   on hover 50% over the darkened base is 4.98:1 — both clear of AA's 4.5 for 14px
   medium, but the hover figure is now the tight one. ~60% on hover is 4.53:1 and is
   effectively the wall; do not raise the peak again without re-measuring, and do not
   assume the rest value has the same headroom the hover value does.
   THREE STOPS, NOT TWO, for the reason .sidebar's note gives at length: a linear
   ramp across the whole height reads as a band with an edge, so the tail is broken
   by a midpoint carrying half the peak. On a 36px control the falloff is the whole
   button rather than a 150px band, so the mid stop is a fraction of the height
   (55%) instead of a px distance. */
@property --btn-primary-glow {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

.btn--primary {
  --btn-primary-glow: 34%;
  /* One definition, two consumers (this rule and :hover below). Written as a
     local rather than repeated because .btn:hover's `background` shorthand
     resets background-image for the primary too, so the hover rule has to
     restate the image — and two copies of these stops would drift. */
  --btn-primary-fill-image: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--color-accent-secondary) var(--btn-primary-glow), transparent) 0,
    color-mix(in srgb, var(--color-accent-secondary) calc(var(--btn-primary-glow) / 2), transparent)
      55%,
    transparent 100%
  );
  /* Longhands, not `background`: the shorthand would reset the image every time
     the colour was touched, which is exactly what the hover rule below had to
     work around. */
  background-color: var(--color-accent-primary);
  background-image: var(--btn-primary-fill-image);
  color: var(--color-on-accent);
  /* NO BORDER AT ALL (2026-09-10, requests: "is the button using a border? if yes,
     remove it", then "on hover a weird border appears, just remove borders for
     primary buttons, colour is enough"). .btn gives every button `1px solid` and
     this modifier used to repaint it --color-accent-primary — a FLAT ring around a
     fill that is no longer flat, so the lit top edge carried a 1px darker line and
     the gradient read as though it started a pixel in.
     `border: 0`, AND THE FIRST ATTEMPT AT `border-color: transparent` IS WHY. Making
     the colour transparent keeps the 1px box, which keeps the primary's outer metrics
     identical to every other .btn — the reason .btn--text does it that way. But a
     background IMAGE's positioning area is the padding box by default, so that 1px
     ring gets painted by the image REPEATING, which lays the gradient's dark bottom
     colour along the top edge: the border, visually, was still there.
     `background-origin: border-box` fixed that at rest and then failed on hover, for
     a reason worth knowing: .btn:hover sets `background`, the SHORTHAND, which resets
     background-origin to padding-box — so the ring came back the moment the cursor
     arrived, which is exactly the "weird border on hover" that was reported. The
     hover rule could restate the origin, but then two rules have to keep a
     non-obvious property in sync forever.
     Removing the border outright deletes the whole class of bug: no border area, no
     ring to paint, nothing for a shorthand to reset. What it costs is 2px of width
     against a secondary carrying the same label — invisible in practice, and cheaper
     than the alternative, which would be a 13px padding to buy it back, a value the
     spacing scale does not have.
     THE SHADOW IS UNCHANGED AND IS THE SHARED --elevation, in case it ever looks
     otherwise (it was reported as looking different on 2026-09-10). Measured at 6x,
     the pixels below a primary and below a secondary are identical, row for row. What
     differs is the boundary above them: a secondary's 1px 15%-black border frames its
     edge, so the shadow reads as a line continuing a line, while on a borderless
     saturated fill the same shadow reads as a soft smudge. That is a perception of
     the border, not of the elevation, and it is the border that was asked to go. */
  border: 0;
}

/* Darken rather than the shared --color-chip tint: a filled button's own
   colour IS its surface, so hover has to move within that colour, not overlay
   an unrelated tint on top of it.
   --color-hover-shade, not the literal `black` it was until 2026-09-02: "move
   within that colour" is direction-neutral, but `black` is not, and under the
   Dark theme a filled button that dims on hover reads as disabling rather than
   responding. The token is `black` at :root, so Classic and Light are unchanged
   to the pixel, and `white` under Dark. See tokens.css. */
/* THE DARKEN STAYS AND THE GLOW STRENGTHENS — the two are not fighting, they are
   the same statement from both ends: the top gets lighter, the bottom gets deeper,
   so hover reads as the gradient turning up rather than as the button changing
   colour. Dropping the darken was the alternative and it leaves the bottom two
   thirds of the button with no hover at all.
   THE DARKEN IS 20%, NOT THE SHARED 10% (2026-09-10: "make the hover effect much
   more visible, is hard to distinguish active from hover now"). The peak could not
   supply that difference — at 34% at rest there are only a few points of AA
   headroom left above it (see .btn--primary), so pushing the top alone buys a
   change too small to see. The BOTTOM has the opposite problem and all the room:
   darkening raises the label's contrast rather than spending it, so the deeper end
   is where a filled button's hover can afford to be loud. 50% -> 57% at the top and
   10% -> 20% at the bottom together move both ends of the gradient, and the button
   now reads as a deeper object with a brighter top rather than as the same object
   slightly warmed.
   A DIVERGENCE FROM .btn--destructive, WHICH KEEPS 10%, and it is deliberate rather
   than an oversight to reconcile: the destructive button's rest state is a flat
   fill, where a 10% shade is a clear change across the whole surface. The primary's
   rest state is no longer flat, so its hover has to be legible against a fill that
   is already shaded top to bottom — a gradient's state change is read at its ends,
   and 10% does not move them far enough. If the gradient is ever reverted, this
   goes back to 10% with it. docs/elements.md records the pair.
   MEASURED: the hover top is 4.87:1 against white and the hover bottom 9.52:1
   (rest: 5.35 and 7.21). The top is the one to watch — it is ~4 points of glow off
   the AA floor for 14px medium. */
.btn--primary:hover:not(:disabled):not(.btn--pending) {
  --btn-primary-glow: 57%;
  background-color: color-mix(in srgb, var(--color-accent-primary) 80%, var(--color-hover-shade));
  background-image: var(--btn-primary-fill-image);
}

/* PRESSED PUTS THE LIGHT OUT. The shared .btn:active sinks the button 1px and drops
   its elevation, which is a clear press on an outlined button but almost nothing on
   a filled one — and once hover carries a brighter top, "pressed" needed to be
   distinguishable from "hovered" and not just from "at rest" (2026-09-10, same
   request). Taking the glow to zero while the hover darken stays gives the press
   its own reading: the deepest state, and the only flat one. It also matches the
   physical story the sink and the dropped shadow already tell — a surface pressed
   flush against the page is not a surface catching light.
   AFTER THE HOVER RULE, NECESSARILY: a pressed button is also a hovered one, the
   two selectors tie on specificity, and the later declaration is what wins.
   No background-color here, so the hover darken carries through — the press is one
   property, and the state it modifies is hover, not rest. */
.btn--primary:active:not(:disabled):not(.btn--pending) {
  --btn-primary-glow: 0%;
}

.btn--text {
  background: transparent;
  border-color: transparent;
  color: var(--color-accent-primary);
  box-shadow: none;
}

.btn--text:hover {
  text-decoration: underline;
}

/* No tint (transparent has nothing to darken) and no press-shadow to remove
   (there wasn't one) — only the position shift still applies. */
.btn--text:hover:not(:disabled):not(.btn--pending) {
  background: transparent;
}

.btn--destructive {
  background: var(--color-error);
  color: var(--color-on-accent);
  border-color: var(--color-error);
}

.btn--destructive:hover:not(:disabled):not(.btn--pending) {
  /* --color-hover-shade for the same reason as .btn--primary above. */
  background: color-mix(in srgb, var(--color-error) 90%, var(--color-hover-shade));
}

/* A destructive action that must not compete with the page's primary — same red,
   no fill. The two modifiers compose; nothing new is needed. */
.btn--text.btn--destructive {
  background: transparent;
  border-color: transparent;
  color: var(--color-error);
  box-shadow: none;
}

.btn--text.btn--destructive:hover:not(:disabled):not(.btn--pending) {
  background: transparent;
}

.btn--compact {
  height: var(--control-height-compact);
}

.btn:disabled,
.btn--pending {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}

.btn svg {
  width: var(--icon-size);
  height: var(--icon-size);
  stroke-width: var(--icon-stroke);
  flex-shrink: 0;
}

/* Optical alignment: an icon glyph carries its own internal whitespace, so the
   usual 12px reads wider on the icon's side than the same 12px does against
   text. Tightening just that edge to 8px balances the two — the label side (or
   both sides, for a label-only button) keeps 12px. Excludes .btn--icon, which
   sets its own (equal, zero) padding for a perfect square.
   :last-child NOW MEANS A TRAILING ICON, WHICH IS WHAT IT ALWAYS MEANT TO (fixed
   2026-09-16, on request: "add 12px padding to the right side of buttons with icons
   on the left side, like add channel in the home screen").
   A LEADING-ICON BUTTON MATCHED BOTH RULES. Its label is a TEXT NODE, not an element,
   so the icon is the only element child and is therefore :first-child AND :last-child
   at once — "Add channel" was getting 8px on the left for its icon and 8px on the
   right for an icon that is not there, at 8/8 instead of 8/12. Every leading-icon
   button in the system was tight on the label side, which is the edge the optical
   correction is explicitly not supposed to touch.
   :not(:first-child) IS THE WHOLE FIX: an icon that trails a label has the label's
   text node before it but no element, so it is :last-child and NOT :first-child; an
   icon that leads is both and no longer matches here. A button with an icon at each
   end matches both rules and gets 8/8, correctly — there is a glyph on either side.
   The two-icon case (leading icon plus a trailing .menu-chevron) is unaffected either
   way: a .menu-chevron is a <span>, not an svg.icon, so it never matched this. */
.btn:not(.btn--icon):has(> svg.icon:first-child) {
  padding-left: var(--space-8);
}

.btn:not(.btn--icon):has(> svg.icon:last-child:not(:first-child)) {
  padding-right: var(--space-8);
}

/* .btn--icon — square, no min-width, tooltip always present (use title + aria-label
   until a real tooltip component exists). */
.btn--icon {
  padding: 0;
  width: var(--control-height);
}

.btn--icon.btn--compact {
  width: var(--control-height-compact);
}

/* Button group — actions the user chooses between, presented as one unit.
   Two rules, both load-bearing:
   Primary rightmost. The eye leaves a row at its right edge, so the action the
   user most likely wants is the last thing read. This holds in every layout, not
   only in a group — a page header, a sticky footer, a dialog.
   Equal widths. Inside a group the buttons are alternatives of equal standing, so
   none of them may look more likely than another by shape alone. A wide button
   next to a narrow one weights the choice before the labels are read.
   inline-grid rather than flex: 1fr columns all take the width of the widest
   label, where flex-basis 0 would divide the row and clip long labels instead. */
.btn-group {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  gap: var(--space-8);
}

/* Icon button group — two (occasionally more) icon buttons that act on the same
   row or target (edit + delete, a table row's actions) merge into one bordered
   container instead of each carrying its own border, shadow and gap. One shared
   border + radius on the group; overflow: hidden clips the end buttons to it, the
   same corner-clipping technique .product-card uses for its thumbnail. Each item
   drops its own border/radius/shadow and shares a divider with its next sibling
   instead — not a .btn-group, which keeps every button separate and equal-width;
   this is for actions that read as one control, not alternatives to choose between. */
.icon-btn-group {
  display: inline-flex;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-sm);
  box-shadow: var(--elevation);
  overflow: hidden;
}

.icon-btn-group .btn--icon {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.icon-btn-group .btn--icon:not(:last-child) {
  border-right: 1px solid var(--color-outline);
}

/* Icon
   Lucide only, inlined via js/icons.js. Stroke width is a class, not an inline
   attribute — stroke-emphasis (2) is for icons next to medium-weight text, default (1)
   otherwise. */

.icon {
  width: var(--icon-size);
  height: var(--icon-size);
  stroke-width: var(--icon-stroke);
  flex-shrink: 0;
}

.icon--emphasis {
  stroke-width: var(--icon-stroke-emphasis);
}

/* A button's icon reads as secondary by default — quieter than the label
   next to it, the same way a supporting glyph is never the loudest thing in
   a row. Modifiers that already set their own foreground colour (primary,
   destructive, text, ai) keep the icon matching that colour instead —
   secondary grey would either lose contrast (on-accent fills) or read as
   disabled next to an accent-coloured label. */
.btn .icon {
  color: var(--color-text-secondary);
}

.btn--primary .icon,
.btn--destructive .icon,
.btn--text .icon,
.btn--ai .icon {
  color: inherit;
}

/* A WHITE GLYPH ON A COLOURED FILL TAKES THE EMPHASIS STROKE (2026-09-10, request:
   "make the icons in button icons be fully white, not at an opacity").
   THE COLOUR WAS ALREADY PURE WHITE and nothing here changes it: the rule above
   inherits --color-on-accent (#ffffff), there is no alpha on it, and js/icons.js
   sets no opacity attribute. What reads as a faded icon is STROKE WEIGHT. A lucide
   glyph is 2 units of stroke in a 24-unit box, so at 16px it is a ~1.3px line, while
   the label beside it is medium-weight type whose stems are heavier — and white on a
   saturated fill loses more to that difference than dark-on-light does, because the
   fill closes in on a thin light line from both sides.
   --icon-stroke-emphasis IS THE EXISTING ANSWER, not a new value: the token exists
   for "icons next to medium-weight text" (see the note above this block), and a .btn
   label is exactly that — every button in the app is --weight-medium. The default
   arguably should have been emphasis inside a button all along; it is scoped to the
   filled variants here because those are the ones that were reported and the ones
   where the fill does the closing in. A secondary button's grey-on-white icon is a
   separate judgement and was left alone.
   .btn--text IS EXCLUDED, deliberately: its "fill" is the page, so nothing closes in
   on the glyph, and a heavier stroke next to accent-coloured text reads as a bolder
   icon rather than an equal one.
   (0,2,0) beats `.btn svg`'s (0,1,1), so this needs no extra weight to land. */
.btn--primary .icon,
.btn--destructive .icon,
.btn--ai .icon {
  stroke-width: var(--icon-stroke-emphasis);
}

/* Hover reads a step stronger than the quiet secondary default — the same
   direction .btn's own hover background moves in, signalling "about to act".
   Primary/destructive/text/ai icons already inherit their button's own
   colour and none of those buttons change their own text colour on hover
   either, so there's nothing to move for them here.

   The four :not()s are what actually enforce that last sentence, and they were
   missing until 2026-08-20. Without them this selector — (0,4,0) — outranks
   `.btn--primary .icon { color: inherit }` at (0,2,0), so hovering a filled
   button turned its white icon near-black while the label beside it stayed
   white. Reported on Products' "Add products". Excluding the variants is the fix
   rather than raising the inherit rule's specificity: the intent is "only the
   secondary button moves on hover", and there is no .btn--secondary class to
   say that positively, since no modifier IS secondary. */
.btn:hover:not(:disabled):not(.btn--pending):not(.btn--primary):not(.btn--destructive):not(.btn--text):not(.btn--ai) .icon {
  color: var(--color-text-primary);
}

/* A destructive icon-only action (e.g. a row's delete button in an
   .icon-btn-group) — neutral at rest like any other icon button, reading as
   destructive only on hover: icon turns error red, background picks up the
   matching error tint instead of the shared .btn hover's neutral chip tint.
   Distinct from .btn--destructive above, which is always filled red — right
   for a labelled action whose destructive intent should be visible
   immediately, wrong for an icon-only button sitting next to other neutral
   icon actions (it would read as permanently alarming). The .btn qualifier
   matches elements.css's own .btn:hover:not(:disabled):not(.btn--pending)
   specificity (0-4-0) — without it this loses on specificity regardless of
   source order. */
.btn.btn--icon-destructive:hover:not(:disabled):not(.btn--pending) {
  background: var(--color-error-tint);
}

.btn.btn--icon-destructive:hover:not(:disabled):not(.btn--pending) .icon {
  color: var(--color-error);
}

/* Badge — status, never a count or a label. Fully rounded per the foundations.
   No stroke: the fill carries the status on its own, and an outline on something
   this small closes the shape up.
   Fills are the status tints, never the full colours: the full set has no single
   label colour that works across it (dark fails on --error, white fails on the other
   three). Neutral has no status colour, so it keeps --color-background.
   The label stays --color-text-primary on every tone. On the tints that measures
   12.5:1 to 16.3:1 — the tint + dark label pairing is the one that passes
   everywhere. Re-measure if the tint values change. */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  height: 20px;   /* a height, not spacing — heights are not tokenised yet */
  padding: 0 var(--space-8);
  border-radius: var(--radius-full);
  background: var(--color-background);
  color: var(--color-text-primary);
  font: var(--weight-medium) var(--text-body-sm) var(--font-sans);
  white-space: nowrap;
  /* A grid item blockifies inline-flex to flex and stretches it by default
     (justify-self: stretch) — exactly what happens when a badge sits directly
     in a .table__row cell with no wrapping element. Pinning justify-self here
     means the badge never stretches to fill its column, wrapped or not. */
  justify-self: start;
  /* The same rule for the FLEX case, found 2026-08-27: a badge inside a
     `.table__lines` stack (a status pill over a muted subline, in the
     Collections table's Sync column) is a flex item, not a grid item, so
     justify-self above does nothing and `align-items: stretch` pulled the pill
     to the full width of its column — 200px of tinted fill behind the word
     "Live". Both properties are needed because they cover different parents;
     neither is redundant. "Pills never stretch to fill a cell or container"
     (CLAUDE.md) is one rule, and it now holds in both layouts rather than only
     the one that happened to come up first.

     width: fit-content, NOT align-self: start (fixed 2026-08-31, reported on the
     order detail's products table: the Quantity pill sat at the TOP of a row that
     had grown tall, while Line total beside it stayed centred).
     align-self: start did stop the stretch, but it also decided the pill's
     alignment — and those are different things. In the column-flex parent this was
     written for, align-self acts on the horizontal axis, so `start` reads as "don't
     fill the width". In a grid row it acts on the VERTICAL axis, so the same
     declaration overrode the row's own `align-items: center` and pinned every badge
     to the top. One property, two axes, depending on a parent the badge cannot see.
     `width: fit-content` says only the thing that was meant. Stretching happens in
     flex and grid alike when the relevant size is `auto`; an explicit size opts out.
     So the pill still never fills its column, and alignment goes back to being the
     container's business — centred in the order-detail row, wherever the stack puts
     it in .table__lines.
     The vertical axis needs no equivalent: .badge already sets an explicit
     height: 20px above, which opts out of a vertical stretch for the same reason. */
  width: fit-content;
}

.badge--success {
  background: var(--color-success-tint);
}

.badge--info {
  background: var(--color-info-tint);
}

.badge--warning {
  background: var(--color-warning-tint);
}

.badge--error {
  background: var(--color-error-tint);
}

/* Big pill — 28px, body-md. Only ever beside a page title (an order's status,
   a channel mark next to "Order 1234") — never inside a table, a list or any
   other body content, which stay the default 20px. .page-header__row already
   centers its children, so title + big pill + logo pill land on one line,
   vertically centered, with no extra markup. */
.badge--lg {
  height: var(--control-height-compact);
  padding: 0 var(--space-12);
  gap: var(--space-8);
  font: var(--weight-medium) var(--text-body-md) var(--font-sans);
}

/* Logo variant — holds a channel/brand mark instead of a status colour, on a
   white fill with the system's one stroke colour (same as every other bordered
   surface — --color-outline). Works at either badge size — the default 20px
   or --lg (28px); --lg is not reserved for a page title here the way it is for
   a status pill, since a channel's identity mark can read just as well at full
   size in a table row (the Orders overview's Channel column uses --lg). This
   superseded the earlier .channel-pill proposal, unifying what used to be two
   similar channel-identity pills. */
.badge--logo {
  /* No fill (2026-08-27, on request). Was --color-surface, which read as a white
     card behind the artwork once the pages went to the blue --color-page-tint —
     the pill looked like a chip cut out of a different surface. The border below
     still draws the pill, so the mark keeps its shape and its shared column
     width; only the fill is gone. */
  background: transparent;
  border: 1px solid var(--color-outline);
  /* space-between rather than the base .badge's flex-start: with only a logo,
     it's a no-op (nothing to distribute). With a flag too, it pins the flag to
     the far right and the logo to the far left, so the flag sits exactly
     padding-right (below, always 8px) from the pill's edge whether the pill is
     sized to its own content or widened to match its neighbours (an Orders
     table column, where every pill shares one width — see orders.html). */
  justify-content: space-between;
  /* Always 8px, regardless of size — .badge--lg's own 12px is for the left
     inset around the logo, not the flag's distance from the right edge. */
  padding-right: var(--space-8);
  /* The minimum space between logo and flag (space-between above only adds
     more on top of this, for a widened pill) — always 4px, not .badge--lg's
     own 8px gap, which is sized for status-badge label text, not this pair. */
  gap: var(--space-4);
}

/* Sized for the default 20px badge (bigger than Figma node 1910:36384's own
   12px-tall mark — legible logo wordmarks read better a little larger than
   the reference) — .badge--lg.badge--logo below scales both up for the 28px
   pill. :not(.badge__flag) matters: without it, this (a class+type selector,
   higher specificity than .badge__flag's single class) would win over the
   flag's own size below regardless of source order, since the flag is also
   an <img> inside .badge--logo. */
.badge--logo img:not(.badge__flag) {
  height: 14px;
  width: auto;
  display: block;
  /* A PLATE UNDER THE ARTWORK, transparent everywhere but Dark (2026-09-02).
     A channel's mark is fixed brand artwork — bol's is a single #0100A4, Amazon's
     is near-black — and on a dark surface it disappears. Nothing here can re-tint
     it: a filter that lightened bol's blue would be printing somebody's logo in a
     colour they do not own, and the sidebar's own inversion (see the prototype's
     sidebar-brand-logo.css) is only defensible because that asset is a single flat
     navy standing in for a wordmark. So the mark keeps its colours and the ground
     under it changes instead, which is what a light plate on a dark UI is for.
     box-shadow rather than padding: the plate has to extend past the artwork's
     own edges to read as a plate, and padding would change the pill's metrics —
     the logo's 14px height is what .badge--logo's whole layout is measured from.
     A spread-only shadow paints outside the box and takes no space at all. */
  background: var(--color-logo-plate);
  box-shadow: 0 0 0 3px var(--color-logo-plate);
  border-radius: var(--radius-flag);
}

.badge--lg.badge--logo img:not(.badge__flag) {
  height: 18px;
}

/* An optional country flag after the logo, e.g. in the Orders table's Channel
   column or an order's page-title-adjacent channel mark — see docs/elements.md.
   Positioned by .badge--logo's own justify-content: space-between above, not a
   margin here — that's what keeps it pinned to the pill's right edge (always
   padding-right, 8px) instead of just trailing the logo by a fixed amount.
   Fixed at every badge size — unlike the logo mark, the flag doesn't scale up
   for --lg. Width follows the flag assets' own 5:4 ratio (ce-ui/assets/flags/,
   20x16 viewBox) rather than "auto", so a flag with a different intrinsic
   ratio doesn't silently resize the pill. */
.badge__flag {
  height: 12px;
  width: 15px;
  flex: none;
  display: block;
  border-radius: var(--radius-flag);
}

/* Identifier — GTIN, MPN, channel/merchant order no. Click anywhere to copy;
   `CEElements.mountIdentifiers()` wires the click.
   Dedicated size + letter-spacing (--text-identifier / --tracking-identifier,
   tokens.css) keep long digit strings scannable — the label stays on
   --text-body-sm with no tracking, since tracking is for scanning digits, not
   reading a word.
   min-width: 0, not a percentage max-width: a % max-width on an inline-flex
   element resolves against a shrunk basis when an ancestor is itself a flex row,
   so it silently truncated inside a .card row that had room to spare. Truncation
   inside a table cell still happens — that's the grid track's own minmax(0, …),
   not this element. */
.identifier {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-2) var(--space-4);
  margin: calc(var(--space-2) * -1) calc(var(--space-4) * -1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  /* Was hover/focus-only (see git history) — the pill's background is now on
     at rest too, ratified 2026-08-18 after trying it live across Orders,
     Order details, Products and the PDP. */
  background: var(--color-background);
  /* Snappy — a hover pill that fades in over 120ms reads as sluggish next to
     a control the user is about to click. 80ms is the fast end of the
     system's own transitions and keeps the whole hover→copy→revert cycle
     comfortably under 300ms end to end. */
  transition: background-color 80ms ease;
  /* Same reasoning as .badge: a grid item blockifies inline-flex to flex and
     stretches it by default, which would turn the hover pill into a wide bar
     the width of its column (e.g. inside .identifier-stack, below). Never let
     this chip stretch to fill a track it happens to sit in. */
  justify-self: start;
  /* The FLEX half of the same rule (2026-10-13, reported on the Enrichment Studio
     products table): under a product name in a .table__lines stack — a column
     flex, align-items: stretch — justify-self does nothing and the pill ran the
     full width of the Product column. width: fit-content opts out of the stretch
     without deciding alignment, exactly as .badge does. docs/elements.md,
     Identifier, "Never stretched to fill its cell". */
  width: fit-content;
}

.identifier:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 1px;
}

/* On a hovered table row the pill flips to white. Its resting --color-background
   is one step off the row's own white, which is exactly the contrast that
   disappears once the row fills with --color-chip on hover — the pill stopped
   reading as a pill at the moment the pointer was on it, which is the moment it
   most needs to. White inverts the relationship instead of trying to out-tint the
   row: the pill is now lighter than its surroundings rather than darker, so the
   chip shape survives the row hover at the same 80ms it already transitions at.
   The label half of an .identifier-stack is included so a stack pill flips as one
   rectangle — style only .identifier and a stack in a table row would go white on
   its value half and stay grey on its label half, split down the seam.

   :not(.menu *) — FLOATING LAYERS ARE NOT PART OF THE ROW (fixed 2026-08-31,
   reported on Orders: identifiers in the products preview card went white when the
   row behind it was hovered). A .menu is a child of the row in the DOM only because
   it is positioned off a trigger that lives in one; on screen it is a panel over the
   table, on its own --color-surface, and its pills are already white-on-white
   candidates that this rule was flipping for a hover state belonging to something
   else entirely. `.table__row:hover` also stays true the whole time the pointer is
   inside the open popover, so the pills sat wrong for as long as it was open.
   Excluded at .menu — the system's one floating-layer primitive, which
   .preview-popover and every dropdown are built on — rather than at
   .preview-popover, because this is a rule about what a row's hover may reach, not
   about one popover. Any future panel opened from a table row inherits the fix.
   Written as `:not(.menu *)` on the subject rather than `.table__row:hover >
   .table__cell ...`: the row's own identifiers sit at no fixed depth (they nest
   inside .table__lines, .identifier-stack and the like), so a child combinator would
   have to be wrong about one of them. This says the thing that is actually true —
   not inside a floating layer — and leaves depth alone. */
.table__body .table__row:hover :is(.identifier, .identifier-stack__row > .identifier__label):not(.menu *) {
  background: var(--color-surface);
}

/* Two identifiers sitting directly next to each other on one line (GTIN then
   MPN — order-detail item codes, the preview popover, the product peek and
   PDP header meta rows) rendered with NO visible gap at all, not the
   container's own 8px: .identifier's own -4px (--space-4) left/right margin
   (above, the "padding balloons the hover pill without growing the layout"
   trick) fires on BOTH identifiers in the pair, so their two -4px margins
   plus the 8px gap net to 8-4-4=0. A trailing non-identifier item (a Price/
   Stock stat, no such margin) isn't affected — that gap already nets to
   8-4+0=4px, which is what's wanted here too. Zeroing just the second
   identifier's margin-left cancels ONE of the two -4px contributions,
   landing the pair at the same 4px. Only fires when the PREVIOUS sibling is
   itself an .identifier, so it never touches .identifier-stack's vertical
   case — each row's .identifier there is nested in its own
   .identifier-stack__row, never a direct sibling of the next row's. */
.identifier + .identifier {
  margin-left: 0;
}

.identifier__label {
  color: var(--color-text-secondary);
  font: var(--weight-regular) var(--text-body-sm) var(--font-sans);
  white-space: nowrap;
}

.identifier__value {
  color: var(--color-text-primary);
  font: var(--weight-regular) var(--text-identifier) var(--font-sans);
  letter-spacing: var(--tracking-identifier);
  /* Tabular figures — the other half of the argument --tracking-identifier
     already makes: an identifier is a long digit string read down a column,
     and proportional figures make a column of GTINs ripple wherever a 1 or a
     7 lands. Degrades on its own: a face whose file carries no `tnum` (DM
     Sans, of the five in the picker) simply keeps its proportional figures. */
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A bare stroke icon, not a filled badge — `--color-text-primary` on hover,
   nothing behind it. `.identifier__copy` is a WRAPPER around a
   `<span data-icon="copy">`, never the data-icon element itself:
   mountIcons() replaces a data-icon element outright
   (`el.outerHTML = ...`), preserving its classes onto the resulting `<svg>` —
   sharing an element with `.icon` risks two rules fighting over the same
   box the moment either one sets its own size, which is exactly what
   happened when this used to be a filled circle. Two separate elements (as
   `.btn--icon` also does around its own data-icon span) avoids that
   regardless of what `.identifier__copy` ends up styling. */
/* Collapsed to zero width at rest (was: full width, opacity:0 — reserved
   space so hover never shifted the row). That reservation read as dead
   padding once the pill's background above went from hover-only to on at
   rest too: idle, the pill hugged label+value plus an invisible icon-sized
   gap, which the now-visible background exposed as a blank strip on the
   right. Collapsing it means the pill hugs label+value tightly at rest, at
   the cost of a small width animation when the icon reveals on hover —
   reasonable trade for a copy affordance, and it's what most identifier/code
   chips with a hover-reveal icon do anyway. */
.identifier__copy {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 0;
  margin-left: calc(var(--space-4) * -1);
  overflow: hidden;
  color: var(--color-text-primary);
  opacity: 0;
  transition: opacity 80ms ease, width 80ms ease, margin-left 80ms ease;
}

/* Smaller than the shared --icon-size default — a copy affordance sits
   beside body-sm identifier text, not beside a button label, so it uses its
   own scoped size token rather than the general icon scale. Every
   .identifier's copy icon everywhere (Orders, Order details, Products) gets
   this from the one shared rule. */
.identifier__copy .icon {
  width: var(--icon-size-identifier);
  height: var(--icon-size-identifier);
}

.identifier:hover .identifier__copy,
.identifier:focus-visible .identifier__copy,
.identifier-stack__row:hover .identifier__copy,
.identifier-stack__row:focus-within .identifier__copy {
  opacity: 1;
  width: var(--icon-size-identifier);
  margin-left: 0;
}

/* Copied: the icon itself is swapped for a circled checkmark (js/elements.js
   copyIdentifier()), held for a beat, then faded out — `forwards` so it
   stays at opacity:0 (rather than snapping back to 1) until the JS timeout
   removes this class and swaps the glyph back to "copy". 500ms total is
   deliberately more relaxed than the 80ms hover transitions above: this is a
   confirmation the user is meant to actually see, not a hover affordance
   that has to feel instant. --color-text-primary, not --color-success — the
   green read as low-contrast against the surface here. */
@keyframes identifier-copied-fade {
  0%,
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.identifier--copied .identifier__copy {
  color: var(--color-text-primary);
  animation: identifier-copied-fade 500ms ease forwards;
}

/* Stacks multiple identifiers with DIFFERENT labels (e.g. "Channel" above
   "Merchant") so every value still starts at one shared left edge. Both
   columns are max-content, not `.card__rows`' max-content/1fr — a card row's
   value is free text that should use the width it's given (an address can
   wrap), but an identifier's value is a short, fixed-shape code, and
   .identifier-stack__row's own pill (below) is exactly as wide as its
   grid row — a 1fr second column would stretch that pill the full width of
   whatever container the stack sits in, empty space and all, instead of
   hugging the label+value+icon it actually contains. */
.identifier-stack {
  display: grid;
  grid-template-columns: max-content max-content;
  /* Each .identifier-stack__row carries a -2px (--space-2) top/bottom margin
     (below) so the pill halves' own padding doesn't grow the row's layout
     footprint — that pulls 2px off each side of this gap, so an 8px
     (--space-8) row-gap is what actually renders as 4px of visible space
     between rows, not 8px. Verified via getBoundingClientRect(). */
  row-gap: var(--space-8);
  /* No column-gap. The two halves of the pill (label cell, value cell) have to
     meet edge to edge for the fill to read as one rectangle — see
     .identifier-stack__row below for why the fill can't live on the row. The
     label→value breathing room is the label cell's own padding-right instead,
     which is inside the paint rather than a hole in it. */
  column-gap: 0;
}

/* The row spans both columns as a subgrid so its two children stay in the
   stack's shared tracks — that's what keeps every value on one left edge no
   matter how long each label is.
   It does NOT carry the fill, though it did briefly (2026-08-21). A subgrid
   item is sized by the tracks it spans, so its box is always as wide as the
   WIDEST row in the stack: painting it gave a short value ("Merchant 12100")
   the same pill width as a long one, with the difference showing as blank
   fill. justify-self: start and width: max-content don't help — both were
   measured and the row still came out at the full track span. So the fill
   goes on the two children, which are free to hug their own content, with
   the stack's column-gap at 0 so the halves meet as one unbroken rectangle.
   The row stays the hover and click target: a hit area slightly wider than
   the paint is forgiving, not misleading. */
.identifier-stack__row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  margin: calc(var(--space-2) * -1) calc(var(--space-4) * -1);
  cursor: pointer;
}

/* Left half of the pill. Scoped to the stack — a plain .identifier's label is
   inside the chip already and needs none of this. padding-right is --space-8,
   matching the label→value distance the old column-gap gave; padding-left is
   --space-4, cancelling the row's own -4px bleed so the text lands where it
   would with no pill at all. Radius on the left corners only: the right edge
   is a seam, not an edge. */
.identifier-stack__row > .identifier__label {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-8) var(--space-2) var(--space-4);
  background: var(--color-background);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  /* Matches .identifier's own 80ms, so the two halves of the pill change
     colour together on a table row hover rather than a frame apart. */
  transition: background-color 80ms ease;
}

/* Right half of the pill: value + copy icon, hugging its own content. Keeps
   .identifier's own fill and vertical padding so the two halves are the same
   height and colour; loses the left radius and all horizontal margin, since
   the label cell owns the left edge and the row owns the bleed. */
.identifier-stack__row > .identifier {
  /* stretch, so the two halves are the same height whichever one's line box
     is taller — a 1px step in the middle of the seam is the one flaw that
     would give away that this is two boxes and not one. */
  align-self: stretch;
  padding: var(--space-2) var(--space-4) var(--space-2) 0;
  margin: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Search — placeholder must name what's searchable, never just "Search".
   Never full viewport width. The scope button is optional: a search with
   nothing to scope omits it rather than forcing a choice. */
.search {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  height: var(--control-height);
  /* Two floors, and the bar takes whichever is larger (2026-08-28).
     1. It is never narrower than its own placeholder — fit-content adds up the
        icon, the gap, the input's own content width (see .search__input) and this
        padding. A toolbar that cannot spare that much is a toolbar with too much
        in it, or a placeholder with too many words in it; both are fixed at the
        page, not by letting the bar shrink until the sentence naming what is
        searchable is unreadable.
     2. It is never narrower than 200px, on request — a bar with a short
        placeholder ("Search fields") would otherwise shrink to the width of two
        words and stop reading as the page's search. That floor is set on the
        input rather than here, so it composes with the first instead of
        overriding it: a min-width in px on this element would let a long
        placeholder be cut at exactly 200px, which is the bug the first floor
        exists to prevent. */
  min-width: fit-content;
  padding: 0 var(--space-12);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  /* EXPLORATION (2026-08-28, on request — may be reverted): recessed, not raised.
     A drop shadow lifts a control off the page, which is how a button asks to be
     pressed; this is a field you type into, so it reads as a well instead.
     Revert = `box-shadow: var(--elevation)` and drop the two state rules below.
     The value is a LITERAL, not --elevation-inset. That token is 0.13 black at
     4px blur, tuned for the channel nav's 40px track, and at 32px on a field it
     read heavy (dialled down on request, same day it went in). Written here
     rather than added to tokens.css because CLAUDE.md is explicit that a missing
     token stops and asks — if the field recess survives its exploration, that is
     the moment to ask for a field-weight token, and this line is what it would
     carry. */
  box-shadow: inset 0 1px 3px 0 rgb(0 0 0 / 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* ------------------------------------------------------------------
   Search states. Modelled on shadcn/ui's Input (researched 2026-08-28, on
   request — its `new-york-v4` registry source), which is the closest thing to a
   settled convention for a text field's states, so this is not a fresh
   invention. What it has: DEFAULT (border + a small shadow), FOCUS
   (`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`
   — the border goes accent and a 3px translucent ring appears outside it),
   INVALID (`aria-invalid:border-destructive` + a ring at 20%), DISABLED
   (`disabled:opacity-50 disabled:cursor-not-allowed`), plus a muted placeholder
   and a themed selection colour. What it does NOT have: a hover state (a field
   is not a button and does not preview an action), and a FILLED state.
   Where this follows it: focus is border + a 3px ring at 30%, invalid is the
   error colour with a 20% ring, the ring percentages are shadcn's, and only
   colour and box-shadow transition.
   Where it deviates, and why:
   - The recess (inset shadow) is CE's own, from the round before this one — the
     bar reads as a field to fill rather than a button to press. shadcn keeps a
     small OUTER shadow instead. Both are kept: the recess is the resting look,
     the ring is the focus mark.
   - FILLED is a CE state, on the user's instruction. It takes the accent stroke
     and the tinted recess but no ring — a ring means "your cursor is here", and
     a filled field you have left still reads as carrying a value.
   - Disabled is opacity 0.6, not shadcn's 0.5, matching .btn:disabled above. The
     system's own disabled weight beats an imported one.
   ------------------------------------------------------------------ */

/* ACTIVE ONLY. The accent stroke, the tinted recess and the ring all belong to
   focus and leave with it — clicking away returns the bar to its resting look
   (2026-08-28, on the user's report that a bar stayed blue after they clicked
   outside). A field still wearing the focus colour with the caret somewhere else
   is claiming an attention the page has moved on from, and with several search
   bars on screen it stops saying which one is live.
   That retires the separate FILLED treatment this rule carried for one round.
   Filled is still marked, just not with the focus colour: the value is medium
   weight where the placeholder is regular, and the clear × below only appears
   when there is something to clear. Both are visible without focus, which is the
   point of them.
   The recess colour is a MIX, not --color-chip taken literally as asked: at the
   #f5fafe that token then held, against the field's own #ffffff, there was nothing
   to see, so "the lightest blue" was read as the direction (blue, not grey) rather
   than the exact token. --color-accent-secondary at 30% is the lightest blue that
   still registers as a recess.
   THE PREMISE CHANGED ON 2026-09-16: --color-chip is #ecf5fe now (1.10:1 on white,
   not 1.03:1), so the literal token WOULD register today. Left as the mix rather
   than quietly restyled — this is a focus treatment, not a chip, and the two moving
   together was never the request. It is one value if the literal is wanted.
   The ring is shadcn's own 3px at 30%, drawn as a second box-shadow layer rather
   than an outline so it follows the border radius. */
.search:focus-within {
  border-color: var(--color-accent-primary);
  box-shadow:
    inset 0 1px 4px 0 color-mix(in srgb, var(--color-accent-secondary) 30%, transparent),
    0 0 0 3px color-mix(in srgb, var(--color-accent-secondary) 30%, transparent);
}

/* The icon goes accent with the stroke while the field is active (2026-08-28, on
   request) — it is the field's own mark, so it belongs to the focused state the
   same way the border does. Only on focus, not on filled: the icon is a label
   for the field, and colouring it permanently would make every used search bar
   shout. */
.search:focus-within .search__icon {
  color: var(--color-accent-primary);
}

/* The clear ×. Present in the markup of every search bar (mountSearch() puts it
   there, js/elements.js) and shown only when the field has something in it —
   `:placeholder-shown` is the empty test, which is a third thing riding on the
   placeholder every search bar already has to carry.
   A bare button, not a .btn--icon: it sits INSIDE the field, where a bordered
   32px control would read as a second input. Secondary at rest so it does not
   compete with the value beside it, primary on hover, which is the same
   quiet-to-loud step .identifier__copy makes. */
.search__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.search__clear:hover {
  color: var(--color-text-primary);
}

.search__clear:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.search:has(.search__input:placeholder-shown) .search__clear {
  display: none;
}

/* Invalid — after focus so it wins when a field is both, which is shadcn's own
   order. A search bar has no validation today; this exists so a page that gives
   one an `aria-invalid` gets the system's treatment rather than inventing one. */
.search:has(.search__input[aria-invalid="true"]) {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-error) 20%, transparent);
}

/* Disabled — .btn:disabled's own weight (0.6), and the shadow off, since a
   recess invites typing. */
.search:has(.search__input:disabled) {
  opacity: 0.6;
  box-shadow: none;
}

.search__input:disabled {
  cursor: not-allowed;
}

/* Selected text takes the accent, matching shadcn's `selection:bg-primary`. */
.search__input::selection {
  background: var(--color-accent-primary);
  color: var(--color-on-accent);
}

@media (prefers-reduced-motion: reduce) {
  .search {
    transition: none;
  }
}

/* A scope button already carries its own text/chevron inset via
   .search__scope's own padding-left — the bar's usual 12px right padding on
   top of that reads as too much air after it. 8px instead, only when a scope
   is present; a plain search input keeps the full 12px. */
.search:has(> .menu-wrap) {
  padding-right: var(--space-8);
}

.search__icon {
  display: inline-flex;
  flex: none;
  color: var(--color-text-secondary);
}

.search__input {
  flex: 1;
  /* The 200px floor, expressed where it composes rather than competes: the bar's
     total is this plus its own chrome, so the number here is 200 minus that
     chrome — the icon, the gap after it and the padding on both sides. Written as
     the subtraction rather than as 152px so it follows the bar if any of those
     change, and so the 200 in the rule is the 200 that was asked for.
     It is a FLOOR on top of the content-based minimum below, not a replacement:
     a placeholder needing more than 200px still gets it.

     `min-width: 0` used to sit here, which let the input — and with it the whole
     bar — shrink to nothing, clipping the placeholder. It is gone, so the input
     keeps its automatic (content-based) minimum instead.
     `field-sizing: content` is what makes that minimum the PLACEHOLDER's width
     rather than the input's arbitrary 20-character default: the field takes its
     intrinsic size from what is in it, and an empty field's content is its
     placeholder. `flex: 1` still makes it fill whatever the bar has spare, so
     this changes the floor only, never the resting width.
     Where field-sizing isn't supported the floor falls back to that 20-character
     default — narrower than a long placeholder, but no longer zero. */
  field-sizing: content;
  min-width: calc(200px - var(--icon-size) - var(--space-8) - var(--space-12) * 2);
  border: 0;
  outline: 0;
  background: none;
  /* Medium, not regular (2026-08-28, on request) — a search term is a value the
     user entered, and it reads as one against the row of labels and secondary
     text around it. */
  font: var(--weight-medium) var(--text-body-md) var(--font-sans);
  color: var(--color-text-primary);
}

/* The placeholder stays REGULAR — the weight above is for the value, and a
   placeholder is a prompt, not one. It also gives the empty and filled states a
   second difference beyond colour, which is what the accent stroke above is
   already saying at the field's edge. */
.search__input::placeholder {
  font-weight: var(--weight-regular);
  color: var(--color-input-placeholder);
}

/* A scope trigger with its own dropdown (docs/elements.md, Search) wraps
   .search__scope in a .menu-wrap so it has a floating panel to anchor — that
   wrapper needs the same stretch .search__scope asks for below, or the
   wrapper stays content-height and .search__scope's own align-self has nothing
   full-height left to stretch *to*. */
.search > .menu-wrap {
  align-self: stretch;
}

.search__scope {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  flex: none;
  /* .search centers its children by default, which leaves this shorter than the
     32px bar and its divider floating mid-height instead of running edge to
     edge. Stretch it to the bar's full height so the border-left is a full-height
     divider, not a short dash. */
  align-self: stretch;
  height: 100%;
  padding-left: var(--space-12);
  border-left: 1px solid var(--color-outline);
  background: none;
  border-top: 0; border-right: 0; border-bottom: 0;
  color: var(--color-text-primary);
  font: var(--weight-medium) var(--text-body-md) var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}

/* Checkbox — shared by table row selection and the filter panel's option list.
   A <button>, not an <input>: the check glyph is a lucide icon like everywhere
   else, and a button gets Enter/Space for free. `CEElements.mountCheckboxes()`
   toggles `--on`, the aria state and the icon. */
.checkbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--icon-size);
  height: var(--icon-size);
  flex: none;
  padding: 0;
  /* --radius-sm (8px) is half a 16px box's size — visually a circle, not a
     rounded square. --radius-checkbox is its own scoped exception (tokens.css). */
  border-radius: var(--radius-checkbox);
  border: 1px solid var(--color-outline);
  background: var(--color-surface);
  color: var(--color-on-accent);
  cursor: pointer;
}

/* Hit-slop: the 16px visual box is too small a target to click precisely
   (especially in a table row), but growing it directly would grow the glyph
   and throw off row rhythm. An invisible ::before sized past the button's own
   edges extends what's clickable without changing what's drawn or laid out —
   a click anywhere on it still lands on .checkbox itself, since it's the
   pseudo-element's ancestor. 4px, not the usual 8px slop: .orders-table__id's
   own -8px margin (orders.html) already eats half the checkbox's column-gap,
   so an 8px slop here would reach into the ID column's own hit area. */
.checkbox::before {
  content: "";
  position: absolute;
  inset: calc(var(--space-4) * -1);
}

.checkbox:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 2px;
}

/* Indeterminate (some, not all, of a group checked — see the header
   "select all" checkbox below) reads as the same fill as fully checked; only
   the glyph (a dash, mounted in JS) tells the two apart. */
.checkbox--on,
.checkbox--indeterminate {
  background: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
}

.checkbox .icon {
  width: 100%;
  height: 100%;
}

/* Menu — a generic floating panel: kebab row menus, the export menu, and any
   select-like trigger (order type, search scope) share this shape. None of
   those are their own specced dropdown/select component, so one class covers
   all of them. `CEElements.mountMenus()` wires open/close for any
   `.menu-wrap` > `[data-menu-trigger]` + `.menu` pair — one open at a time,
   closed by an outside click or Escape. */
.menu-wrap {
  position: relative;
  display: inline-flex;
}

.menu {
  position: absolute;
  top: calc(100% + var(--space-8));
  z-index: 60;
  min-width: 200px;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  /* Same radius as the trigger that opens it (--radius-sm) — see --radius-menu in
     tokens.css. */
  border-radius: var(--radius-menu);
  box-shadow: var(--elevation-lg);
  /* Runs every time [hidden] is removed and the panel becomes visible again —
     an animation restarts on its own whenever an element re-enters the render
     tree, so no extra "opening" class is needed alongside mountMenus()'s own
     hidden toggle.
     200ms, UP FROM 130 (2026-09-10, request: "make the menus from dropdown appear
     a bit smoother, animated in max. 200 ms time, instead of just appearing"). At
     130ms with 4px of travel the panel was technically animating and read as a
     hard cut — under about 150ms a small movement is over before the eye has
     followed it, which is why it was reported as "just appearing". 200ms is the
     ceiling the request set and it is spent on the two things that make the motion
     legible rather than merely longer: the duration, and 6px of travel instead of
     4 (below), since a longer take on the same tiny distance reads as sluggish
     rather than smooth.
     THE EASING IS UNCHANGED and is the reason this can afford 200ms without feeling
     slow: cubic-bezier(0.32, 0.72, 0, 1) puts most of the distance in the first
     third, so the panel arrives early and settles — a linear 200ms would feel like
     twice the wait. The same curve and duration are on .filter-select__panel
     (proposals.css), so every dropdown in the app now opens on one timing.
     CLOSING IS STILL INSTANT, deliberately, and that is not an oversight to fix in
     CSS: mountMenus() sets `hidden`, which removes the panel from the render tree
     with nothing left to animate. Fading a menu out needs the close to wait on a
     transitionend or a timer in js/elements.js, and a dismissal that lingers reads
     as lag in a way an opening does not — the user has already moved on. */
  animation: menu-in 0.2s cubic-bezier(0.32, 0.72, 0, 1) both;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu {
    animation: none;
  }
}

.menu--left { left: 0; }
.menu--right { right: 0; }

.menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  width: 100%;
  padding: var(--space-8) var(--space-12);
  border: 0;
  /* One step inside the panel — outer larger than inner (CLAUDE.md). See
     --radius-menu-item in tokens.css. */
  border-radius: var(--radius-menu-item);
  background: none;
  font: var(--weight-regular) var(--text-body-md) var(--font-sans);
  color: var(--color-text-primary);
  text-align: left;
  white-space: nowrap;
  /* An item is usually a <button>, but it may be an <a> when it navigates — the
     account menu's Settings row (js/shell.js). Stated here so the two render
     identically; a button has no underline to remove, so this changes nothing
     for every existing item. */
  text-decoration: none;
  cursor: pointer;
}

.menu__item:hover {
  background: var(--color-chip);
}

.menu__item:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: -2px;
}

.menu__item--danger {
  color: var(--color-error);
}

/* Marks which option a single-select menu (a type filter, a search scope) is
   currently on. Add `data-menu-select` to opt an item into mountMenus() moving
   this class for you on click within the same .menu; a plain action menu
   (export, a row's kebab) never sets it and never gets one.

   A LIGHT BLUE ROW WITH A CHECKMARK, NOT A FILLED ONE (2026-09-25, on request:
   "use a secondary blue color to show the selected option, a checkmark sitting
   on the right side of the item and keep the text colour as text-primary").
   It was --color-accent-primary with white text — a filled row that read as the
   menu's one button, loud enough in a list of ten that the eye went to the fill
   rather than to the label. --color-info-tint is the same light blue the count
   pill and .chip already carry, so this introduces no new colour, and it is the
   one tint with a dark-mode value of its own (#0f3350) that holds
   --color-text-primary at full contrast in both themes. The label stays
   --color-text-primary inherited from .menu__item, which is why nothing below
   has to repaint the row's children any more.

   Drawn with a mask on a pseudo-element rather than an <svg> in the markup,
   because the class MOVES: mountMenus() toggles .menu__item--selected and a
   pseudo-element follows it for free, where a real node would have to be
   inserted and removed on every click, on every page. The cost is that a
   pseudo-element is not in the accessibility tree — so mountMenus() now mirrors
   the class into `aria-selected` on every opt-in option, both on mount and on
   click (markSelectedForA11y, js/elements.js). A page that sets the class in
   HTML and never loads elements.js owes itself that attribute by hand. */
.menu__item--selected,
.menu__item--selected:hover {
  background: var(--color-info-tint);
  color: var(--color-text-primary);
  font-weight: var(--weight-medium);
}

/* THE CHECKMARK. margin-left: auto pushes it to the row's right edge, past the
   label and past any count — .menu__item's own 8px gap keeps it off whatever
   ends the row. 16px square to match .icon, currentColor through the mask so it
   is the label's own ink, and stroke-width 2 because that is what .icon carries
   beside medium-weight text (js/icons.js).

   flex: none so a long label cannot squeeze it, and the lucide "check" path is
   inlined here rather than fetched: a mask pointing at a file on disk would be
   one more request per menu, and pages must work opened straight from disk. */
.menu__item--selected::after {
  content: "";
  flex: none;
  margin-left: auto;
  width: 1rem;
  height: 1rem;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* NO `:has(.menu__item-count)` OVERRIDE ANY MORE (added and removed 2026-09-25).
   For half a day the check gave up its auto margin on a row with a count, because
   two auto left-margins in one flex row do not stack — they SPLIT the free space,
   which left the count stranded mid-row. Then the counts themselves stopped
   pushing right ("keep the number right next to the text instead of moving it
   around"), so there is no second auto margin left to split with and the check
   simply takes the right edge.

   The hazard is worth remembering rather than the rule: anything a page pushes to
   a menu row's right edge with margin-left: auto will halve the row with this
   checkmark, and the fix is to zero one of the two, page-side. */

/* REMOVED 2026-09-25, with the filled row that needed it. `.menu
   .menu__item--selected *` forced every child of a selected item to
   `color: inherit`, because the row was --color-accent-primary with white text
   and a child with an explicit colour of its own — a count, a sublabel — kept
   its --color-text-secondary #666 and sat at 1.9:1 on the blue (2026-08-28, the
   Fields page's "All fields" menu).

   The row is --color-info-tint now and its label is --color-text-primary, so a
   secondary-toned count reads on it exactly as it does on an unselected row —
   which is the whole point of having a secondary tone, and what the rule was
   overriding. Nothing inherits white any more because nothing is white.

   Kept as a note rather than deleted outright: the specificity lesson is the
   part worth keeping. It needed TWO classes, not one, because
   `.menu__item--selected *` scores the same as the
   `.some-page__count { color: … }` a page writes for its own count, and a
   page's <style> block loads after this file — so the tie went to the page and
   the grey came back. Any future rule that has to reach inside a menu row owes
   itself the same weight. */

/* Settings panel — the account button's floating menu. .menu--settings only widens
   the panel; .menu__label and .menu__radio are generic enough to reuse for any future
   setting, not settings-panel-specific classes.

   NOTE (2026-08-27): .menu__label and .menu__radio now have NO USER in the system.
   The styling groups they were built for moved to the Settings page, which renders
   its own .settings-* controls (css/proposals.css) — a page-width row of options is
   not a 240px menu column. Both classes are kept, not deleted: they are the only
   description the system has of a labelled group and a native radio inside a menu,
   and the next menu that needs either should use these rather than invent a second
   pair. If nothing claims them, they are a deletion to make deliberately. */

.menu__label {
  padding: var(--space-8) var(--space-12) var(--space-4);
  font: var(--weight-medium) var(--text-body-sm) var(--font-sans);
  color: var(--color-text-secondary);
}

/* Browser-native radio input — only positioning and accent colour are themed, per
   "use browser native radio buttons" rather than a custom control. */
.menu__radio {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  width: 100%;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-sm);
  font: var(--weight-regular) var(--text-body-md) var(--font-sans);
  color: var(--color-text-primary);
  cursor: pointer;
}

.menu__radio:hover {
  background: var(--color-chip);
}

.menu__radio input[type="radio"] {
  accent-color: var(--color-accent-primary);
}

/* REMOVED 2026-08-27, with the picker that needed it. This pinned the account
   button and its panel to the fixed --font-ui so that choosing a typeface did not
   restyle the very control you were choosing from. The picker now lives on the
   Settings page, where that is not a problem but the point: the page follows
   --font-sans like every other page, so picking a face shows you the face. The
   account button goes back to --font-sans with the rest of the header, which is
   what it should have looked like all along.
   .settings-trigger keeps its class in the markup — it names what the button is,
   and it is the hook if the trigger ever needs styling of its own again. */

/* REMOVED 2026-09-25, for the same reason as the rule above: this made a
   selected row's icon white for the filled blue it no longer has. The icon
   falls back to .menu__item svg's --color-text-secondary, the same tone it
   carries on every other row. */

.menu__item svg {
  color: var(--color-text-secondary);
  flex: none;
}

/* FULL-BLEED, AND WITH ROOM EITHER SIDE OF IT (2026-09-08, on request: "in the
   export options menu, span the dividers full width, add a bit more padding above
   and below the dividers"). It was inset by .menu's own --space-4 padding and
   carried --space-4 of margin.

   THE NEGATIVE SIDE MARGINS ARE THE FOUNDATION RULE, not a local fix — CLAUDE.md:
   "a divider inside a padded container spans the container's full width... never
   just the padded content width". The menu pads its CONTENT by 4px, which is right
   for the rows; a rule that stops 4px short of each edge reads as a short line
   floating in the panel rather than as the panel's own division. Cancelling the
   padding on this one element is the same technique .sidebar__rail uses on its own
   border-top.
   --space-4 IS THE PANEL'S PADDING, so if that ever changes both sides of this
   change with it — the side margins must stay its exact negative.
   8 ABOVE AND BELOW, up from 4: the request's "a bit more". It reads as a group
   break rather than as one more row's worth of gap, which is what a divider between
   the export menu's three sections (scope / format / delimiter) has to say.
   CORE, NOT PAGE-LOCAL, even though the ask named one menu. Three menus in the app
   use this element and the inset was wrong in all of them by the rule above; a
   page-local copy would have left two of them contradicting the foundation and put a
   second definition of a system element in a page's <style>. */
.menu__divider {
  height: 1px;
  margin: var(--space-8) calc(var(--space-4) * -1);
  background: var(--color-outline);
}

/* A dropdown's own "this expands" indicator — mark the chevron placeholder
   with this class (`<span data-icon="chevron-down" class="menu-chevron">`) and
   it flips 180deg when its trigger opens. Keyed off aria-expanded, which
   mountMenus() sets on the trigger — not a class it toggles for this purpose
   specifically, so any trigger gets the flip for free just by adding the
   class, no extra JS wiring. Instant, no transition — an animated flip read
   as more motion than a chevron warrants. */
.menu-chevron {
  transform: rotate(0deg);
}

[aria-expanded="true"] .menu-chevron {
  transform: rotate(180deg);
}

/* EVERY STROKE IN THIS ELEMENT IS 8% BLACK (--color-outline-card), 2026-08-25
   on request ("apply the outline colour of 8% of full black to the Orders table
   and rows too"). That means all five together — the outer border, the toolbar
   rule, the head rule, the row dividers and the footer rule — because a table
   drawing an 8% frame around 15% row lines reads as a mistake rather than as a
   lighter table. .table is the ratified element, so this reaches the Products
   table as well as Orders': there is one table style, not a per-page one.
   Controls INSIDE the table — the toolbar's search, buttons, checkboxes, menus —
   keep --color-outline at 15%. They are controls, not the table's own chrome. */

/* Table — shell mechanics only (toolbar, header, rows, pagination). Column
   layout is page-local: a page declares its own grid-template-columns on a
   page-local row class, the way channel.html's .split is page-local.
   Static by design — column configuration, density options and a sticky
   action column on horizontal scroll are not built; see CLAUDE.md's
   "Not yet decided". `.table--sticky-head` and `.table__foot--sticky` are
   opt-in per page — a short list doesn't need either — but `.table__toolbar`
   is sticky by default; see below.
   No `overflow: hidden` here, on purpose: any ancestor with overflow other
   than visible/clip becomes the nearest scroll container a `position: sticky`
   descendant sticks against (per spec), and `.table` never scrolls
   independently of `.page` — so `.table__toolbar`, `.table--sticky-head` and
   `.table__foot--sticky` would all silently do nothing if `.table` clipped.
   The rounding that `overflow: hidden` used to buy is reproduced explicitly
   below, and the one thing it was also clipping — a row's own hover/selection
   background — moved to `.table__body` itself, which nothing sticky ever
   lives inside. */
.table {
  background: var(--color-surface);
  /* THE TABLE IS A CARD, SO IT TOOK THE 15% TOO (2026-09-16, with .card — see that
     rule for the request). docs/tables.md says it in as many words ("`.table` is
     already a card — surface, outline, radius"), and tokens.css's own note on
     --color-outline-card has always claimed "the table ... keep[s] --color-outline at
     15%" while this line said otherwise; the two agree now.
     IT ALSO SETTLES A PAGE-LOCAL OVERRIDE: orders.html had already been asked for this
     edge at 15% earlier the same day and carried its own .orders-table rule, which is
     gone now that core does it for every table in the app.
     THE INSIDE IS UNTOUCHED — the head's rule, the row dividers, the toolbar and foot
     edges all stay --color-outline-card, so the container edge is stronger than the
     lines within it.
     12%, NOT 15%, SINCE THE SAME DAY'S SECOND PASS ("dial it down to 12% off black") —
     --color-outline-container, with .card and every other container. */
  border: 1px solid var(--color-outline-container);
  border-radius: var(--radius-md);
}

.table > :first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.table > :last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.table > :first-child:last-child {
  border-radius: var(--radius-md);
}

/* Lives inside `.table` as its first child, alongside `.table__head` and
   `.table__foot` — search, filters, a view-mode `.segmented`, whatever a
   table needs above its rows. Sticky by default (not an opt-in modifier like
   `.table--sticky-head`/`.table__foot--sticky`): the header and footer are
   worth losing on a short list, but a toolbar's controls (search, filters)
   are what the user reaches for regardless of scroll position, so there's no
   short-list case where sticking it costs more than it's worth. */
.table__toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-height: var(--control-height);
  padding: var(--space-12) var(--space-16);
  /* LOAD-BEARING SINCE 2026-09-16, not a decorative edge: .table__head lost its grey
     fill that day (see its own rule below), so this rule is the only thing separating
     the controls from the column names. Removing it merges the two into one
     undifferentiated white block — it was tried on the Orders prototype and came back
     the next day. Any page-local band inserted between this and the head (applied
     filters, tabs) needs the same rule for the same reason: docs/tables.md, "a band
     above the column header always carries a divider". */
  border-bottom: 1px solid var(--color-outline-card);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  /* Higher than .table__head's z-index (below) on purpose: sticky + z-index
     each establish their own stacking context, so a menu opened from inside
     the toolbar (e.g. the search-scope dropdown) has its z-index trapped
     inside that context — it's compared against .table__head as a whole
     unit, not against .table__head's own children. On a tie, later DOM
     order wins, and .table__head sits after .table__toolbar in markup, so
     without this gap the header paints over an open toolbar menu the moment
     it goes sticky on scroll. */
  z-index: 2;
}

/* ...AND THE WHOLE TOOLBAR LIFTS WHILE ONE OF ITS MENUS IS OPEN (2026-09-08, on
   request: "make sure the export menu comes on top of everything else").

   THE PROBLEM IS THE STACKING CONTEXT, NOT THE MENU'S OWN z-index. `position: sticky`
   with a z-index makes this toolbar a stacking context, so every z-index inside it —
   including .menu's 60 — is resolved WITHIN it and the whole subtree is then compared
   to its siblings as one unit at z-index 2. Raising .menu changes nothing; the toolbar
   is what has to move. Two things were painting over an open Export menu because of
   it: the .selection-bar, a later sibling at the same 2 (later DOM order wins a tie),
   and the push filter panel at 50.
   THE FILTER PANEL'S OWN NOTE (proposals.css) SAYS 50 IS BELOW .menu's 60, and it is —
   but that only helps a menu whose z-index is compared at the root, which a toolbar
   menu's never was. This rule is what makes that note true for this menu too.
   70, so it clears the panel and lands below the popover layer at 100 and the modal
   drawer/overlay at 200/201 — a menu should outrank the page's own chrome, not a
   modal. Only while a menu is actually open, so the toolbar goes straight back to 2
   and nothing about the sticky stack changes at rest.
   :has(), not a class toggled by mountMenus() — the state is already in the DOM as the
   menu's own `hidden`, and .selection-bar has been reading it exactly this way
   (proposals.css) since the bar was built. */
.table__toolbar:has(.menu:not([hidden])) {
  z-index: 70;
}

.table__toolbar-spacer {
  flex: 1;
}

/* A table's own heading, and the only place one belongs — inside the toolbar, in
   the row above the column header, so it sits within the table's own box. A
   heading floating above the table is a second box around the first, and it stops
   reading as part of the thing it names; the toolbar row already exists for what a
   table needs above its rows, so the title joins the controls there rather than
   bringing a wrapper of its own.
   Same treatment as .card__title, deliberately: a table title and a card title are
   the same rank of heading, and the two must not drift. It is a separate class
   rather than reuse because .card__title inside a .table would say the table is a
   card, and every rule keyed on .card__title (padding, the Headings-setting family
   selector, anything a page adds) would then reach into tables too. */
.table__title {
  margin: 0;
  color: var(--color-text-primary);
  font: var(--weight-medium) var(--text-heading) var(--font-sans);
}

.table__body {
  overflow: hidden;
}

.table__row {
  display: grid;
  align-items: center;
  column-gap: var(--space-16);
  padding: var(--space-12) var(--space-16);
}

/* NO FILL OF ITS OWN (2026-09-16, on request: "change the table component at its core
   and make it use white background, in the design system so this propagates"). It was
   --color-table-header, the recessed grey, from the system's first table until now.
   Tried on the Orders prototype first — one grey band under a white toolbar, then the
   whole head grey, then all of it white — and white is what shipped, so the change is
   here rather than in that page.
   WHAT TELLS A HEAD FROM A ROW NOW: --color-text-secondary ink, medium weight, body-sm
   against the rows' body-md — and its border-bottom, which is no longer decoration.
   Every head keeps that rule even where a fill would have done the job before, because
   it is now the whole boundary between the chrome and the data.
   AND IT IS WHY ANYTHING ABOVE THE HEAD NEEDS A DIVIDER: the fill used to separate a
   toolbar (or a title, or a page-local band of applied filters) from the column names
   on its own. On one surface it cannot, so every band stacked above .table__head owns
   a border-bottom — .table__toolbar has one in this file, and a page-local band must
   declare its own. docs/tables.md states the rule; this comment is why it exists.
   THE DIVIDER BELONGS TO THE BAND ABOVE, NOT TO THE HEAD. A border-top here instead
   would double up with .table__toolbar's own rule into a 2px line, and the head is not
   always the thing below a band (a section row or an empty state can be).
   --color-table-header IS NOW UNUSED BY THIS FILE and is still defined in tokens.css;
   see the note there before reaching for it. */
.table__head {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font: var(--weight-medium) var(--text-body-sm) var(--font-sans);
  border-bottom: 1px solid var(--color-outline-card);
}

.table--sticky-head .table__head {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* A sticky head under a sticky toolbar must not both claim top:0 — the head
   would render at the same position as the toolbar sitting above it in flow,
   covering it instead of sitting below it. Offset by the toolbar's own
   rendered height (min-height + its own top/bottom padding + its 1px
   border-bottom) so the head sticks directly under it. Computed from the same
   tokens `.table__toolbar` itself is built from, not a measured/hardcoded
   pixel value — it tracks that rule if either ever changes. Scoped with
   `:has()` to a `.table__toolbar` specifically the sticky-head's own
   preceding sibling, so a `.table--sticky-head` table with no toolbar above
   it keeps the plain top:0 case right above it. */
.table:has(> .table__toolbar).table--sticky-head .table__head {
  top: calc(var(--control-height) + var(--space-12) * 2 + 1px);
}

/* A squeezed column truncates, it never wraps and pushes into its neighbour's
   header label — a table this narrow (an 11-column Orders row) is tight enough
   that a header should never be allowed to grow past one line. */
/* inline-flex + center, not the plain inline text a header label would
   otherwise be: a trailing icon (a "Ship before" info glyph) defaults to
   baseline vertical-align, which sits it below the text's own vertical
   centre rather than beside it. A label with no icon is unaffected — a bare
   text node is still just text, centered against itself. */
.table__head > * {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table__body .table__row {
  border-top: 1px solid var(--color-outline-card);
  font: var(--weight-regular) var(--text-body-sm) var(--font-sans);
  color: var(--color-text-primary);
}

.table__body .table__row:first-child {
  border-top: 0;
}

/* Section header — a labelled break between groups of rows inside .table__body,
   for a list that is scoped by something with named groups (Products > Fields,
   grouped by source when the scope is "All fields").
   Its own row, not a .table__row with one cell: it has no columns, so it must
   not inherit the grid every other row carries.

   SAME HEIGHT AS A REGULAR ROW. Not a design preference — a heading that is
   taller than the rows it introduces reads as an interruption in the list rather
   than a part of it, and a column of rows loses its rhythm every time a group
   changes. A row's height is set by its tallest cell, which in every table here
   is the compact icon button in the actions column, so this matches
   --control-height-compact inside the same --space-12 padding and lands on the
   identical 52px. Derived from the same token rather than copied as a number, so
   the two cannot drift apart.

   Deliberately no extra space above the group: the border-top and the label's
   own weight are what separate it. Added 2026-08-28 on the user's instruction,
   after Products > Fields built it page-locally twice. */
.table__section {
  display: flex;
  align-items: center;
  /* The compact control height PLUS the row's own vertical padding: this
     element carries both, and box-sizing is border-box, so a bare
     --control-height-compact would be the whole box and the padding would eat
     it — measured 44px against a data row's 53. A data row gets the same total
     from its padding wrapping a 28px button; this states the sum instead. */
  min-height: calc(var(--control-height-compact) + var(--space-12) * 2);
  padding: var(--space-12) var(--space-16);
  border-top: 1px solid var(--color-outline-card);
  color: var(--color-text-primary);
  font: var(--weight-medium) var(--text-body-md) var(--font-sans);
}

/* First group opens the list, so it has no preceding group to be divided from —
   same exception .table__body .table__row:first-child already takes. */
.table__body > .table__section:first-child {
  border-top: 0;
}

/* The whole row opens the record — never a single cell or icon alone. */
.table__row--clickable {
  cursor: pointer;
}

/* THE FILL STOPS AT THE BORDER, IT DOES NOT RUN UNDER IT (2026-09-16, on report: "when
   hovering table rows, the top divider looks stronger than the bottom one, why is that
   happening?").
   WHY IT HAPPENED. A row's divider is its OWN border-top, and --color-outline-card is
   8% BLACK — a translucent colour, so what it looks like depends on what is behind it.
   With the default background-clip: border-box, a row's background extends under its
   own border, so the hovered row's border-top composited over the HOVER FILL while the
   line below it — which belongs to the next row, not to this one — composited over the
   white surface. Measured: 8% black over #ecf5fe is rgb(217, 225, 234), over #fff it is
   rgb(235, 235, 235). Two different lines above and below one row, from one declaration.
   IT GOT WORSE THE SAME DAY rather than appearing: --color-chip went from #f5fafe to
   #ecf5fe, and the darker the fill the further apart the two composites drift.
   padding-box clips the fill to the padding edge, so every row's border-top sits on
   --color-surface whatever the row's state is, and the pair matches. The 1px of surface
   left showing at the top of a hovered row is under a translucent line and is exactly
   what the row below shows in the same place.
   NOT FIXED BY MAKING THE DIVIDER OPAQUE, which was the alternative: an opaque grey
   would be one value that no longer tracks the surface it is drawn on, and 8% black is
   the token every divider in the system uses (tokens.css). This keeps the token and
   fixes the compositing. */
.table__body .table__row--clickable:hover {
  background: var(--color-chip);
  background-clip: padding-box;
}

.table__body .table__row--selected,
.table__body .table__row--selected:hover {
  background: var(--color-chip);
  background-clip: padding-box;
}

/* A numeric cell — right-aligned so the units digit of every figure in the
   column lands on one vertical line, and tabular so the column does not jitter
   as values change. Added 2026-08-27 on the user's direct instruction, after a
   UX review found the Collections table's product counts (148 / 62 / 210 / 29)
   tabular but left-aligned, which lines up the hundreds and leaves the units
   ragged — the opposite of what a column of figures is scanned for.

   Goes on the cell in BOTH the head and the body, so the label sits over its
   own figures: `.table__head > *` is inline-flex, and justify-self: end moves
   the whole inline box, so no separate header rule is needed.

   text-align matters as well as justify-self — the first only places the box,
   the second aligns wrapped or multi-line content (a `.table__lines` stack of
   a figure over a muted subline) inside it.

   NOT applied retroactively: the Orders table's Total column left-aligns
   deliberately and by comment, and reconciling it is its own decision — see
   docs/tables.md, "Numbers". */
.table__num {
  justify-self: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The stacked case — a figure over a muted subline ("148" over "12 blocked").
   .table__lines is a flex column, so its own items need aligning to the end
   too; justify-self above only places the stack itself. */
.table__num.table__lines,
.table__num .table__lines {
  align-items: flex-end;
}

.table__lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.table__line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table__line--muted {
  color: var(--color-text-secondary);
}

/* Pagination — static markup only; no working page state. Left side holds a
   result count, right side prev/next. */
.table__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-16);
  border-top: 1px solid var(--color-outline-card);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font: var(--weight-regular) var(--text-body-sm) var(--font-sans);
  /* "38 of 1,520" and the page numbers beside it both change as you page —
     proportional figures make the whole footer shift under the cursor. */
  font-variant-numeric: tabular-nums;
}

.table__foot--sticky {
  position: sticky;
  bottom: 0;
}

.table__foot-pages {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

/* Card — bordered surface, no elevation: cards are static content, and
   elevation is reserved for interactive elements. Nested control radius must
   be smaller than the card's own --radius-md (e.g. a --radius-sm button
   inside), per the outer-bigger-than-inner rule. */
.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  padding: var(--space-16);
  background: var(--color-surface);
  /* CARD STROKE AT 15% BLACK (2026-09-16, on request: "all cards to use a stronger
     border 15% of black in classic and light mode, use a relevant equivalent for dark
     mode"). It was --color-outline-card, 8%, from 2026-08-25 to now — a card was
     deliberately quieter than the controls sitting on it. Reversed: at 8% a card's own
     edge was the faintest line on the screen, so a page of cards read as content
     floating on the page rather than as objects on it, and the edge did less work than
     the shadow it is not allowed to have (elevation is interactive-only).
     --color-outline IS THE 15%, and it is the token tokens.css calls "every stroke:
     dividers, container edges, controls" — so this is a card joining the system's one
     stroke rather than a new value. THE DARK EQUIVALENT COMES FREE with it: that theme
     repoints --color-outline to rgb(255 255 255 / 0.18), which is the same step up from
     its own 10% card stroke, so "a relevant equivalent for dark mode" needed no branch
     here. Light inherits Classic's 15%.
     WHAT STAYED AT 8%: every DIVIDER, which is the other half of what
     --color-outline-card is used for — a table's row rules, head and toolbar edges, a
     card's own .card__toolbar, the sticky header bands. A container edge and a line
     between rows are different jobs, and this request is about the edge.
     AND THEN 12%, NOT 15% ("dial it down to 12% off black", the same day). --color-outline
     was the right DIRECTION and one step too strong: at 15% a card's edge weighed the
     same as the buttons standing on it, and a container should recede behind its own
     controls. 12% is --color-outline-container, a token added for this (tokens.css has
     the reasoning, including the 14% white Dark takes) — so a card sits between the
     controls at 15% and its own dividers at 8%. */
  border: 1px solid var(--color-outline-container);
  border-radius: var(--radius-md);
}

.card__title {
  margin: 0;
  color: var(--color-text-primary);
  font: var(--weight-medium) var(--text-heading) var(--font-sans);
}

/* Label column sized to its widest label (e.g. "Commercial order no."), value
   column takes the rest of the width — both left-aligned. Because every row is
   a child of the SAME grid, the 32px gap is measured once, from the longest
   label, not per row — a short label ("Channel") and a long one ("Commercial
   order no.") still put their values on one shared left edge. Labels and values
   are direct grid children; there is no per-row wrapper element. */
.card__rows {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: var(--space-32);
  row-gap: var(--space-12);
  /* Top, not center: identical for any single-line row (label and value are the
     same height, so the two alignments look the same there), but load-bearing
     the moment a value wraps to more than one line — a multi-line address next
     to its label needs the label pinned to the first line, not floating at the
     block's vertical middle. */
  align-items: start;
}

/* A third column for a trailing action (an edit or kebab icon button) — use
   where every row in the card has one, e.g. Buyer details. Rows without an
   action still need an empty cell (an empty <span></span>) so grid
   auto-placement doesn't drift a later row's label into this column instead. */
.card__rows--actions {
  grid-template-columns: max-content 1fr max-content;
}

.card__row-label {
  color: var(--color-text-secondary);
  font: var(--weight-regular) var(--text-body-md) var(--font-sans);
  white-space: nowrap;
}

/* min-width:0 overrides a grid item's default min-width:auto (= its content's
   min-content) — without it, one long value (a URL, a long description) sets
   the floor for every row's value column and can force the whole grid wider
   than its container, overflowing past the card's own edge uncontained. */
/* overflow-wrap covers what min-width:0 above doesn't: a single unbroken
   fragment (a long URL segment between slashes) can still be wider than the
   column even after the column itself is free to shrink — without this it
   overflows past the column into whatever sits next to it (e.g. a row's own
   action buttons) instead of breaking to fit. */
.card__row-value {
  min-width: 0;
  overflow-wrap: break-word;
  color: var(--color-text-primary);
  font: var(--weight-regular) var(--text-body-md) var(--font-sans);
}

.card__row-action {
  display: inline-flex;
  flex: none;
}

/* Product card — a tile for a grid of products (Products list). From Figma
   node 483:8662 (file ON3WMk7yHveLb52Otvygbk). Built on ratified pieces where
   the design already matches one: the family pill is a plain neutral .badge,
   GTIN/MPN are .identifier-stack — not reinvented here.
   overflow:hidden + the card's own --radius-sm clips the thumbnail's top
   corners to match, rather than giving the thumbnail its own radius. Safe
   here — nothing inside a product card is ever sticky, unlike .table, which
   gives its own structural first/last child an explicit radius instead (see
   .table's own comment). */
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  /* 12% black with every other card (2026-09-16) — see .card for the request and the
     reasoning, and tokens.css for --color-outline-container's own note. */
  border: 1px solid var(--color-outline-container);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  /* Matches .btn's own hover timing, so a card and a button settle at the same
     rate on the same screen. */
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

/* The whole card is the click target (cursor: pointer above says so), but until
   2026-08-21 nothing under the cursor moved — only .product-card__name's
   underline, which reads as "the link is the target" rather than "the card is".
   --color-chip is the same tint every other hoverable row uses (a menu item, a
   clickable table row, a secondary button), and --elevation lifts the tile off
   the grid the way it does for any other interactive element. No transform: a
   card that grows nudges its neighbours' baselines across a whole grid.
   The tint lands on the body only — .product-card__thumb-wrap keeps its own
   --color-background fill — which is the intent: the picture itself stays true,
   the surface around it responds. Since 2026-09-10 the image also takes a frame
   on hover (below); that is a line AROUND the photograph, not a wash over it, so
   the statement still holds. */
.product-card:hover {
  background: var(--color-chip);
  box-shadow: var(--elevation);
}

.product-card__thumb-wrap {
  position: relative;
  aspect-ratio: 8 / 5;
  background: var(--color-background);
  /* The hover frame's resting state — see .product-card:hover below for what it is
     and why it is an outline. Declared here, transparent, rather than only on
     hover: outline-color is animatable where the outline's mere appearance is not,
     so this is what gives the frame the same 0.12s arrival as the card's tint and
     lift. outline-offset pulls it inside the box, so it costs no layout and lands
     on the picture's own edge. */
  outline: 1px solid transparent;
  outline-offset: -1px;
  transition: outline-color 0.12s ease;
}

/* THE IMAGE GETS THE CARD'S OWN BORDER ON HOVER (2026-09-10, request: "when
   hovering product cards, show an outline around the image, same colour and style
   as the border of the card"). --color-outline-card at 1px is exactly what
   .product-card draws, referenced rather than restated so the two can never
   disagree about what "the border of the card" is.
   ON THE WRAP, NOT THE <img>: the wrap is the box that has the radius and the
   --color-background fill behind a transparent PNG, so a frame on the image itself
   would sit inside that fill and read as a line floating in the padding.
   AN OUTLINE, AND THAT TOOK THREE PASSES — two of them spent on the wrong variable,
   which is why the sequence is written down.
   Pass 1 drew the frame as `box-shadow: inset` on the wrap. A border was rejected
   then for a reason that still stands: it would take its pixel out of the wrap's
   box, so the picture would shrink by 1px on hover and the card would twitch under
   the cursor — the same reason this hover carries no transform. But an inset shadow
   is invisible HERE at any opacity, because it paints above the element's own
   background and BELOW its descendants, and .product-card__thumb is a child filling
   the wrap at object-fit: cover. The shadow was drawn, then covered by the
   photograph.
   Pass 2 read that invisibility as "too subtle" and doubled the colour to
   --color-outline (15%). It changed nothing, the line still being under the image.
   The lesson worth keeping: a value you cannot see is not a value you can tune.
   Pass 3 is this — an outline, which paints ABOVE descendant content, which is what
   a line over an image has to do. outline-offset: -1px pulls it inside the box, so
   it costs no layout (pass 1's requirement, met) and follows the wrap's
   border-radius (the Products grid rounds it; the ratified default leaves the
   card's overflow:hidden to clip the top corners). With the frame finally
   rendering, 15% read as too strong, so the colour is the 8% the request named in
   the first place.
   NOT CLIPPED, despite the wrap's own overflow: hidden — an element's outline is
   clipped by its ANCESTORS' overflow, never by its own, and at -1px it is inside
   the card's clip regardless.
   HOW TO CHECK IT, because eyeballing an 8% hairline over a photograph is precisely
   what failed twice: sample the pixels one row inside the wrap's edge in a 3x
   screenshot. Over white, 8% black is rgb(235,235,235) and 15% is rgb(216,216,216);
   if that row reads 254 the line is not painting at all, which is pass 1's bug and
   not a strength problem. Do not re-tune the colour without that check.
   IF IT NEEDS TO CHANGE AGAIN: --color-outline (15%) is one step up, and
   --color-accent-secondary would make the frame a focus-coloured statement rather
   than a structural one. Not 2px — a two-pixel frame reads as selection, and the
   card has a selected state to stay distinct from. */
.product-card:hover .product-card__thumb-wrap {
  outline-color: var(--color-outline-card);
}

.product-card__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Neutral .badge, positioned over the thumbnail's top-right corner — the
   family pill (Parent/Standalone/Child/Grandparent) is not a status, so it
   never takes a badge colour modifier. */
.product-card__family {
  position: absolute;
  top: var(--space-8);
  right: var(--space-8);
  cursor: default;
}

/* No padding of its own — .product-card__main and .product-card__stats each
   carry their own, so .product-card__stats' border-top (below) can run edge
   to edge instead of stopping inside a padded parent. See CLAUDE.md: a
   divider and the padding around it belong on the same element.
   flex: 1 so the body fills the card's full stretched height (grid rows
   stretch equal-height by default) — otherwise .product-card__stats sits
   right after however tall .product-card__main happens to be, and the
   stock/price row and its divider drift up or down card to card in the
   same row depending on name wrapping or identifier count. */
.product-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
}

/* flex: 1 pushes .product-card__stats to the bottom of .product-card__body
   regardless of how much space the name/identifiers above take up, so the
   divider and stock/price row land in the same place across every card. */
.product-card__main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-8);
  padding: var(--space-8) var(--space-8) 0;
}

/* min-height reserves the full 2-line box the clamp allows, so a 1-line name
   doesn't leave everything below it (GTIN, then the stats) sitting one line
   higher than on a card with a 2-line name. 3rem is 2 × 1.5rem — the
   line-height half of --text-body-md's "size/line-height" shorthand, not a
   new literal: the name already renders at that line-height, this just makes
   the box tall enough for two of them regardless of how much text there is. */
.product-card__name {
  color: var(--color-accent-primary);
  font: var(--weight-medium) var(--text-body-md) var(--font-sans);
  min-height: 3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  cursor: pointer;
}

.product-card__name:hover {
  text-decoration: underline;
}

/* No row-gap override here — the card uses .identifier-stack's own --space-8,
   which renders as 4px of visible space once each row's -2px top/bottom margin
   is subtracted (see the stack's own comment). This used to declare --space-4,
   which netted to 0 visible and left the two pills touching — invisible while
   the rows had no fill, obvious the moment the pill moved onto the row
   (2026-08-21). Matching the default also keeps cards and the Orders table
   reading the same. */

.product-card__stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-8);
  padding: var(--space-8);
  border-top: 1px solid var(--color-outline);
}

.product-card__stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  color: var(--color-text-secondary);
  font: var(--weight-regular) var(--text-body-sm) var(--font-sans);
}

.product-card__stat-value {
  color: var(--color-text-primary);
  font-weight: var(--weight-medium);
  /* A grid of tiles puts these figures on a shared vertical rhythm — same
     reasoning as .identifier__value above. */
  font-variant-numeric: tabular-nums;
}

/* Segmented control — 2-4 mutually exclusive views of the same content (a
   list/grid switch, not navigation between pages — that's the sidebar's job,
   and not steps visited in any order — that's .subnav's). Track is
   --radius-sm, the active item nests inside it at --radius-xs — the same
   "outer bigger than inner" pairing --radius-channel-nav satisfies for the
   channel nav's own track/pill, done here with a general step instead of a
   one-off scoped token. From Figma node 2023:6908. */
.segmented {
  /* EQUAL-WIDTH SEGMENTS (2026-08-31, on request). inline-GRID rather than the
     inline-flex this was: `grid-auto-columns: 1fr` sizes every column to the widest
     one, so a two-item control reads as one track split down the middle instead of
     two pills of whatever length their labels happen to be. That is the shape the
     control is understood by — the segments are alternatives to each other, and
     unequal widths quietly rank them.
     1fr and not a flex `flex: 1 1 0` on the item: 1fr's floor is auto, so a column
     can never be sized below its own label, which is the failure mode a zero-basis
     flex has (the longest label wins the space and then wraps or clips the others).
     The container still shrink-wraps — inline-grid with auto columns takes its
     width from its contents — so nothing here starts filling its parent.
     Icon-only items are unaffected: .segmented__item--icon sets an explicit 28px
     width, which beats a grid item's default stretch, and two 28px items make two
     28px columns either way. So the view switches on Products and the dashboard
     render exactly as before this.
     COMPONENT-LEVEL, not scoped to the one control that prompted it. Equal segments
     is a property of the element rather than of any instance, and the channel filter
     is currently the only text-label segmented control in the prototype — scoping it
     there would have meant the next one had to rediscover this. */
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  padding: var(--space-2);
  height: var(--control-height);
  box-sizing: border-box;
  background: var(--color-background);
  /* Up from --radius-sm and then back down from --radius-md, both on 2026-09-10 and
     both on request ("a larger one", then "too rounded"). See --radius-segmented in
     tokens.css for the 6 / 9 / 12 bracket and for why this is a scoped value rather
     than a step of the scale. */
  border-radius: var(--radius-segmented);
}

.segmented__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  height: var(--control-height-compact);
  padding: 0 var(--space-12);
  border: 1px solid transparent;
  /* CONCENTRIC WITH THE TRACK, BY ARITHMETIC RATHER THAN BY A CHOSEN VALUE. The
     track's own padding is what separates the two, so an inner corner that stays
     truly concentric is the track's radius minus that inset — 9 - 2 = 7px here.
     Written as the subtraction so it holds if either input moves — the track's own
     radius was retuned twice the day this was written and the item followed both
     times with no edit here.
     This is what --radius-channel-nav's note in tokens.css says it wants and cannot
     have (its own inner pill is a --radius-sm that no longer divides its 12), and it
     is why there is no --radius-segmented-item one-off here: nothing had to be
     invented, so nothing was. */
  border-radius: calc(var(--radius-segmented) - var(--space-2));
  background: none;
  color: var(--color-text-secondary);
  font: var(--weight-medium) var(--text-body-md) var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
}

.segmented__item:hover {
  color: var(--color-text-primary);
}

/* NO STROKE ON THE SELECTED PILL (2026-09-10, request: "remove the border around
   the selected white element"). It carried --color-outline, which put a 15% line
   between a white pill and a --color-background trough — two boundaries doing one
   job, 2px apart, and the outer one is the only edge the eye needs.
   THE 1px BOX STAYS, transparent, from .segmented__item above: it is what keeps
   every segment the same size whether or not it is the selected one, so dropping the
   border outright would shift the labels by a pixel as the selection moved.
   WHAT STILL CARRIES SELECTION: the white fill against the trough, primary ink
   against secondary, and --elevation. The fill is doing the most work of the three,
   which is why the stroke was removable — on Light, where the trough is palest, the
   shadow is what keeps the pill's edge findable. */
.segmented__item--active {
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: var(--elevation);
}

/* Icon-only item (e.g. a view-mode toggle) — square instead of a text pill,
   no horizontal padding since there's no label to clear. */
.segmented__item--icon {
  width: var(--control-height-compact);
  padding: 0;
}


/* ==========================================================================
   UI SHELL
   Always present. Three stacked parts, never merged:
     1. .sidebar      — navigation
     2. .app-header   — global: breadcrumb, AI assistant, notifications, account
     3. .page-header  — page: title, actions, tabs
   The page title lives in .page-header and NEVER in .app-header.
   On-rail values are derived with color-mix() against --color-sidebar-on rather
   than raw hex. That token was --color-on-accent until 2026-08-31, when the Light
   theme needed the rail's foreground to move while accent buttons stayed white on
   blue; see its note in tokens.css. Nothing about the derivation changed — only
   which colour it derives from, and every percentage below is untouched, which is
   what lets one token swap repaint the whole rail.
   ========================================================================== */

/* The page's own fill is --color-page: the themed "whatever sits behind a page"
   token, which resolves to --color-page-tint on Classic and to the neutral
   --color-background on Light (tokens.css).
   It was --color-page-tint directly from 2026-08-25 ("add the same background
   colour to all pages") until 2026-08-31, when a second theme made "the blue tint"
   and "the page fill" two different statements. Classic renders identically either
   way; the name just stopped pinning every theme to one of them.
   --color-background keeps every other job it had — the fill behind a product
   thumbnail, a table header, a hovered identifier's pill — and on Light it happens
   to be the page too, which is a coincidence of value, not an aliasing. Each page
   also sets `body` to --color-page for the strip a short page leaves outside the
   shell; that is per-page because elements.css does not style body at all. */
.shell {
  display: flex;
  height: 100%;
  background: var(--color-page);

  /* THE RAIL'S FILL IS DEFINED HERE, ON THE SHELL, AND USED BY TWO ELEMENTS
     (moved up from .sidebar 2026-09-07). .sidebar paints it as its own
     background, and proposals.css's content sheet paints the same image across
     a strip 12px wider than the rail so there is rail colour behind the sheet's
     rounded corners. Both need the identical image or the corner shows a tonal
     step against the rail beside it — which is exactly what a second copy of
     these stops would drift into. The stops are px from the element's top and
     both elements are full-height, so one definition renders the same in both.
     STILL ELEMENT PLUMBING, NOT TOKENS. The --sidebar- prefix and the rule about
     nothing outside the rail referencing these both stand; .shell is simply the
     nearest ancestor the two consumers share, and custom properties inherit.
     See --color-sidebar-glow in tokens.css for the colour, and .sidebar below
     for why the peak, the hold and the falloff are the values they are.

     for why the peak, the hold and the falloff are the values they are. */
  --sidebar-glow-solid: 16px;
  --sidebar-glow-mid: 56px;
  --sidebar-glow-height: 150px;
  --sidebar-fill-image: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--color-sidebar-glow) 44%, transparent) 0,
    color-mix(in srgb, var(--color-sidebar-glow) 44%, transparent)
      var(--sidebar-glow-solid),
    color-mix(in srgb, var(--color-sidebar-glow) 22%, transparent)
      var(--sidebar-glow-mid),
    transparent var(--sidebar-glow-height)
  );
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

/* THE FILL IS TWO LAYERS, AND --color-sidebar IS STILL THE BOTTOM ONE. A single
   translucent wash of --color-sidebar-glow sits over the flat fill at the TOP of
   the rail, so the tenant switcher reads as a brighter band that falls off into
   the fill (2026-09-07, request: "add a bit of a gradient on the top section in the
   side bar, a bit of a lighter blue"; Figma h1VLKaMZnXSFvvLTZd1oGf 2270:22173).
   Layered rather than blended into one gradient so every derived value on the rail
   stays what it was — hover, selected, the muted subtitle and the footer divider
   are all color-mix(--color-sidebar-on <n>%) over --color-sidebar and now simply
   composite over the wash where it reaches. Not one of them changed.
   THE GLOW IS PINNED IN PX, NOT %. The Figma frame's stops are percentages of a
   732px artboard; carried across literally, the band would grow on a tall monitor
   and shrink on a laptop, and it is not a proportion of the rail — it is the top
   section, whose height is fixed by the brand block.
   FOUR STOPS, NOT TWO, AND THAT IS THE WHOLE POINT (2026-09-07). A two-stop ramp
   holds full strength across the brand block and then falls off linearly, which
   reads as a band with an edge rather than as light. So the peak is held for 16px
   only — the fade begins inside the switcher instead of below it — and the tail is
   broken by a midpoint at 56px carrying half the peak, putting most of the falloff
   in the first third and stretching what is left over a longer run. That mid stop
   does the same job the eased curve does on .sidebar__link's transition: a linear
   alpha ramp is what makes a gradient look like a band instead of like light.
   THE VALUES ARE THE FOURTH PASS, AND THE RANGE IS THE USEFUL RECORD. 45% held to
   46px was "too strong"; 32% held to 8px, gone by 180, was "too invisible"; their
   midpoint on every axis (40%, 16px, 150px) was right in shape but short at the
   top, so the PEAK alone went up and the midpoint stop moved 20 -> 22 to keep the
   falloff continuous; 46 was tried and settled at 44. The hold and the extent have
   not moved since the third pass. Anyone retuning this should read it as a bracket
   narrowed three times, not as a first guess — and should note that the peak is
   within a point or two of its contrast ceiling (below), so much more strength at
   the top has to be bought with the switcher's ink.
   THE STRENGTH IS LOWER THAN FIGMA'S, ON A CONTRAST MEASUREMENT, NOT A PREFERENCE.
   The frame paints #0968b4 flat to ~30px and hard-stops into the fill 5px later.
   At full strength .sidebar__brand-sub — the tenant region, 12px at 60% ink — is
   3.08:1 against it, down from 6.06:1 on the flat fill and under AA for that size.
   The peak is 44%, near the limit of what the type in the band allows: the sub
   measures 4.59:1 against the peak itself and 4.95:1 at its actual position on the
   ramp (~32% strength), with AA at 4.5 for its size. The white brand name is clear
   everywhere. A materially stronger top needs --sidebar-glow-solid pulled back above
   the sub, or the sub's own 60% raised. Every stop and both strengths are locals,
   so any of that is one line.
   Theme note: Light and Dark both set --color-sidebar-glow to `transparent`, which
   makes the color-mix() transparent and the whole layer a no-op — the gradient
   exists to lift a navy rail and neither of them has one. See tokens.css. */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  /* The wash and the flat fill, as two properties rather than one `background`
     shorthand: the image is shared with .shell (which defines it, above) and the
     colour is the theme token, and a shorthand here would reset one every time
     the other changed. */
  background-image: var(--sidebar-fill-image);
  background-color: var(--color-sidebar);
  color: var(--color-sidebar-on);
  /* 8% black, not --color-outline. The outline token is the app-wide hairline and
     read too strong here: the rail already separates itself from the page by fill,
     so this line only has to close the seam, not draw a border. A literal rgb()
     rather than a token because it is the same 8% black the scrolled app-header
     stroke uses, and it must stay put across themes — a token-derived mix would
     re-tune the seam every time a theme moved its outline. */
  border-right: 1px solid rgb(0 0 0 / 8%);
}

/* Sidebar icons run one step larger than the app-wide 16px: on the dark rail,
   at nav row scale, the shared size read undersized against its label. Scoped
   as a local override of --icon-size so every .icon inside the rail (nav rows,
   carets, brand, collapse) picks it up from the same place and nothing outside
   the sidebar moves. */
.sidebar {
  --icon-size: var(--icon-size-sidebar);
  /* See .sidebar__brand-mark below for why this is here and not on the mark. */
  --sidebar-brand-mark: 32px;

  /* Selected/hover fill for every nav row, section and child alike (2026-08-25,
     on the user's direct instruction, from Figma 2127:2825 "Menu_button").
     Defined once here rather than repeated in the four rules that use it —
     .sidebar__link:hover, --active, .sidebar__sublink:hover, --active — which
     is what stops a selected section and a selected child drifting apart. The
     --sidebar- prefix is deliberate, the same way app-header.css uses --app-:
     these are this element's private plumbing, NOT system tokens, and nothing
     outside the rail may reference them.

     THE FRAME'S VALUE, AND WHY THE BOTTOM STOP IS NOT IT:
     Figma draws white 10% -> #999999 10%, top to bottom. #999999 is not a token
     and adding one is a system decision, so it is not written here. It does not
     need to be: the sidebar's whole overlay vocabulary is already
     color-mix(--color-sidebar-on <n>%, transparent) — the flat fills these
     gradients replace were exactly that at 8% and 10% — so the falloff is
     expressed as less white instead of as a grey.
     Composited over --color-sidebar (#18294F), #999999 at 10% and white at 6%
     differ by at most 3.2/255 on any channel (R 36.90 vs 37.86, G 52.20 vs
     53.84, B 86.40 vs 89.56). Not a visible difference, and it costs no token.

     SELECTED IS ABOVE THE FRAME'S VALUE NOW, AND THE RAIL IS WHY (2026-09-07,
     request: "make the active selected item in the side bar background a bit
     lighter so that it's more visible, now that the side bar itself got lighter
     and more colourful"). The frame's 10% was measured against a near-black rail
     (#021627, flat). The rail is now #18294F with a lighter blue washed over its
     top 150px, so the SAME 10% white sits on a lighter, more saturated ground and
     reads as less: a white overlay is only as visible as the gap between it and
     what is under it, and the fill moved up while the overlay did not. The top stop
     of 16% restores that gap.
     THE BOTTOM STOP IS THE FRAME'S 6%, HELD WHILE THE TOP ROSE, and that is a
     deliberate break from the frame's 0.6 falloff ratio (2026-09-07, second pass:
     "still make sure that the gradient is visible in this list item background, so
     it starts light and gets a bit darker towards the bottom"). At 16 -> 10 the two
     stops composite to roughly 14/255 apart on each channel over #18294F — present,
     but on a 36px row that reads as a flat pill rather than as a ramp, and on a
     28px child row it all but disappears. Holding the bottom at 6 puts them ~23/255
     apart, which is what makes the light-to-dark direction legible at row height.
     So the ratio is now 0.375, not the frame's 0.6: the top carries the visibility
     of the selected state and the bottom carries its shape, and those turned out to
     be two requests rather than one. Both stops are therefore literal, not derived
     from each other — do not re-impose a single falloff multiplier on them.

     Hover keeps its existing 8% -> 5% UNCHANGED, and the widening gap is the
     point, not a side effect. Hover has to stay under selected or the two states
     invert; it was 8 against a 10 selected, which is a 2-point separation doing
     the work of distinguishing "pointer is here" from "this is the page you are
     on". Against a 16 selected that separation is 8 points, so selection now
     reads at a glance rather than on comparison, and a hovered row is clearly the
     quieter of the two. Hover is DERIVED, not referenced: the file has one node
     and no hover variant, so nothing in Figma pins it.
     KNOWN INCONSISTENCY, LEFT ALONE ON PURPOSE: hover's own 8 -> 5 is still a 0.625
     falloff, so the two gradients no longer share a shape the way they did when
     both ran the frame's 0.6. Hover is faint enough at 8% that a steeper ramp inside
     it is not perceptible, and matching it would mean a 3% bottom stop — a hovered
     row that fades to almost nothing at its lower edge. Raised here rather than
     fixed silently; if the two should share a curve again, hover's TOP is the value
     to move, not selected's bottom.

     to move, not selected's bottom.

     A THEME MAY REPLACE EITHER GRADIENT OUTRIGHT, and a LIGHT RAIL HAS TO. Everything
     above describes an overlay of --color-sidebar-on, and that derivation only means
     "highlight" while the rail is DARKER than its own ink. On a light rail the same
     expression is a wash of near-black: a selected row gets a grey smudge where a
     dark rail gets a lift. No percentage fixes it, because the direction is wrong
     rather than the amount.
     So --color-sidebar-selected-fill and --color-sidebar-hover-fill (tokens.css,
     unset at :root) are the hook: a theme sets them and the rail takes them whole; no
     theme sets them and the fallback below is the value, byte for byte what it was
     before the hook existed. Classic and Dark set neither. This is a TOKEN and not a
     [data-theme] .sidebar__link rule — see CLAUDE.md on why a second one of those
     means the token set is missing a name. This was the missing name.
     (Added for the New theme on 2026-09-07, removed with it when the themes were
     consolidated, and restored the same day for Light, whose rail became pale blue.
     Worth noting it has now been needed twice: any future light-rail theme needs it
     too, so it is not speculative generality.)
     A WHOLE GRADIENT RATHER THAN A COLOUR PLUS FOUR PERCENTAGES, because the stops
     are not a scale: as the note above says, selected's 16 and 6 are literal and
     independent — one carries visibility, the other shape — so there is no single
     parameter a theme could move that would mean anything. */
  --sidebar-fill-selected: var(
    --color-sidebar-selected-fill,
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--color-sidebar-on) 16%, transparent),
      color-mix(in srgb, var(--color-sidebar-on) 6%, transparent)
    )
  );
  --sidebar-fill-hover: var(
    --color-sidebar-hover-fill,
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--color-sidebar-on) 8%, transparent),
      color-mix(in srgb, var(--color-sidebar-on) 5%, transparent)
    )
  );
}

/* Tenant switcher — the whole row is the control, so it carries the hover. */
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  width: calc(100% - var(--space-16));
  padding: 6px;   /* off-scale, from Figma — do not round, see CLAUDE.md */
  /* 8px here + 8px of .sidebar__nav padding = the 16px the brand needs to sit
     clear of the first nav row. */
  margin: var(--space-8);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar__brand:hover {
  background: color-mix(in srgb, var(--color-sidebar-on) 8%, transparent);
}

/* The size lives on .sidebar as --sidebar-brand-mark rather than as a literal here,
   because the COLLAPSED brand has to centre this mark and a parent cannot read a
   child's own width. Custom properties inherit downward, so the one place that knows
   the number is above both of them. Overriding the size is a one-line repoint on
   .sidebar — which is what the prototype's sidebar-brand-logo.css does to take it
   to 28 — and the collapsed inset follows automatically instead of silently
   mis-centring by half the difference. */
.sidebar__brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sidebar-brand-mark);
  height: var(--sidebar-brand-mark);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-sidebar-on) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-text-primary) 15%, transparent);
  font: var(--weight-medium) var(--text-body-sm) var(--font-sans);
  flex-shrink: 0;
}

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sidebar__brand-name {
  font: var(--weight-medium) var(--text-body-sm) var(--font-sans);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__brand-sub {
  font: var(--weight-regular) var(--text-body-sm) var(--font-sans);
  line-height: 1.2;
  color: color-mix(in srgb, var(--color-sidebar-on) 60%, transparent);
}

.sidebar__brand .icon {
  color: color-mix(in srgb, var(--color-sidebar-on) 60%, transparent);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 6px;   /* off-scale, from Figma — do not round, see CLAUDE.md */
  padding: var(--space-8);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}

/* flex-shrink:0 throughout the nav. Without it, expanding a section overflows the
   bounded column and every row compresses a pixel or two instead of scrolling —
   which reads as the whole list drifting when you open and close a section. */
.sidebar__group {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* Either <a> (navigates) or <button> (expands its children) — the button reset
   keeps the two identical. */
.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  width: 100%;
  /* 36px, a sidebar-local literal rather than --control-height (2026-09-03,
     request; 40 first, then pulled back a step). The nav row is not a control:
     it is the primary target on the page, hit repeatedly, and at 32 the rows
     read as a tight list rather than a menu — 36 buys that room without the
     nav claiming the height a page title has. Not retokenised to
     --control-height, which buttons, inputs and selects share — raising that
     would grow every form on every page. Child rows keep
     --control-height-compact, so the two levels stay distinguishable by size
     as well as indent. */
  height: 36px;
  flex-shrink: 0;
  padding: 0 var(--space-8);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  font: var(--weight-regular) var(--text-body-sm) var(--font-sans);
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.sidebar__link > span:not([class]) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__link:hover {
  background: var(--sidebar-fill-hover);
}

/* Active row: a lighter navy pill on the navy rail, white medium-weight text —
   it reads as raised out of the sidebar rather than punched through it. */
.sidebar__link--active,
.sidebar__link--active:hover {
  background: var(--sidebar-fill-selected);
  font-weight: var(--weight-medium);
}

/* Emphasis follows the active row in CSS, so selection changes at runtime don't
   need to shuffle classes on the icon. */
.sidebar__link--active .icon:not(.sidebar__caret):not(.sidebar__caret-static) {
  stroke-width: var(--icon-stroke-emphasis);
}

/* Every caret is a chevron-right, so expandable and navigating rows are
   optically identical at rest — a rotated chevron-down does not land in the same
   place as a real chevron-right, which is what made Plugins and Finance look off.
   Expanding rotates the same glyph a quarter turn. */
.sidebar__caret,
.sidebar__caret-static {
  margin-left: auto;
  opacity: 0.6;
}

.sidebar__caret {
  transition: transform 0.16s cubic-bezier(0.2, 0, 0, 1);
}

.sidebar__caret--open {
  transform: rotate(90deg);
}

/* Children indent to 24px so their text hangs under the parent's label,
   not its icon. Children never carry icons.

   Open and close animate rather than snap. The list has no fixed height — it is
   two rows under Settings and eight under Orders — so the height is animated with
   the grid 0fr -> 1fr trick: the sublist is a one-track grid and the track, not a
   hard-coded height, is what transitions. That is why the children sit in
   .sidebar__sublist-inner (js/shell.js): a single child for the single track, and
   its padding and gap collapse with it. A flex column cannot do this, which is why
   the sublist is a grid here and a flex column everywhere it isn't animating.

   0.16s, the same duration as the caret it moves with, so the row and its chevron
   read as one gesture. Fast enough to stay snappy — the list is already open by the
   time the pointer has settled — and the ease-out curve puts most of the movement
   in the first half, which is what makes a short duration read as smooth rather
   than as a jump. */
.sidebar__sublist {
  display: grid;
  grid-template-rows: 1fr;
  transition:
    grid-template-rows 0.16s cubic-bezier(0.2, 0, 0, 1),
    opacity 0.16s ease;
}

/* [hidden] is still the single source of truth for open/closed — shell.js sets it
   and nothing else changes — so the closed state is styled off the attribute
   instead of a second class that could drift from it. Overriding the UA's
   display:none is what lets the close animate at all; `visibility: hidden`,
   delayed until the collapse finishes, then does display:none's real job of taking
   the collapsed links out of the tab order and the accessibility tree. */
.sidebar__sublist[hidden] {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition:
    grid-template-rows 0.16s cubic-bezier(0.2, 0, 0, 1),
    opacity 0.12s ease,
    visibility 0s linear 0.16s;
}

/* overflow:hidden is what the 0fr track clips against — without it the children
   keep their own height and spill out of the collapsed track. min-height:0 stops
   the flex column's default min-content floor from propping the track open. */
/* NO HORIZONTAL PADDING — the child's indent is the child's own padding-left, not
   an inset on this wrapper (2026-09-07, request: "make sure sub side bar items'
   highlight spans across the entire width of the element"). The 24px used to live
   here, which shortened the hover and selected pill by 24px on BOTH sides and left
   a child's highlight visibly narrower than its parent row's; the text sat in the
   right place and the fill did not. Moving it onto .sidebar__sublink leaves every
   label exactly where it was (24 + 8 = the same 32px) and lets the pill run the
   full width of the nav, edge-aligned with .sidebar__link above it. */
.sidebar__sublist-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  min-height: 0;
  overflow: hidden;
}

.sidebar__sublink {
  display: flex;
  align-items: center;
  height: var(--control-height-compact);
  flex-shrink: 0;
  /* Left indent + right inset, replacing .sidebar__sublist-inner's horizontal
     padding so the fill reaches the nav's edges. 32 = the 24 the wrapper held plus
     the 8 this row already had, i.e. the label does not move; 8 on the right is
     .sidebar__link's own value, so the two levels end flush. */
  padding: 0 var(--space-8) 0 var(--space-32);
  border-radius: var(--radius-sm);
  color: color-mix(in srgb, var(--color-sidebar-on) 70%, transparent);
  text-decoration: none;
  font: var(--weight-regular) var(--text-body-sm) var(--font-sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__sublink:hover {
  background: var(--sidebar-fill-hover);
  color: var(--color-sidebar-on);
}

/* Selected child: the same pill and medium weight as a selected section, so
   selection reads identically at both levels. The child stays smaller and indented,
   which is what keeps the two apart — never a second selection treatment. */
.sidebar__sublink--active,
.sidebar__sublink--active:hover {
  background: var(--sidebar-fill-selected);
  color: var(--color-sidebar-on);
  font-weight: var(--weight-medium);
}

/* The sidebar is fully usable without the motion, so it is dropped outright
   rather than shortened — same call as the page fade in the prototype's
   app-transitions.css. Open and close still work; they just happen at once. */
@media (prefers-reduced-motion: reduce) {
  .sidebar__caret,
  .sidebar__sublist,
  .sidebar__sublist[hidden],
  /* The collapse goes the same way: the rail still opens and closes, it just does
     it in one frame. Width, the row insets and the label fade are all listed —
     dropping only the width would leave the labels dissolving over a rail that had
     already snapped shut. */
  .sidebar,
  .sidebar__link,
  .sidebar__brand,
  .sidebar__rail,
  .sidebar__link > span:not([class]),
  .sidebar__caret-static,
  .sidebar__brand-text,
  .sidebar__logo {
    transition: none;
  }
}

.sidebar__footer {
  flex-shrink: 0;
  padding: var(--space-8);
}

/* Bottom rail: product mark on the left, collapse toggle on the right.
   Negative side margins cancel .sidebar__footer's own padding so the rule
   above traces the sidebar's full width, edge to edge — CLAUDE.md: "a divider
   inside a padded container spans the container's full width... never just
   the padded content width." The rail's own matching padding re-insets its
   CONTENT (the logo, the collapse button) by that same amount, so nothing
   else about the layout moves. */
.sidebar__rail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* 8px above the rule and 8px below it — the separator sits in its own gap.
     Left padding is 12px, not the others' 8px: the logo read as too close to
     the sidebar's true edge at the standard inset. */
  margin: var(--space-8) calc(var(--space-8) * -1) 0;
  padding: var(--space-8) var(--space-8) var(--space-4) var(--space-12);
  border-top: 1px solid color-mix(in srgb, var(--color-sidebar-on) 12%, transparent);
}

/* Brand artwork, not an icon — a real asset file that carries its own colour
   and is never restyled (same convention as .channel-mark). Sized by height
   so the wordmark+mark lockup scales as one unit; width follows from the
   asset's own aspect ratio. */
.sidebar__logo {
  height: 18px;
  width: auto;
}

.sidebar__collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height-compact);
  height: var(--control-height-compact);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: color-mix(in srgb, var(--color-sidebar-on) 60%, transparent);
  cursor: pointer;
}

.sidebar__collapse:hover {
  background: color-mix(in srgb, var(--color-sidebar-on) 8%, transparent);
  color: var(--color-sidebar-on);
}

/* One glyph shows, the other is out of flow. Both are in the markup because
   mountIcons() consumes the [data-icon] element and keeps only its class, so there
   is nothing left to rewrite after mount — see the note in shell.js. */
.sidebar__collapse-glyph--open {
  display: none;
}

/* --------------------------------------------------------------------------
   Sidebar — collapsed
   --------------------------------------------------------------------------
   2026-09-07, request: "make the sidebar collapse icon in the bottom right be real
   like from lucide icons, and make it work. Make sure the collapse of the side bar
   is smooth, that icons are centred once collapsed and y position is kept as is.
   For the logo elements at top and bottom, just keep the logos visible in collapsed
   mode."

   ONE REPOINTED TOKEN IS THE WHOLE STATE. --sidebar-width becomes
   --sidebar-width-collapsed and four things move at once: the rail, the content
   sheet's rail strip (proposals.css), and the two fixed peek layers that start at
   the rail's right edge. None of them learns about collapsing. This is why the
   attribute is on <html> rather than a class on .sidebar — three of the four are
   outside the rail and could not see it.

   NOTHING MOVES VERTICALLY. Every row keeps its height (36px top level, 28 for the
   footer's rail) and its order, so an icon that was at a given y before the collapse
   is at that same y after it. The rail narrows and the labels go; that is all.

   THE ICONS ARE CENTRED BY PADDING, NOT BY justify-content, AND THAT IS WHAT MAKES
   IT SMOOTH. `justify-content: center` is the obvious way and it is visibly wrong
   here: the label leaves the flow on the first frame, so the icon jumps to the
   middle of a row that is still 204px wide and then slides back left as the width
   animates — a lurch right, then a glide left. Transitioning the row's horizontal
   padding instead moves the icon from 16px to 23px from the rail's edge, seven
   pixels, while the rail travels 156. The icon effectively stays put and the rail
   closes around it.
   The inset is derived, not measured: half of what is left of a collapsed row once
   the icon is taken out of it. Written from the tokens it depends on, so it stays
   correct if the collapsed width or the rail's icon size ever changes, and it is not
   a literal CLAUDE.md would (rightly) reject.

   LABELS FADE, THEY DO NOT DISAPPEAR. .sidebar__link already carries
   overflow: hidden and white-space: nowrap, so a narrowing row clips its own text
   for free — but a label chopped mid-word for 160ms reads as breakage. Opacity over
   half the width's duration gets it out of the way first and lets the clip finish
   the job unseen. The labels keep their space in the flow the whole time, which is
   the other half of why the icon does not jump.

   SUBLISTS CLOSE, AND THIS IS THE ONE PLACE VERTICAL POSITION DOES CHANGE. Child
   rows carry no icon by design ("Children never carry icons", the nav's own rule),
   so a collapsed rail with a section open would show a run of empty pills. Hidden
   with display:none rather than by clearing aria-expanded, so the open/closed state
   is untouched and expanding the rail again restores exactly the sections that were
   open. Rows below an expanded section do rise while collapsed; the alternative was
   a blank gap the height of the sublist. Flagged, not assumed. */
html[data-sidebar-collapsed] {
  --sidebar-width: var(--sidebar-width-collapsed);
}

.sidebar {
  /* The same 0.16s and the same curve as .sidebar__sublist and .sidebar__caret, so
     the rail's three motions read as one system rather than three decisions. */
  transition: width 0.16s cubic-bezier(0.2, 0, 0, 1);
}

/* Restoring a collapsed rail on a fresh page load must not animate — a rail that
   slides shut while the page paints reads as closing by itself. shell.js sets this
   for two frames around the boot call; see applySidebarCollapsed(). */
html[data-sidebar-no-anim] .sidebar,
html[data-sidebar-no-anim] .sidebar * {
  transition: none;
}

.sidebar__link,
.sidebar__brand,
.sidebar__rail {
  transition: padding 0.16s cubic-bezier(0.2, 0, 0, 1);
}

.sidebar__link > span:not([class]),
.sidebar__caret,
.sidebar__caret-static,
.sidebar__brand-text,
.sidebar__brand .icon,
.sidebar__logo {
  transition: opacity 0.08s ease;
}

html[data-sidebar-collapsed] .sidebar__link > span:not([class]),
html[data-sidebar-collapsed] .sidebar__caret,
html[data-sidebar-collapsed] .sidebar__caret-static,
html[data-sidebar-collapsed] .sidebar__brand-text,
html[data-sidebar-collapsed] .sidebar__brand .icon {
  opacity: 0;
}

/* Half of what a collapsed row has left over once its icon is accounted for:
   the rail, less .sidebar__nav's padding on both sides, less the icon. */
html[data-sidebar-collapsed] .sidebar__link {
  padding-left: calc(
    (var(--sidebar-width) - var(--space-8) * 2 - var(--icon-size-sidebar)) / 2
  );
  padding-right: calc(
    (var(--sidebar-width) - var(--space-8) * 2 - var(--icon-size-sidebar)) / 2
  );
}

/* The tenant mark stays — it is one of the two logos asked for. Its own padding
   centres it the same way, against the 32px mark rather than an 18px icon. */
html[data-sidebar-collapsed] .sidebar__brand {
  padding-left: calc(
    (var(--sidebar-width) - var(--space-16) - var(--sidebar-brand-mark)) / 2
  );
  padding-right: calc(
    (var(--sidebar-width) - var(--space-16) - var(--sidebar-brand-mark)) / 2
  );
}

html[data-sidebar-collapsed] .sidebar__sublist {
  display: none;
}

/* The bottom rail stacks. Side by side, the brand and the toggle need more width
   than the whole collapsed rail has; stacking keeps BOTH, which is what "keep the
   logos visible" requires of the one that would otherwise have to go. Column
   direction follows DOM order, so the mark stays above the toggle exactly as the
   lockup sat left of it. */
html[data-sidebar-collapsed] .sidebar__rail {
  flex-direction: column;
  justify-content: center;
  gap: var(--space-4);
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}

/* The lockup out, the mark in. Both are in the document from the start — see the
   note in shell.js on why this is not one <img> with its src swapped. */
html[data-sidebar-collapsed] .sidebar__logo {
  display: none;
}

.sidebar__logo--mark {
  display: none;
  height: 20px;
}

html[data-sidebar-collapsed] .sidebar__logo--mark {
  display: block;
}

html[data-sidebar-collapsed] .sidebar__collapse-glyph--close {
  display: none;
}

html[data-sidebar-collapsed] .sidebar__collapse-glyph--open {
  display: block;
}

/* --------------------------------------------------------------------------
   Main column
   -------------------------------------------------------------------------- */

.shell__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* [data-page-content] (js/shell.js, docs/proposals.md — the wrapper a page
   uses so mountSidebarNav() can swap it for [data-unbuilt-view] when the
   sidebar selects a different section) sits between .shell__main and .page in
   every page that has it, but was never given the flex properties that
   relationship depends on — a plain block box defaults to sizing itself to
   its content's natural height instead of the space .shell__main actually has
   to give it, so .page's own `overflow-y: auto` (below) never had a bounded
   height to scroll within; content past the fold was clipped by
   .shell__main's own overflow:hidden instead of scrolling. Same flex
   properties as .shell__main itself, since this wrapper's whole job is to be
   invisible to that layout, not to add a second one. */
[data-page-content] {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Author styles beat the UA stylesheet's own `[hidden] { display: none }`
   regardless of specificity (different cascade origins, not a specificity
   contest) — without this, the rule above would keep this wrapper visible
   even while `.hidden = true`, showing it and [data-unbuilt-view] at once. */
[data-page-content][hidden] {
  display: none;
}

/* Global header — spans the full page width, always. Breadcrumb left;
   AI assistant, notifications and account right. Never the page title.
   The bottom divider separates app chrome from page content, and as of
   2026-09-07 it only appears once there is content to separate — see the
   [data-page-scrolled] rule below. */
.app-header {
  height: var(--app-header-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: 0 var(--page-gutter);
  /* The l-shaped shell repoints this to the rail's own fill (see the rule further
     down), which is what makes the header and the sidebar read as one band. In the
     default shell the header is a surface, as it always was. */
  background: var(--color-surface);
  /* 8% black (2026-08-25, on request: global header and sticky header, all
     pages). Takes --color-outline-card rather than the general --color-outline
     every other divider uses — see that token's own note in tokens.css about
     its name now reaching past cards.
     TRANSPARENT AT REST (2026-09-07, on request: "remove the global divider
     stroke unless the page is scrolling"). The border stays in the box at 1px so
     the header's height, and every offset measured against it, are unchanged —
     the rule below only ever moves its COLOUR. Dropping the declaration instead
     would shift the whole page a pixel the moment the divider came back. */
  border-bottom: 1px solid transparent;
}

/* The divider, once the page has moved. A line under the header at scrollTop 0
   draws a boundary the layout is already making perfectly clear; the line's real
   job is to catch content sliding under the header, and that only happens once
   you scroll.
   [data-page-scrolled] is set on <html> by mountScrolledState() in js/shell.js —
   see the note there for why this cannot be animation-timeline: scroll(), and for
   what "the page" means when a page holds several views.
   NOT TRANSITIONED. The stroke appears on the first pixel of scroll; a fade over
   even 120ms reads as the line lagging the content rather than as chrome
   responding to it. It is 8% black — there is very little to ease.
   THE STICKY PAGE HEADER KEEPS ITS DIVIDER UNCONDITIONALLY (.page-header:has(.tabs)
   below, which carries a copy of the comment above because the two came in together
   on 2026-08-25). This request names the global one, and that is the right line to
   split on: the sticky header always has a fold's worth of content beneath it to
   separate, so its stroke is doing work at every scroll position including 0. */
html[data-page-scrolled] .app-header {
  border-bottom-color: var(--color-outline-card);
}

/* L-shaped shell (js/shell.js, Settings panel) — the header takes the sidebar's own
   dark fill, so the two read as one continuous band wrapped around the page rather
   than a white strip sitting on top of a dark column. The sidebar's own right border
   drops so the fill runs seamlessly around the corner. Header controls borrow the
   sidebar's own on-accent treatment (see .sidebar__link, .sidebar__collapse above)
   for the same reason a white .btn would otherwise read as a chip sitting on the
   dark fill, not chrome that belongs to it. */
/* --------------------------------------------------------------------------
   Heading typeface — the "Headings" setting in the app header's own panel
   (js/shell.js, HEADING_FONTS). "Unique" pins headings to --font-ui, the fixed
   Plus Jakarta Sans that tokens.css already keeps out of the typeface picker's
   reach, so the page reads in two faces: headings in the system's own, body copy
   in whichever the picker chose.

   Keyed on ["unique"], not on :not(["match"]) — flipped 2026-08-20 when Match body
   became the DEFAULT. The rule for a default has to be the ABSENT one: a page where
   shell.js has not run yet, or at all, has no attribute, and whichever state the
   selector catches in that gap is what paints first. It used to catch Brand because
   Brand was the default; keyed the old way now, every page would flash headings in
   --font-ui and snap to the body face once the script ran. "Unique" is the state
   that has to be asked for, so it is the state that carries a rule.

   font-family ALONE, deliberately. Every heading below sets size and weight
   through the `font:` shorthand, and the shorthand resets what it does not name —
   so overriding with the shorthand would silently re-declare the scale. This
   changes the family and nothing else, which is the whole point of the setting.

   An explicit selector list, not a variable: there is no --font-heading, and
   adding one is a token decision rather than an element one. h1-h4 catches the
   semantic headings a page writes for itself; the two classes are the system's
   own heading rules. Proposal-level titles (.filter-drawer__title and friends)
   are covered by the matching rule in proposals.css. Page-local heading classes
   in a prototype's own <style> are NOT covered unless they are h-elements.
   -------------------------------------------------------------------------- */
:root:not([data-heading-font="match"]) :is(h1, h2, h3, h4, .page-header__title, .card__title, .table__title) {
  /* ARCHIVO SINCE 2026-09-15 (on request). It was --font-ui, the chrome's own face,
     which made "Unique" mean "the Settings panel's face" — and said nothing at all
     on New, whose body is that same Plus Jakarta Sans. --font-heading is its own
     token now (tokens.css, where the reasoning sits); nothing at runtime overrides
     it, so the headings hold Archivo whichever body typeface is picked.
     Archivo is a two-axis variable face, so it takes the same two lines the
     typeface picker gives it on body (tokens.css, [data-typeface="archivo"]):
     without them a heading renders at whatever width axis the browser settles on
     while the body — when Archivo is also the body face — renders at the stated
     100, and the two read as different fonts. */
  font-family: var(--font-heading);
  font-optical-sizing: auto;
  font-variation-settings: "wdth" 100;
}

[data-shell-shape="l-shaped"] .sidebar {
  border-right: none;
}

/* The header takes the rail's fill and the rail's ink, so the two read as one band
   wrapped around the page. Every control in the band follows, in the eight rules
   below — that treatment predates the shape consolidation and is what the L has
   always been; what changed on 2026-09-07 is that this shape now also makes the page
   a card (proposals.css), which is why the always-on border-bottom that used to be
   here is gone. The card's own edge draws that boundary; the header keeps only the
   scroll-triggered stroke, re-coloured for this band in proposals.css. */
[data-shell-shape="l-shaped"] .app-header {
  /* TWO PROPERTIES, NOT THE `background` SHORTHAND, AND THE IMAGE IS THE POINT
     (2026-09-07: "the gradient clashes with the solid header colour, make this look
     uniform, make the gradient naturally spread in that direction").
     The rail carries a wash over its top 150px; the header was a flat
     --color-sidebar beside it, so on Classic the top of the rail was visibly lighter
     than the header two pixels to its right and the L read as two panels rather than
     one band. Painting the SAME --sidebar-fill-image here fixes it exactly, with no
     second set of stops to keep in sync.
     IT ALIGNS FOR FREE, and that is a property of how the gradient was written
     rather than luck: its stops are px FROM THE ELEMENT'S TOP, and the header and
     the rail both start at y=0 of the viewport. The header is 44px tall, so it
     renders stops 0..44 of the same ramp the rail renders at 0..44. No offset, no
     background-attachment, nothing to recompute if --app-header-height moves.
     The shorthand would reset one of these every time the other changed — the same
     reason .sidebar itself splits them (see its note above).
     THEMES WITH NO WASH ARE UNAFFECTED: Light and Dark set --color-sidebar-glow to
     transparent, which makes the image a no-op, and the header is flat
     --color-sidebar exactly as before. */
  background-color: var(--color-sidebar);
  background-image: var(--sidebar-fill-image);
  color: var(--color-sidebar-on);
}

[data-shell-shape="l-shaped"] .app-header .breadcrumb {
  color: color-mix(in srgb, var(--color-sidebar-on) 70%, transparent);
}

[data-shell-shape="l-shaped"] .app-header .breadcrumb__current,
[data-shell-shape="l-shaped"] .app-header .breadcrumb a:hover {
  color: var(--color-sidebar-on);
}

[data-shell-shape="l-shaped"] .app-header .btn:not(.btn--ai) {
  background: transparent;
  border-color: color-mix(in srgb, var(--color-sidebar-on) 20%, transparent);
  color: var(--color-sidebar-on);
  box-shadow: none;
}

[data-shell-shape="l-shaped"] .app-header .btn:not(.btn--ai):hover:not(:disabled):not(.btn--pending) {
  background: color-mix(in srgb, var(--color-sidebar-on) 8%, transparent);
}

/* These three read --color-sidebar-on, not --color-on-accent (fixed 2026-09-02
   with the Dark theme). In the l-shaped shell the header band sits ON THE SIDEBAR
   FILL, so its ink is the rail's ink — which is exactly the job --color-sidebar-on
   was added for on 2026-08-31, and the three rules just below/above them already
   name it. They were the leftovers of the derive-everything-from---color-on-accent
   pass that token replaced, and under Classic and Light the two resolve to the same
   colour so nothing showed. Dark is the first theme where they part: on-accent is
   a near-black ink for a light accent fill, and painting the header's icons in it
   over #030303 left the band blank. */
[data-shell-shape="l-shaped"] .app-header .btn--ai {
  background: color-mix(in srgb, var(--color-sidebar-on) 6%, transparent);
}

[data-shell-shape="l-shaped"] .app-header .btn .icon {
  color: color-mix(in srgb, var(--color-sidebar-on) 70%, transparent);
}

[data-shell-shape="l-shaped"] .app-header .btn:hover:not(:disabled):not(.btn--pending) .icon {
  color: var(--color-sidebar-on);
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-left: auto;
  flex-shrink: 0;
}

/* AI assistant — square with the standard corner radius, like every other
   header control. It is set apart by the blue edge and glow, not by shape. */
.btn--ai {
  border-radius: var(--radius-sm);
  border-color: var(--color-ai-edge);
  background: var(--color-surface);
  color: var(--color-accent-secondary);
  box-shadow: 0 0 8px 1px color-mix(in srgb, var(--color-ai-edge) 25%, transparent);
}

/* Breadcrumb — always shown, including at two levels.

   BODY-SM, REGULAR (2026-09-08, core change on request: "the breadcrumb should use
   body-sm at regular size"). It was --text-body-md, the same 16/20 as the page's own
   body copy, which put the crumb trail at the size of the content it points into. The
   crumb is orientation, not content: 14/16 keeps it legible in the global header while
   letting the page title and the body it sits above outrank it.
   The weight is unchanged — it was already --weight-regular, and the instruction names
   it to pin it, so a future pass does not reach for medium to win back the size.
   THIS IS A CORE CHANGE AND IT LANDS EVERYWHERE. Every page's global header uses this
   one class (shell.js builds the trail), so nothing needs a per-page follow-up. Two
   things deliberately NOT retuned with it: the 6px gap, which is off-scale from Figma
   and governed by CLAUDE.md, and .breadcrumb__sep's 14px box, which is a hair over the
   new 16px line box and reads as level with it — a separator scaled to match the type
   exactly tends to read as smaller than the text either side of it. */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;   /* off-scale, from Figma — do not round, see CLAUDE.md */
  min-width: 0;
  font: var(--weight-regular) var(--text-body-sm) var(--font-sans);
  color: var(--color-text-secondary);
}

.breadcrumb a {
  color: inherit;
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-text-primary);
  text-decoration: underline;
}

.breadcrumb__sep {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  flex-shrink: 0;
}

.breadcrumb__current {
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Page header — title, actions, tabs. Sits below the global header, on the
   same white surface. Its bottom border is the seam against the page body.
   -------------------------------------------------------------------------- */

/* Sits on the page background by default — the global header's divider is the
   only rule between chrome and content. Tabs change that: they need a surface to
   sit on and a rule for the active underline to break, so a page header carrying
   tabs becomes a white band with its own divider. */
/* Always full width — a capped-content page's header band, background and
   border-bottom still span edge to edge; only its CONTENT is capped, on
   .page-header__row and .page-header's own direct-child .tabs below. A page
   header that capped itself, background included, would show a "floating"
   band with the page's plain background peeking in on both sides — the same
   bug .page__body's own cap doesn't have, since .page__body has no
   background of its own to leak past its edges. */
.page-header {
  flex-shrink: 0;
  width: 100%;
}

/* Capped and centred exactly like .page__body — a capped-content page (an
   order, a product) must not show full-width content under a full-width
   header band. Follows .page__body--full automatically via :has(), so a
   table-heavy page's content goes full width with no second modifier to
   remember. `.page-header > .tabs` (not the bare `.tabs` used elsewhere,
   e.g. nested inside a tab panel's own content) is this header's OWN tab
   row — the channel nav doesn't need a second rule here, it already lives
   inside `.page-header__row` via `channelBarHTML()` in js/shell.js. */
.page-header__row,
.page-header > .tabs {
  max-width: var(--page-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--page-gutter);
  box-sizing: border-box;
}

.page:has(.page__body--full) .page-header__row,
.page:has(.page__body--full) .page-header > .tabs {
  max-width: none;
}

/* The channel nav needs the same white band for the same reason a tab set does —
   its recessed track has to sit on a surface, not on the page fill. */
.page-header:has(.tabs),
.page-header:has(.channel-nav) {
  background: var(--color-surface);
  /* 8% black (2026-08-25, on request: global header and sticky header, all
     pages). Takes --color-outline-card rather than the general --color-outline
     every other divider uses — see that token's own note in tokens.css about
     its name now reaching past cards. */
  border-bottom: 1px solid var(--color-outline-card);
}

/* Opt-in, not automatic just because a header has tabs and/or actions — see
   CLAUDE.md and docs/shell-forms.md, "Variations". A bare title never gets it,
   since there's nothing on it worth pinning. */
.page-header--sticky {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* 80 = the title's own 48px line box with 16px of air above and below it — the
   same 16 as --page-gutter, so the space over the heading matches the page's left
   inset, and the space under it (the body's padding-top is zeroed beneath a bare
   header, below) matches it too. The row centres its content, so the 32 splits
   itself without a padding declaration.
   MEASURED AND CONFIRMED AT 80 ON 2026-09-15, on request: "reduce the vertical
   space between the page title, the content below and the container edge above,
   to be the same as the left padding... remove the extra 8 padding above the page
   title and make sure the space to the first element in a page like Orders is
   16px". The extra 8 was NOT in this rule — it was the +8 title rows the Orders
   and Products lists set page-locally, which put 24px over the heading. Those are
   gone; this value is what the request asks for and it was briefly taken to 64
   before the boxes were measured (the heading's line box is 48, not the 32 an
   earlier version of this comment claimed — 64 would give 8 and 8).
   WAS 64 until 2026-09-08, when it went up on request. .page-header--channel pins
   its own 64px and is deliberately NOT included: that row holds a 46px nav track,
   not a heading. */
.page-header__row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-height: 80px;
}

.page-header__title {
  margin: 0;
  min-width: 0;
  font: var(--weight-medium) var(--text-heading-2xl) var(--font-sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Content-page actions: top right, in line with the title. */
.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-left: auto;
  flex-shrink: 0;
}

/* Tabs — line style, horizontal by default. Breaks page content into chunks the
   user reads in place; not for navigating between pages (that's the sidebar) and
   not for steps visited in any order (that's .subnav).
   .tabs--vertical reorients the same element: the underline moves to the left
   edge instead of the bottom. It is not .subnav — subnav fills the active row;
   this keeps the line-tab look, just rotated. */

.tabs {
  display: flex;
  align-items: center;
  gap: var(--space-16);
}

.tabs--vertical {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-4);
}

/* Works as either <a> or <button> — the button reset keeps them identical.
   inline-flex + gap so an icon and label centre together; a text-only tab is
   unaffected since there's nothing to gap against. */
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  /* 14px, off-scale, and it is what sets the height of EVERY tab bar in the app —
     .page-header > .tabs has no vertical padding of its own, so the row is this
     padding plus the label's line box plus the 2px underline. Was 10px, from Figma,
     which gave the 40px row the frame drew; raised to 14 on 2026-09-07 ("increase
     the height of tab bars, in default and fixed sticky position, by 8px"), +4 each
     side for the 8 asked for.
     ONE VALUE COVERS BOTH STATES the request names: .page-header--sticky sets
     position, top and z-index and nothing else, so a pinned tab bar has always been
     the same height as a resting one. There was no second number to change.
     Still off-scale and still do not round it — see CLAUDE.md. Rounding to
     --space-16 would add another 4px to every tab bar in the app. */
  padding: 14px var(--space-2);
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--color-text-secondary);
  text-decoration: none;
  font: var(--weight-regular) var(--text-body-md) var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
}

.tab:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 2px;
}

.tab:hover {
  color: var(--color-text-primary);
}

.tab--active {
  color: var(--color-accent-primary);
  border-bottom-color: var(--color-accent-primary);
  font-weight: var(--weight-medium);
}

/* Vertical: the line moves from the bottom edge to the left edge, full width,
   left-aligned. */
.tabs--vertical .tab {
  justify-content: flex-start;
  width: 100%;
  padding: var(--space-8) var(--space-12);
  border-bottom: none;
  border-left: 2px solid transparent;
}

.tabs--vertical .tab--active {
  border-left-color: var(--color-accent-primary);
}

/* --------------------------------------------------------------------------
   Segmented control
   Channel nav
   THIS STYLE BELONGS TO THE CHANNEL SHELL AND NOWHERE ELSE. It is not the generic
   segmented control — see .segmented above, a separate element with its own style.
   Do not reuse .channel-nav for a segmented control elsewhere, and do not
   generalise this block: the channel bar is expected to change visually on its
   own, independently of anything else in the system.
   One track, one selected destination. A channel's eight destinations belong to
   the channel, not to the page, so an underlined tab row would read as page tabs
   and collide with any the page adds below.
   The track is recessed by an inset shadow, and only the selected item is a
   raised surface — the two read against each other, which is what makes
   selection legible without a heavier fill. This is the one place a container
   carries a shadow; the foundations' "interactive elements only" rule holds
   everywhere else.
   -------------------------------------------------------------------------- */

.channel-nav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
  /* Containing block for the sliding thumb. */
  position: relative;
  /* The row's flexible part: it shrinks before the logo or the actions do, and
     scrolls sideways once it can shrink no further. */
  overflow-x: auto;
  scrollbar-width: none;
  /* 4px, so the segment nearly fills the track and the tint reads as an edge
     around it rather than as a band it floats in. */
  padding: var(--space-4);
  /* Off-scale on purpose — concentric with the pill it holds: 12 - 4px padding = 8. */
  border-radius: var(--radius-channel-nav);
  border: 1px solid var(--color-outline);
  /* Half-strength chip: at full tint the track competes with the selected
     segment sitting in it. Mixed toward transparent rather than set with
     `opacity`, which would fade the labels too. */
  background: color-mix(in srgb, var(--color-chip) 50%, transparent);
  /* The one container in the system allowed a shadow, and it is an inset one:
     it pushes the track below the surface so the selected segment reads as
     raised out of it. Without this the track is a flat tinted band and selection
     rests on colour alone. */
  box-shadow: var(--elevation-inset);
}

.channel-nav::-webkit-scrollbar {
  display: none;
}

/* Works as either <a> or <button>.
   One step taller than a control, not a control height in its own right — the
   segment sits inside the track, and it is the 46px track (4 + 36 + 4 + borders)
   that lines up with the 32px controls beside it on the row. Expressed as a
   relationship rather than a token so nothing outside the channel nav can reach
   for a 36px height. */
.channel-nav__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  /* Above the thumb, which slides underneath the labels. */
  position: relative;
  z-index: 1;
  height: calc(var(--control-height) + 4px);
  padding: 0 var(--space-12);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  /* Primary, not secondary: every segment is a destination the user can be in,
     so none of them is subordinate. Selection is carried by the raised pill and
     the accent, which is enough without dimming the rest. */
  color: var(--color-text-primary);
  text-decoration: none;
  font: var(--weight-regular) var(--text-body-md) var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  /* Matched to the thumb, so the accent arrives with the pill instead of landing on
     the new segment while the pill is still crossing to it. */
  transition: color 180ms ease;
}

.channel-nav__item:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 2px;
}

/* Unselected segments already sit at primary, so hover moves to the accent —
   the colour selection lands on — rather than having no feedback at all. */
.channel-nav__item:hover {
  color: var(--color-accent-primary);
}

/* Weight is the only thing that changes with selection — the type scale has no
   step between body-md and heading, so the size stays put. */
.channel-nav__item--active,
.channel-nav__item--active:hover {
  border-color: var(--color-outline);
  background: var(--color-surface);
  color: var(--color-accent-primary);
  font-weight: var(--weight-medium);
  box-shadow: var(--elevation);
}

/* The sliding pill.
   Selection moves rather than jumping: one thumb travels between segments,
   because a background cannot travel from one element to another. It carries the
   raised surface the active segment would otherwise draw itself, and sits below
   the labels.
   mountTabs() creates it, sizes it and moves it. Without JS the active segment
   keeps its own static pill above and nothing here applies, so the control is
   never left with no selection visible. */
.channel-nav__thumb {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--elevation);
  pointer-events: none;
  /* Position and size only. Fading it would read as two pills, not one moving. */
  transition: transform 180ms ease, width 180ms ease;
}

/* Once the thumb exists the segments stop drawing their own surface — a pill that
   slides and a pill that jumps, both visible, reads as a glitch rather than a
   transition. Set by mountTabs(), so this only applies where the thumb is real. */
.channel-nav--animated .channel-nav__item--active,
.channel-nav--animated .channel-nav__item--active:hover {
  background: none;
  border-color: transparent;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .channel-nav__thumb,
  .channel-nav__item {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Channel page header
   A connected channel's shell. The channel is identified by its own logo and by
   the breadcrumb in the global header, so this header carries no title: the
   channel's name is not a nav destination, and setting it twice on one screen
   is what the logo is there to avoid.
   One row: logo, the channel's own nav, then channel-level actions.
   -------------------------------------------------------------------------- */

.page-header--channel .page-header__row {
  /* Same 64px as a titled row: 9 above, the 46px track, 9 below. The track is
     taller than a 28px heading, so it needs less air around it to balance. */
  min-height: 64px;
  gap: var(--space-16);
}

/* Brand artwork, not an icon — a real asset file, so it carries its own colour
   and is never restyled. Sized by height so any channel's logo lines up
   whatever its aspect ratio. */
.channel-mark {
  height: 24px;
  width: auto;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Page body
   Content pages and workflow pages differ only in where actions live:
   .page--content puts them in .page-header__actions (top right);
   .page--workflow puts them in .page__footer (bottom right, sticky).
   -------------------------------------------------------------------------- */

/* Vertical scrolling only. Wide content (tables, code) scrolls inside its own
   container — the shell itself never scrolls sideways. */
.page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.page__body {
  flex: 1;
  /* Top inset is its own token (2026-09-07, "in the main container increase top
     padding to 24px", then "keep it specific to New"). --page-body-pad-top resolves
     to --page-gutter at :root, so every theme but New is byte-identical to the
     single `padding: var(--page-gutter)` this replaces. */
  padding: var(--page-body-pad-top) var(--page-gutter) var(--page-gutter);
  /* Provisional — the 80% cap is still unresolved; see docs/shell-forms.md. */
  max-width: var(--page-width);
  width: 100%;
  margin: 0 auto;
}

/* A header with no tabs and no channel nav draws no rule of its own — the
   title row's centering already puts 16px of air below it, so this padding
   would double that seam to 32px. Zero it there; a header WITH a rule (tabs,
   channel nav) keeps this padding, because that 16px is the only gap below the
   rule itself.
   Scoped to the VISIBLE header/body pair within the same .page, not to strict
   DOM adjacency (`+`) — a page that toggles between two headers (e.g.
   channel.html's channel bar vs. its "left the channel" fallback) keeps the
   other one in the DOM with [hidden], and `+` would match whichever sits
   physically next in markup regardless of which one is actually showing.
   Requires a page-header to actually be visible in the first place
   (:has(> .page-header:not([hidden]))) — a page whose header is hidden
   OUTRIGHT (dashboard.html) has no title row supplying that 16px of air at
   all, so its own .page__body padding must NOT be zeroed the same way. */
.page:has(> .page-header:not([hidden])):not(:has(> .page-header:not([hidden]) .tabs)):not(:has(> .page-header:not([hidden]) .channel-nav))
  > .page__body:not([hidden]) {
  padding-top: 0;
}

/* Table-heavy pages (orders, mappings) span the full width instead. */
.page__body--full {
  max-width: none;
}

/* --------------------------------------------------------------------------
   Toolbar — a row at the top of .page__body, above the content.
   The channel shell needs it: its page header row is the channel's nav, so a
   channel tab's own actions have nowhere to go up there. They sit here instead,
   right-aligned, still above the content and still read before it.
   Only inside a shell whose page header holds no actions — a page must not offer
   actions in two places.
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-height: var(--control-height);
  margin-bottom: var(--space-16);
}

.toolbar--end {
  justify-content: flex-end;
}

/* Carries controls that need a surface under them — a sub-tab set, whose active
   underline needs a rule to break, the same reason the page header goes white. */
.toolbar--surface {
  padding: 0 var(--page-gutter);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

/* Separates a destructive action from the rest of the row. */
.toolbar__divider {
  width: 1px;
  height: 20px;
  flex-shrink: 0;
  background: var(--color-outline);
}

/* --------------------------------------------------------------------------
   Sub-nav — a vertical nav beside the content, for a workflow split into steps
   that are visited in any order (a channel's pricing: rules, promotions, fees,
   changes, review). Not for page-level navigation; that is the sidebar's job.
   -------------------------------------------------------------------------- */

.subnav {
  width: 224px;
  flex-shrink: 0;
  align-self: flex-start;
  padding: 6px;   /* off-scale and unverified — mine, not Figma's. See CLAUDE.md. */
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.subnav__link {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-height: var(--control-height);
  padding: 0 10px;   /* off-scale and unverified — mine, not Figma's. See CLAUDE.md. */
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  font: var(--weight-regular) var(--text-body-md) var(--font-sans);
}

.subnav__link:hover {
  color: var(--color-text-primary);
}

.subnav__link--active,
.subnav__link--active:hover {
  background: var(--color-chip);
  color: var(--color-accent-primary);
  font-weight: var(--weight-medium);
}

/* Workflow actions: bottom right, pinned. */
.page__footer {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-8);
  padding: var(--space-12) var(--page-gutter);
  background: var(--color-surface);
  border-top: 1px solid var(--color-outline);
}

/* ------------------------------------------------------------------
   Dialog — a modal that asks one question and takes one answer. Added
   2026-08-27 on the user's direct instruction, after a UX review of the
   Collections page found its Delete action was a single unguarded click on
   something that ungroups hundreds of products across live marketplaces.
   The system had no element to build a confirmation from, so the review's
   Critical finding could not be closed at the page level at all.

   NOT scoped to destructive actions. This is "a modal that asks one question"
   — the destructive case is only the first one to need it, which is why the
   danger styling lives on the footer's own .btn--destructive (a ratified
   element) rather than on any class here. A dialog that asks something neutral
   uses .btn--primary in the same slot and needs nothing else.

   Deliberately NOT built from .filter-drawer (proposals.css): that is a
   persistent side panel you work inside and can push the page over for, this is
   a centred interruption you answer and dismiss. They share only the scrim, and
   they share it by both referencing --color-overlay.

   RATIFIED 2026-09-25, moved here from proposals.css unchanged. The footer's
   button order is a written rule now — Cancel immediately left of the primary,
   nothing between them; see docs/elements.md, "A modal's footer: Cancel, then
   the primary".

   NO JS SHIPS WITH IT. Escape, a backdrop click and Cancel all close it, and
   focus moves to Cancel on open so the safe action is the one Enter takes —
   but that behaviour is still wired per page. Promoting it into elements.js is
   separate follow-up work.

   Everything here is a token except the two dimensions noted on .dialog
   itself, which is the same footing as .filter-drawer's own 312px width
   (proposals.css).
   ------------------------------------------------------------------ */
.dialog-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* --space-32 so a narrow window insets the panel rather than letting it
     touch the viewport edge — the scrim has to stay visible on every side or
     the dialog reads as a page, the same rule .product-peek follows. */
  padding: var(--space-32);
  background: var(--color-overlay);
  /* Above the sticky table toolbar (z-index 2), the selection bar (2), an open
     toolbar menu (70) and the app header — everything this file has. A modal is
     the one thing in the app that is above everything; it is not competing for a
     layer, it is taking all of them.
     OPEN: proposals.css puts .filter-drawer-overlay and .product-peek-overlay at
     200/201, so those two would paint over a dialog today, and .preview-popover
     and .fulfillment-popover tie with it at 100. That contradicts the sentence
     above and needs one owner for the whole scale before either tier moves. */
  z-index: 100;
  opacity: 1;
  transition: opacity 0.15s ease;
}

/* Same reasoning as .selection-bar--hidden: elements.css's global
   `[hidden] { display: none !important }` would collapse the overlay with no
   frame to fade from, so hidden state is a class and `display: flex` never
   changes. pointer-events: none matters more here than there — an invisible
   full-viewport scrim would otherwise swallow every click on the page. */
.dialog-overlay--hidden {
  opacity: 0;
  pointer-events: none;
}

.dialog {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  /* Two one-off outer dimensions with no token to reference, same footing as
     .filter-drawer's 312px width (proposals.css). 26rem is a measured value, not a round one:
     it is the width at which the scope sentence this element exists to carry
     ("210 products across 4 channels will be ungrouped") sets to two lines at
     body-md rather than three, which is what keeps the consequence readable in
     one glance. max-height + the body's own scroll keep a long question usable
     on a short window instead of overflowing the viewport. */
  width: 26rem;
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
  padding: var(--space-24);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  /* The strongest of the three steps. A dialog is not "lifted off" the page
     the way a dropdown is — it has to read as dominant over everything behind
     it, which is what --elevation-xl was added for. No border: the scrim is
     what separates it from the page, and an outline on top of that reads as a
     card cut out of the dim rather than floating over it. */
  box-shadow: var(--elevation-xl);
  transform: translateY(0) scale(1);
  transition: transform 0.15s ease;
}

/* Rises into place rather than fading alone — the scale is tiny on purpose
   (0.98, ~8px at this width), enough to give the appearance a direction
   without it reading as a zoom. */
.dialog-overlay--hidden .dialog {
  transform: translateY(var(--space-8)) scale(0.98);
}

.dialog__title {
  margin: 0;
  color: var(--color-text-primary);
  font: var(--weight-medium) var(--text-heading) var(--font-sans);
}

/* Scrolls, so a dialog with more to say than a sentence stays inside
   .dialog's max-height instead of pushing its own footer off-screen — the
   footer holds the only way out and must never be the part that overflows. */
.dialog__body {
  margin: 0;
  overflow-y: auto;
  color: var(--color-text-secondary);
  font: var(--weight-regular) var(--text-body-md) var(--font-sans);
}

/* The scope line — how many records, which ones, and whether it can be undone.
   Its own element rather than a sentence inside the body: this is the part the
   user is actually being asked to check, and B2B practice is that the scope of
   a destructive or bulk action is stated, not implied. Primary text on the
   page's own neutral fill, so it reads a step louder than the explanation
   around it without introducing a colour — a red panel here would say "this
   already went wrong" when nothing has happened yet. */
.dialog__scope {
  display: block;
  margin-top: var(--space-12);
  padding: var(--space-12);
  /* Nested inside .dialog's own --radius-md, per the outer-larger-than-inner
     rule. */
  border-radius: var(--radius-sm);
  background: var(--color-background);
  color: var(--color-text-primary);
  font: var(--weight-regular) var(--text-body-md) var(--font-sans);
}

/* Primary rightmost, one per row — the same rule as a page header or a sticky
   footer, and the reason the confirming button is last in the markup. Cancel is
   the one immediately before it; nothing goes between them. */
.dialog__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-8);
}

/* Splits the footer when a DESTRUCTIVE action shares it with the primary:
   the destructive one goes to the left edge, Cancel and the primary stay
   together on the right. Only for that case — a footer whose buttons are all
   answers to the dialog's question needs no spacer, and flex-end above already
   puts them where they belong.

   An explicit element rather than `margin-right: auto` on the button, matching
   .table__toolbar-spacer: the split is a layout decision the markup should
   state, not a side effect of a modifier someone could remove by changing a
   button's class.

   WHY THE GAP IS THE POINT. A destructive action in a footer with a primary is
   not the answer to what the dialog asked — it is a different action reachable
   from the same panel, and the one the user can least afford to hit by mistake.
   Sitting it in the right-hand cluster puts it one slot from Cancel, which is
   the button people press without reading. When the destructive action IS the
   answer ("Delete this collection?"), it takes the primary's rightmost slot
   instead and this element is not used at all. */
.dialog__footer-spacer {
  flex: 1;
}
