/* Call routing builder: visual polish over flow-editor.js markup (no markup
   dependencies beyond its existing classes and data attributes). */

#flow-editor {
  --flow-accent: #5843ce;
}
#flow-editor > .form-error:empty {
  display: none;
}
#flow-editor legend {
  font-size: 13px;
  font-weight: 600;
  color: #5b5f7a;
  letter-spacing: 0.2px;
}
#flow-editor .form-panel {
  border-radius: 16px;
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
}
#flow-editor .form-panel label.field {
  margin-bottom: 14px;
}
#flow-editor aside .form-panel {
  display: block;
}
@media (max-width: 700px) {
  #flow-editor .form-panel {
    grid-template-columns: 1fr;
  }
}

/* Step cards and the connectors between them */
.flow-canvas {
  gap: 34px;
  margin: 26px 0;
}
.flow-card {
  border: 1px solid #e3e4f1;
  border-radius: 18px;
  padding: 0 22px 20px;
  background: #fff;
  box-shadow: 0 1px 2px #1b1a4a0d, 0 6px 18px #1b1a4a0a;
  transition: box-shadow 240ms var(--ease-out, ease), border-color 240ms, transform 240ms var(--ease-out, ease);
}
.flow-card:hover {
  border-color: #d3cff0;
  box-shadow: 0 2px 4px #1b1a4a0f, 0 14px 30px #1b1a4a14;
}
.flow-card:focus-within {
  border-color: #b9adf5;
  box-shadow: 0 0 0 4px #5843ce14, 0 14px 30px #1b1a4a14;
}
.flow-card + .flow-card::before {
  content: "";
  position: absolute;
  top: -35px;
  left: 42px;
  width: 2px;
  height: 34px;
  border-radius: 2px;
  background: linear-gradient(180deg, #cfc8f7, #8f80ea);
  background-size: 100% 200%;
  animation: flow-current 1.8s linear infinite;
}
.flow-card + .flow-card::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 38px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #8f80ea;
}
@keyframes flow-current {
  from { background-position: 0 100%; }
  to { background-position: 0 -100%; }
}
.flow-card header {
  margin: 0 -22px 18px;
  padding: 16px 22px;
  border-bottom: 1px solid #efeff7;
  background: linear-gradient(180deg, #faf9ff, #fff);
  border-radius: 18px 18px 0 0;
}
.flow-card header .node-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(150deg, #efeaff, #e2dbff);
  color: var(--flow-accent);
  display: grid;
  place-items: center;
  flex: none;
  transition: transform 300ms var(--ease-spring, ease);
}
.flow-card:hover header .node-icon {
  transform: rotate(-6deg) scale(1.06);
}
.flow-card h3 {
  font-size: 15px;
  font-weight: 650;
  color: #14172b;
  letter-spacing: -0.2px;
}
.flow-card h3 small {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #1fbf6a1a;
  color: #128a4b;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  vertical-align: 2px;
}
.flow-card header small {
  font-size: 12px;
  color: #8a8ea8;
}
.flow-card header [data-flow-op="delete"] {
  color: #8a8ea8;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.flow-card header [data-flow-op="delete"]:hover {
  color: #c4283a;
  background: #fff1f2;
  border-color: #fecdd3;
}
.flow-card h4 {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #3d4160;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Weekly hours: one tidy row per day */
.flow-day {
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #f1f1f8;
}
.flow-day > strong {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.8px;
  color: #5b5f7a;
}
.flow-day > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.flow-day .flow-row {
  margin: 0;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: 12px;
  background: #f6f5fd;
  border: 1px solid #ebe8fa;
  align-items: center;
  flex-wrap: nowrap;
  animation: pop-in 260ms var(--ease-spring, ease) both;
}
.flow-day .flow-row label.field {
  min-width: 0;
  flex: 0 0 auto;
}
.flow-day .flow-row label.field > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.flow-day .flow-row input[type="time"] {
  width: 112px;
  min-height: 34px;
  padding: 4px 8px;
  border-color: transparent;
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.flow-day .flow-row label.field + label.field::before {
  content: "–";
  margin: 0 2px 0 -2px;
  color: #8a8ea8;
}
.flow-day .flow-row label.field + label.field {
  display: flex;
  align-items: center;
  gap: 6px;
}
.flow-day > div:not(:has(.flow-row))::before {
  content: "Closed";
  font-size: 12px;
  font-weight: 500;
  color: #a6a9c2;
  margin-right: 4px;
}
#flow-editor .button.small {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
}
[data-flow-op="interval-remove"],
[data-flow-op="holiday-remove"],
[data-flow-op="option-remove"] {
  color: #8a8ea8 !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
[data-flow-op="interval-remove"]:hover,
[data-flow-op="holiday-remove"]:hover,
[data-flow-op="option-remove"]:hover {
  color: #c4283a !important;
  background: #fff1f2 !important;
}
[data-flow-op="interval-add"],
[data-flow-op="holiday-add"],
[data-flow-op="option-add"] {
  border-style: dashed !important;
  color: var(--flow-accent) !important;
  background: transparent !important;
  box-shadow: none !important;
}
[data-flow-op="interval-add"]:hover,
[data-flow-op="holiday-add"]:hover,
[data-flow-op="option-add"]:hover {
  background: #f1eefe !important;
  border-color: #b9adf5 !important;
}

/* "When open →" style destinations read as routes to the next step */
.flow-card > label.field:has(select) > span,
.flow-card > .flow-row label.field:has(select) > span {
  color: var(--flow-accent);
}

/* Ring members and simulator answers: selectable chips */
.flow-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
  border: 0;
  padding: 0;
}
.flow-members legend {
  width: 100%;
  margin-bottom: 10px;
  font-size: 12px !important;
  font-weight: 600;
  color: #3d4160 !important;
}
.flow-members label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  border: 1px solid #e0e1ef;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: #3d4160;
  cursor: pointer;
  user-select: none;
  transition: background-color 200ms, border-color 200ms, color 200ms, transform 160ms var(--ease-spring, ease), box-shadow 200ms;
}
.flow-members label:hover {
  border-color: #c4bdf3;
  transform: translateY(-1px);
}
.flow-members label:active {
  transform: scale(0.96);
}
.flow-members input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid #c7c8dc;
  background: #fff;
  display: grid;
  place-items: center;
  transition: background-color 200ms, border-color 200ms;
}
.flow-members input::after {
  content: "";
  width: 8px;
  height: 5px;
  border: solid #fff;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  transition: transform 220ms var(--ease-spring, ease);
}
.flow-members input:checked {
  background: var(--flow-accent);
  border-color: var(--flow-accent);
}
.flow-members input:checked::after {
  transform: rotate(-45deg) scale(1);
}
.flow-members label:has(input:checked) {
  background: #f1eefe;
  border-color: #b9adf5;
  color: #2d2170;
  box-shadow: 0 2px 8px #5843ce1a;
}
.flow-members label:has(input:focus-visible) {
  box-shadow: 0 0 0 4px #5843ce26;
}

/* Transcription checkbox becomes a switch */
.flow-card > label:not(.field):has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 2px;
  font-size: 13px;
  font-weight: 500;
  color: #14172b;
  cursor: pointer;
}
.flow-card > label:not(.field) input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d5d6e8;
  cursor: pointer;
  transition: background-color 220ms;
}
.flow-card > label:not(.field) input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px #0003;
  transition: transform 260ms var(--ease-spring, ease);
}
.flow-card > label:not(.field) input[type="checkbox"]:checked {
  background: var(--flow-accent);
}
.flow-card > label:not(.field) input[type="checkbox"]:checked::before {
  transform: translateX(16px);
}

/* Add a step */
.flow-add {
  padding: 16px;
  border: 1.5px dashed #cfc8f7;
  border-radius: 18px;
  background: #fbfaff;
  align-items: end;
  transition: border-color 200ms, background-color 200ms;
}
.flow-add:hover {
  border-color: #a99bf3;
  background: #f6f4ff;
}
.flow-add label.field {
  margin: 0;
  min-width: 180px;
}
.flow-add [data-flow-op="add"] {
  min-height: 40px !important;
  padding: 0 18px !important;
  background: var(--flow-accent) !important;
  color: #fff !important;
  border-color: transparent !important;
}

/* Sticky save bar */
#flow-editor .form-actions {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  margin-top: 18px;
  padding: 12px 12px 12px 18px;
  border: 1px solid #e3e4f1;
  border-radius: 16px;
  background: #ffffffd9;
  backdrop-filter: blur(12px) saturate(140%);
  box-shadow: 0 10px 30px #1b1a4a1f;
  font-size: 13px;
  color: #5b5f7a;
}
#flow-editor .form-actions .button {
  min-height: 40px;
  padding: 0 20px;
  font-size: 13px;
}

/* Simulator and history */
#flow-editor aside.stack {
  position: sticky;
  top: 88px;
  align-self: start;
}
#flow-editor aside .form-panel {
  border-radius: 16px;
}
#flow-editor aside h2 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.2px;
  margin: 0 0 4px;
}
#flow-editor aside h2 + p {
  font-size: 12px;
  color: #8a8ea8;
  margin: 0 0 16px;
}
#flow-sim .button {
  width: 100%;
  justify-content: center;
}
.simulation-result {
  position: relative;
  margin: 18px 0 8px;
  padding: 0 0 0 22px;
  list-style: none;
  border-left: 0;
}
.simulation-result::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, #b9adf5, #e6e1fc);
  border-radius: 2px;
}
.simulation-result li {
  position: relative;
  padding: 0 0 14px;
  font-size: 13px;
  animation: rise-in 360ms var(--ease-out, ease) both;
}
.simulation-result li:nth-child(2) { animation-delay: 90ms; }
.simulation-result li:nth-child(3) { animation-delay: 180ms; }
.simulation-result li:nth-child(4) { animation-delay: 270ms; }
.simulation-result li:nth-child(n + 5) { animation-delay: 360ms; }
.simulation-result li::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--flow-accent);
}
.simulation-result li:last-child::before {
  background: var(--flow-accent);
  box-shadow: 0 0 0 4px #5843ce22;
}
.simulation-result li p {
  margin: 4px 0 0;
  color: #8a8ea8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.version-row {
  padding: 10px 0;
  border-top: 1px solid #f1f1f8;
  align-items: center;
}
.version-row:first-of-type {
  border-top: 0;
}
.version-row > span:last-child:not(:has(*)) {
  padding: 2px 10px;
  border-radius: 999px;
  background: #1fbf6a1a;
  color: #128a4b;
  font-size: 11px;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .flow-card + .flow-card::before {
    animation: none;
  }
}

/* Breathing room between help text, add buttons and the next field */
.flow-card .field-help {
  margin: 6px 0 14px;
}
.flow-card [data-flow-op="holiday-add"],
.flow-card [data-flow-op="option-add"] {
  margin-bottom: 18px;
}

/* ---------- Auto attendant and ring group summaries ---------- */
.step-summary {
  margin-bottom: 18px;
  animation: rise-in 420ms var(--ease-out, ease) both;
}
.step-summary .panel-header .button > .icon {
  width: 15px;
  height: 15px;
}
.ivr-greeting {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 20px 6px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(150deg, #f4f1ff, #faf9ff);
  border: 1px solid #ebe6fd;
  color: #2d2170;
  font-size: 14px;
  line-height: 1.55;
}
.ivr-greeting > .icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: #5843ce;
}
.ivr-options {
  list-style: none;
  margin: 10px 20px 20px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.ivr-options li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border-radius: 12px;
  border: 1px solid #ecedf6;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: #14172b;
  transition: transform 200ms var(--ease-out, ease), border-color 200ms, box-shadow 200ms;
}
.ivr-options li:hover {
  transform: translateX(3px);
  border-color: #d3cff0;
  box-shadow: 0 4px 14px #1b1a4a0f;
}
.ivr-options li > .icon {
  margin-left: auto;
  width: 16px;
  height: 16px;
  color: #b0a6ef;
}
.ivr-key {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(150deg, #6d58e0, #4a35c0);
  color: #fff;
  font-weight: 650;
  font-size: 15px;
  box-shadow: 0 4px 10px #5843ce40;
}
.ivr-key > .icon {
  width: 16px;
  height: 16px;
}
.ivr-fallback {
  color: #5b5f7a !important;
  background: #fafafd !important;
}
.ivr-fallback .ivr-key {
  background: #e7e8f3;
  color: #5b5f7a;
  box-shadow: none;
}
.ring-summary {
  padding: 18px 20px 20px;
}
.ring-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ring-member {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: #f1eefe;
  border: 1px solid #ddd6fb;
  font-size: 13px;
  font-weight: 500;
  color: #2d2170;
}
.ring-member b {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  color: #5843ce;
}
.ring-summary p {
  margin: 12px 0 0;
  font-size: 13px;
  color: #5b5f7a;
}
.step-empty {
  padding: 34px 28px;
}
.step-empty .feature-icon {
  animation: float-y 3.6s ease-in-out infinite;
}
.step-empty h3 {
  font-size: 18px;
  letter-spacing: -0.3px;
}
.step-empty p {
  max-width: 520px;
  font-size: 14px;
  line-height: 1.6;
}
@keyframes float-y {
  50% { transform: translateY(-5px); }
}

/* ---------- Settings: team invite form ---------- */
.team-empty {
  color: #8a8ea8;
  font-size: 13px;
  padding: 18px 20px !important;
}
.invite-form {
  border-top: 1px solid #efeff7;
  background: linear-gradient(180deg, #fbfaff, #fff);
}
.invite-intro {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}
.invite-intro h3 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 650;
}
.invite-intro .field-help {
  margin: 0;
}
.invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: 12px;
  align-items: end;
}
.invite-row label.field {
  margin: 0;
}
.invite-row .button {
  min-height: 40px;
  padding: 0 18px;
  font-size: 13px;
}
@media (max-width: 700px) {
  .invite-row {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .step-empty .feature-icon {
    animation: none;
  }
}
