:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --success: #10B981;
    --success-light: #D1FAE5;
    --error: #EF4444;
    --error-light: #FEE2E2;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --bg-white: #FFFFFF;
    --bg-gray: #F9FAFB;
    --bg-dark: #F3F4F6;
    --border: #E5E7EB;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-gray);
}

.onboarding-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.onboarding-header {
    text-align: center;
    margin-bottom: 2rem;
}
.onboarding-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.progress-container { margin-bottom: 1.5rem; }
.progress-bar {
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818CF8);
    transition: width 0.4s ease;
}
.step-indicators {
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
}
.step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.step-dot span {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-dark);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}
.step-dot.active span { background: var(--primary-light); color: var(--primary); }
.step-dot.current span { background: var(--primary); color: white; box-shadow: 0 0 0 4px var(--primary-light); }
.step-dot label { font-size: 0.75rem; color: var(--text-muted); }
.step-dot.active label { color: var(--text-secondary); }
.step-dot.current label { color: var(--primary); font-weight: 600; }

.error-banner {
    background: var(--error-light);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.error-banner button {
    background: none;
    border: none;
    color: var(--error);
    font-size: 1.25rem;
    cursor: pointer;
}

.step-container {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}
.step-header { margin-bottom: 1.5rem; }
.step-header h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.step-header p { color: var(--text-secondary); }
.step-header.success h2 { color: var(--success); }
.step-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    margin-bottom: 0.75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}
.form-grid .full-width { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-size: 0.875rem; font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.question-stack { display: flex; flex-direction: column; gap: 1rem; }
.question-counter { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.question-card {
    background: var(--bg-gray);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.question-card h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; }
.question-card .question-subtext { font-size: 0.9375rem; color: var(--text-secondary); margin-bottom: 1rem; }
.question-card textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: inherit;
    resize: vertical;
    min-height: 140px;
    background: var(--bg-white);
}
.question-card textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.question-card textarea::placeholder { color: var(--text-muted); font-size: 0.875rem; }
.question-card .question-tip { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.75rem; font-style: italic; }

.reflection-card {
    background: var(--bg-gray);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.reflection-content { font-size: 0.9375rem; line-height: 1.7; }
.reflection-content h3, .reflection-content h4 { margin-top: 1rem; margin-bottom: 0.5rem; }
.reflection-content ul { margin: 0.5rem 0; padding-left: 1.25rem; }
.reflection-content li { margin-bottom: 0.375rem; }
.reflection-content strong { font-weight: 600; }
.confirmation-prompt { text-align: center; padding: 1rem; font-weight: 500; color: var(--text-secondary); }

.compile-preview {
    background: var(--bg-gray);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}
.compile-preview h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem; }
.compile-preview ul { list-style: none; padding: 0; margin: 0 0 1.5rem 0; }
.compile-preview li { padding: 0.5rem 0; color: var(--text-secondary); }
.compile-note { font-size: 0.875rem; color: var(--text-muted); font-style: italic; border-top: 1px solid var(--border); padding-top: 1rem; }

.training-guide-preview {
    background: var(--text-primary);
    color: #E5E7EB;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    max-height: 500px;
    overflow-y: auto;
}
.training-guide-preview pre { font-family: 'Monaco', 'Menlo', monospace; font-size: 0.8125rem; line-height: 1.6; white-space: pre-wrap; }

.loading-message { text-align: center; padding: 1rem; color: var(--text-muted); }

.next-steps {
    background: var(--success-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
}
.next-steps h3 { font-size: 1rem; font-weight: 600; color: var(--success); margin-bottom: 0.75rem; }
.next-steps ul { list-style: none; padding: 0; }
.next-steps li { padding: 0.375rem 0; font-size: 0.875rem; color: var(--text-secondary); }

.step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.step-actions.centered { justify-content: center; }

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:disabled { background: var(--text-muted); cursor: not-allowed; }
.btn-secondary { background: var(--bg-white); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-gray); color: var(--text-primary); }
.btn-large { padding: 1rem 2rem; font-size: 1rem; }

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
    .onboarding-container { padding: 1rem; }
    .step-container { padding: 1.5rem; }
    .form-grid { grid-template-columns: 1fr; }
    .step-indicators { display: none; }
    .step-actions { flex-direction: column-reverse; gap: 1rem; }
    .step-actions button { width: 100%; }
}
