/*
 * Workflow Settings (workflow-settings.js)
 * ========================================
 * Loaded from this checkout's override asset root; the shared stylesheets are
 * untouched. .wfset* is the System Settings → Workflows screen — one list: each
 * workflow with its switch and who approves it. .wfoff-note is the notice a page shows
 * when its workflow is paused; .wfstage-note the one a review screen shows when an
 * approval step is skipped.
 */

/* --- the screen ----------------------------------------------------------------- */

.wfset__summary {
  margin: 0 0 .5rem;
}

.wfset__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
  align-items: start;
}

.wfset__card {
  margin: 0 !important;
}

/* One workflow: two lines — name and switch; who approves it and the path. */
.wfset__item {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
  padding: .45rem 0;
  border-top: 1px solid #eef2f9;
}

.sysset__cardhead + .wfset__item {
  border-top: 0;
  padding-top: .1rem;
}

.wfset__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 26px;
}

.wfset__title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  min-width: 0;
}

.wfset__label {
  font-size: .88rem;
  line-height: 1.25;
  color: #0f1f44;
}

.wfset__item.is-off .wfset__label {
  color: #64748b;
}

.wfset__actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 0 0 auto;
}

.wfset__pill {
  display: inline-flex;
  align-items: center;
  padding: 0 .4rem;
  height: 17px;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .05em;
}

.wfset__pill--on {
  background: #e9f6ee;
  color: #17693a;
}

.wfset__pill--off {
  background: #fdecea;
  color: #b42318;
}

/* "Approved by", the two tick-chips and the path, on one line. */
.wfset__by {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem .45rem;
  min-width: 0;
}

.wfset__bylabel {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #8a93a5;
}

.wfset__chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  min-width: 0;
}

.wfset__chip {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: 26px;
  padding: .1rem .55rem .1rem .25rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.wfset__chipmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 1.5px solid #94a3b8;
  border-radius: 5px;
  background: #fff;
  font-size: .64rem;
  font-weight: 900;
  line-height: 1;
}

.wfset__chip.is-on {
  border-color: #9fd3b2;
  background: #e9f6ee;
  color: #17693a;
}

.wfset__chip.is-on .wfset__chipmark {
  border-color: #17693a;
  background: #17693a;
  color: #fff;
}

.wfset__chip:not(.is-on) {
  border-style: dashed;
  background: #f8fafc;
  color: #7c8798;
}

.wfset__chip:not(.is-on) .wfset__chipname {
  text-decoration: line-through;
}

.wfset__chipoff {
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #b42318;
}

.wfset__chip:focus-visible,
.wfset__more:focus-visible {
  outline: 2px solid #2f6fbf;
  outline-offset: 2px;
}

.wfset__chip:disabled {
  opacity: .6;
  cursor: progress;
}

/* The path in words: plain text, amber when an approval is skipped, red when none is left. */
.wfset__path {
  min-width: 0;
  font-size: .72rem;
  line-height: 1.35;
  color: #64748b;
  overflow-wrap: anywhere;
}

.wfset__path.is-changed {
  color: #8a5a00;
  font-weight: 600;
}

.wfset__path.is-unchecked {
  color: #b42318;
}

/* Details: a small link on the first line; what it opens, under the row. */
.wfset__more {
  appearance: none;
  -webkit-appearance: none;
  padding: .1rem .2rem;
  border: 0;
  background: none;
  color: #2f6fbf;
  font: inherit;
  font-size: .74rem;
  font-weight: 600;
  cursor: pointer;
}

.wfset__more::after {
  content: ' ▸';
  font-size: .62rem;
}

.wfset__more[aria-expanded="true"]::after {
  content: ' ▾';
}

.wfset__detailbody {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .4rem .6rem;
  border-radius: 8px;
  background: #f6f8fc;
  font-size: .76rem;
  color: #64748b;
}

.wfset__detailbody[hidden] {
  display: none;
}

.wfset__detail {
  margin: 0;
  line-height: 1.4;
}

.wfset__detail strong {
  color: #334155;
}

/* The switch: a track and a knob, 42px wide so a thumb still finds it. */
.wfset__switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #cbd2df;
  cursor: pointer;
  transition: background-color .18s ease;
}

.wfset__switch.is-on {
  background: #17693a;
}

.wfset__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(13, 27, 62, .3);
  transition: transform .18s ease;
}

.wfset__switch.is-on .wfset__knob {
  transform: translateX(18px);
}

.wfset__switch:focus-visible {
  outline: 2px solid #2f6fbf;
  outline-offset: 2px;
}

.wfset__switch:disabled {
  opacity: .6;
  cursor: progress;
}

@media (prefers-reduced-motion: reduce) {
  .wfset__switch,
  .wfset__knob,
  .wfset__chip {
    transition: none;
  }
}

@media (max-width: 1100px) {
  .wfset__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Phones: the two approvers side by side, the path under them; the caption goes, and
   so does "ON" — the switch says it, and a paused workflow still shows OFF. */
@media (max-width: 600px) {
  .wfset__pill--on {
    display: none;
  }

  .wfset__by {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .3rem;
  }

  .wfset__bylabel {
    display: none;
  }

  .wfset__chips {
    display: contents;
  }

  .wfset__chip {
    flex-wrap: wrap;
    min-width: 0;
    row-gap: 0;
  }

  .wfset__chipname {
    flex: 1 1 0;
    min-width: 0;
  }

  /* "Skipped" on its own line under the name, never squeezing it. */
  .wfset__chipoff {
    flex-basis: 100%;
    padding-left: calc(16px + .3rem);
  }

  .wfset__path {
    grid-column: 1 / -1;
  }
}
/* --- a review screen with an approval step skipped -------------------------- */

.wfstage-note {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin: 0 0 .85rem;
  padding: .65rem .9rem;
  border: 1px solid #c9dbf5;
  border-left: 4px solid #2f6fbf;
  border-radius: 10px;
  background: #f2f7fe;
  color: #1d3d6b;
  font-size: .84rem;
  line-height: 1.45;
}

.wfstage-note__title {
  font-size: .8rem;
  letter-spacing: .02em;
  color: #1d3d6b;
}

/* --- a page whose workflow is paused ---------------------------------------- */

.wfoff-note {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin: 0 0 .85rem;
  padding: .7rem .9rem;
  border: 1px solid #f3d38a;
  border-left: 4px solid #d99a0b;
  border-radius: 10px;
  background: #fff8e6;
  color: #5c4100;
  font-size: .86rem;
  line-height: 1.45;
}

.wfoff-note__title {
  font-size: .82rem;
  letter-spacing: .02em;
  color: #7a5200;
}
