/* app.css — Interface RENE' — styles principaux */

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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            max-width: 960px;
            margin: 0 auto;
            background: white;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
            overflow: hidden;
        }

        /* ── Header ───────────────────────────────────────────────── */
        /* ── En-tête complet ───────────────────────────────────────── */
        .header {
            padding: 0;
            box-shadow: 0 2px 12px rgba(0,0,0,0.10);
        }

        /* Bande partenaires — dégradé violet, alignée à droite */
        .header__partners {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 20px;
            padding: 8px 28px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .header__partner-label {
            font-size: 0.68em;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: rgba(255,255,255,0.72);
            white-space: nowrap;
            margin-right: 2px;
        }
        .header__partner-logo {
            height: 32px;
            width: auto;
            object-fit: contain;
            filter: brightness(0) invert(1);
            opacity: 0.82;
            transition: opacity 0.18s;
        }
        .header__partner-logo:hover { opacity: 1; }
        .header__partner-logo--light {
            filter: none;
            background: white;
            border-radius: 4px;
            padding: 2px 6px;
            opacity: 1;
            height: 28px;
        }

        /* Zone titre — fond blanc, logo Eiko à gauche, texte à droite */
        .header__main {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0;
            padding: 18px 32px;
            background: #ffffff;
            border-bottom: 3px solid #667eea;
        }
        .header__eiko-logo {
            height: 72px;
            width: auto;
            object-fit: contain;
            flex-shrink: 0;
        }
        .header__text {
            text-align: right;
        }
        .header__text h1 {
            font-size: 1.55em;
            font-weight: 800;
            line-height: 1.2;
            margin-bottom: 5px;
            letter-spacing: -0.01em;
            color: #2d2d4e;
        }
        .header__text p {
            font-size: 0.92em;
            color: #666;
        }
        .header__version {
            display: inline-block;
            font-size: 0.62em;
            font-weight: 500;
            color: #9990cc;
            background: #f0eeff;
            border-radius: 20px;
            padding: 1px 8px;
            margin-left: 8px;
            vertical-align: middle;
        }

        @media (max-width: 600px) {
            .header__main { flex-direction: column-reverse; align-items: flex-start; gap: 12px; padding: 16px 20px; }
            .header__text { text-align: left; }
            .header__partners { justify-content: flex-start; flex-wrap: wrap; padding: 8px 20px; }
        }

        /* ── Panneaux accordéon communs ───────────────────────────── */
        .panel-toggle {
            width: 100%;
            padding: 14px 28px;
            background: none;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.95em;
            font-weight: 600;
            text-align: left;
        }
        .toggle-arrow {
            margin-left: auto;
            transition: transform 0.25s;
            font-style: normal;
            display: inline-block;
        }

        /* ── Panneau modèle ───────────────────────────────────────── */
        .model-panel { border-bottom: 1px solid #e8e8f0; background: #f9f8ff; }
        .model-panel .panel-toggle { color: #5a4fa0; }
        .model-panel .panel-toggle:hover { background: #f0eeff; }
        .model-panel.open .toggle-arrow { transform: rotate(180deg); }

        .model-badge {
            display: inline-block;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 3px 12px;
            border-radius: 20px;
            font-size: 0.82em;
            font-weight: 600;
        }
        .mode-badge {
            display: inline-block;
            padding: 2px 9px;
            border-radius: 12px;
            font-size: 0.75em;
            font-weight: 700;
            text-transform: uppercase;
        }
        .mode-ccp    { background: #fff3cd; color: #856404; }
        .mode-ollama { background: #d1e7dd; color: #0a3622; }

        .model-panel-body {
            display: none;
            padding: 20px 28px 24px;
            border-top: 1px solid #e2dff5;
        }
        .model-panel.open .model-panel-body { display: block; }

        .param-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 14px 20px;
            margin-top: 16px;
        }
        @media (max-width: 600px) { .param-grid { grid-template-columns: 1fr; } }

        .param-block label {
            display: block;
            font-size: 0.82em;
            font-weight: 600;
            color: #555;
            margin-bottom: 5px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }
        .param-block input[type="number"],
        .param-block select {
            width: 100%;
            padding: 8px 10px;
            border: 2px solid #ddd;
            border-radius: 7px;
            font-size: 0.95em;
            background: white;
            transition: border-color 0.2s;
        }
        .param-block input[type="number"]:focus,
        .param-block select:focus { outline: none; border-color: #667eea; }

        .range-row { display: flex; align-items: center; gap: 10px; }
        .range-row input[type="range"] { flex: 1; accent-color: #667eea; }
        .range-val { min-width: 36px; text-align: right; font-weight: 700; color: #667eea; font-size: 0.95em; }

        .ccp-only { display: none; }

        .btn-reload {
            margin-top: 18px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 11px 28px;
            border-radius: 8px;
            font-size: 0.95em;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: opacity 0.2s, transform 0.15s;
        }
        .btn-reload:hover    { transform: translateY(-1px); opacity: 0.93; }
        .btn-reload:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

        .panel-status {
            margin-top: 12px;
            padding: 10px 14px;
            border-radius: 7px;
            font-size: 0.88em;
            display: none;
        }
        .panel-status.show    { display: block; }
        .panel-status.ok      { background: #d1e7dd; color: #0a3622; border-left: 3px solid #198754; }
        .panel-status.error   { background: #f8d7da; color: #58151c; border-left: 3px solid #dc3545; }
        .panel-status.loading { background: #e7f0ff; color: #2c4a9e; border-left: 3px solid #667eea; }
        .panel-status.loading-amber { background: #fff8e1; color: #7a6200; border-left: 3px solid #f0b429; }

        /* ── Panneau prompts ──────────────────────────────────────── */
        .prompts-panel { border-bottom: 1px solid #e8e8f0; background: #fffdf5; }
        .prompts-panel .panel-toggle { color: #7a6200; }
        .prompts-panel .panel-toggle:hover { background: #fff8e1; }
        .prompts-panel.open .toggle-arrow { transform: rotate(180deg); }

        .prompts-panel-body {
            display: none;
            padding: 20px 28px 24px;
            border-top: 1px solid #f0e8c0;
        }
        .prompts-panel.open .prompts-panel-body { display: block; }

        .prompt-block { margin-bottom: 18px; }
        .prompt-block label {
            display: flex;
            align-items: baseline;
            gap: 10px;
            font-size: 0.82em;
            font-weight: 700;
            color: #555;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            margin-bottom: 6px;
        }
        .prompt-hint { font-size: 0.78em; font-weight: 400; color: #888; text-transform: none; letter-spacing: 0; }
        .prompt-block textarea {
            width: 100%;
            padding: 10px 12px;
            border: 2px solid #ddd;
            border-radius: 7px;
            font-size: 0.9em;
            font-family: 'Menlo', 'Consolas', monospace;
            line-height: 1.55;
            resize: vertical;
            background: white;
            transition: border-color 0.2s;
        }
        .prompt-block textarea:focus { outline: none; border-color: #f0b429; }
        #systemPromptTa { min-height: 130px; }
        #introductionTa { min-height: 72px; }

        .btn-prompts {
            margin-top: 4px;
            background: linear-gradient(135deg, #f6b93b 0%, #e58e0a 100%);
            color: white;
            border: none;
            padding: 11px 28px;
            border-radius: 8px;
            font-size: 0.95em;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: opacity 0.2s, transform 0.15s;
        }
        .btn-prompts:hover    { transform: translateY(-1px); opacity: 0.93; }
        .btn-prompts:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

        /* ── Main content ──────────────────────────────────────────── */
        .main-content { padding: 28px; }

        .status {
            background: #f8f9fa;
            border-left: 4px solid #667eea;
            padding: 13px 16px;
            margin-bottom: 20px;
            border-radius: 5px;
            display: none;
        }
        .status.active  { display: block; }
        .status.success { border-left-color: #28a745; background: #d4edda; }
        .status.error   { border-left-color: #dc3545; background: #f8d7da; }

        .input-group { margin-bottom: 18px; }
        .input-group label { display: block; margin-bottom: 7px; font-weight: 600; color: #333; }
        .input-group input,
        .input-group textarea {
            width: 100%;
            padding: 12px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 16px;
            transition: border-color 0.3s;
        }
        .input-group input:focus,
        .input-group textarea:focus { outline: none; border-color: #667eea; }
        .input-group textarea { min-height: 100px; resize: vertical; font-family: inherit; }
        .input-row { display: flex; gap: 20px; }
        .input-row .input-group { flex: 1; }

        .btn {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 15px 30px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            width: 100%;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        .btn:hover    { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(102,126,234,.4); }
        .btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

        .results { margin-top: 28px; padding: 20px; background: #f8f9fa; border-radius: 10px; display: none; }
        .results.active { display: block; }
        .results h3 { margin-bottom: 15px; color: #667eea; }

        .keywords { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
        .keyword-tag { background: #667eea; color: white; padding: 6px 12px; border-radius: 20px; font-size: 14px; }

        .sources-result { background: white; padding: 20px; border-radius: 8px; line-height: 1.6; }
        .sources-result p   { margin-bottom: 15px; }
        .sources-result a   { color: #667eea; text-decoration: none; }
        .sources-result a:hover { text-decoration: underline; }

        .loading {
            display: inline-block;
            width: 18px; height: 18px;
            border: 3px solid rgba(255,255,255,.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 0.8s ease-in-out infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        .examples { margin-top: 20px; padding: 15px; background: #e7f3ff; border-radius: 8px; }
        .examples h4 { margin-bottom: 10px; color: #333; }
        .examples ul { list-style: none; }
        .examples li { padding: 7px 0; cursor: pointer; color: #667eea; transition: padding-left 0.2s; }
        .examples li:hover { padding-left: 10px; }

        /* ── Panneau diagnostic ────────────────────────────────────── */
        .debug-panel { border-top: 1px solid #e2e2ea; background: #f4f4f6; }
        .debug-panel .panel-toggle { color: #999; font-size: 0.88em; }
        .debug-panel .panel-toggle:hover { background: #ececf0; }
        .debug-panel.open .toggle-arrow { transform: rotate(180deg); }

        .debug-panel-body {
            display: none;
            padding: 20px 28px 28px;
            border-top: 1px solid #e2e2ea;
        }
        .debug-panel.open .debug-panel-body { display: block; }

        .debug-section { margin-bottom: 24px; }
        .debug-section:last-child { margin-bottom: 0; }

        .debug-section h5 {
            font-size: 0.78em;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: #888;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }
        .debug-hint {
            font-size: 0.9em;
            font-weight: 400;
            text-transform: none;
            letter-spacing: 0;
            color: #bbb;
        }

        .debug-ta {
            width: 100%;
            font-family: 'Menlo', 'Consolas', monospace;
            font-size: 0.82em;
            line-height: 1.5;
            padding: 10px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            background: #fff;
            color: #333;
            resize: vertical;
        }
        #promptTa { min-height: 120px; }
        #kwTa     { min-height: 52px; }

        /* ── Perf cards ────────────────────────────────────────────── */
        .llm-timing {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 12px 16px;
            background: white;
            border: 1px solid #e0e0e8;
            border-radius: 8px;
            margin-bottom: 12px;
        }
        .lt-icon  { font-size: 1.5em; line-height: 1; }
        .lt-val   { font-size: 1.35em; font-weight: 700; color: #333; font-variant-numeric: tabular-nums; }
        .lt-label { font-size: 0.78em; color: #aaa; margin-top: 2px; }

        .perf-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
            gap: 10px;
            margin-bottom: 10px;
        }
        .perf-card {
            background: white;
            border: 1px solid #e0e0e8;
            border-radius: 8px;
            padding: 10px 14px;
        }
        .pc-label {
            font-size: 0.71em;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: #aaa;
            margin-bottom: 3px;
        }
        .pc-value {
            font-size: 1.18em;
            font-weight: 700;
            color: #333;
            font-variant-numeric: tabular-nums;
        }
        .pc-sub { font-size: 0.75em; color: #aaa; margin-top: 2px; }

        .perf-bar-wrap {
            height: 4px;
            background: #eee;
            border-radius: 2px;
            margin-top: 7px;
            overflow: hidden;
        }
        .perf-bar {
            height: 100%;
            border-radius: 2px;
            background: linear-gradient(90deg, #667eea, #764ba2);
            transition: width 0.4s ease;
        }
        .perf-bar.warn { background: linear-gradient(90deg, #f6b93b, #e58e0a); }
        .perf-bar.crit { background: linear-gradient(90deg, #e55a00, #dc3545); }

        /* ── Perf group labels ─────────────────────────────────────────── */
        .perf-group-label {
            font-size: 0.72em;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: #bbb;
            margin-bottom: 8px;
        }
        .perf-card--accent {
            border-color: #d0c8f8;
            background: linear-gradient(135deg, #f5f3ff 0%, #ede9ff 100%);
        }
        .perf-card--accent .pc-label { color: #8b7fd4; }
        .perf-card--accent .pc-value { color: #5a4fa0; }
        .perf-bar-wrap { background: #e8e8ee; }

        /* ── Download buttons ──────────────────────────────────────── */
        .debug-downloads { display: flex; gap: 12px; flex-wrap: wrap; }
        .btn-dl {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 7px 16px;
            border: 1.5px solid #ccc;
            border-radius: 6px;
            font-size: 0.85em;
            font-weight: 600;
            color: #666;
            background: white;
            text-decoration: none;
            transition: background 0.15s, border-color 0.15s, color 0.15s;
        }
        .btn-dl:hover { background: #f0eeff; border-color: #667eea; color: #4a3fa0; }
    