/* UniCirc Workspace 2 — the whole supply chain (#/chain, ws2-chain.js, prefix "ch-").
   Only the ws2.css tokens and look: no new colours, fonts, button styles or themes. The Handoff tag reuses .lp-ho-tag /
   .lp-ho-t from ws2-loop.css (the same look as the loop screens). Works from 390 px up.
   ch-chain / ch-st / ch-ho (the numbered vertical chain and the line between stages) · ch-pair (A and B side by side) ·
   ch-back (back to supply) · ch-state / ch-at (a loop's live state) · ch-ap / ch-mini / ch-leg (step approvals) ·
   ch-feed / ch-f (latest shared records) · ch-m / ch-feat / ch-src (how we recycle) */

/* a jump to a group (?loop= / ?part=) or to a record after "Show more" stops below the sticky top bar */
.grp[id^="ch-"], .ch-f { scroll-margin-top: calc(var(--top) + 16px); }

/* a loop's live state, under its title */
.ch-state { display: grid; gap: 2px; color: var(--ink-2); font-size: 14.5px; }
.ch-at { color: var(--ink-3); font-size: 13.5px; }

/* the numbered vertical chain */
.ch-chain { list-style: none; margin: 0; padding: 0; display: grid; min-width: 0; }
.ch-st { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; }
.ch-st::after { content: ""; position: absolute; left: 16px; top: 46px; bottom: 0; width: 2px; background: var(--line); }
.ch-chain:not(.ch-sub) > .ch-st:last-child::after { display: none; }
.ch-no { position: relative; z-index: 1; width: 34px; height: 34px; margin-top: 12px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); border: 2px solid var(--line); font: 600 13.5px/1 var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ch-st.ch-wait .ch-no { border-color: var(--wait); color: var(--wait); }
.ch-st.ch-now .ch-no { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.ch-card { display: grid; gap: 6px; min-width: 0; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); }
.ch-st.ch-now .ch-card { border-color: var(--glow); box-shadow: inset 0 0 0 1px var(--glow); background: var(--surface-2); }
.ch-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font: 600 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
html[data-lang="zh"] .ch-who { font-family: var(--sans); letter-spacing: .02em; font-size: 12.5px; text-transform: none; }
.ch-who .chip { font: 600 13.5px/1.3 var(--sans); letter-spacing: 0; text-transform: none; }
.ch-t { font-size: 16px; font-weight: 600; line-height: 1.3; }
.ch-what { color: var(--ink-2); font-size: 14.5px; }
.ch-ev { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.ch-ev .ic { width: 18px; height: 18px; margin-top: 2px; color: var(--ink-3); }
.ch-ev b { color: var(--ink); font-weight: 600; }
.ch-live { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.ch-live b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ch-live span { color: var(--ink-2); }
.ch-live small { flex-basis: 100%; color: var(--ink-3); font-size: 13.5px; }
.ch-bar { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); overflow: hidden; }
.ch-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--wait); }
.ch-waits { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-waits .chip, .ch-ap .chip { white-space: normal; }
.ch-open { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ink-2); font-size: 14.5px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-3); }
.ch-open:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* between two stages: the line, with a Handoff tag when another role takes over */
.ch-ho { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 34px; }
.ch-ho::before { content: ""; justify-self: center; align-self: stretch; width: 2px; background: var(--line); }
.ch-ho-l { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 6px 0; min-width: 0; }
.ch-ho-tag .lp-ho-t { font-size: 13.5px; color: var(--ink-2); }
.ch-arr { color: var(--ink-3); font-size: 16px; line-height: 1; }

/* A cleaning and B repair, side by side (stacked on phones) */
.ch-pair { min-width: 0; }
.ch-pair-in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.ch-pair .ch-st::after { bottom: -1px; }

/* the last recycling stage leads back to supply */
.ch-back { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; padding-top: 8px; }
.ch-back-i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 2px dashed var(--line); color: var(--ink-2); font-size: 16px; }
.ch-back p { color: var(--ink-2); font-size: 14.5px; }

/* step approvals, per batch */
.ch-aps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ch-ap { gap: 10px; }
.ch-ap-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ch-ap-h h3 { font-size: 16px; font-weight: 600; margin-right: 2px; }
.ch-ap-s { color: var(--ink-2); font-size: 14.5px; }
.ch-ap-n { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.ch-ap-n b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ch-ap-n span { color: var(--ink-2); }
ol.ch-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
ol.ch-mini li { position: relative; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 12px/1 var(--mono); border: 1.5px solid var(--line); color: var(--ink-3); }
ol.ch-mini li.done { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); }
ol.ch-mini li.now { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 2px var(--glow); }
ol.ch-mini li.ch-part { margin-left: 8px; }
.ch-kv { font-size: 14.5px; gap: 6px 18px; }
.ch-legs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; align-items: start; }
.ch-leg { display: grid; gap: 6px; min-width: 0; align-content: start; }
.ch-leg h4, .ch-h4 { margin: 0; font-size: 14.5px; font-weight: 600; }
.ch-leg-l { margin: 0; padding-left: 26px; display: grid; gap: 4px; align-content: start; color: var(--ink-2); font-size: 14.5px; }

/* latest shared records */
ol.ch-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ch-f { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 4px 14px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-2); min-width: 0; }
.ch-f > time { color: var(--ink-3); font-size: 13.5px; white-space: nowrap; padding-top: 2px; }
.ch-f-b { display: grid; gap: 2px; min-width: 0; justify-items: start; }
.ch-f-w { font-size: 13.5px; color: var(--ink-2); }
.ch-f-w .org { color: var(--ink-3); }
.ch-f-x { overflow-wrap: anywhere; }
.ch-f-r { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; color: var(--ink-2); font-size: 14px; }
a.ch-f-r { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-3); }
a.ch-f-r:hover { color: var(--ink); text-decoration-color: var(--ink); }
.ch-more { margin-top: 4px; }

/* how we recycle (when ws2-loop.js has no WS.methodCard) */
.ch-m { display: grid; gap: 12px; }
.ch-m-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-m-chips .chip { white-space: normal; }
.ch-feat, .ch-g2g { margin: 0; padding-left: 22px; display: grid; gap: 6px; color: var(--ink-2); }
.ch-src { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ch-src a { display: inline-flex; align-items: center; min-height: 36px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-3); overflow-wrap: anywhere; }
.ch-src a:hover { color: var(--ink); text-decoration-color: var(--ink); }

@media (max-width: 860px) {
  .ch-pair-in, .ch-legs { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .ch-st, .ch-ho, .ch-back { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
  .ch-no, .ch-back-i { width: 28px; height: 28px; font-size: 12.5px; }
  .ch-st::after { left: 13px; top: 40px; }
  .ch-card { padding: 12px 14px; }
  .ch-f { grid-template-columns: minmax(0, 1fr); }
}
