.em-setup {
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--em-admin-color-gray-100);
}

/*
 * min-height, not height: the shell grows past the viewport for a tall step and the page
 * scrolls as one. A fixed height would centre a too-tall card into unreachable overflow.
 */
.em-setup-shell {
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--em-admin-space-6);
    padding: var(--em-admin-space-8) var(--em-admin-space-4);
}

@keyframes em-setup-fade-in {
    from {
        opacity: 0;
    }
}

@keyframes em-setup-card-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

@keyframes em-setup-badge-in {
    0% {
        opacity: 0;
        transform: scale(0.7);
    }

    60% {
        opacity: 1;
        transform: scale(1.06);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes em-setup-check-draw {
    from {
        stroke-dashoffset: 24;
    }
}

.em-setup-brand {
    animation: em-setup-fade-in 200ms ease-out;
    display: flex;
    align-items: center;
    gap: var(--em-admin-space-3);
}

.em-setup-brand__icon {
    width: 30px;
    height: 30px;
}

.em-setup-brand__name {
    font-size: var(--em-admin-font-size-xl);
    font-weight: var(--em-admin-font-weight-semibold);
    color: var(--em-admin-text-primary);
}

.em-setup-card {
    animation: em-setup-card-in 260ms ease-out 60ms backwards;
    box-sizing: border-box;
    width: 100%;
    max-width: 640px;
    background-color: var(--em-admin-surface);
    border: 1px solid var(--em-admin-border);
    border-radius: var(--em-admin-radius-lg);
    box-shadow: var(--em-admin-shadow-sm);
    overflow: hidden;
}

.em-setup-steps {
    display: flex;
    align-items: flex-start;
    margin: 0;
    padding: var(--em-admin-space-5) var(--em-admin-space-8) var(--em-admin-space-4);
    border-bottom: 1px solid var(--em-admin-border);
    list-style: none;
}

.em-setup-step {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
}

.em-setup .em-setup-step__link {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--em-admin-space-2);
    border-radius: var(--em-admin-radius-md);
    color: inherit;
    text-decoration: none;
}

.em-setup .em-setup-step__link:hover {
    text-decoration: none;
}

.em-setup .em-setup-step__link:hover .em-setup-step__marker {
    border-color: var(--em-admin-color-accent-600);
}

.em-setup .em-setup-step__link:hover .em-setup-step__label {
    color: var(--em-admin-hover-text);
}

.em-setup .em-setup-step__link:focus-visible {
    outline: 2px solid var(--em-admin-focus-ring);
    outline-offset: 2px;
}

/* Connector back to the previous marker; the inset keeps it clear of both. */
.em-setup-step + .em-setup-step::before {
    content: "";
    position: absolute;
    top: 11px;
    left: -50%;
    right: 50%;
    margin: 0 15px;
    height: 1px;
    background-color: var(--em-admin-border);
}

.em-setup-step__marker {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--em-admin-input-border);
    border-radius: 999px;
    background-color: var(--em-admin-surface);
    font-size: var(--em-admin-font-size-xs);
    font-weight: var(--em-admin-font-weight-semibold);
    line-height: 1;
    color: var(--em-admin-text-faint);
}

.em-setup-step__marker .em-admin-icon {
    width: 12px;
    height: 12px;
}

.em-setup-step.is-complete .em-setup-step__marker,
.em-setup-step.is-current .em-setup-step__marker {
    border-color: var(--em-admin-color-accent-600);
    background-color: var(--em-admin-color-accent-600);
    color: var(--em-admin-color-white);
}

.em-setup-step.is-current .em-setup-step__marker {
    box-shadow: 0 0 0 3px var(--em-admin-color-accent-50);
}

/* A required step nobody has done yet — the guide refuses to finish without it. */
.em-setup-step.is-missing .em-setup-step__marker {
    border-color: var(--em-admin-status-warning-border);
    background-color: var(--em-admin-status-warning-bg);
    color: var(--em-admin-status-warning-icon);
}

.em-setup-step.is-missing .em-setup-step__label {
    color: var(--em-admin-status-warning-text);
}

.em-setup-step__label {
    padding: 0 var(--em-admin-space-1);
    font-size: var(--em-admin-font-size-xs);
    font-weight: var(--em-admin-font-weight-medium);
    line-height: var(--em-admin-line-height-tight);
    text-align: center;
    color: var(--em-admin-text-faint);
}

.em-setup-step.is-complete .em-setup-step__label {
    color: var(--em-admin-text-secondary);
}

/* Weight stays the same across states so the label does not rewrap as the step advances. */
.em-setup-step.is-current .em-setup-step__label {
    color: var(--em-admin-color-accent-700);
}

.em-setup .em-admin-content {
    padding: 0;
}

.em-setup-card__body {
    padding: var(--em-admin-space-6) var(--em-admin-space-8) var(--em-admin-space-8);
}

.em-setup .em-setup-card__body h1 {
    font-size: var(--em-admin-font-size-xl);
}

.em-setup .em-setup-card__intro {
    font-size: var(--em-admin-font-size-sm);
    color: var(--em-admin-text-secondary);
    margin-bottom: var(--em-admin-space-6);
}

.em-setup-card__body--final {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--em-admin-space-2);
    padding-top: var(--em-admin-space-8);
    text-align: center;
}

.em-setup-final__badge {
    animation: em-setup-badge-in 420ms cubic-bezier(0.34, 1.56, 0.64, 1) 120ms backwards;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: var(--em-admin-space-2);
    border-radius: 999px;
    background-color: var(--em-admin-status-success-bg);
    color: var(--em-admin-status-success-icon);
}

.em-setup-final__badge .em-admin-icon {
    width: 26px;
    height: 26px;
}

/* The check path is about 23 units long, so a longer dash leaves it solid at rest. */
.em-setup-final__badge .em-admin-icon polyline {
    stroke-dasharray: 24;
    animation: em-setup-check-draw 320ms ease-out 300ms backwards;
}

.em-setup .em-setup-card__body--final h1 {
    margin-bottom: 0;
}

.em-setup .em-setup-card__body--final .em-setup-card__intro {
    max-width: 420px;
    margin-bottom: 0;
}

.em-setup .em-setup-final__notice {
    max-width: 420px;
    margin-top: var(--em-admin-space-2);
    padding: var(--em-admin-space-3) var(--em-admin-space-4);
    border: 1px solid var(--em-admin-status-warning-border);
    border-radius: var(--em-admin-radius-md);
    background-color: var(--em-admin-status-warning-bg);
    font-size: var(--em-admin-font-size-sm);
    color: var(--em-admin-status-warning-text);
}

.em-setup-summary {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--em-admin-space-2) var(--em-admin-space-4);
    width: 100%;
    max-width: 420px;
    margin: var(--em-admin-space-4) 0 0;
    text-align: left;
}

.em-setup-summary dt {
    color: var(--em-admin-text-secondary);
}

.em-setup-summary dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.em-setup-license-institution {
    display: flex;
    gap: var(--em-admin-space-4);
    margin: 0;
}

.em-setup-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--em-admin-space-4);
    padding: var(--em-admin-space-4) var(--em-admin-space-8);
    border-top: 1px solid var(--em-admin-border);
    background-color: var(--em-admin-color-gray-50);
}

.em-setup-card__actions--end {
    justify-content: flex-end;
}

.em-setup .em-setup-card__actions .em-admin-button {
    margin-top: 0;
    margin-bottom: 0;
    text-decoration: none;
}

.em-setup-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--em-admin-space-4);
}

.em-setup-overview {
    display: flex;
    flex-direction: column;
    gap: var(--em-admin-space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.em-setup-overview__item {
    display: flex;
    align-items: flex-start;
    gap: var(--em-admin-space-3);
}

.em-setup-overview__marker {
    box-sizing: border-box;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--em-admin-input-border);
    border-radius: 999px;
    font-size: var(--em-admin-font-size-xs);
    font-weight: var(--em-admin-font-weight-semibold);
    line-height: 1;
    color: var(--em-admin-text-muted);
}

.em-setup-overview__text {
    display: flex;
    flex-direction: column;
    gap: var(--em-admin-space-1);
}

.em-setup-overview__name {
    font-size: var(--em-admin-font-size-sm);
    font-weight: var(--em-admin-font-weight-medium);
    line-height: var(--em-admin-line-height-tight);
    color: var(--em-admin-text-primary);
}

.em-setup-overview__detail {
    font-size: var(--em-admin-font-size-xs);
    color: var(--em-admin-text-muted);
}

.em-setup-license-stub {
    display: flex;
    align-items: flex-start;
    gap: var(--em-admin-space-2);
    padding: var(--em-admin-space-3);
    border: 1px solid var(--em-admin-border);
    border-radius: var(--em-admin-radius-lg);
    background-color: var(--em-admin-content-bg);
}

.em-setup-license-stub__value {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--em-admin-font-size-xs);
    line-height: var(--em-admin-line-height-normal);
    color: var(--em-admin-text-label);
    word-break: break-all;
}

.em-setup-skip {
    margin: 0;
}

.em-setup-skip__button {
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: var(--em-admin-font-size-xs);
    color: var(--em-admin-text-muted);
    text-decoration: underline;
    cursor: pointer;
}

.em-setup-skip__button:hover {
    color: var(--em-admin-hover-text);
}

.em-setup-footer {
    display: flex;
    align-items: center;
    gap: var(--em-admin-space-2);
    font-size: var(--em-admin-font-size-xs);
    color: var(--em-admin-text-muted);
}

.em-setup-footer a {
    color: var(--em-admin-color-accent-600);
    text-decoration: none;
}

.em-setup-footer a:hover {
    color: var(--em-admin-color-accent-700);
    text-decoration: underline;
}

@media (max-width: 560px) {
    .em-setup-step:not(.is-current) .em-setup-step__label {
        display: none;
    }

    .em-setup-steps,
    .em-setup-card__body,
    .em-setup-card__actions {
        padding-left: var(--em-admin-space-5);
        padding-right: var(--em-admin-space-5);
    }

    .em-setup-field-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .em-setup-brand,
    .em-setup-card,
    .em-setup-final__badge,
    .em-setup-final__badge .em-admin-icon polyline {
        animation: none;
    }
}
