/* Muskoid — Brand Creation Platform */
:root {
    --bg: #0a0a0f;
    --bg-card: #12121a;
    --bg-hover: #1a1a25;
    --border: #2a2a3a;
    --text: #e4e4ef;
    --text-muted: #8888a0;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Nav */
.nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.nav-brand a { font-family: 'Space Grotesk', sans-serif; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--text-muted); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem; }

/* Page Header */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 1.25rem; border-radius: var(--radius);
    font-size: 0.9rem; font-weight: 500;
    border: none; cursor: pointer; transition: all 0.15s;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color: white; }
.btn-secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: white; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

/* Badges */
.badge {
    display: inline-block; padding: 0.2rem 0.6rem;
    border-radius: 999px; font-size: 0.75rem; font-weight: 500;
}
.badge-draft { background: #333; color: var(--text-muted); }
.badge-running { background: #1e3a5f; color: #60a5fa; }
.badge-pending { background: #333; color: var(--text-muted); }
.badge-completed { background: #14532d; color: var(--success); }
.badge-failed { background: #450a0a; color: var(--error); }
.badge-paused_for_review, .badge-paused_phase_1, .badge-paused_phase_2 {
    background: #422006; color: var(--warning);
}
.badge-cancelled { background: #333; color: var(--text-muted); }

/* Cards */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Project Grid */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.project-card {
    display: block; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.25rem;
    transition: all 0.15s; color: var(--text);
}
.project-card:hover { border-color: var(--primary); background: var(--bg-hover); color: var(--text); }
.project-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.project-meta { color: var(--text-muted); font-size: 0.85rem; }
.project-brief { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.5rem; }
.project-card-footer { display: flex; justify-content: space-between; margin-top: 1rem; font-size: 0.8rem; color: var(--text-muted); }

/* Phase Stepper */
.phase-stepper { display: flex; gap: 1rem; margin-bottom: 2rem; }
.phase-step {
    flex: 1; display: flex; align-items: center; gap: 1rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1rem 1.25rem;
}
.phase-step.active { border-color: var(--primary); }
.phase-step.completed { border-color: var(--success); }
.phase-number {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--border); font-weight: 700; font-size: 0.9rem;
    flex-shrink: 0;
}
.phase-step.active .phase-number { background: var(--primary); color: white; }
.phase-step.completed .phase-number { background: var(--success); color: white; }
.phase-info h4 { font-size: 0.85rem; margin-bottom: 0.15rem; }
.phase-status { font-size: 0.75rem; color: var(--text-muted); }

/* Agents List */
.agents-list { display: flex; flex-direction: column; gap: 0.75rem; }
.agent-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem 1.25rem;
}
.agent-header { display: flex; justify-content: space-between; align-items: center; }
.agent-info { display: flex; align-items: center; gap: 0.75rem; }
.agent-order { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }
.agent-stats { display: flex; gap: 1.5rem; margin-top: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }

/* Forms */
.form-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; max-width: 700px; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-size: 0.9rem; font-weight: 500; }
.form-input {
    width: 100%; padding: 0.6rem 0.8rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-size: 0.9rem; font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--primary); }
textarea.form-input { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* Runs */
.runs-list { display: flex; flex-direction: column; gap: 0.5rem; }
.run-card {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.75rem 1rem; color: var(--text);
}
.run-card:hover { border-color: var(--primary); color: var(--text); }

/* Review Banner */
.review-banner {
    background: #1a1520; border: 1px solid #4a3060;
    border-radius: var(--radius-lg); padding: 2rem; text-align: center;
    margin-top: 2rem;
}
.review-banner h2 { color: var(--warning); }
.review-banner p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Actions Bar */
.actions-bar { margin-bottom: 2rem; }

/* Output */
.output-card pre { background: var(--bg); padding: 1rem; border-radius: var(--radius); overflow-x: auto; font-size: 0.8rem; }
.agent-stats-bar { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem; font-size: 0.85rem; color: var(--text-muted); }

/* Section */
.section { margin-top: 2rem; }

/* Breadcrumbs */
.breadcrumb { color: var(--text-muted); font-size: 0.85rem; }
.breadcrumb:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); margin: 0 0.25rem; font-size: 0.85rem; }

/* Spinner */
.spinner {
    width: 20px; height: 20px; border: 2px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin-top: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error */
.error-text { color: var(--error); font-size: 0.85rem; margin-top: 0.5rem; }

/* Empty State */
.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-state h2 { margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Footer */
.footer { text-align: center; padding: 2rem; color: var(--text-muted); font-size: 0.8rem; border-top: 1px solid var(--border); margin-top: 4rem; }

/* Brief Card */
.brief-card p { color: var(--text-muted); white-space: pre-wrap; }

/* Rerun Card */
.rerun-card { margin-top: 1.5rem; }

/* Rendered Agent Output */
.output-section { margin-bottom: 2rem; }
.output-section h3 { color: var(--primary); margin-bottom: 0.5rem; }
.output-section h4 { margin: 0.75rem 0 0.25rem; }
.output-section p { color: var(--text-muted); margin-bottom: 0.4rem; }
.output-section ul { padding-left: 1.5rem; color: var(--text-muted); }
.output-section li { margin-bottom: 0.25rem; }

.highlight-box { background: var(--bg); border-left: 3px solid var(--primary); padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; }
.essence { font-size: 1.3rem; font-weight: 600; color: var(--text); font-family: 'Space Grotesk', sans-serif; }
.positioning { font-style: italic; color: var(--text); border-left: 3px solid var(--warning); padding-left: 1rem; }

.competitor-card, .persona-card, .pillar-card, .gap-card, .voice-example {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; margin-bottom: 0.75rem;
}
.voice-example .context { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.voice-example blockquote { border-left: 3px solid var(--primary); padding-left: 1rem; margin: 0.5rem 0; color: var(--text); font-style: italic; }

details summary { padding: 0.75rem 0; }

/* Adaptive Renderer */
.result-card {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.25rem; margin-bottom: 0.75rem;
}
.result-card h4 { color: var(--primary); margin-bottom: 0.4rem; }
.result-card p { color: var(--text-muted); margin-bottom: 0.3rem; font-size: 0.9rem; }
.output-list { padding-left: 1.5rem; color: var(--text-muted); margin: 0.5rem 0; }
.output-list li { margin-bottom: 0.3rem; font-size: 0.9rem; }
.compact-card { background: var(--bg); border-radius: var(--radius); padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; font-size: 0.9rem; }
.inline-details { color: var(--text-muted); font-size: 0.85rem; }
.color-swatch-inline {
    display: inline-block; width: 14px; height: 14px; border-radius: 3px;
    vertical-align: middle; margin-right: 4px; border: 1px solid var(--border);
}
.num-value { font-family: monospace; color: var(--accent); }
.bool-value { color: var(--success); }

/* Stakeholder Q&A */
.question-card { margin-bottom: 1rem; }
.question-card.answered { opacity: 0.7; }
.question-header { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.5rem; }
.question-category { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.question-text { font-size: 1rem; font-weight: 500; margin-bottom: 0.5rem; }
.question-purpose { font-size: 0.85rem; color: var(--text-muted); font-style: italic; margin-bottom: 0.75rem; }
.answer-form { display: flex; flex-direction: column; gap: 0.5rem; }
.answer-form .btn { align-self: flex-end; }
.answer-text { background: var(--bg); border-radius: var(--radius); padding: 0.75rem; margin-top: 0.5rem; }
.answer-text p { color: var(--text-muted); }
.text-muted { color: var(--text-muted); }
.badge-high { background: #450a0a; color: var(--error); }
.badge-medium { background: #422006; color: var(--warning); }
.badge-low { background: #14532d; color: var(--success); }

/* Responsive */
/* Asset Gallery */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.asset-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; transition: all 0.15s; cursor: pointer;
}
.asset-card:hover { border-color: var(--primary); }
.asset-card.selected { border-color: var(--success); box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3); }
.asset-image { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--bg); }
.asset-image img { width: 100%; height: 100%; object-fit: cover; }
.asset-check {
    position: absolute; top: 8px; right: 8px;
    width: 28px; height: 28px; background: var(--success); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; font-weight: 700;
}
.asset-meta { display: flex; justify-content: space-between; padding: 0.5rem 0.75rem; font-size: 0.75rem; color: var(--text-muted); }
.asset-prompt { padding: 0 0.75rem 0.75rem; }
.asset-prompt summary { font-size: 0.75rem; color: var(--text-muted); cursor: pointer; }
.asset-prompt p { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.asset-actions { display: flex; gap: 0.5rem; }

/* Color Swatch Display */
.color-swatches { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0; }
.color-swatch {
    width: 48px; height: 48px; border-radius: var(--radius); border: 1px solid var(--border);
    display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px;
    font-size: 0.55rem; color: white; text-shadow: 0 0 2px rgba(0,0,0,0.8);
}

/* Typography Preview */
.font-preview { background: var(--bg); border-radius: var(--radius); padding: 1rem; margin: 0.5rem 0; }
.font-preview h4 { margin-bottom: 0.25rem; }
.font-preview p { color: var(--text-muted); font-size: 0.85rem; }

/* Next Step Banner */
.next-step-banner {
    background: linear-gradient(135deg, #1a1530 0%, #1e2040 100%);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
}
.next-step-banner.success { border-color: var(--success); }
.next-step-banner.success h2 { color: var(--success); }
.next-step-banner.error { border-color: var(--error); }
.next-step-banner.error h2 { color: var(--error); }
.next-step-banner.running { border-color: #60a5fa; }
.next-step-banner.running h2 { color: #60a5fa; }
.next-step-content h2 { margin-bottom: 0.4rem; }
.next-step-content p { color: var(--text-muted); margin-bottom: 1rem; }
.next-step-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; align-items: flex-end; }

/* Provider Toggle */
.provider-toggle { margin-bottom: 0.75rem; }
.provider-toggle > label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.toggle-options { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.toggle-option { cursor: pointer; }
.toggle-option input { display: none; }
.toggle-option span {
    display: block; padding: 0.4rem 0.9rem; font-size: 0.85rem;
    color: var(--text-muted); transition: all 0.15s;
    border-right: 1px solid var(--border);
}
.toggle-option:last-child span { border-right: none; }
.toggle-option input:checked + span { background: var(--primary); color: white; }
.toggle-option:hover span { background: var(--bg-hover); }
.toggle-option input:checked:hover + span { background: var(--primary-hover); }
.phase-start-form { text-align: center; }

/* Export */
.export-actions { display: flex; gap: 1rem; margin: 2rem 0; }
.toc-preview ol { padding-left: 1.5rem; }
.toc-preview li { margin-bottom: 0.5rem; }
.toc-preview li strong { color: var(--text); }
.gaps-warning ul { padding-left: 1.5rem; }

/* Bible Viewer */
.bible-entry { margin-bottom: 0.5rem; }
.bible-entry.directive { border-left: 3px solid var(--error); }
.bible-entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.25rem; }
.bible-entry-meta { display: flex; gap: 0.5rem; align-items: center; }
.btn-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 0 0.25rem; }
.btn-icon:hover { color: var(--error); }

/* Retry */
.btn-retry { background: var(--error); color: white; border: none; margin-top: 0.5rem; }
.btn-retry:hover { background: #dc2626; color: white; }
.rerun-inline { margin-top: 0.5rem; }

@media (max-width: 768px) {
    .container { padding: 1rem; }
    .phase-stepper { flex-direction: column; }
    .form-row { grid-template-columns: 1fr; }
    .project-grid { grid-template-columns: 1fr; }
}
