.policy-flow {
  --flow-gap: .9rem;
  --flow-line: var(--hub-border, #becbd7);
  container-type: inline-size;
  min-width: 0;
  margin-block: 1rem;
  padding: clamp(.75rem, 2vw, 1.2rem);
  border: 1px solid var(--flow-line);
  border-radius: 10px;
  background: var(--hub-surface-alt, #f4f7fa);
  color: var(--hub-text, #213b50);
  overflow-wrap: anywhere;
}
.policy-flow h3 {
  margin: 0 0 .8rem;
  color: inherit;
  font-size: 1rem;
}
.flow-root, .flow-card {
  min-width: 0;
  padding: .7rem .85rem;
  border: 1px solid var(--flow-line);
  border-radius: 7px;
  background: var(--hub-surface, #fff);
}
.flow-root {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: start;
  gap: .15rem .5rem;
  border-inline-start: 4px solid var(--hub-accent, #1c589b);
}
.flow-root strong { grid-column: 1; font-size: 1rem; font-weight: 650; }
.flow-source, .flow-label, .flow-count, .flow-note, .flow-notes, .flow-summary {
  color: var(--hub-muted, #506479);
  font-size: .82rem;
}
.flow-source { grid-column: 1 / -1; }
.flow-state {
  grid-column: 2;
  grid-row: 2;
  max-width: 15ch;
  padding: .1rem .45rem;
  color: var(--hub-text, #213b50);
  background: var(--hub-accent-soft, #e5eef9);
  border-radius: 4px;
  font-size: .8rem;
  line-height: 1.4;
}
.policy-flow :is(.flow-branches,.flow-card ul,.flow-notes) { list-style: none; padding: 0; }
.policy-flow .flow-branches { margin: 0 0 0 .85rem; }
.flow-branch {
  position: relative;
  margin: 0;
  padding: var(--flow-gap) 0 0 1.2rem;
  min-width: 0;
}
.flow-branch::before, .flow-branch::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.flow-branch::before {
  inset: 0 auto 0 0;
  border-inline-start: 1px solid var(--flow-line);
}
.flow-branch:last-child::before { bottom: auto; height: calc(var(--flow-gap) + 1.2rem); }
.flow-branch::after {
  top: calc(var(--flow-gap) + 1.2rem);
  left: 0;
  width: 1.2rem;
  border-top: 1px solid var(--flow-line);
}
.flow-card h4 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .15rem .5rem;
  color: inherit;
  font-size: .94rem;
  margin: 0;
}
.flow-count { font-weight: 400; white-space: nowrap; }
.flow-summary, .flow-note { margin: .3rem 0; }
.flow-card ul, .flow-notes { margin: .25rem 0 0; }
.flow-card .flow-item {
  display: grid;
  grid-template-columns: minmax(5rem, 30%) minmax(0,1fr);
  gap: .3rem .65rem;
  align-items: baseline;
  margin: 0;
  padding: .25rem 0;
  line-height: 1.45;
}
.flow-label { font-weight: 550; }
.flow-value { color: var(--hub-text, #213b50); font-size: .9rem; }
.flow-item.is-excluded .flow-label { font-weight: 700; }
.flow-more { margin-top: .3rem; }
.flow-more summary {
  width: fit-content;
  max-width: 100%;
  padding: .3rem .2rem;
  color: var(--hub-accent, #1955a0);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
}
.flow-more summary:focus-visible {
  outline: 2px solid var(--hub-accent, #1955a0);
  outline-offset: 2px;
}
.policy-flow .flow-notes { margin-top: .7rem; }
.flow-notes li { margin: .15rem 0; }
@container (max-width: 340px) {
  .policy-flow .flow-branches { margin-left: .5rem; }
  .flow-card .flow-item { display: block; }
  .flow-item span { display: block; }
  .flow-root { grid-template-columns: 1fr; }
  .flow-state { grid-area: auto; justify-self: start; }
}
@container (min-width: 680px) {
  .flow-root { width: fit-content; max-width: 85%; margin-inline: auto; }
  .policy-flow .flow-branches { display: flex; position: relative; gap: var(--flow-gap); margin: 0; padding-top: 1rem; }
  .flow-branches::before {
    content: ""; position: absolute; inset: 0 auto auto 50%; height: 1rem; border-inline-start: 1px solid var(--flow-line);
  }
  .flow-branch { flex: 1 1 0; padding: 1rem 0 0; }
  .flow-branch::before, .flow-branch:last-child::before {
    inset: 0 auto auto 50%; height: 1rem; width: 0; border-inline-start: 1px solid var(--flow-line);
  }
  .flow-branch::after {
    top: 0; left: calc(0px - var(--flow-gap) / 2); width: calc(100% + var(--flow-gap));
  }
  .flow-branch:first-child::after { left: 50%; width: calc(50% + var(--flow-gap) / 2); }
  .flow-branch:last-child::after { width: calc(50% + var(--flow-gap) / 2); }
  .flow-branch:only-child::after { content: none; }
  .flow-card .flow-item { display: block; }
  .flow-item span { display: block; }
}
@media (forced-colors: active) {
  .policy-flow { --flow-line: CanvasText; }
  .flow-more summary:focus-visible { outline-color: Highlight; }
}
