.pl {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.2rem 1.25rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.pl-head { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: baseline; justify-content: space-between; }
.pl-legend { display: flex; flex-wrap: wrap; gap: 0.9rem; font-size: 0.875rem; color: var(--muted); margin: 0.55rem 0 0.2rem; }
.pl-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.pl-key { width: 0.7rem; height: 0.7rem; border-radius: 3px; display: inline-block; }
.pl-key.auto { background: var(--brand); }
.pl-key.human { background: #b8791a; }
.pl-key.done { background: var(--ok); }

.pl-scenarios { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.85rem 0 0.2rem; }
.pl-scenarios button {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  cursor: pointer;
}
.pl-scenarios button:hover { border-color: var(--brand); background: #eef6fb; }
.pl-scenarios button[disabled] { opacity: 0.5; cursor: wait; }

.pl-viewport { position: relative; margin-top: 1rem; }
.pl-flow { position: relative; display: flex; flex-direction: column; gap: 1.5rem; padding: 0.3rem 0.2rem 0.4rem; }
.pl-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pl-edges path { fill: none; stroke: rgba(20, 48, 72, 0.2); stroke-width: 1.6; transition: stroke 0.3s ease; }
.pl-edges path.on { stroke: var(--ok); stroke-width: 2.2; }
.pl-edges path.dim { stroke: rgba(20, 48, 72, 0.08); }

.pl-stage { position: relative; z-index: 1; display: grid; grid-template-columns: 6.4rem 1fr; gap: 0.75rem; align-items: start; }
.pl-stage-nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.6rem, 1fr)); gap: 0.55rem; }
.pl-stage-title {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.5rem 0 0;
  line-height: 1.25;
}
.pl-node {
  position: relative;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  padding: 0.55rem 0.65rem;
  font-size: 0.9375rem;
  opacity: 0.55;
  transition: opacity 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.pl-node.human { border-left-color: #b8791a; }
.pl-node.muted { opacity: 0.2; }
.pl-node.on {
  opacity: 1;
  border-color: rgba(14, 154, 120, 0.5);
  border-left-color: var(--ok);
  box-shadow: 0 6px 16px rgba(14, 154, 120, 0.16);
  transform: translateY(-1px);
}
.pl-node.firing { animation: pl-pulse 0.55s ease; }
@keyframes pl-pulse {
  0% { box-shadow: 0 0 0 0 rgba(14, 154, 120, 0.4); }
  100% { box-shadow: 0 0 0 12px rgba(14, 154, 120, 0); }
}
.pl-node b { display: block; font-weight: 700; color: var(--ink); line-height: 1.25; }
.pl-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.15rem;
}
.pl-node.human .pl-tag { color: #96620f; }
.pl-note { display: block; color: var(--muted); font-size: 0.875rem; margin-top: 0.25rem; line-height: 1.4; }
.pl-node.on .pl-note { color: var(--text); }

.pl-log { margin: 1.1rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.pl-log:empty { border-top: 0; }
.pl-log li {
  display: grid;
  grid-template-columns: 4.6rem 1fr;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
  animation: pl-fade 0.3s ease;
}
@keyframes pl-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.pl-log li:last-child { border-bottom: 0; }
.pl-when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.875rem; padding-top: 0.08rem; }
.pl-what b { color: var(--ink); }
.pl-what span { color: var(--muted); }
.pl-log li.human .pl-when { color: #96620f; font-weight: 700; }

.pl-integrations { margin-top: 1.15rem; border-top: 1px solid var(--line); padding-top: 0.9rem; }
.pl-integrations h3 { font-size: 1rem; margin: 0 0 0.15rem; color: var(--ink); }
.pl-int-hint { font-size: 0.875rem; color: var(--muted); margin: 0 0 0.6rem; }
.pl-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pl-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9375rem;
  background: #fbfdfe;
  color: var(--text);
}
.pl-chip.on { border-color: rgba(14, 154, 120, 0.45); background: #eaf7f3; }
.pl-chip em { font-style: normal; color: var(--muted); font-size: 0.8125rem; display: block; }
.pl-chip.live b::after {
  content: "live";
  margin-left: 0.35rem;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ok);
}
.pl-chip.sim b::after {
  content: "simulated";
  margin-left: 0.35rem;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The graph is the argument these pages make, so it breaks out of the reading
   column once the screen can hold it. Body copy stays narrow to stay readable. */
@media (min-width: 1024px) {
  .pl {
    width: min(1180px, calc(100vw - 3rem));
    margin-left: calc(50% - min(590px, calc(50vw - 1.5rem)));
    padding: 1.5rem 1.75rem 1.75rem;
  }
  .pl-stage { grid-template-columns: 7.5rem 1fr; gap: 1rem; }
  .pl-stage-nodes { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.7rem; }
  /* A stage with one step should read as a step, not a full-width banner. */
  .pl-node { max-width: 26rem; }
}

@media (max-width: 640px) {
  .pl-stage { grid-template-columns: 1fr; gap: 0.35rem; }
  .pl-stage-title { margin: 0; }
  .pl-stage-nodes { grid-template-columns: 1fr 1fr; }
  .pl-log li { grid-template-columns: 4rem 1fr; }
}
