.setup-body {
    background: var(--c-surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem 1rem;
}

.setup-shell {
    max-width: 640px;
    margin: 2rem auto;
    background: white;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 2rem 2.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    width: 100%;
}

.setup-logo {
    margin: 0 0 1.1rem;
}
.setup-logo img {
    display: block;
    width: auto;
    height: 48px;
    margin-left: auto;
    margin-right: auto;
}

.setup-header {
    text-align: center;
}

.setup-header h1 {
    margin: 0 0 0.25rem;
    color: var(--c-accent);
    font-size: 1.6rem;
    text-align: center;
}

.setup-subtitle {
    color: var(--c-muted);
    margin: 0 0 1.5rem;
    text-align: center;
}

.setup-steps {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    gap: 0.5rem;
    counter-reset: step;
}

.setup-steps li {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.15rem;
    font-size: 0.85rem;
    color: var(--c-muted);
    border-bottom: 3px solid var(--c-border);
    counter-increment: step;
    white-space: nowrap;
}

.setup-steps li::before {
    content: counter(step) ". ";
    font-weight: 600;
}

.setup-steps li.active {
    color: var(--c-accent);
    border-bottom-color: var(--c-accent);
    font-weight: 600;
}

.setup-form .form-row {
    margin-bottom: 1.25rem;
}

.setup-form .form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.setup-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.setup-form input[type=text],
.setup-form input[type=email],
.setup-form input[type=password],
.setup-form input[type=number],
.setup-form input:not([type]),
.setup-form select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
}

.setup-form input:focus,
.setup-form select:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.setup-form .hint {
    color: var(--c-muted);
    font-size: 0.8rem;
    display: block;
    margin-top: 0.25rem;
}

.field-error {
    color: #b91c1c;
    font-size: 0.85rem;
    display: block;
    margin-top: 0.25rem;
}

.setup-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
}

.btn-primary {
    background: var(--c-accent);
    color: white;
}
.btn-primary:hover { background: var(--c-accent-dark); }

.btn-secondary {
    background: white;
    color: var(--c-text);
    border-color: var(--c-border);
}
.btn-secondary:hover { background: var(--c-surface); }

.btn-danger {
    background: #dc2626;
    color: white;
}
.btn-danger:hover { background: #b91c1c; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #854d0e; border: 1px solid #fde68a; }
.alert-success { background: #f0fdf4; color: #14532d; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.setup-list { padding-left: 1.25rem; }
.setup-list li { margin: 0.4rem 0; }

.review-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.review-card {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    position: relative;
}

.review-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.review-card dl {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1rem;
    font-size: 0.9rem;
}
.review-card dt { color: var(--c-muted); }
.review-card dd { margin: 0; font-family: ui-monospace, monospace; }

.link-edit {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 0.85rem;
}

.completed {
    text-align: center;
    padding: 2rem 1rem;
}
.check-mark {
    font-size: 4rem;
    color: #16a34a;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #f0fdf4;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.form-fieldset {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}
.form-fieldset legend {
    padding: 0 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
}

/* Brand line under the admin sign-in card. */
.setup-footer-brand {
    text-align: center;
    color: var(--c-muted);
    font-size: 0.8rem;
    margin: 1.5rem 0 0;
}
.setup-footer-brand a {
    color: var(--c-muted);
    text-decoration: none;
}
.setup-footer-brand a:hover {
    color: var(--c-accent);
    text-decoration: underline;
}

/* ---- Licence activation: 4×4 product-key input ---- */
.key-input {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.key-input .key-seg {
    width: 4.5rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.05rem;
    padding: 0.5rem 0.3rem;
}
.key-input .key-sep {
    color: var(--c-muted);
    font-weight: 700;
    user-select: none;
}
.machine-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    color: var(--c-muted);
    background: var(--c-surface);
}
@media (max-width: 480px) {
    .key-input .key-seg { width: 100%; }
}

/* ---- Database step (first-run DB selection) ---- */
.db-panel {
    margin-top: 0.25rem;
    padding: 1rem 1.1rem 0.4rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
}
.db-test-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 1.1rem 0 0.4rem;
    flex-wrap: wrap;
}
.db-test-result {
    font-size: 0.9rem;
    font-weight: 500;
}
.db-test-result.testing { color: var(--c-muted); }
.db-test-result.ok      { color: #14532d; }
.db-test-result.fail    { color: #991b1b; }

/* Self-restart progress (Database step, supervised hosts) */
.setup-restart {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.setup-restart.is-error {
    background: #fef2f2;
    border-color: #fecaca;
}
.setup-restart-spinner {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    border: 3px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: setup-spin 0.8s linear infinite;
}
.setup-restart.is-error .setup-restart-spinner {
    display: none;
}
.setup-restart-message {
    font-weight: 500;
    color: #334155;
}
@keyframes setup-spin {
    to { transform: rotate(360deg); }
}
