.hero-workflow {
  --wf-purple: #6873b1;
  --wf-blue: var(--pr-blue, #3b5bdb);
  --wf-ink: #292d36;
  --wf-muted: #69707d;
  --wf-line: #e2e5eb;
  --wf-soft: #f5f6fa;
  --wf-duration: 3000ms;
  --wf-fade: 380ms;
  color: var(--wf-ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

.hero-workflow .wf-window {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid var(--wf-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 48px -30px rgba(37, 40, 73, .35);
}

/* Title bar with request-source tabs */
.hero-workflow .wf-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 4px 0 16px;
  border-bottom: 1px solid var(--wf-line);
  background: #fff;
  color: #434954;
  font-size: 11px;
}

.hero-workflow .wf-titlebar img {
  flex: 0 0 18px;
}

.hero-workflow .wf-live {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding-right: 12px;
  color: var(--wf-muted);
  font-size: 10px;
}

.hero-workflow .wf-live > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7aa08e;
}

.hero-workflow .wf-flows {
  display: flex;
  align-self: stretch;
  margin-left: auto;
}

.hero-workflow:not([data-ready]) .wf-flows,
.hero-workflow[data-ready] .wf-live {
  display: none;
}

.hero-workflow .wf-flows button {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 43px;
  padding: 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--wf-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.hero-workflow .wf-flows button:hover,
.hero-workflow .wf-flows button[aria-pressed="true"] {
  color: #465b9b;
}

.hero-workflow .wf-flows button[aria-pressed="true"] {
  border-bottom-color: var(--wf-purple);
  font-weight: 600;
}

.hero-workflow .wf-flows button:focus-visible {
  outline: 3px solid var(--wf-purple);
  outline-offset: -3px;
}

.hero-workflow .wf-caption {
  overflow: hidden;
  height: 36px;
  margin: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--wf-line);
  background: #fbfbfd;
  color: #434954;
  font-size: 12px;
  font-weight: 600;
  line-height: 36px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Icons */
.hero-workflow .wf-icon {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-workflow .wf-check {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  fill: #4f8a72;
}

.hero-workflow .wf-check path {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-workflow .wf-muted {
  color: var(--wf-muted);
}

.hero-workflow .wf-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e3e8fb;
  color: #2b3a8f;
  font-size: 9px;
  font-weight: 700;
}

/* Stage: queue + detail */
.hero-workflow .wf-stage {
  position: relative;
  display: flex;
  overflow: hidden;
  height: 360px;
  background: #fff;
}

.hero-workflow .wf-queue {
  flex: 0 0 40%;
  overflow: hidden;
  border-right: 1px solid var(--wf-line);
  background: #fff;
}

.hero-workflow .wf-queue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 14px 10px;
  font-size: 12px;
}

.hero-workflow .wf-queue-head span {
  color: var(--wf-muted);
  font-size: 10px;
}

.hero-workflow .wf-row {
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  border-top: 1px solid #eef0f4;
  font-size: 12px;
  line-height: 1.4;
}

.hero-workflow .wf-row > strong {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-workflow .wf-row-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--wf-muted);
  font-size: 10px;
}

.hero-workflow .wf-row-meta > span:first-child {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  white-space: nowrap;
}

.hero-workflow .wf-row-meta .wf-icon {
  flex-basis: 12px;
  width: 12px;
  height: 12px;
}

.hero-workflow .wf-row-tags {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hero-workflow .wf-row-tags .wf-avatar {
  margin-left: auto;
}

.hero-workflow .wf-tag {
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.hero-workflow .wf-tag-progress { background: #fdf2e3; color: #8a4b08; }
.hero-workflow .wf-tag-done { background: #e5f4ec; color: #1d6a45; }
.hero-workflow .wf-tag-waiting { background: #f0f2f7; color: #4a5060; }
.hero-workflow .wf-tag-high { background: #fdecec; color: #a8261b; }

.hero-workflow .wf-row-new {
  overflow: hidden;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top-width: 0;
  background: #eef1fd;
  opacity: 0;
  transition: max-height 450ms ease, padding 450ms ease, opacity 350ms ease;
}

.hero-workflow .wf-when-done { display: none; }

.hero-workflow .wf-detail {
  position: relative;
  flex: 1;
  min-width: 0;
}

/* Everything that appears per step */
.hero-workflow .wf-pane,
.hero-workflow .wf-overlay,
.hero-workflow .wf-toast,
.hero-workflow .wf-reply {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--wf-fade) ease, transform var(--wf-fade) ease, visibility 0s var(--wf-fade);
}

.hero-workflow .wf-pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}

.hero-workflow .wf-empty {
  align-items: center;
  justify-content: center;
  color: var(--wf-muted);
  font-size: 12px;
}

.hero-workflow .wf-empty .wf-icon {
  flex-basis: 26px;
  width: 26px;
  height: 26px;
  stroke-width: 1.6;
}

.hero-workflow .wf-meta {
  color: var(--wf-muted);
  font-size: 10px;
}

.hero-workflow .wf-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.hero-workflow .wf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
}

.hero-workflow .wf-chips > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f0f2f7;
  color: #3f4554;
}

.hero-workflow .wf-chips .wf-chip-owner {
  padding-left: 2px;
  background: #eef1fd;
  color: #2b3a8f;
  font-weight: 600;
}

.hero-workflow .wf-chips .wf-chip-owner .wf-avatar {
  flex-basis: 18px;
  width: 18px;
  height: 18px;
  background: #dce3fb;
  font-size: 8px;
}

.hero-workflow .wf-chips .wf-chip-high {
  background: #fdecec;
  color: #a8261b;
  font-weight: 600;
}

.hero-workflow .wf-message {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--wf-soft);
  color: #3f4554;
  font-size: 12px;
  line-height: 1.5;
}

.hero-workflow .wf-attachment {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  color: var(--wf-muted);
  font-size: 10px;
}

.hero-workflow .wf-reply {
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 16px;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
}

.hero-workflow .wf-reply > strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.hero-workflow .wf-reply p {
  margin: 0;
}

.hero-workflow .wf-draft {
  border: 1.5px solid #c9d2f6;
  background: #fafbff;
  color: #3f4554;
}

.hero-workflow .wf-draft > strong {
  color: #2b3a8f;
}

.hero-workflow .wf-reply-actions {
  display: flex;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
}

.hero-workflow .wf-reply-actions > span {
  padding: 4px 10px;
  border-radius: 6px;
  background: #eef0f5;
}

.hero-workflow .wf-reply-actions .wf-send {
  background: var(--wf-blue);
  color: #fff;
}

.hero-workflow .wf-sent {
  background: #e7f4ed;
  color: #1f3b2c;
}

.hero-workflow .wf-sent > strong {
  color: #1d6a45;
}

.hero-workflow .wf-sent .wf-check {
  flex-basis: 16px;
  width: 16px;
  height: 16px;
}

/* Manual ticket form */
.hero-workflow .wf-form {
  gap: 8px;
}

.hero-workflow .wf-form-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.hero-workflow .wf-form-head small {
  color: var(--wf-muted);
  font-size: 10px;
}

.hero-workflow .wf-fields {
  display: grid;
  gap: 8px;
}

.hero-workflow .wf-fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-workflow .wf-fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.hero-workflow .wf-field {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.hero-workflow .wf-field > span {
  color: var(--wf-muted);
  font-size: 10px;
  line-height: 1.4;
}

.hero-workflow .wf-field > strong {
  overflow: hidden;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--wf-line);
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 300ms ease, border-color 300ms ease;
}

.hero-workflow .wf-field em {
  color: #8a90a0;
  font-style: normal;
}

.hero-workflow .wf-field b {
  display: none;
  font-weight: 500;
}

.hero-workflow .wf-typed {
  display: inline-block;
  vertical-align: top;
}

.hero-workflow .wf-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

.hero-workflow .wf-create {
  padding: 6px 14px;
  border-radius: 7px;
  background: var(--wf-blue);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  opacity: .5;
  transition: opacity 250ms ease, box-shadow 250ms ease, transform 250ms ease;
}

.hero-workflow .wf-history {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 0 0 16px;
  color: #3f4554;
  font-size: 11px;
  line-height: 1.4;
}

/* Overlays and toasts */
.hero-workflow .wf-overlay {
  position: absolute;
  top: 26px;
  right: 16px;
  left: calc(40% + 16px);
  max-width: 340px;
  margin-inline: auto;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.5;
}

.hero-workflow .wf-overlay p {
  margin: 4px 0 0;
}

.hero-workflow .wf-incoming {
  border: 1px solid #dce1ee;
  background: #fff;
  box-shadow: 0 18px 36px -12px rgba(20, 23, 34, .25);
}

.hero-workflow .wf-incoming p {
  color: var(--wf-muted);
}

.hero-workflow .wf-overlay-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  color: #3f4554;
  font-size: 11px;
}

.hero-workflow .wf-overlay-head .wf-icon {
  color: var(--wf-purple);
}

.hero-workflow .wf-badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f0edf6;
  color: #5e4f7a;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.hero-workflow .wf-call {
  display: grid;
  justify-items: center;
  gap: 2px;
  background: #1d2130;
  color: #fff;
  text-align: center;
  box-shadow: 0 18px 36px -12px rgba(20, 23, 34, .45);
}

.hero-workflow .wf-call small {
  color: #c3c7d4;
  font-size: 11px;
}

.hero-workflow .wf-call p {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #2b3040;
  color: #e6e8ef;
}

.hero-workflow .wf-call-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: #2f3445;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .06);
  font-size: 14px;
  font-weight: 700;
}

.hero-workflow .wf-toast {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(290px, calc(100% - 28px));
  padding: 10px 12px;
  border: 1px solid var(--wf-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 32px -12px rgba(20, 23, 34, .28);
  font-size: 12px;
  line-height: 1.4;
}

.hero-workflow .wf-toast > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.hero-workflow .wf-toast small {
  color: var(--wf-muted);
  font-size: 10px;
}

.hero-workflow .wf-toast-resolved {
  right: auto;
  left: 14px;
}

.hero-workflow .wf-toast-dark {
  border-color: #1d2130;
  background: #1d2130;
  color: #fff;
}

.hero-workflow .wf-toast-dark small {
  color: #c3c7d4;
}

.hero-workflow .wf-toast-dark > .wf-icon {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  padding: 7px;
  border-radius: 8px;
  background: var(--wf-blue);
}

/* Step matrix: which elements show for each flow and step */
.hero-workflow[data-flow="email"][data-scene="1"] :is(.wf-empty, .wf-incoming),
.hero-workflow[data-flow="email"]:not([data-scene="1"]) .wf-ticket-email,
.hero-workflow[data-flow="email"][data-scene="2"] .wf-toast-assigned,
.hero-workflow[data-flow="email"][data-scene="3"] .wf-draft,
.hero-workflow[data-flow="email"][data-scene="4"] :is(.wf-sent, .wf-toast-resolved),
.hero-workflow[data-flow="manual"][data-scene="1"] .wf-call,
.hero-workflow[data-flow="manual"]:is([data-scene="2"], [data-scene="3"]) .wf-form,
.hero-workflow[data-flow="manual"][data-scene="4"] :is(.wf-ticket-manual, .wf-toast-created) {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.hero-workflow[data-flow="email"]:not([data-scene="1"]) .wf-row-email,
.hero-workflow[data-flow="manual"] .wf-row-email,
.hero-workflow[data-flow="manual"][data-scene="4"] .wf-row-manual {
  max-height: 90px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-top-width: 1px;
  opacity: 1;
}

.hero-workflow:is([data-flow="manual"], [data-flow="email"][data-scene="4"]) .wf-row-email .wf-when-done {
  display: inline;
}

.hero-workflow:is([data-flow="manual"], [data-flow="email"][data-scene="4"]) .wf-row-email .wf-when-open {
  display: none;
}

.hero-workflow[data-flow="manual"] .wf-row-email {
  background: #fff;
}

.hero-workflow[data-scene="3"] .wf-later em {
  display: none;
}

.hero-workflow[data-scene="3"] .wf-later b {
  display: inline;
}

.hero-workflow[data-scene="3"] .wf-create {
  opacity: 1;
  box-shadow: 0 0 0 4px rgba(59, 91, 219, .2);
  transform: scale(1.04);
}

.hero-workflow[data-ready][data-flow="manual"][data-scene="2"] .wf-typed {
  animation: wf-type 1000ms steps(26, end) 500ms both;
}

/* Controls */
.hero-workflow .wf-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 64px;
  padding: 8px 12px;
  border-top: 1px solid var(--wf-line);
  background: #fff;
}

.hero-workflow:not([data-ready]) .wf-controls {
  visibility: hidden;
}

.hero-workflow .wf-steps {
  display: flex;
  flex: 1;
  gap: 4px;
}

.hero-workflow .wf-controls button {
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #6f7480;
  font: inherit;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
}

.hero-workflow .wf-steps button {
  flex: 1;
}

.hero-workflow .wf-controls button:hover,
.hero-workflow .wf-controls button[aria-pressed="true"] {
  background: #f0f3f9;
  color: #465b9b;
}

.hero-workflow .wf-step-number {
  margin-right: 3px;
  color: #8a90a0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 9px;
}

.hero-workflow .wf-controls button:focus-visible {
  outline: 3px solid var(--wf-purple);
  outline-offset: 2px;
}

.hero-workflow .wf-controls button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.hero-workflow .wf-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-workflow .wf-toggle .wf-icon {
  flex-basis: 18px;
  width: 18px;
  height: 18px;
}

.hero-workflow .wf-pause,
.hero-workflow[data-playing="true"] .wf-play {
  display: none;
}

.hero-workflow[data-playing="true"] .wf-pause {
  display: block;
}

.hero-workflow .wf-progress {
  height: 3px;
  background: #eff1f5;
}

.hero-workflow .wf-progress span {
  display: block;
  height: 100%;
  background: var(--wf-purple);
  transform: scaleX(0);
  transform-origin: left;
}

.hero-workflow[data-ready] .wf-progress span {
  animation: wf-progress var(--wf-duration) linear both;
}

/* A step chosen while paused shows its end state instead of freezing mid-transition. */
.hero-workflow[data-static-scene] .wf-stage *,
.hero-workflow[data-static-scene] .wf-caption {
  transition: none !important;
}

.hero-workflow[data-static-scene] .wf-typed {
  animation: none !important;
}

.hero-workflow[data-playing="false"] *,
.hero-workflow[data-playing="false"] *::before,
.hero-workflow[data-playing="false"] *::after {
  animation-play-state: paused !important;
}

.hero-workflow figcaption {
  margin-top: 10px;
  color: var(--wf-muted);
  font-size: 10px;
  line-height: 1.5;
}

@keyframes wf-type {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes wf-progress {
  to { transform: scaleX(1); }
}

@media (max-width: 1199px) {
  .hero-workflow .wf-queue {
    flex-basis: 38%;
  }

  .hero-workflow .wf-overlay {
    left: calc(38% + 12px);
    right: 12px;
  }

  .hero-workflow .wf-flows button {
    padding: 0 8px;
  }
}

@media (max-width: 575px) {
  .hero-workflow .wf-stage {
    height: 380px;
  }

  .hero-workflow .wf-queue {
    display: none;
  }

  .hero-workflow .wf-overlay {
    right: 12px;
    left: 12px;
  }

  .hero-workflow .wf-titlebar {
    padding-left: 12px;
    font-size: 10px;
  }

  .hero-workflow .wf-flows button {
    padding: 0 7px;
    font-size: 10px;
  }

  .hero-workflow .wf-flows .wf-icon {
    display: none;
  }

  .hero-workflow .wf-caption {
    padding: 0 12px;
    font-size: 11px;
  }

  .hero-workflow .wf-pane {
    padding: 12px;
  }

  .hero-workflow .wf-reply {
    right: 12px;
    left: 12px;
  }

  .hero-workflow .wf-toast {
    right: 12px;
    width: calc(100% - 24px);
  }

  .hero-workflow .wf-toast-resolved {
    display: none;
  }

  .hero-workflow .wf-controls {
    padding: 8px;
  }

  .hero-workflow .wf-steps button {
    padding: 4px 2px;
    font-size: 9px;
  }

  .hero-workflow .wf-steps .wf-step-number {
    display: none;
  }
}

.hero-workflow[data-reduced="true"] *,
.hero-workflow[data-reduced="true"] *::before,
.hero-workflow[data-reduced="true"] *::after {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .hero-workflow *,
  .hero-workflow *::before,
  .hero-workflow *::after {
    animation: none !important;
    transition: none !important;
  }
}
