.run-flow-dialog {
  width: min(1080px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  border: 1px solid #485053;
  border-radius: 16px;
  background: #171b20;
  color: #e0e9f4;
  box-shadow: 0 24px 90px #0009;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: auto;
}
.run-flow-dialog::backdrop {
  background: #030811a8;
  backdrop-filter: blur(5px);
}
.run-flow-dialog [hidden] {
  display: none !important;
}
.run-flow-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #8291a51c;
}
.run-flow-heading h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #edf3fc;
}
.run-flow-heading p {
  font-size: 12px;
  color: #879bb1;
  margin: 5px 0 0;
}
.run-flow-heading > button,
.run-flow-detail header button {
  width: 30px;
  height: 30px;
  background: #ffffff06;
  color: #a0b1c7;
  border: 0;
  border-radius: 7px;
  font: 22px/1 sans-serif;
  cursor: pointer;
}
.run-flow-heading > button:hover,
.run-flow-detail header button:hover {
  background: #ffffff12;
  color: white;
}
.run-flow-body {
  padding: 20px 24px;
  background-color: #14191c;
  background-image: radial-gradient(#81989126 0.8px, transparent 1px), radial-gradient(ellipse at 25% 0%, #21302d, transparent 65%);
  background-size: 20px 20px, 100% 100%;
}
.flow-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  margin: 0 0 20px;
  gap: 12px;
}
.flow-overview p {
  margin: 0;
  color: #b6e5dd;
  font-size: 13px;
}
.flow-overview button {
  border: 1px solid #c9ac6855;
  background: #c9ac6810;
  color: #ead195;
  padding: 7px 11px;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.run-flow-diagram {
  position: relative;
  isolation: isolate;
}
.run-flow-nodes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(5, 68px);
  gap: 24px 34px;
  position: relative;
  z-index: 1;
}
.flow-node {
  grid-column: var(--col);
  grid-row: var(--row);
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  gap: 5px 8px;
  min-width: 0;
  position: relative;
  text-align: left;
  padding: 10px 12px 10px 15px;
  background: #242b31;
  border: 1px solid #454e55;
  border-radius: 9px;
  color: #eef1ee;
  font: inherit;
  cursor: pointer;
  box-shadow: inset 0 1px #ffffff08, 0 3px 9px #0003;
}
.flow-node:before {
  content: "";
  position: absolute;
  left: 6px;
  top: 12px;
  bottom: 12px;
  border-radius: 2px;
  width: 3px;
  background: #647a95;
}
.flow-node strong {
  grid-column: 1/-1;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow-node > span {
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #b2bec4;
}
.flow-node > small {
  font-size: 10px;
  line-height: 1.5;
  color: #8ba1b8;
  white-space: nowrap;
}
.flow-node[data-state="done"]:before {
  background: #82c7ae;
}
.flow-node[data-state="done"] {
  border-color: #405650;
}
.flow-node[data-state="done"] > small {
  color: #a1d3bc;
}
.flow-node[data-state="active"] {
  border-color: #75b6e2;
  box-shadow: 0 0 0 3px #75b6e210;
}
.flow-node[data-state="active"]:before {
  background: #79c7f3;
}
.flow-node[data-state="active"] > small {
  color: #91d2f6;
}
.flow-node[data-state="waiting"] {
  border-color: #d8b46e;
  background: linear-gradient(150deg, #393329, #2c2925);
  box-shadow: 0 0 0 3px #d8b46e0c;
}
.flow-node[data-state="waiting"]:before {
  background: #e5bf72;
}
.flow-node[data-state="waiting"] > small {
  color: #e4c684;
}
.flow-node:is([data-state="failed"], [data-state="ended"]) {
  border-color: #a76c83;
}
.flow-node:is([data-state="failed"], [data-state="ended"]):before {
  background: #df91ae;
}
.flow-node:is([data-state="failed"], [data-state="ended"]) > small {
  color: #e49db6;
}
.flow-gate {
  border-radius: 12px;
  background: #282e33;
}
.flow-node[data-node="budget"]:before,
.flow-node[data-node="lead"]:before {
  background: #d496b6;
}
.flow-node:hover,
.flow-node[aria-pressed="true"] {
  background: #303c3c;
  border-color: #a2c9b8;
}
.run-flow-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}
.run-flow-link {
  fill: none;
  stroke: #48617c;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  stroke-linejoin: round;
  opacity: 0.75;
}
.run-flow-link.ready {
  stroke: #749f90;
  stroke-dasharray: none;
  opacity: 1;
}
.run-flow-link.waiting {
  stroke: #d8b46e;
  stroke-dasharray: none;
}
.flow-legend {
  display: flex;
  gap: 17px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin: 18px 0;
  color: #93a7ba;
  font-size: 10px;
}
.flow-legend span:before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #62768d;
  margin: 0 5px 1px 0;
}
.flow-legend [data-state="done"]:before {
  background: #82c7ae;
}
.flow-legend [data-state="active"]:before {
  background: #79c7f3;
}
.flow-legend [data-state="waiting"]:before {
  background: #e5bf72;
}
.flow-error {
  font-size: 12px;
  color: #e5a7bb;
  line-height: 1.6;
}
.run-flow-detail {
  padding: 15px 17px;
  margin: 15px 0;
  color: #bbcddd;
  background: #20272c;
  border: 1px solid #3e5872;
  border-radius: 10px;
}
.run-flow-detail header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.run-flow-detail h3 {
  margin: 0;
  font-size: 14px;
  color: #dfeaf7;
  font-weight: 550;
}
.run-flow-detail p {
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.run-flow-detail dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 14px;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.6;
}
.run-flow-detail dt {
  color: #879fb9;
}
.run-flow-detail dd {
  margin: 0;
  color: #d3e0ee;
  overflow-wrap: anywhere;
}
.flow-history {
  margin-top: 16px;
  font-size: 12px;
  color: #b3c7d9;
  border-top: 1px solid #394246;
  padding-top: 10px;
}
.flow-history summary {
  padding: 5px 0;
  cursor: pointer;
}
.flow-history ol {
  list-style: none;
  max-height: 180px;
  overflow: auto;
  padding: 0;
  margin: 8px 0;
}
.flow-history li {
  display: grid;
  grid-template-columns: 4em 7em 1fr;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #333c41;
  font-size: 11px;
  line-height: 1.65;
}
.flow-history time {
  color: #879fb6;
}
.run-flow-dialog button:focus-visible {
  outline: 2px solid #96c1da;
  outline-offset: 3px;
}
@media (max-width: 700px) {
  .run-flow-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 24px);
    border-radius: 13px;
  }
  .run-flow-heading {
    padding: 16px;
  }
  .run-flow-body {
    padding: 16px;
  }
  .run-flow-nodes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(9, 65px);
    gap: 24px 28px;
  }
  .flow-node {
    grid-column: var(--mobile-col);
    grid-row: var(--mobile-row);
    padding: 9px 9px 9px 13px;
    gap: 3px 5px;
  }
  .flow-node strong {
    font-size: 11px;
  }
  .flow-node > span,
  .flow-node > small {
    font-size: 9px;
  }
  .flow-node > span {
    grid-column: 1/-1;
  }
  .flow-node > small {
    position: absolute;
    right: 7px;
    top: 7px;
    font-size: 8px;
    padding: 1px 3px;
    background: #172335;
    border-radius: 3px;
  }
  .flow-node strong {
    padding-right: 31px;
    white-space: normal;
    line-height: 1.35;
  }
  .flow-legend {
    justify-content: flex-start;
    gap: 12px;
  }
  .run-flow-detail dl {
    grid-template-columns: 95px 1fr;
  }
  .flow-history li {
    grid-template-columns: 3.5em 6em 1fr;
  }
}

.run-flow-dialog[open] {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(1680px, 96vw);
  height: 94dvh;
  max-height: none;
  overflow: hidden;
}
.run-flow-heading {display:block;flex:none;padding:14px 22px 10px}
.flow-heading-line,.flow-toolbar {display:flex;align-items:center;gap:14px}
.flow-heading-line p {margin:0}
.flow-heading-line button {margin-left:auto;width:30px;height:30px;border:0;border-radius:7px;background:#ffffff0c;color:#bac8d7;font:22px/1 sans-serif;cursor:pointer}
.flow-toolbar {justify-content:space-between;flex-wrap:wrap;margin-top:5px;gap:6px 16px}
.flow-toolbar .flow-overview,.flow-toolbar .flow-legend {margin:0}
.run-flow-body {flex:1;min-height:0;overflow:auto;display:grid;padding:20px 24px}
.run-flow-nodes {min-height:100%;grid-template-rows:repeat(5,minmax(58px,1fr));gap:clamp(16px,3vh,40px) clamp(34px,4vw,80px)}
.flow-node {align-self:center;min-height:58px}
.flow-node strong {font-size:14px;font-weight:600}
.flow-node > span,.flow-node > small {font-size:12px}
.flow-node > small {padding:0 6px;border-radius:5px;background:#ffffff08}
.flow-node[aria-pressed="true"] {outline:2px solid #bbd9ca;outline-offset:2px}
.run-flow-dialog .flow-history {background:#1b2025}
.run-flow-dialog .run-flow-detail {margin:0;padding:9px 22px;max-height:24dvh;overflow:auto;flex:none;border:0;border-bottom:1px solid #394246;border-radius:0}
.run-flow-detail [data-node-caption] {color:#a4d5d0;margin:2px 0}
.run-flow-dialog .flow-history {flex:none;margin:0;padding:6px 22px}
@media(max-width:700px){
  .run-flow-dialog[open]{width:calc(100vw - 8px);height:calc(100dvh - 10px)}
  .run-flow-heading {padding:10px 12px 8px}
  .flow-heading-line {gap:8px}
  .flow-toolbar .flow-legend {gap:8px}
  .run-flow-body {padding:14px 10px}
  .run-flow-nodes {grid-template-rows:repeat(9,65px);gap:24px 24px}
  .flow-node strong {font-size:12px}
  .flow-node > span,.flow-node > small {font-size:10px}
}

.run-flow-dialog[open] {background:white;color:#233344;border-color:#ced7df}
.run-flow-body {background:radial-gradient(#dce2e7 .8px,transparent 1px) 0 0/20px 20px white}
.run-flow-heading,.run-flow-dialog .flow-history,.run-flow-dialog .run-flow-detail {background:#f9fafb;border-color:#dce2e6;color:#364957}
.run-flow-heading h2,.run-flow-detail h3,.run-flow-detail dd {color:#172b3b}
.run-flow-heading p,.flow-legend,.flow-history time,.run-flow-detail dt {color:#516472}
.flow-overview p,.run-flow-detail [data-node-caption] {color:#216951}
.run-flow-dialog .flow-node[data-kind] {border:2px solid var(--pastel);border-radius:11px;background:var(--pastel);box-shadow:none;padding-left:15px}
.run-flow-dialog .flow-node[data-kind]::before {display:none}
.run-flow-dialog [data-kind="source"] {--pastel:#c7dff5}
.run-flow-dialog [data-kind="setting"] {--pastel:#dfd2f1}
.run-flow-dialog [data-kind="process"] {--pastel:#c7e6d8}
.run-flow-dialog [data-kind="approval"] {--pastel:#f7dfb5}
.run-flow-dialog [data-kind="result"] {--pastel:#f0cfdc}
.run-flow-dialog .flow-node strong {color:#192d37;font-weight:650}
.run-flow-dialog .flow-node > span {color:#374a52}
.run-flow-dialog .flow-node[data-state] > small {color:#2d443f;background:transparent;font-weight:600}
.flow-legend [data-kind]::before {background:var(--pastel);width:8px;height:8px}
.run-flow-dialog .run-flow-link {stroke-width:2.25px;stroke-linejoin:round;stroke-linecap:round}
.run-flow-dialog .run-flow-link.ready {stroke:#81939e}
.run-flow-dialog .flow-node[data-kind]:is(:hover,[aria-pressed="true"],:focus-visible) {
  outline: 2px solid #526875;
  outline-offset: 2px;
}
.flow-overview button {background:#fff1d7;color:#80530c}
.flow-error {color:#94334c;background:#fbeef1}
.run-flow-link.waiting {stroke:#a87527}
.flow-heading-line button,.run-flow-detail header button {background:#e9eef0;color:#465866}
.run-flow-detail header button:hover {background:#dce5e8;color:#223642}
.flow-history li {border-color:#dce2e6}

.run-flow-dialog dialog.run-flow-detail {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(440px, calc(100vw - 32px));
  max-height: 80dvh;
  box-sizing: border-box;
  padding: 0;
  background: white;
  border: 1px solid #ccd6d9;
  border-radius: 18px;
  box-shadow: 0 20px 70px #16334030;
}
dialog.run-flow-detail::backdrop { background: #24394338; }
dialog.run-flow-detail header { background: var(--pastel); padding: 18px 22px; align-items: flex-start; }
dialog.run-flow-detail header h3 { font-size: 20px; color: #192d37; }
dialog.run-flow-detail header button { background: #ffffff91; }
dialog.run-flow-detail header [data-node-caption] { color: #354e50; font-weight: 600; margin: 0 0 4px; }
dialog.run-flow-detail > p { margin: 16px 22px; font-size: 14px; }
dialog.run-flow-detail dl { margin: 16px 22px 22px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
dialog.run-flow-detail dl:empty { display: none; }
dialog.run-flow-detail dl div { background: #f4f7f7; border-radius: 9px; padding: 10px 12px; }
dialog.run-flow-detail dd { margin-top: 4px; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
