{% set lang = get_lang(request) %}
<section class="card">
    <h2>{{ t('system.ollama_process', lang) }}</h2>
    <p class="section-desc">{{ t('system.process_desc', lang) }}</p>
    <div class="signal-item" style="margin-bottom: 1rem;">
        <span class="signal-dot {{ 'active' if ollama_status == 'running' else 'inactive' }}"></span>
        <span>{{ t('system.' + ollama_status, lang) }}</span>
    </div>
    <div class="system-actions">
        <button class="btn-sm btn-start"
                hx-post="/system/ollama/start"
                hx-target="#process-section"
                hx-swap="innerHTML"
                {% if ollama_status == 'running' or not installed %}disabled{% endif %}>
            {{ t('system.start', lang) }}
        </button>
        <button class="btn-sm btn-stop"
                hx-post="/system/ollama/stop"
                hx-target="#process-section"
                hx-swap="innerHTML"
                {% if ollama_status == 'stopped' %}disabled{% endif %}>
            {{ t('system.stop', lang) }}
        </button>
        <button class="btn-sm btn-restart"
                hx-post="/system/ollama/restart"
                hx-target="#process-section"
                hx-swap="innerHTML"
                {% if ollama_status == 'stopped' or not installed %}disabled{% endif %}>
            {{ t('system.restart', lang) }}
        </button>
    </div>
    {% if ollama_status == 'stopped' %}
    <div class="degraded-notice" style="margin-top: 1rem; padding: 0.75rem 1rem; background: rgba(200,160,60,0.10); border-left: 3px solid var(--warning); border-radius: 4px; font-size: 0.8125rem; line-height: 1.6; color: var(--text);">
        <strong style="color: var(--warning);">{{ t('system.degraded_summary', lang) }}</strong>
        {% for line in t('system.degraded_detail', lang).split('\n') %}
        {% if line.strip() %}
        <p style="margin: 0.5rem 0 0 0;">{{ line }}</p>
        {% endif %}
        {% endfor %}
    </div>
    {% endif %}
</section>
