html:has(body.solvea-setup-mode),
body.solvea-setup-mode {
    min-height: 100%;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body.solvea-setup-mode {
    margin: 0;
    background: var(--zen-theme-canvas, #f4f5f2);
}

.solvea-first-run {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    box-sizing: border-box;
    overflow: visible;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 32px;
    background: var(--zen-theme-canvas, #f4f5f2);
    font-family: Arial, sans-serif;
    color: var(--zen-theme-text, #25302b);
}

.first-run-shell {
    flex: 0 0 auto;
    margin: auto 0;
    width: min(920px, 100%);
    background: var(--zen-theme-surface, #fff);
    border: 1px solid var(--zen-theme-border, #d9ddd5);
    border-radius: 18px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, .09);
    overflow: hidden;
}

.first-run-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    padding: 34px 38px 24px;
}

.first-run-mark {
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--zen-theme-text-muted, #687067);
}

.first-run-header h1 {
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 600;
}

.first-run-header p {
    margin: 0;
    color: var(--zen-theme-text-muted, #687067);
    line-height: 1.45;
}

.first-run-state {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--zen-theme-surface-muted, #edf2ed);
    color: var(--zen-theme-text-muted, #526056);
    font-size: 13px;
    font-weight: 700;
}

.first-run-reason {
    margin: 0 38px 22px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--zen-theme-surface-muted, #f7f8f5);
    border: 1px solid var(--zen-theme-border, #e5e8e2);
    color: var(--zen-theme-text-muted, #626a63);
    font-size: 14px;
}

.first-run-progress {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 0 38px 28px;
}

.first-run-step-indicator {
    appearance: none;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0;
    color: var(--zen-theme-placeholder, #8a918b);
    font: inherit;
}

.first-run-step-indicator span {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--zen-theme-border, #cdd2cd);
    background: var(--zen-theme-surface, #fff);
    font-size: 13px;
    font-weight: 700;
}

.first-run-step-indicator strong {
    font-size: 13px;
    white-space: nowrap;
}

.first-run-step-indicator.active,
.first-run-step-indicator.done {
    color: var(--zen-theme-selection-text, #33433a);
}

.first-run-step-indicator.active span,
.first-run-step-indicator.done span {
    border-color: var(--zen-theme-selection-border, #788e7d);
    background: var(--zen-theme-selection-bg, #e9f0ea);
}

.first-run-progress-line {
    height: 1px;
    background: var(--zen-theme-border, #dfe3de);
}

.first-run-message {
    display: none;
    margin: 0 38px 20px;
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 14px;
    line-height: 1.4;
}

.first-run-message.visible {
    display: block;
}

.first-run-message.success {
    background: var(--zen-theme-success-bg, #eef6ef);
    border: 1px solid var(--zen-theme-success, #cfe1d1);
    color: var(--zen-theme-on-success, #36563b);
}

.first-run-message.error {
    background: var(--zen-theme-danger-bg, #fff1f0);
    border: 1px solid var(--zen-theme-danger, #efc9c5);
    color: var(--zen-theme-on-danger, #8a3f39);
}

.first-run-message.info {
    background: var(--zen-theme-info-bg, #f2f5f7);
    border: 1px solid var(--zen-theme-info, #d7dfe4);
    color: var(--zen-theme-on-info, #485761);
}

.first-run-panel {
    display: none;
    padding: 30px 38px 34px;
    border-top: 1px solid var(--zen-theme-border, #eceeeb);
}

.first-run-panel.active {
    display: block;
}

.first-run-panel-title {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: end;
    margin-bottom: 26px;
}

.first-run-kicker {
    margin-bottom: 5px;
    color: var(--zen-theme-text-muted, #7b837d);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.first-run-panel-title h2 {
    margin: 0;
    font-size: 23px;
    font-weight: 600;
}

.first-run-panel-title p {
    max-width: 390px;
    margin: 0;
    text-align: right;
    color: var(--zen-theme-text-muted, #707871);
    font-size: 14px;
    line-height: 1.45;
}

.first-run-grid {
    display: grid;
    gap: 18px 20px;
}

.first-run-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.first-run-grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.first-run-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.first-run-field.span-2 {
    grid-column: span 2;
}

.first-run-field span {
    font-size: 13px;
    font-weight: 700;
    color: var(--zen-theme-text, #4f5952);
}

.first-run-field small {
    font-weight: 400;
    color: var(--zen-theme-text-muted, #808780);
}

.first-run-field input,
.first-run-field select {
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--zen-theme-border, #cfd5cf);
    border-radius: 8px;
    background: var(--zen-theme-surface, #fff);
    color: var(--zen-theme-text, #27312b);
    font: inherit;
    outline: none;
}

.first-run-field input:focus,
.first-run-field select:focus {
    border-color: var(--zen-theme-focus, #7c9180);
    box-shadow: 0 0 0 3px rgba(124, 145, 128, .12);
}

.first-run-section-title {
    margin: 26px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--zen-theme-border, #eceeeb);
    font-size: 14px;
    font-weight: 700;
    color: var(--zen-theme-text-muted, #5d675f);
}

.first-run-section-title:first-of-type {
    margin-top: 0;
}

.first-run-logo-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.first-run-logo-field.span-2 {
    grid-column: span 2;
}

.first-run-logo-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--zen-theme-text, #4f5952);
}

.first-run-logo-editor {
    display: flex;
    align-items: center;
    gap: 18px;
}

.first-run-logo-preview {
    width: 150px;
    height: 86px;
    flex: 0 0 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px dashed var(--zen-theme-border, #c8cec8);
    border-radius: 10px;
    background: var(--zen-theme-surface, #fff);
    color: var(--zen-theme-placeholder, #8a918b);
    font-size: 12px;
}

.first-run-logo-preview.has-image span {
    display: none;
}

.first-run-logo-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.first-run-logo-preview img[hidden] {
    display: none;
}

.first-run-logo-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.first-run-logo-actions small {
    flex-basis: 100%;
    color: var(--zen-theme-text-muted, #808780);
    font-size: 12px;
}

.first-run-logo-actions button {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.first-run-details {
    margin-top: 22px;
    padding: 13px 15px;
    border: 1px solid var(--zen-theme-border, #e2e5e1);
    border-radius: 10px;
    background: var(--zen-theme-surface-muted, #fafbf9);
}

.first-run-details summary {
    cursor: pointer;
    color: var(--zen-theme-text-muted, #5d675f);
    font-size: 14px;
    font-weight: 700;
}

.first-run-details .details-grid {
    margin-top: 18px;
}

.first-run-inline-action {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.first-run-test-state {
    font-size: 14px;
    color: var(--zen-theme-text-muted, #667068);
}

.first-run-password-help {
    margin-top: 14px;
    color: var(--zen-theme-text-muted, #707871);
    font-size: 13px;
}

.first-run-summary {
    margin-top: 24px;
    padding: 16px 18px;
    border-radius: 10px;
    background: var(--zen-theme-surface-muted, #f7f8f5);
    border: 1px solid var(--zen-theme-border, #e2e5e1);
    line-height: 1.55;
    font-size: 14px;
}

.first-run-summary strong {
    color: var(--zen-theme-text, #344139);
}

.first-run-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 38px 26px;
    border-top: 1px solid var(--zen-theme-border, #eceeeb);
    background: var(--zen-theme-surface-muted, #fafbf9);
}

.first-run-actions-right {
    display: flex;
    gap: 12px;
}

.first-run-actions button,
.first-run-inline-action button {
    min-height: 40px;
    padding: 0 18px;
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.first-run-actions button:disabled,
.first-run-inline-action button:disabled {
    opacity: .5;
    cursor: default;
}

.solvea-first-run .btn-secondary {
    border: 1px solid var(--zen-theme-border, #cdd3cd);
    background: var(--zen-theme-surface, #fff);
    color: var(--zen-theme-text, #455049);
}

.solvea-first-run .btn-primary {
    border: 1px solid var(--zen-theme-action-active, #617466);
    background: var(--zen-theme-action, #687d6d);
    color: var(--zen-theme-on-action, #fff);
}

.solvea-first-run .btn-primary.install {
    min-width: 160px;
}


.solvea-first-run.installing {
    cursor: wait;
}

.solvea-first-run .is-busy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.first-run-spinner {
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: first-run-spin .75s linear infinite;
}

@keyframes first-run-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
    .first-run-logo-editor {
        align-items: stretch;
        flex-direction: column;
    }

    .first-run-logo-preview {
        width: 100%;
        max-width: 260px;
        height: 110px;
        flex-basis: auto;
    }

    .first-run-logo-field.span-2 {
        grid-column: span 1;
    }

    .solvea-first-run {
        align-items: stretch;
        justify-content: flex-start;
        padding: 14px;
    }

    .first-run-shell {
        margin: 0 auto;
    }

    .first-run-header,
    .first-run-panel,
    .first-run-actions {
        padding-left: 22px;
        padding-right: 22px;
    }

    .first-run-reason,
    .first-run-message {
        margin-left: 22px;
        margin-right: 22px;
    }

    .first-run-progress {
        padding-left: 22px;
        padding-right: 22px;
    }

    .first-run-step-indicator strong,
    .first-run-progress-line {
        display: none;
    }

    .first-run-progress {
        grid-template-columns: repeat(4, auto);
        justify-content: start;
    }

    .first-run-panel-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .first-run-panel-title p {
        text-align: left;
    }

    .first-run-grid.cols-2,
    .first-run-grid.cols-3 {
        grid-template-columns: 1fr;
    }

    .first-run-field.span-2 {
        grid-column: span 1;
    }
}
