.xh-workflow-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .25rem 1rem;
  margin-block-end: .5rem;
}

.xh-workflow-heading h2 {
  margin: 0;
}

.xh-workflow-all {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .35rem .2rem;
  border: 0;
  background: transparent;
  color: var(--xh-link);
  font: inherit;
  cursor: pointer;
}

.xh-workflow-all[hidden] {
  display: none;
}

.xh-workflow-all:focus-visible {
  outline: 2px solid var(--xh-link);
  outline-offset: 3px;
}

.xh-flow.xh-flow--timeline {
  --step-number-size: 2rem;
  --step-inset: .9rem;
  padding: 0;
  list-style: none;
}

.xh-flow--timeline > li {
  position: relative;
  margin: 0;
  padding-inline-start: calc(var(--step-number-size) + .85rem);
  border: 0;
}

.xh-flow--timeline > li:not(:last-child)::before {
  position: absolute;
  inset-block: var(--step-inset) calc(-1 * var(--step-inset) - 1px);
  inset-inline-start: calc(var(--step-number-size) / 2);
  width: 1px;
  background: var(--xh-line);
  content: "";
  pointer-events: none;
}

.xh-flow--timeline details {
  border-block-start: 1px solid var(--xh-line);
}

.xh-flow--timeline details[open] {
  padding-block-end: var(--step-inset);
}

.xh-flow--timeline > li:last-child details {
  border-block-end: 1px solid var(--xh-line);
}

.xh-flow--timeline summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .22rem .8rem;
  align-items: start;
  min-height: calc(var(--step-number-size) + var(--step-inset) * 2);
  padding: var(--step-inset) .15rem var(--step-inset) 0;
  list-style: none;
  cursor: pointer;
}

.xh-flow--timeline summary::-webkit-details-marker {
  display: none;
}

.xh-flow--timeline summary h3 {
  margin: 0;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.xh-workflow-caption {
  grid-column: 1 / -1;
  color: var(--xh-muted);
  font-size: .91rem;
}

.xh-workflow-number {
  position: absolute;
  inset-block-start: calc(var(--step-inset) + 1px);
  inset-inline-start: 0;
  display: grid;
  width: var(--step-number-size);
  height: var(--step-number-size);
  place-items: center;
  border: 1px solid var(--xh-line);
  border-radius: 50%;
  background: var(--xh-paper);
  color: var(--xh-ink);
  font-size: .9rem;
  font-weight: 675;
  line-height: 1;
}

.xh-flow--timeline details[open] .xh-workflow-number,
.xh-workflow-confirmation .xh-workflow-number,
.xh-flow--timeline > li:target .xh-workflow-number {
  border-color: var(--xh-link);
  background: #e6eff3;
  color: var(--xh-link);
}

.xh-workflow-control {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  color: var(--xh-link);
  font-size: .91rem;
  white-space: nowrap;
}

.xh-workflow-chevron {
  display: inline-block;
  width: .48rem;
  height: .48rem;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-.11rem) rotate(45deg);
}

.xh-workflow-all[data-all-open] .xh-workflow-chevron,
.xh-flow--timeline details[open] .xh-workflow-chevron {
  transform: translateY(.13rem) rotate(225deg);
}

.xh-workflow-all:hover .xh-workflow-all-label,
.xh-flow--timeline summary:hover .xh-workflow-control {
  text-decoration: underline;
  text-underline-offset: .2em;
}

.xh-flow--timeline details[open] .xh-workflow-open,
.xh-flow--timeline details:not([open]) .xh-workflow-close {
  display: none;
}

.xh-workflow-body {
  padding: .85rem 1rem;
  border-radius: .45rem;
  background: #edf2f3;
}

.xh-workflow-body .resource-fields {
  margin: 0;
}

.xh-workflow-body .resource-fields > div {
  grid-template-columns: minmax(5.5rem, .6fr) minmax(0, 4fr);
}

.xh-workflow-body .resource-fields > div:first-child {
  margin-block-start: 0;
}

.xh-workflow-body .resource-fields > .xh-workflow-exception {
  margin-block-start: .75rem;
  padding: .6rem .75rem;
  border-radius: .45rem;
  background: #f8f1e7;
  color: #684326;
}

.xh-workflow-exception dd {
  color: inherit;
}

@media (max-width: 420px) {
  .xh-flow.xh-flow--timeline {
    --step-number-size: 1.75rem;
    --step-inset: .7rem;
  }

  .xh-flow--timeline > li {
    padding-inline-start: calc(var(--step-number-size) + .55rem);
  }

  .xh-flow--timeline summary {
    column-gap: .45rem;
  }

  .xh-workflow-body {
    padding-inline: .65rem;
  }

  .xh-workflow-body .resource-fields > div {
    grid-template-columns: minmax(0, 1fr);
    gap: .1rem;
    margin-block-start: .65rem;
  }
}

[data-topic-workflow] {
  --xh-ink: var(--inner-ink);
  --xh-link: var(--inner-accent);
  --xh-line: var(--inner-line);
  --xh-muted: #445761;
  --xh-paper: #fff;
  max-inline-size: 60rem;
}

[data-topic-workflow] .xh-flow--timeline {
  margin-block: 0;
}

#workflow[data-topic-workflow] .xh-flow--timeline > li > details,
#workflow[data-topic-workflow] .xh-flow--timeline > li > details > summary {
  position: static;
}

#workflow[data-topic-workflow] .xh-flow--timeline > li > details > summary {
  display: grid;
  padding: var(--step-inset) .15rem var(--step-inset) 0;
  font-weight: normal;
}

#workflow[data-topic-workflow] .xh-flow--timeline summary::after {
  content: none;
}

[data-topic-workflow] .xh-flow--timeline summary h3 {
  font-weight: 700;
}

[data-topic-workflow] .xh-workflow-body {
  background: var(--inner-paper);
  overflow-wrap: anywhere;
}

[data-topic-workflow] .xh-flow--timeline > li,
.topic-workflow-exceptions li {
  scroll-margin-top: 108px;
}

[data-topic-workflow] summary:focus-visible {
  outline: 2px solid var(--inner-accent);
  outline-offset: 2px;
}

[data-topic-workflow] .xh-flow--timeline details[open] .xh-workflow-number,
[data-topic-workflow] .xh-flow--timeline > li:target .xh-workflow-number {
  background: var(--inner-paper);
}

[data-topic-workflow] .xh-workflow-body :is(.field-fields, .resource-fields) {
  margin-block: 0;
}

[data-topic-workflow] .xh-workflow-body :is(.field-fields, .resource-fields) > div {
  display: grid;
  grid-template-columns: minmax(5rem, max-content) minmax(0, 1fr);
  gap: .1rem .85rem;
  margin-block-start: .45rem;
}

[data-topic-workflow] .xh-workflow-body :is(.field-fields, .resource-fields) > div:first-child {
  margin-block-start: 0;
}

[data-topic-workflow] .xh-workflow-body .xh-workflow-exception {
  margin-block-start: .65rem;
  padding: .55rem .7rem;
  border: 0;
  border-radius: .45rem;
  background: #f8f1e7;
  color: #684326;
}

[data-topic-workflow] .xh-workflow-exception :is(dt, dd, a),
.topic-workflow-exceptions {
  color: #684326;
}

.topic-workflow-exceptions,
.topic-workflow-checks {
  margin-block-start: .9rem;
  padding: .65rem .85rem;
  border-radius: .45rem;
}

.topic-workflow-exceptions {
  background: #f8f1e7;
}

.topic-workflow-checks {
  color: var(--inner-ink);
  background: var(--inner-paper);
}

.topic-workflow-exceptions h3,
.topic-workflow-checks h3 {
  margin: 0;
  color: inherit;
  font-size: 1rem;
}

.topic-workflow-exceptions ul,
.topic-workflow-checks ul {
  margin: .35rem 0 0;
  padding-inline-start: 1.15rem;
}

.topic-workflow-exceptions li + li,
.topic-workflow-checks li + li {
  margin-block-start: .25rem;
}

@media (max-width: 560px) {
  [data-topic-workflow] .xh-workflow-body :is(.field-fields, .resource-fields) > div {
    grid-template-columns: minmax(0, 1fr);
  }

  [data-topic-workflow] .xh-flow--timeline > li,
  .topic-workflow-exceptions li {
    scroll-margin-top: 84px;
  }
}
