/* ============================================================
   PHASE TRACKER — horizontal 4-step progress indicator
   States per step: --done / --current / --upcoming
   Used on dashboards for all 4 phases.
   ============================================================ */

.phase-tracker {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.phase-tracker__step {
  flex: 1;
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
  column-gap: var(--space-3);
  row-gap: 2px;
  align-items: center;
  position: relative;
  min-width: 0;
}

/* Connector line between steps — drawn from each step's icon to the next */
.phase-tracker__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 14px;            /* vertically centered with the 28px icon */
  left: calc(28px + var(--space-3) + 2px);
  right: calc(-1 * var(--space-3));
  height: 2px;
  background: var(--border-strong);
  z-index: 0;
}

.phase-tracker__step--done:not(:last-child)::after {
  background: var(--color-success);
}

/* Icon (circle) — col 1, row 1 */
.phase-tracker__icon {
  grid-column: 1;
  grid-row: 1;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  position: relative;
  z-index: 1;
}

.phase-tracker__icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

/* Step labels */
.phase-tracker__label {
  grid-column: 2;
  grid-row: 1;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: center;
}

.phase-tracker__meta {
  grid-column: 2;
  grid-row: 2;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- STEP STATES ---------- */

/* Done — green check */
.phase-tracker__step--done .phase-tracker__icon {
  background: var(--color-success);
  color: var(--text-on-primary);
}
.phase-tracker__step--done .phase-tracker__label {
  color: var(--text-secondary);
}

/* Current — solid primary, with pulse ring */
.phase-tracker__step--current .phase-tracker__icon {
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: 0 0 0 4px var(--color-primary-subtle);
}
.phase-tracker__step--current .phase-tracker__label {
  color: var(--text-primary);
  font-weight: var(--weight-bold);
}

/* Upcoming — outlined neutral */
.phase-tracker__step--upcoming .phase-tracker__icon {
  background: var(--bg-subtle);
  color: var(--text-tertiary);
  border: 1.5px solid var(--border-strong);
}
.phase-tracker__step--upcoming .phase-tracker__label {
  color: var(--text-tertiary);
}

@media (max-width: 900px) {
  /* Stack vertically on narrow viewports */
  .phase-tracker {
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .phase-tracker__step:not(:last-child)::after {
    /* Vertical connector line */
    top: calc(28px + 2px);
    left: 13px;
    right: auto;
    bottom: -12px;
    width: 2px;
    height: auto;
  }
}
