/* 向导步骤条：按 Ant Steps 摆放（序号、标题、描述、步骤间连线），外观取 Mantine Stepper。
   状态写在 kxed-wizard-step-<status> 上：finish 实心主色，process 主色描边，error 实心危险色，wait 灰底。 */

.kxed-wizard {
  gap: var(--kxed-space-5);
}

/* 档位写在步骤条上，序号尺寸只在步骤条里生效；显式档位排在点状变体之后，同特异度时档位胜出。 */
.kxed-wizard-list {
  --kxed-step-icon: var(--kxed-step-icon-md);
}

.kxed-wizard-dot > .kxed-wizard-list {
  --kxed-step-icon: var(--kxed-space-2);
}

.kxed-wizard-list[data-kxed-size="xs"],
.kxed-wizard-list[data-kxed-size="sm"] {
  --kxed-step-icon: var(--kxed-step-icon-sm);
}

.kxed-wizard-list[data-kxed-size="lg"] {
  --kxed-step-icon: var(--kxed-step-icon-lg);
}

.kxed-wizard-list {
  display: flex;
  align-items: center;
  gap: var(--kxed-space-4);
  min-width: 0;
}

.kxed-wizard-step {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: var(--kxed-space-3);
  min-width: 0;
  border: 0;
  border-radius: var(--kxed-radius);
  padding: 0;
  background: transparent;
  color: var(--kxed-text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.kxed-wizard-step:last-child {
  flex: 0 1 auto;
}

.kxed-wizard-step:focus-visible {
  outline: var(--kxed-focus-outline);
  outline-offset: var(--kxed-focus-offset);
}

/* 连线接在标题之后、伸到下一步之前；前一步完成时整段变主色，进度一眼可读。 */
.kxed-wizard-step:not(:last-child)::after {
  content: "";
  flex: 1 1 auto;
  min-width: var(--kxed-space-4);
  height: 2px;
  background: var(--kxed-border);
  transition: background-color var(--kxed-duration-mid) var(--kxed-ease-out);
}

.kxed-wizard-step-finish:not(:last-child)::after {
  background: var(--kxed-primary);
}

.kxed-wizard-step-icon,
.kxed-wizard-step-dot {
  --kxed-step-color: var(--kxed-gray-2);
  --kxed-step-color: light-dark(var(--kxed-gray-2), var(--kxed-dark-5));
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--kxed-step-icon);
  height: var(--kxed-step-icon);
  border: 2px solid var(--kxed-step-color);
  border-radius: 50%;
  background: var(--kxed-step-color);
  color: var(--kxed-gray-7);
  color: light-dark(var(--kxed-gray-7), var(--kxed-dark-1));
  font-size: var(--kxed-font-size-sm);
  font-weight: var(--kxed-font-weight-semibold);
  line-height: 1;
  transition: background-color var(--kxed-duration-mid) var(--kxed-ease-out), border-color var(--kxed-duration-mid) var(--kxed-ease-out);
}

.kxed-wizard-step-dot {
  border-width: 0;
}

.kxed-wizard-step-process :is(.kxed-wizard-step-icon, .kxed-wizard-step-dot) {
  border-color: var(--kxed-primary);
}

.kxed-wizard-step-process .kxed-wizard-step-dot,
.kxed-wizard-step-finish :is(.kxed-wizard-step-icon, .kxed-wizard-step-dot) {
  border-color: var(--kxed-primary);
  background: var(--kxed-primary);
  color: var(--kxed-primary-fg);
}

.kxed-wizard-step-error :is(.kxed-wizard-step-icon, .kxed-wizard-step-dot) {
  border-color: var(--kxed-danger);
  background: var(--kxed-danger);
  color: var(--kxed-danger-fg);
}

.kxed-wizard-step-text {
  display: grid;
  gap: var(--kxed-space-1);
  min-width: 0;
}

.kxed-wizard-step-label {
  color: var(--kxed-bright);
  font-size: var(--kxed-font-size-md);
  line-height: var(--kxed-line-height-md);
  font-weight: var(--kxed-font-weight-medium);
  transition: color var(--kxed-duration-fast) var(--kxed-ease-out);
}

.kxed-wizard-step-wait .kxed-wizard-step-label {
  color: var(--kxed-muted);
}

.kxed-wizard-step-error .kxed-wizard-step-label {
  color: var(--kxed-danger-text);
}

.kxed-wizard-step:not([aria-current="step"]):hover .kxed-wizard-step-label {
  color: var(--kxed-primary-text);
}

.kxed-wizard-step-description {
  color: var(--kxed-muted);
  font-size: var(--kxed-font-size-sm);
  line-height: var(--kxed-line-height-sm);
}

.kxed-wizard-list:is([data-kxed-size="xs"], [data-kxed-size="sm"]) .kxed-wizard-step-icon {
  font-size: var(--kxed-font-size-xs);
}

.kxed-wizard-list:is([data-kxed-size="xs"], [data-kxed-size="sm"]) .kxed-wizard-step-label {
  font-size: var(--kxed-font-size-sm);
  line-height: var(--kxed-line-height-sm);
}

.kxed-wizard-list:is([data-kxed-size="xs"], [data-kxed-size="sm"]) .kxed-wizard-step-description {
  font-size: var(--kxed-font-size-xs);
  line-height: var(--kxed-line-height-xs);
}

.kxed-wizard-list[data-kxed-size="lg"] .kxed-wizard-step-icon {
  font-size: var(--kxed-font-size-md);
}

.kxed-wizard-list[data-kxed-size="lg"] .kxed-wizard-step-label {
  font-size: var(--kxed-font-size-lg);
  line-height: var(--kxed-line-height-lg);
}

.kxed-wizard-list[data-kxed-size="lg"] .kxed-wizard-step-description {
  font-size: var(--kxed-font-size-md);
  line-height: var(--kxed-line-height-md);
}

/* 导航式：步骤之间用折角分隔，当前步用底部主色线标出，不画连线。 */
.kxed-wizard-navigation .kxed-wizard-list {
  box-shadow: inset 0 -2px 0 var(--kxed-divider);
}

.kxed-wizard-navigation .kxed-wizard-step {
  align-self: stretch;
  padding-block: var(--kxed-space-3);
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.kxed-wizard-navigation .kxed-wizard-step[aria-current="step"] {
  border-bottom-color: var(--kxed-primary);
}

.kxed-wizard-navigation .kxed-wizard-step:not(:last-child)::after {
  flex: none;
  width: var(--kxed-space-2);
  min-width: 0;
  height: var(--kxed-space-2);
  margin-inline-start: auto;
  border-top: var(--kxed-icon-stroke) solid var(--kxed-muted);
  border-right: var(--kxed-icon-stroke) solid var(--kxed-muted);
  background: none;
  rotate: 45deg;
}

[dir="rtl"] .kxed-wizard-navigation .kxed-wizard-step:not(:last-child)::after {
  rotate: -135deg;
}

.kxed-wizard-errors {
  display: grid;
  gap: var(--kxed-space-1);
  border-radius: var(--kxed-radius);
  padding: var(--kxed-space-3) var(--kxed-space-4);
  background: var(--kxed-danger-light);
}

.kxed-wizard-actions {
  display: flex;
  gap: var(--kxed-space-2);
  justify-content: flex-end;
}

/* 竖排：步骤条居左、面板与动作占右列，连线改到序号下方竖着连到下一步；窄容器回到横排。 */
@media (min-width: 48rem) {
  .kxed-wizard-vertical {
    grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
    align-items: start;
    column-gap: var(--kxed-space-6);
  }

  .kxed-wizard-vertical > .kxed-wizard-list {
    grid-row: 1 / span 3;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .kxed-wizard-vertical > :not(.kxed-wizard-list) {
    grid-column: 2;
  }

  .kxed-wizard-vertical .kxed-wizard-step {
    position: relative;
    flex: none;
    align-items: flex-start;
    padding-block-end: var(--kxed-space-5);
  }

  .kxed-wizard-vertical .kxed-wizard-step:last-child {
    padding-block-end: 0;
  }

  .kxed-wizard-vertical .kxed-wizard-step:not(:last-child)::after {
    position: absolute;
    inset-block: calc(var(--kxed-step-icon) + var(--kxed-space-1)) var(--kxed-space-1);
    inset-inline-start: calc(var(--kxed-step-icon) / 2 - 1px);
    width: 2px;
    min-width: 0;
    height: auto;
  }
}
