/* Everyone in it: four role tabs; the chosen role's story plays once beside its static steps, then rests */

.roles { display: grid; }

/* Tabs: short cards, the icon beside the name and Tom's line under both, so the picker, the screen and its steps
   share one screen */
/* The scene, not the hint, takes the pull toward the heading, so the hint stays inside the scene's box */
[data-scene="roles"] { margin-top: calc(-1 * var(--eyebrow-gap)); }
.roles-hint { margin: 8px 0 8px; font-size: 15px; line-height: 22px; }
.roles-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.roles-tab { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ic nm" "ln ln"; align-content: start; align-items: center; gap: 4px 8px; min-width: 0; min-height: 44px; padding: 9px 12px 10px; border: 0; border-radius: var(--r-md); background: var(--card); box-shadow: var(--depth-card); text-align: left; cursor: pointer; transition: box-shadow var(--m-state) var(--m-ease-enter); -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .roles-tab:hover { box-shadow: var(--depth-hover); } }
.roles-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.roles-tab[aria-selected="true"] { background: var(--selected); box-shadow: 0 0 0 1px var(--ink-2); cursor: default; }
.roles-tab-ic { grid-area: ic; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--neutral-1); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.roles-tab-ic .i { width: 14px; height: 14px; }
.roles-tab[aria-selected="true"] .roles-tab-ic { background: var(--card); color: var(--accent); box-shadow: none; }
.roles-tab-name { grid-area: nm; min-width: 0; font-size: 16px; font-weight: var(--w-title); line-height: 22px; letter-spacing: -0.3px; color: var(--ink); }
.roles-tab-line { grid-area: ln; font-size: 14px; line-height: 20px; color: var(--ink-2); text-wrap: pretty; }

/* Panel: in one column the steps come first, so the step that explains the screen is read above it while it plays.
   Every role's panel shares one cell, so the section keeps the tallest role's
   height and nothing under it moves when the role changes */
.roles-panel { grid-area: 3 / 1; align-self: start; display: grid; gap: 10px; min-width: 0; margin-top: 10px; }
/* A story's changes share one pace, at every width: what leaves goes in --roles-out, what arrives glides in after it on
   the standard curve, which eases out evenly rather than landing at once. A press and a change of colour keep --m-state. */
.roles-panel { --roles-out: var(--m-story-out); }
.roles-panel[hidden] { display: grid; visibility: hidden; opacity: 0; pointer-events: none; }
.roles-panel[data-snap] *, .roles-panel[data-snap] *::before, .roles-panel[data-snap] *::after { transition: none !important; }
/* Without script no tab can switch, so every role's story stands in turn at its end frame, under its own name. */
.roles-head { display: none; }
.no-js :is(.roles-tabs, .roles-hint) { display: none; }
.no-js .roles-panel { grid-area: auto; }
.no-js .roles-panel[hidden] { visibility: visible; opacity: 1; pointer-events: auto; }
.no-js .roles-panel + .roles-panel { margin-top: 48px; }
.no-js .roles-head { display: grid; gap: 4px; grid-column: 1 / -1; }
.roles-head h3 { font-size: 17px; font-weight: var(--w-title); line-height: 24px; letter-spacing: -0.3px; color: var(--ink); }
.roles-head p { font-size: 15px; line-height: 22px; color: var(--ink-2); }
.roles-frame { margin: 0; }
.roles-intro { position: relative; display: grid; justify-items: start; gap: 8px; min-width: 0; }

/* The steps: a static numbered list, every line readable at any time; only the current marker changes */
.roles-steps { display: grid; width: 100%; }
.roles-steps li { position: relative; }
/* One track from each marker's centre to the next, under the markers, so the rail is continuous whatever a line's length */
.roles-steps { gap: 8px; }
.roles-steps li:not(:last-child)::after { content: ""; position: absolute; left: 25.25px; top: 22px; bottom: -30px; width: 1.5px; border-radius: 1px; background: var(--line-strong); }
.roles-step { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; column-gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; text-align: left; font-size: 15px; line-height: 22px; color: var(--ink-3); transition: background-color var(--m-state) var(--m-ease-enter), color var(--m-state) var(--m-ease-enter); }
@media (hover: hover) { .roles-step:hover { background: var(--outline-hover); } }
.roles-step:focus-visible { outline-offset: 0; border-radius: var(--r-sm); }
.roles-step-mk { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-full); background: var(--neutral-1); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); font: var(--w-title) 14px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.roles-step-mk > * { grid-area: 1 / 1; }
.roles-step-mk svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.roles-step-t { padding-top: 3px; text-wrap: pretty; }
.roles-step[data-s="done"] { color: var(--ink-2); }
.roles-step[data-s="done"] .roles-step-mk { color: var(--ink-2); }
.roles-step[data-s="done"] .roles-step-mk span { opacity: 0; }
.roles-step[data-s="done"] .roles-step-mk svg { opacity: 1; }
/* The number and the tick trade places, the old one out before the new one in */
.roles-step-mk > * { transition: opacity var(--m-state) var(--m-ease-exit); }
.roles-step:not([data-s="done"]) .roles-step-mk span, .roles-step[data-s="done"] .roles-step-mk svg { transition: opacity var(--m-state) var(--m-ease-enter) var(--m-state); }
.roles-step:is([data-s="now"], [data-s="coming"]) { color: var(--ink); }
.roles-step[data-s="now"] .roles-step-mk { background: var(--accent); box-shadow: var(--depth-lit); color: var(--card); }
/* The moving highlight: crosses from one marker to the next, then the marker itself holds the accent */
.roles-dot { position: absolute; left: 0; top: 0; z-index: 2; width: 28px; height: 28px; border-radius: var(--r-full); background: var(--accent); box-shadow: var(--depth-lit); opacity: 0; pointer-events: none; transition: opacity var(--m-state) var(--m-ease-enter); }
/* Purchasing ends on the award, which is the reader's: In TERIO's cue sits under its step while Award answers a press */
.roles-try { display: flex; align-items: center; gap: 8px; margin: -6px 0 0 52px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-2); opacity: 0; visibility: hidden; transition: opacity var(--roles-out) var(--m-ease-exit), visibility 0s linear var(--roles-out); }
.roles-try-dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--accent); }
.roles-panel[data-try] .roles-try { opacity: 1; visibility: visible; transition: opacity var(--m-fade) var(--m-ease-enter); }
.roles-play { margin-left: 4px; }
/* Without motion the control has nothing to do; it sits in the frame's bar, so leaving takes no height */
.roles-play:not([data-live]) { display: none; }

/* The product frame */
.roles-sheet { position: relative; container: roles-sheet / inline-size; }
.roles-vbar-t { min-width: 0; padding-block: 6px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-2); }
/* The person goes whole onto a second line, which is clipped, so a narrow bar names the role alone */
.roles-vbar-t { height: 20px; padding-block: 0; margin-block: 6px; overflow: hidden; }
.roles-vbar-who { display: inline-block; white-space: nowrap; }
.roles-frame .vbar .i { color: var(--ink-3); }
.roles-stage { min-width: 0; }
.roles-sheet > .vbar { position: relative; z-index: 2; min-height: 44px; background: var(--sheet); }
.roles-frame .vbar .i { width: 16px; height: 16px; }
/* Readable at a glance: nothing in the screen under 14 px; what a step is about at 15 */
.roles .sheet :is(.chip, .id, .pebble, .roles-awarded) { font-size: 14px; }
.roles .sheet .chip { height: 24px; padding: 0 9px; }
.roles .sheet .roles-awarded { height: 24px; }

.roles-pic { width: 36px; height: 36px; flex: none; padding: 3px; border-radius: 8px; background: var(--picture-tile); box-shadow: var(--depth-thumb); object-fit: contain; }
.roles-pic.lg { width: 48px; height: 48px; padding: 4px; border-radius: var(--r-sm); }
.roles-nm { font-size: 14px; font-weight: var(--w-title); line-height: 20px; color: var(--ink); }
.roles-nm-lg { font-size: 18px; line-height: 26px; letter-spacing: -0.01em; }
.roles-why, .roles-from, .roles-small { font-size: 14px; line-height: 20px; color: var(--ink-3); }
.roles-who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.roles-who .pebble { flex: none; }
.roles-stage .pebble { width: 28px; height: 28px; letter-spacing: -0.2px; }
.roles-stage .pebble.lg { width: 36px; height: 36px; font-size: 14px; }
.roles-part-t, .roles-offer-nm, .roles-bom-nm, .roles-proj-nm { display: grid; min-width: 0; }
.roles-mock { justify-self: start; pointer-events: none; }
/* The app's buttons, as In TERIO draws them: 32 px, small 28, the soft one a filled step with no edge */
@media (min-width: 760px) {
  .roles .sheet .btn { min-height: 0; height: 32px; padding: 0 14px; font: 500 14px/1 var(--font-sans); }
  .roles .sheet .btn.primary { padding: 0 16px; }
  .roles .sheet .btn.sm { height: 30px; padding: 0 12px; font-size: 14px; }
  .roles .sheet .btn.primary:not(.sm) { font-size: 15px; }
}
.roles .frame .btn.soft { background: var(--neutral-2); box-shadow: none; }
.roles .sheet .btn.sm { font-size: 14px; }
.roles-pn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 20px; color: var(--ink-3); }
.roles-pn .id { line-height: inherit; }
/* Every row is a custom part: where the table's columns leave the number no room, that is the words that go */
@container roles-sheet (max-width: 719px) { .roles-pn-x { display: none; } }

/* One state at a time in the same place: the old words fade out (220 ms), then the new fade in (420 ms) */
.roles-swap { display: inline-grid; justify-items: start; align-items: center; min-width: 0; }
.roles-swap > * { grid-area: 1 / 1; min-width: 0; opacity: 0; transition: opacity var(--roles-out) var(--m-ease-exit); }
.roles-swap > .roles-a { opacity: 1; }
.roles-swap > :not(.roles-a) { pointer-events: none; }

/* A press: 150 ms, the one the pointer makes */
.roles-panel [data-press] { transform: scale(0.97); }
.roles-panel[data-k~="dwg"][data-k~="appr"] .roles-appr, .roles-panel[data-k~="blocks"]:not([data-k~="asked"]) .roles-ask .btn { pointer-events: auto; }
.roles-panel :is(.roles-appr, .roles-ask .btn, [data-award] .btn):active { transform: scale(0.97); }
.roles-mock, .roles-link, .roles-quote, .roles-ask { transition: transform var(--m-state) var(--m-ease-enter), opacity var(--m-enter) var(--m-ease-enter); }

/* The pointer: an arrow on a wide frame, a fingertip on a narrow one; roles.js places it frame by frame */
.roles-ptr { position: absolute; left: 0; top: 0; z-index: 3; width: 0; height: 0; opacity: 0; pointer-events: none; }
.roles-ptr svg { position: absolute; left: -1.5px; top: -1.5px; width: 22px; max-width: none; height: 28px; filter: drop-shadow(0 2px 3px oklch(30% 0.02 275 / 0.3)); }
.roles-ptr svg path { fill: var(--card); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.roles-ptr-ring { position: absolute; left: -20px; top: -20px; width: 40px; height: 40px; border-radius: var(--r-full); box-shadow: 0 0 0 2px var(--accent); opacity: 0; }
@container roles-sheet (max-width: 579px) {
  .roles-ptr svg { display: none; }
  .roles-ptr::after { content: ""; position: absolute; left: -13px; top: -13px; width: 26px; height: 26px; border-radius: var(--r-full); background: oklch(23% 0.01 275 / 0.22); box-shadow: 0 0 0 2px oklch(100% 0 0 / 0.9), 0 2px 6px oklch(30% 0.02 275 / 0.25); }
}

/* Engineering ------------------------------------------------------------------------------ */
.roles-eng { display: grid; }
/* The two screens fade through: the old one leaves, then the new one rises into its place, so the frame stands empty
   for a moment rather than holding both screens at once */
.roles-sc { grid-area: 1 / 1; align-self: stretch; min-width: 0; background: var(--sheet); opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity var(--roles-out) var(--m-ease-exit), transform 0s linear var(--roles-out), visibility 0s linear var(--roles-out); }
.roles-panel[data-k~="bom"] .roles-sc-bom, .roles-panel[data-k~="dwg"] .roles-sc-dwg { z-index: 1; opacity: 1; visibility: visible; transform: none; transition: opacity var(--m-enter) var(--m-ease-enter) var(--roles-out), transform var(--m-enter) var(--m-ease-enter) var(--roles-out), visibility 0s; }

.roles-sc-bom { display: grid; grid-template-rows: auto 1fr; }
.roles-bom { display: grid; align-content: start; padding-top: 4px; min-width: 0; }
/* Status is never narrower than its longest chip, "Ready for purchasing" at 15 px */
.roles-bom-head, .roles-bom-row { display: grid; grid-template-columns: 36px minmax(0, 1.4fr) minmax(168px, 1fr) minmax(0, 1.3fr); gap: 14px; align-items: center; padding-inline: 16px; }
.roles-bom-head { min-height: 34px; border-bottom: 1px solid var(--line); font: 500 13px/1.3 var(--font-sans); color: var(--ink-3); }
.roles-bom-row { min-height: 54px; padding-block: 7px; }
.roles-bom-row + .roles-bom-row { border-top: 1px solid var(--line); }
.roles-bom-meta { display: contents; }
/* Every drawing checked: the statuses settle in one wave, top to bottom */
.roles-bom-meta > :first-child { opacity: 0.35; transition: opacity var(--m-fade) var(--m-ease-enter) calc(var(--i) * var(--m-stagger)); }
.roles-panel[data-k~="checked"] .roles-bom-meta > :first-child { opacity: 1; }
/* The row in hand lights on a tint under its content, which fades with the beat */
.roles-hg { position: relative; isolation: isolate; }
.roles-hg::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--selected); box-shadow: inset 2px 0 0 var(--accent); opacity: 0; pointer-events: none; transition: opacity var(--m-fade) var(--m-ease-enter); }
.roles-panel[data-k~="hot"] .roles-hg::after { opacity: 1; }
.roles-panel[data-k~="done"] .roles-hg-st > .roles-a, .roles-panel[data-k~="ready"] .roles-hg-who > .roles-a { opacity: 0; }
.roles-panel[data-k~="done"] .roles-hg-st > .roles-b,
.roles-panel[data-k~="ready"] .roles-hg-who > .roles-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
.roles-hold { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.roles-link { display: inline-block; font-size: 14px; font-weight: var(--w-title); line-height: 20px; color: var(--accent); white-space: nowrap; }
/* Gone once approved, keeping its room so the screen never changes height between steps */
.roles-panel[data-k~="done"] .roles-act { visibility: hidden; }

.roles-rail { display: grid; align-content: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--page); }
.roles-hand { display: grid; gap: 10px; }
.roles-hand-h { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; font-weight: var(--w-title); color: var(--ink); }
.roles-hand-h::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: var(--r-full); background: var(--line-strong); transition: background-color var(--m-state) var(--m-ease-enter); }
/* Until Daniel approves, the foot says where the part goes next, not that it is already there */
.roles-hand-h .roles-a { color: var(--ink-2); }
.roles-panel[data-k~="ready"] .roles-hand-h::before { background: var(--accent); }
.roles-panel[data-k~="ready"] .roles-hand-h .roles-swap > .roles-a { opacity: 0; }
.roles-panel[data-k~="ready"] .roles-hand-h .roles-swap > .roles-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
.roles-drop { position: relative; min-width: 0; min-height: 74px; border-radius: var(--r-sm); }
/* The slot shows only while the hand-off card is on its way, so it never reads as an empty box */
.roles-drop::before { content: ""; position: absolute; inset: 0; border: 1.5px dashed var(--line-strong); border-radius: inherit; opacity: 0; transition: opacity var(--roles-out) var(--m-ease-exit); }
.roles-panel[data-k~="ready"]:not([data-k~="hand"]) .roles-drop::before { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter); }
.roles-part { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 16px 12px 12px; border-radius: var(--r-sm); opacity: 0; transform: translateY(8px); transition: opacity var(--m-enter) var(--m-ease-enter), transform var(--m-enter) var(--m-ease-enter); }
.roles-panel[data-k~="hand"] .roles-part { opacity: 1; transform: none; }

.roles-sc-dwg { display: grid; gap: 16px; padding: 16px; align-content: start; align-items: start; }
.roles-dwg { display: grid; gap: 0; align-content: start; min-width: 0; border-radius: var(--r-sm); background: var(--card); box-shadow: var(--depth-thumb); overflow: hidden; }
.roles-dwg-pic { position: relative; min-width: 0; }
.roles-dwg-pic svg { width: 100%; height: auto; }
.roles-dwg-line { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.roles-dwg-hid { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 5 4; }
.roles-dwg-ask, .roles-dwg-ok { fill: none; stroke-width: 1.8; }
.roles-dwg-ask { stroke: var(--attention); }
.roles-dwg-ok { stroke: var(--settled); }
/* The pen mark lands with its finding; the fix turns the mark into a tick */
.roles-dwg-ask path, .roles-dwg-ok path { opacity: 0; transition: opacity var(--m-fade) var(--m-ease-enter); }
.roles-panel[data-k~="m1"]:not([data-k~="k1"]) .roles-dwg-ask .roles-l1, .roles-panel[data-k~="k1"] .roles-dwg-ok .roles-l1 { opacity: 1; }
.roles-mk { position: absolute; left: var(--x); top: var(--y); display: inline-grid; transform: translateY(-50%); opacity: 0; transition: opacity var(--m-fade) var(--m-ease-enter); }
.roles-panel[data-k~="m1"] .roles-mk-1 { opacity: 1; }
.roles-mk > span { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 6px; font: 500 13px/1 var(--font-mono); white-space: nowrap; transition: opacity var(--roles-out) var(--m-ease-exit); }
.roles-mk-a { color: var(--attention); }
.roles-mk-b { color: var(--ink); opacity: 0; }
.roles-mk b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-full); background: var(--attention); color: var(--card); font: 700 13px/1 var(--font-sans); }
.roles-mk-b b { background: var(--settled); }
.roles-mk b svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.roles-panel[data-k~="k1"] .roles-mk-1 .roles-mk-a { opacity: 0; }
.roles-panel[data-k~="k1"] .roles-mk-1 .roles-mk-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
.roles-dwg-tb { padding: 10px 14px; border-top: 1px solid var(--line); line-height: 18px; }
/* Each finding carries TERIO's mark, the one that also sits on its supplier suggestions */
.roles-find-h { display: flex; align-items: flex-start; gap: 8px; }
.roles-find-h .roles-reason-ic { width: 14px; height: 14px; margin-top: 3px; }

.roles-finds { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; min-width: 0; }
.roles-find { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 16px; border-radius: var(--r-md); background: var(--card); box-shadow: var(--depth-card); opacity: 0; transform: translateY(8px); transition: opacity var(--m-enter) var(--m-ease-enter), transform var(--m-enter) var(--m-ease-enter); }
.roles-panel[data-k~="m1"] .roles-find-1 { opacity: 1; transform: none; }
.roles-find-mk { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-full); background: var(--tint-bad-wash); color: var(--tint-bad-fg); font: 700 13px/1 var(--font-sans); transition: background-color var(--m-state) var(--m-ease-enter), color var(--m-state) var(--m-ease-enter); }
.roles-find-mk > * { grid-area: 1 / 1; transition: opacity var(--m-fade) var(--m-ease-enter); }
.roles-find-mk svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.roles-panel[data-k~="k1"] .roles-find-1 .roles-find-mk { background: var(--tint-good-bg); color: var(--tint-good-fg); }
.roles-panel[data-k~="k1"] .roles-find-1 .roles-find-mk span { opacity: 0; }
.roles-panel[data-k~="k1"] .roles-find-1 .roles-find-mk svg { opacity: 1; }
.roles-find-t { display: grid; min-width: 0; }
.roles-find-row { position: relative; display: grid; align-items: center; min-height: 32px; margin-top: 4px; }
.roles-fix { display: grid; }
.roles-fix > .roles-a { padding-right: 116px; }
.roles-fixed { font-size: 14px; font-weight: var(--w-title); line-height: 20px; color: var(--tint-good-fg); }
.roles-fix-btn { position: absolute; right: 0; top: 50%; translate: 0 -50%; }
.roles-panel[data-k~="k1"] .roles-find-1 .roles-fix-btn { opacity: 0; transition-duration: var(--roles-out); transition-timing-function: var(--m-ease-exit); }
.roles-panel[data-k~="k1"] .roles-find-1 .roles-fix > .roles-a { opacity: 0; }
.roles-panel[data-k~="k1"] .roles-find-1 .roles-fix > .roles-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
.roles-find-h { padding-top: 4px; font-size: 14px; font-weight: var(--w-title); line-height: 20px; color: var(--ink); }
.roles-find-s { font-size: 14px; line-height: 20px; color: var(--ink-2); }
/* On a narrow screen the line beside the button wraps a word alone, and a row of its own for the button would
   leave the BOM screen an empty band. The finding's title says what is missing and the step says why it matters,
   so the button takes the line's place under the title, and the fix, once taken, takes the button's */
@container roles-sheet (max-width: 639px) {
  .roles-find-row { grid-template-columns: minmax(0, 1fr); }
  .roles-fix { display: contents; }
  .roles-fix > .roles-a { display: none; }
  .roles-fix > .roles-b { grid-area: 1 / 1; }
  .roles-fix-btn { position: static; grid-area: 1 / 1; justify-self: start; translate: none; }
}
/* Approve stands greyed with the drawing until the finding is fixed, as the supplier's Send does, so the screen
   has no empty foot while the findings land */
.roles-appr { justify-self: stretch; transition: transform var(--m-state) var(--m-ease-enter), background-color var(--m-state) var(--m-ease-enter), color var(--m-state) var(--m-ease-enter), box-shadow var(--m-state) var(--m-ease-enter); }
.roles-panel:not([data-k~="appr"]) .roles-appr { background: var(--neutral-2); color: var(--ink-3); box-shadow: none; }
.roles-panel[data-k~="appr"] .roles-appr[data-press] { transform: scale(0.97); }

@container roles-sheet (min-width: 640px) {
  .roles-mk > span { font-size: 15px; }
  .roles-mk b { width: 24px; height: 24px; }
  .roles-rail { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 20px; padding: 14px 20px; }
  .roles-sc-dwg { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); align-content: stretch; align-items: stretch; gap: 20px; padding: 20px; }
  .roles-dwg { grid-template-rows: minmax(0, 1fr) auto; }
  .roles-dwg-pic { align-self: center; }
  .roles-finds { grid-template-rows: auto minmax(0, 1fr); }
  .roles-appr { align-self: end; }
}
/* A mid-width frame gives the findings more of its width, so each reads in two lines rather than four */
@container roles-sheet (min-width: 640px) and (max-width: 819px) {
  .roles-sc-dwg { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; }
  .roles-finds { gap: 10px; }
  .roles-find { padding: 12px 14px; }
}
@container roles-sheet (max-width: 639px) {
  .roles-bom-head { display: none; }
  .roles-bom-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 4px 12px; min-height: 56px; padding: 9px 14px; }
  .roles-bom-row .roles-who, .roles-hg-who { display: none; }
  .roles-bom-row .roles-pn { display: none; }
  .roles-hold { display: none; }
  .roles-hg .roles-hg-st { grid-row: 1; grid-column: 3; justify-items: end; }
  .roles-rail { gap: 10px; padding: 14px; }
  .roles-drop { min-height: 70px; }
  .roles-sc-dwg { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px; }
  .roles-dwg-tb br { display: none; }
  .roles-dwg-tb { padding: 8px 12px; }
  .roles-find { grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 12px 14px; }
  .roles-find-mk { width: 24px; height: 24px; }
  .roles-find-h { padding-top: 1px; font-size: 14px; line-height: 21px; }
  .roles-finds { gap: 10px; }
}

@container roles-sheet (max-width: 340px) {
  .roles-mk > span { gap: 4px; letter-spacing: -0.6px; }
  .roles-mk b { width: 20px; height: 20px; letter-spacing: 0; }
}
/* At 320 px even the role word overflows the bar: the icon gives up its room and the role wraps inside the bar */
@container roles-sheet (max-width: 639px) {
  .roles-vbar-who { display: none; }
  .roles-vbar-t { height: auto; overflow: visible; overflow-wrap: anywhere; }
}
@container roles-sheet (max-width: 300px) {
  .roles-sheet > .vbar { gap: 8px; padding-left: 12px; }
  .roles-sheet > .vbar > .i, .roles-vbar-who { display: none; }
}

/* Purchasing ------------------------------------------------------------------------------- */
.roles-buy { display: grid; gap: 16px; padding: 20px 16px 16px; }
.roles-buy-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; min-width: 0; }
.roles-buy-head .roles-part-t { flex: 1 1 160px; }
.roles-panel[data-k~="sent"] .roles-buy-tag > .roles-a { opacity: 0; }
.roles-panel[data-k~="sent"] .roles-buy-tag > .roles-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
.roles-buy-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-height: 32px; padding-top: 12px; border-top: 1px solid var(--line); }
.roles-buy-h > .roles-a { opacity: 0; transform: translateY(8px); transition: opacity var(--m-enter) var(--m-ease-enter), transform var(--m-enter) var(--m-ease-enter); }
.roles-panel[data-k~="part"]:not([data-k~="sugs"]) .roles-buy-h > .roles-a { opacity: 1; transform: none; }
.roles-buy-h .roles-who { gap: 10px; color: var(--ink-3); }
.roles-panel[data-k~="sugs"] .roles-buy-h > .roles-a { opacity: 0; transform: none; transition: opacity var(--roles-out) var(--m-ease-exit); }
.roles-panel[data-k~="sugs"]:not([data-k~="offers"]) .roles-buy-h > .roles-b,
.roles-panel[data-k~="offers"] .roles-buy-h > .roles-c { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
.roles-sub-h { font-size: 14px; font-weight: var(--w-title); line-height: 20px; color: var(--ink); }
.roles-need { opacity: 0; transition: opacity var(--m-fade) var(--m-ease-enter); }
.roles-panel[data-k~="offers"] .roles-need { opacity: 1; transition-delay: var(--roles-out); }

.roles-buy-body { display: grid; }
.roles-sugs, .roles-offers { grid-area: 1 / 1; min-width: 0; }
/* Once sent, the list steps back and stays until the offers take its place */
.roles-sugs { display: grid; gap: 12px; align-content: start; transition: opacity var(--roles-out) var(--m-ease-exit); }
.roles-sugs ul { display: grid; gap: 10px; }
.roles-panel[data-k~="sent"] .roles-sugs { opacity: 0.4; }
.roles-panel[data-k~="offers"] .roles-sugs { opacity: 0; visibility: hidden; transition: opacity var(--roles-out) var(--m-ease-exit), visibility 0s linear var(--roles-out); }
.roles-sug { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 14px; border-radius: var(--r-md); background: var(--card); box-shadow: var(--depth-card); opacity: 0; transform: translateY(8px); transition: opacity var(--m-enter) var(--m-ease-enter) calc(var(--i) * var(--m-stagger)), transform var(--m-enter) var(--m-ease-enter) calc(var(--i) * var(--m-stagger)), box-shadow var(--m-state) var(--m-ease-enter); }
.roles-sug .roles-offer-nm { flex: 1; }
.roles-panel[data-k~="sugs"] .roles-sug { opacity: 1; transform: none; }
.roles-tick { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: var(--r-full); background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line-strong); color: var(--card); transition: background-color var(--m-state) var(--m-ease-enter), box-shadow var(--m-state) var(--m-ease-enter); }
.roles-tick svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transform: scale(0.4); opacity: 0; transition: transform var(--m-state) var(--m-ease-enter), opacity var(--m-state) var(--m-ease-enter); }
.roles-panel[data-k~="pick1"] .roles-sug:nth-child(1), .roles-panel[data-k~="pick2"] .roles-sug:nth-child(2), .roles-panel[data-k~="pick3"] .roles-sug:nth-child(3) { box-shadow: var(--depth-card), 0 0 0 1.5px var(--accent-mid); }
.roles-panel[data-k~="pick1"] .roles-sug:nth-child(1) .roles-tick, .roles-panel[data-k~="pick2"] .roles-sug:nth-child(2) .roles-tick, .roles-panel[data-k~="pick3"] .roles-sug:nth-child(3) .roles-tick { background: var(--accent); box-shadow: none; }
.roles-panel[data-k~="pick1"] .roles-sug:nth-child(1) .roles-tick svg, .roles-panel[data-k~="pick2"] .roles-sug:nth-child(2) .roles-tick svg, .roles-panel[data-k~="pick3"] .roles-sug:nth-child(3) .roles-tick svg { transform: none; opacity: 1; }
/* Send waits at the list's head, where the offers' date chip lands once it is gone */
.roles-bar-end { display: inline-grid; justify-items: end; align-items: center; margin-left: auto; }
.roles-bar-end > * { grid-area: 1 / 1; }
.roles-send { opacity: 0; transform: translateY(8px); }
.roles-panel[data-k~="send"]:not([data-k~="sent"]) .roles-send { opacity: 1; transform: none; }
.roles-panel[data-k~="send"] .roles-send[data-press] { transform: scale(0.97); }

.roles-offers { display: grid; gap: 12px; align-content: start; }
.roles-offer { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--card); box-shadow: var(--depth-card); opacity: 0; transform: translateY(8px); transition: opacity var(--m-enter) var(--m-ease-enter) calc(var(--roles-out) + var(--i) * var(--m-stagger)), transform var(--m-enter) var(--m-ease-enter) calc(var(--roles-out) + var(--i) * var(--m-stagger)), box-shadow var(--m-state) var(--m-ease-enter), background-color var(--m-state) var(--m-ease-enter); }
.roles-panel[data-k~="offers"] .roles-offer { opacity: 1; transform: none; }
.roles-panel[data-k~="focus"] .roles-offer { transition-delay: 0s; }
.roles-panel[data-k~="focus"] .roles-offer:not(.is-best) { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.roles-panel[data-k~="focus"] .roles-offer:not(.is-best) :is(.roles-nm, .roles-big) { color: var(--ink-2); }
.roles-offer :is(.roles-nm, .roles-big) { transition: color var(--m-state) var(--m-ease-enter); }
.roles-panel[data-k~="focus"] .roles-offer:not(.is-best) .roles-award { opacity: 0; }
.roles-panel[data-k~="focus"] .roles-offer.is-best { box-shadow: var(--depth-hover); }
/* The offer to award takes its ring on a layer that fades with the beat */
.roles-offer.is-best::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 2px var(--accent); opacity: 0; pointer-events: none; transition: opacity var(--m-fade) var(--m-ease-enter); }
.roles-panel[data-k~="focus"] .roles-offer.is-best::after { opacity: 1; }
.roles-award { transition: opacity var(--roles-out) var(--m-ease-exit); }
/* Ends before the award, as In TERIO's Requests shows RFQ-042: three answered, none awarded. The award is the
   reader's: Oakridge's button answers a press, until the story is played again */
.roles-award .btn { transition: transform var(--m-state) var(--m-ease-enter), background-color var(--m-state) var(--m-ease-enter), color var(--m-state) var(--m-ease-enter), box-shadow var(--m-state) var(--m-ease-enter); }
.roles-panel[data-k~="focus"] .roles-offer.is-best .roles-award .btn { background: var(--ink); color: var(--sheet); box-shadow: var(--depth-press); }
.roles-panel[data-k~="focus"]:not([data-awarded]) [data-award] .btn { pointer-events: auto; }
@media (hover: hover) { .roles-panel[data-k~="focus"] .roles-offer.is-best [data-award] .btn:hover { background: color-mix(in oklab, var(--ink) 88%, var(--card)); } }
.roles-panel[data-awarded] [data-award] > .roles-a { opacity: 0; }
.roles-panel[data-awarded] [data-award] > .roles-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
.roles-offer-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.roles-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.roles-figs > div { display: grid; align-content: start; }
.roles-big { font-size: 26px; font-weight: var(--w-display); line-height: 30px; letter-spacing: -0.03em; color: var(--ink); }
.roles-offer-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.roles-when { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 20px; color: var(--ink-3); }
.roles-when.is-ok { color: var(--settled); font-weight: 500; }
.roles-awarded { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-full); background: var(--tint-good-bg); color: var(--tint-good-fg); font: 500 13px/1 var(--font-sans); white-space: nowrap; }
.roles-awarded .i { width: 13px; height: 13px; }
/* Each supplier's reason is what step 2 is about: body size, TERIO's mark, its own beat after the cards land */
.roles-buy .roles-reason { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.roles-reason-ic { flex: none; width: 13px; height: 13px; margin-top: 3.5px; fill: var(--accent); }
.roles-sub-why { display: inline-flex; align-items: center; gap: 8px; }
.roles-sub-why .roles-reason-ic { width: 15px; height: 15px; margin-top: 0; }
.roles-sug .roles-reason { order: -1; font-size: 14px; line-height: 20px; font-weight: var(--w-title); color: var(--ink); transition: opacity var(--m-enter) var(--m-ease-enter); }
.roles-sug .roles-reason .roles-reason-ic { width: 13px; height: 13px; margin-top: 3.5px; }
.roles-buy .roles-sug .roles-nm { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-2); }
/* Before its beat a reason stands sunk rather than gone, so the cards never show an empty line */
.roles-panel[data-k~="sugs"]:not([data-k~="why"]) .roles-sug .roles-reason { opacity: 0.3; }
.roles-when.is-none { color: var(--tint-warn-fg); }
@container roles-sheet (max-width: 639px) {
  /* Stacked, the offers stand far taller than the suggestions; their room is kept from the start, so the steps
     under the screen never move while the story plays */
  .roles-panel:not([data-k~="offers"]) .roles-offers { visibility: hidden; }
  .roles-buy { gap: 14px; padding: 16px 14px 14px; }
  .roles-buy-bar { padding-top: 12px; }
  .roles-sug { padding: 10px 12px; }
  .roles-offers { gap: 10px; }
  .roles-offer { gap: 8px; padding: 12px 14px; }
  .roles-figs { gap: 10px; padding-top: 0; border-top: 0; }
  .roles-offer-end { min-height: 32px; }
}
@container roles-sheet (min-width: 640px) {
  .roles-buy { gap: 14px; padding: 20px; }
  .roles-buy-tag { margin-left: auto; justify-items: end; }
  .roles-offers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .roles-offer-end { flex-direction: column; align-items: flex-start; }
}

/* Your suppliers --------------------------------------------------------------------------- */
.roles-sup { display: grid; gap: 14px; padding: 16px; background: var(--page); }
.roles-sup-main { display: grid; min-width: 0; }
.roles-mail, .roles-form { grid-area: 1 / 1; display: grid; align-content: start; gap: 10px; min-width: 0; padding: 14px 16px 16px; }
.roles-mail { transition: opacity var(--roles-out) var(--m-ease-exit), background-color var(--m-state) var(--m-ease-enter), box-shadow var(--m-state) var(--m-ease-enter); }
.roles-panel[data-k~="open"] .roles-mail { opacity: 0; visibility: hidden; transition: opacity var(--roles-out) var(--m-ease-exit), visibility 0s linear var(--roles-out); }
.roles-form { opacity: 0; transform: translateY(8px); transition: opacity var(--m-enter) var(--m-ease-enter), transform var(--m-enter) var(--m-ease-enter); }
.roles-panel[data-k~="open"] .roles-form { opacity: 1; transform: none; transition-delay: var(--roles-out); }
.roles-mail-from { display: flex; align-items: center; gap: 10px; min-width: 0; }
.roles-mail-subj { margin-top: 4px; font-size: 14px; font-weight: var(--w-title); line-height: 20px; color: var(--ink); }
.roles-mail-body { font-size: 14px; line-height: 21px; color: var(--ink-2); }
.roles-open { justify-self: start; }
.roles-opened { display: inline-flex; align-items: center; gap: 6px; height: 30px; color: var(--ink-3); font: 500 14px/1 var(--font-sans); white-space: nowrap; }
.roles-opened .i { width: 14px; height: 14px; }
.roles-panel[data-k~="open"] .roles-open > .roles-a { opacity: 0; }
.roles-panel[data-k~="open"] .roles-open > .roles-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
.roles-files { display: flex; flex-wrap: wrap; gap: 8px; }
.roles-file { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 9px; border-radius: var(--r-xs); background: var(--neutral-1); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); font: 500 13px/1 var(--font-sans); opacity: 0; transition: opacity var(--m-enter) var(--m-ease-enter); }
.roles-file + .roles-file { transition-delay: var(--m-stagger); }
.roles-panel[data-k~="files"] .roles-file { opacity: 1; }
.roles-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.roles-field { display: grid; gap: 4px; min-width: 0; }
.roles-field-k { font-size: 13px; line-height: 18px; color: var(--ink-3); }
.roles-field-v { display: flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: var(--r-sm); background: var(--card); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 14px; font-weight: 500; color: var(--ink); }
/* The supplier's answer: each value is entered once, by a fade, not typed */
.roles-val { opacity: 0; transition: opacity var(--m-enter) var(--m-ease-enter); }
.roles-panel[data-k~="v1"] .roles-field-1 .roles-val, .roles-panel[data-k~="v2"] .roles-field-2 .roles-val { opacity: 1; }
.roles-quote { display: grid; justify-items: stretch; }
.roles-quote > * { display: grid; }
.roles-quote-btn { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: var(--r-full); background: var(--neutral-2); color: var(--ink-3); font: var(--w-title) 14px/1 var(--font-sans); transition: background-color var(--m-state) var(--m-ease-enter), color var(--m-state) var(--m-ease-enter); }
.roles-panel[data-k~="ready"] .roles-quote-btn { background: var(--ink); color: var(--sheet); box-shadow: var(--depth-press); }
.roles-panel[data-k~="sent"] .roles-quote > .roles-a { opacity: 0; }
.roles-panel[data-k~="sent"] .roles-quote > .roles-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
@media (min-width: 760px) { .roles-quote-btn { min-height: 32px; font-weight: 500; } }
.roles-sent { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: var(--r-full); background: var(--tint-good-bg); color: var(--tint-good-fg); font: var(--w-title) 14px/1 var(--font-sans); }
@media (min-width: 760px) { .roles-sent { min-height: 32px; font-weight: 500; } }
.roles-strip { position: relative; display: grid; gap: 8px; padding: 12px 16px; border-radius: var(--r-md); background: var(--card); box-shadow: var(--depth-card); }
/* The buyer's row lights once when the answer lands, then fades over a second; roles.js sets --glow */
.roles-strip::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 2px var(--tint-good-mid); opacity: var(--glow, 0); pointer-events: none; }
.roles-strip-h { font-size: 13px; font-weight: var(--w-title); line-height: 18px; color: var(--ink-3); }
.roles-strip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.roles-strip-v { font-size: 14px; color: var(--ink-3); }
.roles-strip-v .roles-b { color: var(--ink-2); }
.roles-strip-v b { font-size: 18px; font-weight: var(--w-display); letter-spacing: -0.02em; color: var(--ink); }
.roles-panel[data-k~="answered"] .roles-strip .roles-swap > .roles-a { opacity: 0; }
.roles-panel[data-k~="answered"] .roles-strip .roles-swap > .roles-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
@container roles-sheet (min-width: 640px) {
  .roles-sup { gap: 12px; padding: 20px; }
  .roles-sup-main { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; }
  .roles-mail { grid-area: 1 / 1; }
  .roles-form { grid-area: 1 / 2; transform: translateX(8px); }
  .roles-mail-subj { transition: color var(--m-state) var(--m-ease-enter); }
  .roles-panel[data-k~="open"] .roles-mail { opacity: 1; visibility: visible; background: transparent; box-shadow: inset 0 0 0 1px var(--line); transition: background-color var(--m-state) var(--m-ease-enter), box-shadow var(--m-state) var(--m-ease-enter); }
  .roles-panel[data-k~="open"] .roles-mail-subj { color: var(--ink-2); }
  .roles-mail { align-self: start; }
}

/* The manager ------------------------------------------------------------------------------ */
/* Each project is one line of figures, and under it the one thing that blocks it first */
.roles-proj { position: relative; display: grid; align-items: start; }
.roles-proj + .roles-proj { border-top: 1px solid var(--line); }
.roles-proj-ask { isolation: isolate; }
.roles-proj-ask::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--selected); box-shadow: inset 2px 0 0 var(--accent); opacity: 0; pointer-events: none; transition: opacity var(--m-fade) var(--m-ease-enter); }
.roles-panel[data-k~="hot"] .roles-proj-ask::after { opacity: 1; }
.roles-proj-nm { display: grid; min-width: 0; }
.roles-proj-c { display: grid; align-content: start; gap: 4px; min-width: 0; }
.roles-mid { font-size: 14px; line-height: 24px; color: var(--ink-2); white-space: nowrap; }
.roles-mid b { font-size: 22px; font-weight: var(--w-display); letter-spacing: -0.02em; color: var(--ink); }
.roles-track { height: 6px; border-radius: var(--r-full); background: var(--track); overflow: hidden; }
.roles-track i { display: block; width: calc(var(--w) * 1%); height: 100%; border-radius: var(--r-full); background: var(--neutral-5); }
.roles-track .roles-shipped { background: var(--mark-green); }
/* Each project's bars fill once, a row one stagger after the one above */
.roles-fill { transform: scaleX(0); transform-origin: left; transition: transform var(--m-enter) var(--m-ease-enter) calc(var(--i, 0) * var(--m-stagger)); }
.roles-panel[data-k~="fill"] .roles-fill { transform: none; }
.roles-block { transition: background-color var(--m-state) var(--m-ease-enter); }
.roles-block, .roles-block > * { min-width: 0; }
.roles-first { font-weight: var(--w-title); line-height: 22px; color: var(--ink); text-wrap: pretty; }
.roles-block .roles-who { align-items: center; font-size: 14px; line-height: 20px; white-space: nowrap; }
.roles-ask-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; }
.roles-ask .roles-mock { justify-self: auto; }
.roles-panel[data-k~="asked"] .roles-block .roles-swap > .roles-a { opacity: 0; }
.roles-panel[data-k~="asked"] .roles-block .roles-swap > .roles-b { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
.roles-projs { padding-top: 2px; }
.roles-mgr-foot { padding: 7px 16px 8px; border-top: 1px solid var(--line); font-size: 14px; line-height: 20px; }

/* Stacked: name and the blocker's chip, then parts, money and days side by side, then the blocker */
@container roles-sheet (max-width: 639px) {
  .roles-proj { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px 10px; padding: 8px 14px; }
  .roles-proj > :nth-child(1) { grid-area: 1 / 1 / 2 / 8; align-self: center; }
  .roles-proj > :nth-child(2) { grid-area: 2 / 1 / 3 / 6; }
  .roles-proj > :nth-child(3) { grid-area: 2 / 6 / 3 / 10; }
  .roles-proj > :nth-child(4) { grid-area: 2 / 10 / 3 / 13; justify-items: end; }
  .roles-proj .roles-why, .roles-proj .roles-small, .roles-bud { display: none; }
  .roles-mid b { font-size: 20px; }
  .roles-proj .roles-nm { line-height: 22px; }
  /* The blocker's parts join the project's grid, so each rises on its own, from sunk rather than from an empty card */
  .roles-block { display: contents; }
  .roles-block > * { opacity: 0.3; transition: opacity var(--m-enter) var(--m-ease-enter) calc(var(--i) * var(--m-stagger)); }
  .roles-panel[data-k~="blocks"] .roles-block > * { opacity: 1; }
  .roles-block > :first-child { grid-area: 1 / 7 / 2 / 13; justify-self: end; align-self: center; }
  .roles-block > .roles-first { grid-area: 3 / 1 / 4 / 13; }
  .roles-block > :last-child:not(.roles-first) { grid-area: 4 / 1 / 5 / 13; }
  .roles-proj:not(.roles-proj-ask) .roles-block > .roles-who { display: none; }
  .roles-mgr-foot, .roles-vbar-more { display: none; }
  .roles-ask { justify-items: end; }
}
/* The project nothing blocks is its name and its verdict: the eye goes to the two that need someone */
@container roles-sheet (max-width: 639px) {
  .roles-proj-ok > :is(:nth-child(2), :nth-child(3), :nth-child(4)), .roles-proj-ok .roles-block > :not(:first-child) { display: none; }
}
/* Narrowest: the name over its verdict, the three figures under both */
@container roles-sheet (max-width: 300px) {
  .roles-proj > :nth-child(1) { grid-area: 1 / 1 / 2 / 13; }
  .roles-block > :first-child { grid-area: 2 / 1 / 3 / 13; justify-self: start; }
  .roles-proj > :nth-child(2) { grid-area: 3 / 1 / 4 / 6; }
  .roles-proj > :nth-child(3) { grid-area: 3 / 6 / 4 / 10; }
  .roles-proj > :nth-child(4) { grid-area: 3 / 10 / 4 / 13; }
  .roles-block > .roles-first { grid-area: 4 / 1 / 5 / 13; }
  .roles-block > :last-child:not(.roles-first) { grid-area: 5 / 1 / 6 / 13; }
}
/* Wide: the figures as columns, and the blocker as one strip under them */
@container roles-sheet (min-width: 640px) {
  .roles-proj { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1.1fr) minmax(72px, 0.5fr); gap: 4px 20px; padding-inline: 24px 20px; }
  .roles-proj { padding-block: 7px; }
  .roles-block { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; margin: 0 -10px; padding: 2px 10px; border-radius: var(--r-sm); opacity: 0; transform: translateY(8px); transition: opacity var(--m-enter) var(--m-ease-enter) calc(var(--i) * var(--m-stagger)), transform var(--m-enter) var(--m-ease-enter) calc(var(--i) * var(--m-stagger)), background-color var(--m-state) var(--m-ease-enter); }
  .roles-panel[data-k~="blocks"] .roles-block { opacity: 1; transform: none; }
  .roles-panel[data-k~="hot"] .roles-proj-ask .roles-block { background: var(--card); transition-delay: 0s; }
  .roles-proj-c > .roles-small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .roles-mgr-foot { padding-inline: 24px 20px; }
}
@container roles-sheet (min-width: 640px) and (max-width: 819px) {
  .roles-proj { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1.1fr) minmax(72px, 0.5fr); }
  .roles-proj > :nth-child(2) .roles-small { display: none; }
}
@container roles-sheet (min-width: 820px) {
  .roles-mid b { font-size: 24px; }
}

/* A figure is 26 px; where three offers share a mid-width frame, 26 does not fit and it is 18 */
@container roles-sheet (min-width: 640px) and (max-width: 799px) {
  .roles-big { font-size: 18px; line-height: 24px; letter-spacing: -0.02em; }
}
/* Three offers in a mid-width frame: each supplier's reason was step 2's, so here the card keeps its name */
@container roles-sheet (min-width: 640px) and (max-width: 819px) {
  .roles-offer-who .roles-reason { display: none; }
}

/* The screen's small print is 14 px at every width */
.roles-field-k, .roles-strip-h, .roles-file, .roles-bom-head { font-size: 14px; line-height: 20px; }

/* Wide: tabs in one row, the steps as a list beside the frame, so the story's words stay in view while it plays */
@container (min-width: 900px) {
  .roles-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .roles-tab { padding: 12px 16px 14px; column-gap: 10px; }
  .roles-tab-name { font-size: 17px; line-height: 24px; }
  /* The steps take the first tab's track and the screen starts under the second tab */
  .roles-panel { grid-template-columns: calc((100% - 3 * 12px) / 4) minmax(0, 1fr); gap: 12px; align-items: start; margin-top: 16px; }
  .roles-frame { order: 0; }
  /* The control sits under the frame's corner as every scene's does, in the band's padding rather than a row of
     its own, so the picker, the screen and its steps fit one screen */
  .roles-panel { position: relative; }
  .roles .roles-panel .roles-play.scene-dock { position: absolute; top: calc(100% + 10px); right: 0; margin: 0; }
  .roles-intro { position: sticky; top: calc(var(--nav-h) + 24px); gap: 12px; padding-top: 4px; }
  .roles-step { padding-inline: 4px 8px; }
  /* Every step takes the tallest one's room, so the markers sit at one even pitch */
  .roles-steps { grid-auto-rows: 1fr; }
  .roles-steps li:not(:last-child)::after { left: 17.25px; }
}
@container (min-width: 1100px) {
  .roles-tab-line { font-size: 15px; line-height: 21px; }
}
/* Stacked: the four cards and a list of steps would push the screen off the first screen. The roles become one row
   of names, the chosen role's line opens its panel, and the steps become a row of markers with the current step's
   words under them; every step's words stay its button's name. roles.js takes the lines out of the tabs here, so a
   role's line is read once, at the head of its panel. */
@container (max-width: 899px) {
  .roles-tabs { --roles-compact: 1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .roles-tab { grid-template-columns: minmax(0, 1fr); grid-template-areas: "nm"; place-items: center; align-content: center; min-height: 44px; padding: 4px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; text-align: center; }
  .roles-tab-ic, .roles-tab-line { display: none; }
  .roles-tab-name { font: inherit; font-size: 14px; line-height: 18px; letter-spacing: 0; color: inherit; overflow-wrap: anywhere; text-wrap: balance; }
  .roles-tab[aria-selected="true"] { color: var(--accent); font-weight: var(--w-title); }
  .roles-panel { gap: 8px; margin-top: 8px; }
  .roles-head { display: block; }
  .roles-head h3 { display: none; }
  .roles-head p { font-size: 15px; line-height: 22px; color: var(--ink-2); }

  .roles-intro { gap: 0; }
  .roles-steps { --cap: 2; position: relative; display: flex; align-items: center; gap: 8px; padding-bottom: calc(var(--cap) * 22px + 2px); }
  .roles-steps[data-cap="1"] { --cap: 1; }
  .roles-steps[data-cap="3"] { --cap: 3; }
  .roles-steps[data-cap="4"] { --cap: 4; }
  .roles-steps li { position: static; display: flex; align-items: center; gap: 8px; }
  .roles-steps li::after { display: none; }
  .roles-step { display: grid; place-items: center; width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: var(--r-full); }
  .roles-steps li:not(:last-child) .roles-step-mk::before { content: ""; position: absolute; left: 100%; top: calc(50% - 0.75px); width: 24px; height: 1.5px; background: var(--line-strong); }
  .roles-step-t { position: absolute; left: 0; right: 0; top: 46px; padding: 0; color: var(--ink); opacity: 0; pointer-events: none; transition: opacity var(--roles-out) var(--m-ease-exit); }
  .roles-step:is([data-s="now"], [data-s="coming"]) .roles-step-t { opacity: 1; transition: opacity var(--m-fade) var(--m-ease-enter) var(--roles-out); }
  .roles-try { margin: 0; }
}
/* Too narrow or too short for a tab row, its line, the steps and the screen to share one screen: each role is a card
   with its name and line, one open at a time, its steps and its screen under it. The hint still says what to do. */
@media (max-width: 359px), (max-width: 759px) and (max-height: 599px) and (orientation: portrait) {
  .roles-tabs { --roles-stack: 1; display: none; }
  .roles-panel { grid-area: auto; margin-top: 8px; }
  .roles-panel[hidden] { visibility: visible; opacity: 1; pointer-events: auto; }
  .roles-panel[hidden] > :not(.roles-head) { display: none; }
  .roles-panel:not([hidden]) + .roles-panel { margin-top: 16px; }
  .roles .roles-head { position: relative; display: grid; padding: 0 14px 12px; border-radius: var(--r-md); background: var(--card); box-shadow: var(--depth-card); }
  .roles .roles-head p { margin-top: -8px; }
  .roles .roles-head h3 { display: block; }
  .roles-panel:not([hidden]) .roles-head { background: var(--selected); box-shadow: 0 0 0 1px var(--ink-2); }
  .roles-panel:not([hidden]) .roles-head h3 { color: var(--accent); }
  .roles-acc { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .roles-acc::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
  .roles-acc:focus-visible { outline: 0; }
  .roles-head:has(.roles-acc:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .roles-panel:not([hidden]) .roles-acc { cursor: default; }
}
/* Two names a line would break a word: the single words keep their width and the two-word names take two lines */
@container (min-width: 328px) and (max-width: 419px) {
  .roles-tabs { grid-template-columns: max-content max-content minmax(0, 1fr) minmax(0, 1fr); }
}
@container (max-width: 339px) {
  .roles-try { display: none; }
}
/* Under 390 px Tom's line at 15 px takes two lines; at 14 it takes one from 360 px */
@container (max-width: 357px) {
  .roles-head p, .roles-hint { font-size: 14px; line-height: 20px; }
}
/* A short laptop screen: the band gives up half its padding, the control still clear of the next section */
@media (min-width: 760px) and (max-height: 860px) {
  #roles.band { padding-block: 48px; }
}
@media (min-width: 760px) and (max-height: 790px) {
  #roles.band { padding-block: 40px; }
  .roles .roles-panel .roles-play.scene-dock { top: calc(100% + 6px); }
  .roles-tabs .roles-tab { padding-block: 10px 12px; }
}
/* A laptop under 650 px of height: the cards keep their names and the chosen role's line heads its steps, so the
   picker, the steps and the screen still share one screen */
@media (min-width: 760px) and (max-height: 649px) {
  @container (min-width: 900px) {
    .roles-tabs { --roles-lines-out: 1; }
    .roles-tabs .roles-tab { grid-template-areas: "ic nm"; padding-block: 10px; }
    .roles-tab-line { display: none; }
    .roles-panel { grid-template-rows: auto minmax(0, 1fr); margin-top: 8px; }
    .roles-frame { padding: 6px; }
    .roles-head { display: block; grid-area: 1 / 1; padding-top: 2px; }
    .roles-head h3 { display: none; }
    .roles-head p { font-size: 15px; line-height: 22px; color: var(--ink-2); }
    .roles-intro { grid-area: 2 / 1; }
    .roles-frame { grid-area: 1 / 2 / 3 / 3; }
  }
  @container roles-sheet (min-width: 640px) { .roles .roles-buy { padding-block: 16px; } }
}

/* A phone: each screen is no taller than its busiest step, so the picker, the screen and the step it is on share
   one screen, and every step of a story fills about the same height (nothing waits in an empty frame) */
/* A phone's widest windows would give the screen a tablet's layout, taller than a phone's screen holds: the roles keep
   a phone's width */
@media (min-width: 700px) and (max-width: 759px) {
  .roles { max-width: 648px; }
}
@media (max-width: 759px) {
  #roles.band { padding-block: 48px; }
  .roles-frame { padding: 6px; border-radius: 22px; }
  .roles-panel { gap: 8px; }
}
@container roles-sheet (max-width: 639px) {
  .roles .sheet .btn.sm { min-height: 0; height: 30px; padding: 0 12px; }
  .roles .sheet .btn.primary:not(.sm) { min-height: 0; height: 40px; }
  .roles-pic.lg { width: 40px; height: 40px; }
  .roles-nm-lg { font-size: 17px; line-height: 24px; }

  /* Engineering */
  .roles-bom-row { grid-template-columns: 32px minmax(0, 1fr) auto; min-height: 48px; padding: 6px 12px; }
  .roles-bom-row .roles-pic { width: 32px; height: 32px; padding: 2px; border-radius: 7px; }
  .roles-rail { gap: 8px; padding: 8px 12px 10px; }
  .roles-hand { gap: 6px; }
  .roles-hand > .roles-who { display: none; }
  .roles-drop { min-height: 60px; }
  .roles-part { padding: 8px 12px 8px 8px; }
  .roles-part .roles-pn { display: none; }
  /* The highlighted row and its chip say which drawing is next; the link would need a line of its own */
  .roles-act { display: none; }
  .roles-sc-dwg { gap: 8px; padding: 10px 12px 12px; }
  .roles-dwg-pic { width: min(100%, 236px); margin-inline: auto; }
  /* The title block would be cut to one line here; without it the drawing screen is about the BOM screen's height,
     so the BOM's foot holds no empty band before the hand-off lands */
  .roles-dwg-tb { display: none; }
  .roles-finds { gap: 8px; }
  .roles-find { padding: 10px 12px; }
  .roles-find-row { min-height: 30px; margin-top: 2px; }

  /* Purchasing: the offers as three short rows, price beside the name and the date under it */
  .roles-buy { gap: 8px; padding: 10px 12px; }
  .roles-buy-head { gap: 8px 12px; }
  /* The list's head already says where the part came from and, once sent, which RFQ it is */
  .roles-buy-tag { display: none; }
  .roles-buy-bar { min-height: 0; padding-top: 8px; }
  .roles-sugs { gap: 8px; }
  .roles-sugs ul { gap: 8px; }
  .roles-sug { gap: 10px; padding: 8px 12px; }
  .roles-sug .pebble.lg { width: 28px; height: 28px; }
  .roles-offers { gap: 4px; }
  .roles-offer { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who fig" "end end"; align-items: center; gap: 4px 10px; padding: 8px 12px; }
  .roles-offer-who { grid-area: who; gap: 8px; }
  .roles-offer-who .pebble.lg { width: 28px; height: 28px; }
  .roles-offer-who .roles-reason { display: none; }
  .roles-figs { grid-area: fig; display: block; padding: 0; border: 0; }
  .roles-figs > div { display: flex; align-items: baseline; gap: 4px; }
  .roles-figs > div + div { display: none; }
  .roles-big { font-size: 20px; line-height: 26px; letter-spacing: -0.02em; }
  .roles-offer { grid-template-areas: "who fig" "end award"; }
  .roles-offer-end { display: contents; }
  .roles-when { grid-area: end; }
  .roles-offer .roles-award { grid-area: award; justify-self: end; }
  /* Only the offer to award carries its button; the others' date is why they are not it */
  .roles-offer:not(.is-best) .roles-award { display: none; }
  .roles-buy-h .roles-who .pebble, .roles-buy-head .roles-pn { display: none; }
  .roles-buy-h { flex: 1 1 0; min-width: 0; }
  .roles-buy-head .roles-pic.lg { width: 32px; height: 32px; padding: 3px; }
  .roles-bar-end .roles-send { padding: 0 10px; }
  .roles-buy-bar { gap: 8px; }

  /* Your suppliers */
  .roles-sup { gap: 10px; padding: 12px; }
  .roles-mail, .roles-form { gap: 10px; padding: 12px 14px 14px; }
  .roles-field-v { min-height: 36px; }
  .roles-quote-btn, .roles-sent { min-height: 36px; }
  .roles-form .roles-pn { display: none; }
  /* The buyer's row: its name and state, then the price and the date, the date under the price where both do not fit */
  .roles-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; padding: 10px 14px; }
  .roles-strip::before { content: ""; order: 2; flex-basis: 100%; }
  .roles-strip-row { display: contents; }
  .roles-strip-row > .roles-who { display: none; }
  .roles-strip-h { order: 1; flex: 1 1 0; min-width: 0; }
  .roles-strip-row > :nth-child(2) { order: 1; }
  .roles-strip-row > :nth-child(n + 3) { order: 3; margin-top: 6px; }
  .roles-strip-row > :nth-child(4) { margin-left: auto; justify-items: end; text-align: right; }
}

@container roles-sheet (max-width: 340px) {
  .roles-dwg-pic { width: 100%; }
  .roles-mk { left: calc(var(--x) - 2%); }
  .roles-mk > span { gap: 3px; letter-spacing: -1px; }
  .roles-mk b { width: 18px; height: 18px; }
  .roles-offer .roles-nm { white-space: normal; }
  .roles-offer-end { flex-wrap: wrap; row-gap: 4px; }
  .roles .sheet .roles-strip .chip { padding-inline: 7px; }
  .roles-strip .roles-who .pebble { display: none; }
}

/* What each step is about reads at 15 px: the statuses and findings, the hand-off, the suppliers and their reasons,
   the offers, the request and its answer, the blocker and the ask, and every pressed button */
.roles .sheet :is(.roles-hg .chip, .roles-find-h, .roles-find-s, .roles-fixed, .roles-mk > span, .roles-hand-h, .roles-part .roles-nm, .roles-buy-tag .chip, .roles-buy-h .roles-who, .roles-sub-h, .roles-sug .roles-reason, .roles-sug .roles-nm, .roles-offer .roles-nm, .roles-when, .roles-mail-subj, .roles-mail-body, .roles-field-v, .roles-quote-btn, .roles-sent, .roles-opened, .roles-strip-v, .roles-strip .chip, .roles-proj .roles-nm, .roles-first, .roles-block .chip, .roles-ask .roles-awarded, .btn[data-t], [data-t] .btn) { font-size: 15px; }

/* Reduced motion: every state lands at once, by a crossfade of 120 ms at most, nothing moves */
@media (prefers-reduced-motion: reduce) {
  .roles *, .roles *::before, .roles *::after { transition-property: opacity !important; transition-duration: 120ms !important; transition-delay: 0s !important; }
}
