/* Тип поля «Этапы» — палитра бренда #0B679E */

.stages-view {
  --stages-accent: var(--brand-accent, #0B679E);
  --stages-accent-soft: color-mix(in srgb, var(--stages-accent) 14%, #fff);
  --stages-accent-mid: color-mix(in srgb, var(--stages-accent) 35%, #fff);
  --stages-muted: var(--bs-secondary-color);
  --stages-line: var(--bs-border-color);
  font-size: 13px;
  font-weight: 400;
}

.stages-list-cell__stage { color: var(--bs-secondary-color); }
.stages-list-cell__status { color: var(--bs-body-color); }

.stages-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1;
  border: 1.5px solid var(--stages-line);
  background: #fff;
  color: transparent;
  box-sizing: border-box;
}
.stages-mark--done {
  border-color: var(--stages-accent);
  background: var(--stages-accent);
  color: #fff;
}
.stages-mark--current {
  border-color: var(--stages-accent);
  background: #fff;
  box-shadow: inset 0 0 0 4px var(--stages-accent);
}
.stages-mark--upcoming {
  border-color: color-mix(in srgb, var(--stages-muted) 35%, var(--stages-line));
  background: #fff;
}

/* --- admin --- */
.stages-admin__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stages-admin__stage {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: var(--bs-body-bg);
  padding: 10px 12px;
}
.stages-admin__stage-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.stages-admin__stage-head .form-control {
  flex: 1 1 auto;
  font-weight: 500;
}
.stages-admin__stage-actions {
  display: inline-flex;
  gap: 4px;
  flex: 0 0 auto;
}
.stages-admin__statuses {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 8px;
  border-left: 2px solid var(--bs-border-color);
  margin-left: 4px;
}
.stages-admin__status {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stages-admin__status-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--bs-secondary-color);
  flex: 0 0 auto;
}
.stages-admin__add-status {
  align-self: flex-start;
  margin-top: 2px;
}
.stages-admin__preview {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: var(--bs-body-bg);
  padding: 14px 16px;
  min-height: 72px;
}
.stages-admin__preview-note {
  border-top: 1px solid var(--bs-border-color);
  padding-top: 8px;
}

/* --- pipeline --- */
.stages-pipeline__track {
  display: grid;
  grid-template-columns: repeat(var(--stages-n, 1), minmax(0, 1fr));
  gap: 0;
  position: relative;
}
.stages-pipeline__track::before {
  content: '';
  position: absolute;
  left: calc(100% / var(--stages-n, 1) / 2);
  right: calc(100% / var(--stages-n, 1) / 2);
  top: 8px;
  height: 2px;
  background: var(--stages-line);
  z-index: 0;
}
.stages-pipeline__step {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 4px;
  min-width: 0;
}
.stages-pipeline__node {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.stages-pipeline__name {
  color: var(--stages-muted);
  line-height: 1.25;
  font-size: 12px;
  min-height: 2.5em;
}
.stages-pipeline__step.is-done .stages-pipeline__name,
.stages-pipeline__step.is-current .stages-pipeline__name {
  color: var(--bs-body-color);
}
.stages-pipeline__step.is-current .stages-pipeline__name {
  color: var(--stages-accent);
}
.stages-pipeline__status {
  min-height: 1.3em;
  margin-top: 4px;
  font-size: 12px;
  color: var(--stages-accent);
}

/* --- timeline --- */
.stages-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.stages-timeline__item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 0 0 14px;
  position: relative;
}
.stages-timeline__item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--stages-line);
}
.stages-timeline__item.is-done:not(:last-child)::before {
  background: var(--stages-accent-mid);
}
.stages-timeline__marker {
  display: flex;
  justify-content: center;
  padding-top: 1px;
}
.stages-timeline__title { color: var(--stages-muted); }
.stages-timeline__item.is-current .stages-timeline__title { color: var(--stages-accent); }
.stages-timeline__item.is-done .stages-timeline__title { color: var(--bs-body-color); }
.stages-timeline__status {
  margin-top: 2px;
  color: var(--bs-body-color);
}

/* --- stepper --- */
.stages-stepper { display: flex; flex-direction: column; gap: 8px; }
.stages-stepper__row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.stages-stepper__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--stages-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--stages-muted);
  flex: 0 0 auto;
  background: #fff;
}
.stages-stepper__row.is-done .stages-stepper__num {
  border-color: var(--stages-accent);
  background: var(--stages-accent);
  color: #fff;
}
.stages-stepper__row.is-current .stages-stepper__num {
  border-color: var(--stages-accent);
  color: var(--stages-accent);
  background: var(--stages-accent-soft);
}
.stages-stepper__title { color: var(--stages-muted); }
.stages-stepper__row.is-current .stages-stepper__title { color: var(--stages-accent); }
.stages-stepper__row.is-done .stages-stepper__title { color: var(--bs-body-color); }
.stages-stepper__status { margin-top: 2px; color: var(--bs-body-color); }

/* --- progress --- */
.stages-progress__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.stages-progress__stage { color: var(--stages-accent); }
.stages-progress__status { color: var(--bs-body-color); }
.stages-progress__grid {
  display: grid;
  grid-template-columns: repeat(var(--stages-n, 1), minmax(0, 1fr));
  gap: 4px;
}
.stages-progress__seg {
  height: 8px;
  border-radius: 4px;
  background: var(--stages-line);
  overflow: hidden;
}
.stages-progress__fill {
  display: block;
  height: 100%;
  background: var(--stages-accent);
  border-radius: inherit;
}
.stages-progress__label {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.25;
  color: var(--stages-muted);
  text-align: center;
  word-break: break-word;
}
.stages-progress__col.is-current .stages-progress__label { color: var(--stages-accent); }
.stages-progress__col.is-done .stages-progress__label { color: var(--bs-body-color); }

/* --- cards --- */
.stages-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.stages-cards__item {
  border: 1px solid var(--stages-line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  min-height: 72px;
  display: flex;
  flex-direction: column;
}
.stages-cards__item.is-done {
  border-color: var(--stages-accent-mid);
  background: color-mix(in srgb, var(--stages-accent) 4%, #fff);
}
.stages-cards__item.is-current {
  border-color: var(--stages-accent);
  background: var(--stages-accent-soft);
}
.stages-cards__item.is-upcoming { opacity: .62; }
.stages-cards__top {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.stages-cards__title {
  font-size: 12px;
  color: var(--bs-body-color);
  line-height: 1.3;
}
.stages-cards__item.is-current .stages-cards__title { color: var(--stages-accent); }
.stages-cards__status {
  margin-top: auto;
  padding-top: 6px;
  min-height: 1.2em;
  font-size: 12px;
  color: var(--bs-body-color);
}

/* --- breadcrumb --- */
.stages-breadcrumb__path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.stages-breadcrumb__sep { color: var(--stages-muted); opacity: .45; }
.stages-breadcrumb__item { color: var(--stages-muted); }
.stages-breadcrumb__item.is-done { color: var(--bs-body-color); }
.stages-breadcrumb__item.is-current {
  color: #111;
  background: var(--stages-accent-soft);
  padding: 1px 8px;
  border-radius: 4px;
}
.stages-breadcrumb__item.is-upcoming { opacity: .55; }
.stages-breadcrumb__now {
  margin-top: 6px;
  color: var(--bs-body-color);
}

/* --- badges --- */
.stages-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.stages-badges__stage,
.stages-badges__status {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
}
.stages-badges__stage {
  color: var(--stages-accent);
  background: var(--stages-accent-soft);
  border: 1px solid var(--stages-accent-mid);
}
.stages-badges__status {
  color: #fff;
  background: var(--stages-accent);
}

/* --- segments --- */
.stages-segments__track,
.stages-segments__labels {
  display: grid;
  grid-template-columns: repeat(var(--stages-n, 1), minmax(0, 1fr));
  gap: 3px;
}
.stages-segments__seg {
  height: 10px;
  border-radius: 3px;
  background: var(--stages-line);
  overflow: hidden;
}
.stages-segments__fill {
  display: block;
  height: 100%;
  background: var(--stages-accent);
  border-radius: inherit;
}
.stages-segments__labels {
  margin-top: 6px;
}
.stages-segments__labels span {
  font-size: 11px;
  text-align: center;
  color: var(--stages-muted);
  line-height: 1.25;
  word-break: break-word;
}
.stages-segments__labels .is-current { color: var(--stages-accent); }
.stages-segments__labels .is-done { color: var(--bs-body-color); }
.stages-segments__caption {
  margin-top: 8px;
  color: var(--bs-body-color);
}

/* --- checklist --- */
.stages-checklist__stage {
  margin-bottom: 8px;
  color: var(--stages-accent);
}
.stages-checklist__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.stages-checklist__list li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  color: var(--stages-muted);
}
.stages-checklist__list li.is-current { color: var(--bs-body-color); }
.stages-checklist__list li.is-done { color: var(--bs-body-color); opacity: .85; }

/* --- kanban --- */
.stages-kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.stages-kanban__col {
  border: 1px solid var(--stages-line);
  border-radius: 8px;
  padding: 8px;
  background: color-mix(in srgb, var(--stages-accent) 3%, #f6f8fa);
  min-height: 88px;
  box-shadow: none;
}
.stages-kanban__col.is-current {
  border-color: var(--stages-accent);
  background: var(--stages-accent-soft);
  box-shadow: none;
}
.stages-kanban__col.is-upcoming { opacity: .55; }
.stages-kanban__head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--stages-muted);
  margin-bottom: 8px;
}
.stages-kanban__col.is-current .stages-kanban__head { color: var(--stages-accent); }
.stages-kanban__card {
  background: #fff;
  border: 1px solid var(--stages-accent-mid);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--bs-body-color);
}
.stages-kanban__done {
  font-size: 11px;
  color: var(--stages-accent);
}

/* --- dots --- */
.stages-dots { position: relative; }
.stages-dots__line {
  position: absolute;
  left: calc(100% / var(--stages-n, 1) / 2);
  right: calc(100% / var(--stages-n, 1) / 2);
  top: 8px;
  height: 2px;
  background: var(--stages-line);
}
.stages-dots__row {
  display: grid;
  grid-template-columns: repeat(var(--stages-n, 1), minmax(0, 1fr));
  position: relative;
  z-index: 1;
}
.stages-dots__item { text-align: center; padding: 0 4px; }
.stages-dots__node { display: flex; justify-content: center; margin-bottom: 8px; }
.stages-dots__name {
  font-size: 11px;
  color: var(--stages-muted);
  line-height: 1.25;
  min-height: 2.4em;
}
.stages-dots__item.is-current .stages-dots__name { color: var(--stages-accent); }
.stages-dots__item.is-done .stages-dots__name { color: var(--bs-body-color); }
.stages-dots__now {
  margin-top: 8px;
  text-align: center;
  color: var(--bs-body-color);
}

/* --- ribbon --- */
.stages-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.stages-ribbon__item {
  position: relative;
  background: color-mix(in srgb, var(--stages-muted) 10%, #fff);
  color: var(--stages-muted);
  padding: 7px 16px 7px 18px;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
  font-size: 12px;
  box-shadow: none;
  filter: none;
}
.stages-ribbon__item:first-child {
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
  padding-left: 12px;
}
.stages-ribbon__item.is-done {
  background: var(--stages-accent-mid);
  color: #fff;
}
.stages-ribbon__item.is-current {
  background: var(--stages-accent);
  color: #fff;
}
.stages-ribbon__item.is-upcoming { opacity: .7; }
.stages-ribbon__now {
  margin-top: 8px;
  color: var(--bs-body-color);
}

/* --- rail --- */
.stages-rail { display: flex; flex-direction: column; }
.stages-rail__item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  position: relative;
  padding-bottom: 14px;
}
.stages-rail__item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--stages-line);
}
.stages-rail__item.is-done:not(:last-child)::before {
  background: var(--stages-accent-mid);
}
.stages-rail__axis { display: flex; justify-content: center; }
.stages-rail__title { color: var(--stages-muted); }
.stages-rail__item.is-current .stages-rail__title { color: var(--stages-accent); }
.stages-rail__item.is-done .stages-rail__title { color: var(--bs-body-color); }
.stages-rail__status {
  margin-top: 2px;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--stages-accent-soft);
  color: var(--stages-accent);
  font-size: 12px;
}

/* --- split --- */
.stages-split {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(160px, 1.2fr);
  gap: 16px;
  align-items: start;
}
.stages-split__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stages-split__row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--stages-muted);
  font-size: 12px;
}
.stages-split__row.is-done { color: var(--bs-body-color); }
.stages-split__row.is-current { color: var(--stages-accent); }
.stages-split__row.is-upcoming { opacity: .55; }
.stages-split__detail {
  border: 1px solid var(--stages-accent-mid);
  border-radius: 8px;
  background: var(--stages-accent-soft);
  padding: 12px 14px;
}
.stages-split__stage {
  font-size: 12px;
  color: var(--stages-accent);
  margin-bottom: 4px;
}
.stages-split__status {
  color: var(--bs-body-color);
  font-size: 14px;
}
@media (max-width: 576px) {
  .stages-split { grid-template-columns: 1fr; }
}

/* --- pills --- */
.stages-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.stages-pills__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--stages-line);
  color: var(--stages-muted);
  font-size: 12px;
  background: #fff;
}
.stages-pills__item.is-done {
  border-color: var(--stages-accent-mid);
  background: var(--stages-accent-soft);
  color: var(--stages-accent);
}
.stages-pills__item.is-current {
  border-color: var(--stages-accent);
  background: var(--stages-accent);
  color: #fff;
}
.stages-pills__item.is-upcoming { opacity: .55; }
.stages-pills__check { font-size: 11px; }
.stages-pills__now {
  margin-top: 8px;
  color: var(--bs-body-color);
}

/* --- current value tag (как ярлык документов) --- */
.stages-current-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--tblr-secondary, var(--bs-secondary-color));
  font-size: var(--app-font-size-sm, 12px);
  line-height: 1;
  padding: .15rem .2rem;
  border-radius: .35rem;
  white-space: nowrap;
}
.stages-current-tag__icon,
.stages-current-tag__icon-svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  display: block;
}
.stages-current-tag__icon svg,
.stages-current-tag__icon-svg {
  width: 15px;
  height: 15px;
}
.stages-current-tag__value {
  font-weight: 600;
}

/* --- effects --- */
.stages-view--raised .stages-progress__fill,
.stages-view--raised .stages-segments__fill,
.stages-view--raised .stages-pills__item.is-current,
.stages-view--raised .stages-pills__item.is-done,
.stages-view--raised .stages-kanban__col.is-current,
.stages-view--raised .stages-cards__item.is-current,
.stages-view--raised .stages-ribbon__item.is-current,
.stages-view--raised .stages-badges__status {
  box-shadow: 0 1px 2px rgba(15, 45, 66, .16), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.stages-view--inset .stages-progress__seg,
.stages-view--inset .stages-segments__seg,
.stages-view--inset .stages-pills__item,
.stages-view--inset .stages-kanban__col,
.stages-view--inset .stages-cards__item,
.stages-view--inset .stages-ribbon__item,
.stages-view--inset .stages-badges__stage,
.stages-view--inset .stages-badges__status {
  box-shadow: inset 0 1px 3px rgba(15, 45, 66, .18);
}
