/* Assistant · F-Assistant (panneau de 380 px) et F-AssistantModales (Valider l'action, Aperçu du code, Configuration). */

.as { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100vw; z-index: 2500; display: flex; flex-direction: column;
  background: var(--f-right); border-left: 1px solid var(--f-line-3); box-shadow: -30px 0 60px -20px #000;
  transform: translateX(100%); visibility: hidden; transition: transform var(--motion-slow) var(--ease-standard), visibility 0s linear var(--motion-slow); }
.as.active { transform: none; visibility: visible; transition-delay: 0s; }
.as-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--f-line); }
.as-head b { font: 700 16px Manrope; flex: 1; }
.as-conv { border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; max-width: 190px; }
.as-conv span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-conv .chev { width: 12px; height: 12px; flex: none; }
.as-conv.active { background: var(--f-s4); }
.as-ico { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--f-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.as-ico:hover { background: var(--f-s2); color: var(--f-text); }
.as-ico svg { width: 15px; height: 15px; }
.as button:focus-visible, .as [role="button"]:focus-visible { outline: 2px solid var(--f-accent); outline-offset: 2px; }

.as-menu { position: absolute; top: 56px; right: 14px; width: 310px; max-height: 60vh; z-index: 4; display: none; flex-direction: column; gap: 8px; padding: 10px; overflow: hidden;
  background: var(--f-s2); border: 1px solid var(--f-line-3); border-radius: 14px; box-shadow: 0 24px 50px -12px #000; }
.as-menu.open { display: flex; }
.as-menu .in { height: 34px; font-size: 12px; }
.as-menu-row { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--f-text-body); font: 500 13px Inter; cursor: pointer; text-align: left; }
.as-menu-row:hover { background: var(--f-s3); }
.as-menu-row svg { width: 15px; height: 15px; color: var(--f-muted); flex: none; }
.as-conv-list { overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--f-line); border-bottom: 1px solid var(--f-line); padding: 6px 0; }
.cwr-conv-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; cursor: pointer; color: var(--f-text-2); }
.cwr-conv-item:hover { background: var(--f-s3); }
.cwr-conv-item.active { background: var(--f-sel); color: var(--f-text); }
.cwr-conv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.cwr-conv-meta { display: flex; align-items: center; gap: 6px; color: var(--f-dim); font: 400 10.5px 'Geist Mono', monospace; }
.cwr-conv-rename, .cwr-conv-delete { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 6px; cursor: pointer; opacity: 0; }
.cwr-conv-item:hover .cwr-conv-rename, .cwr-conv-item:hover .cwr-conv-delete, .cwr-conv-rename:focus-visible, .cwr-conv-delete:focus-visible { opacity: 1; }
.cwr-conv-rename:hover, .cwr-conv-delete:hover { background: var(--f-s4); color: var(--f-text); }
.cwr-conv-rename svg, .cwr-conv-delete svg { width: 12px; height: 12px; }
.cwr-conv-empty { padding: 10px; font-size: 12px; color: var(--f-dim); }

.as-body { flex: 1; min-height: 0; overflow-y: auto; }
.as-feed { padding: 18px; display: flex; flex-direction: column; gap: 16px; min-height: 100%; box-sizing: border-box; }
.as-empty { color: var(--f-muted); line-height: 21px; }
.cwr-entry { display: flex; flex-direction: column; gap: 10px; }
.as-user { align-self: flex-end; max-width: 80%; align-items: flex-end; }
.as-user .cwr-question { background: #1C1D22; padding: 11px 14px; border-radius: 16px 16px 4px 16px; line-height: 20px; overflow-wrap: anywhere; white-space: pre-wrap; }
.cwr-unity-ctx { display: inline-flex; gap: 6px; align-items: center; font: 400 10.5px 'Geist Mono', monospace; color: var(--f-muted); }
.as-ai .cwr-answer, .as-tool .cwr-answer { color: #D6D6DA; line-height: 21px; overflow-wrap: anywhere; }
.as-tool .cwr-answer { color: var(--f-muted); font-size: 12.5px; }
.cwr-answer p { margin: 0 0 8px; }
.cwr-answer p:last-child { margin-bottom: 0; }
.cwr-answer a { color: var(--f-accent); }
.cwr-answer ul, .cwr-answer ol { margin: 6px 0; padding-left: 20px; }
.cwr-answer code { font-family: 'Geist Mono', monospace; font-size: 12px; background: var(--f-s2); padding: 1px 5px; border-radius: 5px; }
.cwr-answer pre { margin: 8px 0; padding: 12px 14px; background: var(--f-bg); border-radius: 12px; overflow-x: auto; }
.cwr-answer pre code { background: transparent; padding: 0; }
.cwr-code-block { margin: 8px 0; background: var(--f-bg); border-radius: 12px; overflow: hidden; }
.cwr-code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; font: 400 10.5px 'Geist Mono', monospace; color: var(--f-dim); text-transform: uppercase; letter-spacing: .08em; }
.cwr-code-head button { border: 0; background: transparent; color: var(--f-muted); cursor: pointer; font: inherit; }
.cwr-entry-credits { font: 400 11px 'Geist Mono', monospace; color: var(--f-dim); }
.cwr-typing { display: flex; align-items: center; gap: 4px; color: var(--f-muted); font-size: 12.5px; }
.cwr-typing .dot { width: 5px; height: 5px; border-radius: 9px; background: var(--f-muted); animation: as-dot var(--motion-loop-spin) var(--ease-standard) infinite; }
.cwr-typing .dot:nth-child(2) { animation-delay: calc(var(--motion-stagger) * 4); }
.cwr-typing .dot:nth-child(3) { animation-delay: calc(var(--motion-stagger) * 8); margin-right: 6px; }
@keyframes as-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.cwr-long-notice { margin: 0 18px 12px; padding: 10px 12px; border-radius: 12px; background: var(--f-warn-bg); color: var(--f-warn); display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 12px; }
.as .cwr-long-notice .btn { height: 30px; font-size: 12px; padding: 0 12px; border: 0; border-radius: 9px; background: var(--f-s4); color: var(--f-text); cursor: pointer; font-weight: 600; }

/* détails d'un enchaînement d'outils */
.cwr-substeps { margin-top: 2px; }
.cwr-substeps-btn { border: 0; border-radius: 99px; background: var(--f-s2); color: var(--f-muted); font: 400 11px 'Geist Mono', monospace; padding: 4px 10px; cursor: pointer; }
.cwr-substeps-btn:hover { color: var(--f-text); }
.cwr-substeps-count { color: var(--f-accent); margin-right: 4px; }
.cwr-substeps-panel { display: none; margin-top: 8px; background: #17181B; border-radius: 12px; padding: 6px 12px; }
.cwr-substeps-panel.open { display: block; }
.cwr-substep-item { padding: 6px 0; border-top: 1px solid var(--f-line); }
.cwr-substep-item:first-child { border-top: 0; }
.cwr-substep-label { cursor: pointer; display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--f-muted); }
.cwr-substep-name { font-family: 'Geist Mono', monospace; color: var(--f-text-body); }
.cwr-result-icon { display: inline-flex; width: 13px; height: 13px; }
.cwr-substep-detail { margin-top: 6px; font: 400 11.5px/17px 'Geist Mono', monospace; color: var(--f-text-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; }
.cwr-msg-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cwr-tool-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; background: var(--f-s2); color: #C9C9CE; font: 400 11px 'Geist Mono', monospace; }
.cwr-tool-badge[data-action] { cursor: pointer; }
.cwr-tool-badge[data-action]:hover { background: var(--f-s4); }
.cwr-tool-result-table { border-collapse: collapse; width: 100%; font-size: 11.5px; }
.cwr-tool-result-table th, .cwr-tool-result-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--f-line); }
.cwr-tool-result-json, .cwr-file-tree { font: 400 11.5px/17px 'Geist Mono', monospace; }
.cwr-file-tree-level { padding-left: 14px; }
.cwr-ft-dir { color: var(--f-warn); }
.cwr-ft-file { color: var(--f-text-2); }

/* plan proposé */
.as-plan { background: #17181B; padding: 16px; border-radius: 16px; display: flex; flex-direction: column; border: 0; box-shadow: none; }
.as-plan .lab { margin-bottom: 4px; }
.as-plan-row { padding: 6px 0; gap: 12px; }
.as-plan-row .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-plan-row .mono { color: var(--f-muted); font-size: 12px; white-space: nowrap; }
.as-plan-row .mono.free, .as-plan-row .mono.ok { color: var(--f-accent); }
.as-plan-row .mono.bad { color: var(--f-error); }
.as-plan .gen { width: 100%; margin-top: 10px; }
.as-plan-note { margin-top: 8px; font-size: 12px; color: var(--f-muted); line-height: 18px; }
.as-plan-note.bad { color: var(--f-error); }
.as-plan-note a { color: var(--f-accent); }
.as-plan-actions { display: flex; gap: 8px; margin-top: 8px; }
.as-plan-actions button { flex: 1; height: 32px; border: 0; border-radius: 10px; background: var(--f-s4); color: var(--f-text); font: 600 12px Inter; cursor: pointer; }
.as-plan.is-done .gen, .as-plan.is-refused .gen, .as-plan.is-done .as-plan-actions, .as-plan.is-refused .as-plan-actions { display: none; }

/* pied : contexte et saisie */
.as-foot { padding: 14px 18px; border-top: 1px solid var(--f-line); }
.as-ctx { gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.as-sel { display: inline-flex; align-items: center; gap: 6px; }
.as-sel [role="button"] { cursor: pointer; }
.as-x { border: 0; background: transparent; color: var(--f-muted); cursor: pointer; padding: 0; font-size: 14px; line-height: 1; }
.as-composer { position: relative; height: auto; min-height: 46px; max-height: 170px; padding: 7px 8px 7px 12px; gap: 8px; align-items: flex-end; box-sizing: border-box; border-radius: 14px; }
.as-composer:focus-within { border-color: var(--f-accent); }
.as-input { flex: 1; min-width: 0; max-height: 120px; overflow-y: auto; outline: none; line-height: 20px; padding: 6px 0; color: var(--f-text-body); overflow-wrap: anywhere; }
.as-input:empty::before { content: attr(data-placeholder); color: var(--f-dim); pointer-events: none; }
.as .as-send { width: 30px; height: 30px; min-width: 30px; padding: 0; border: 0; border-radius: 9px; background: var(--f-accent); color: var(--f-bg); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.as .as-send:disabled { opacity: .4; cursor: not-allowed; }
.as-send svg { width: 15px; height: 15px; }
.as-ac { display: none; position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); max-height: 240px; overflow: auto; background: var(--f-s2); border: 1px solid var(--f-line-3); border-radius: 14px; padding: 6px; box-shadow: 0 -18px 40px -12px #000; z-index: 3; }
.as-ac.open { display: block; }
.cwr-ac-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 12.5px; color: var(--f-text-body); }
.cwr-ac-item:hover, .cwr-ac-sel { background: var(--f-s3); }
.mcp-mention { display: inline-block; padding: 1px 7px; border-radius: 99px; background: rgba(62,207,142,.14); color: var(--f-accent); font: 400 12px 'Geist Mono', monospace; }
.as .error-message { display: none; color: var(--f-error); font-size: 12px; margin-top: 8px; }
.as .error-message.active { display: block; }

/* fenêtre (F-AssistantModales) */
#mcpConfigModal { display: none; }
#mcpConfigModal.active { display: flex; }
#mcpConfigModal .md { width: 600px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); overflow: auto; gap: 14px; }
.as-pane { display: flex; flex-direction: column; gap: 14px; }
.as-pane[hidden] { display: none; }
.as-m0 { margin: 0; }
.as-sum { background: var(--f-bg); border: 0; padding: 16px; border-radius: 14px; box-shadow: none; }
.as-sum .row2 { padding: 4px 0; }
.as-sum .row2 > span { flex: 1; color: var(--f-muted); }
.as-sum .row2 > b { font-family: 'Geist Mono', monospace; font-weight: 600; text-align: right; }
.as-code { margin: 0; background: var(--f-bg); border-radius: 14px; padding: 14px; font: 400 12px/19px 'Geist Mono', monospace; color: #D6D6DA; overflow: auto; max-height: 300px; white-space: pre; }
.as-code .sh-keyword { color: #C792EA; }
.as-code .sh-string { color: var(--f-accent); }
.as-code .sh-comment { color: var(--f-dim); }
.as-code .sh-tag, .as-code .sh-selector, .as-code .sh-json-key { color: #82AAFF; }
.as-code .sh-attr { color: var(--f-warn); }
#mcpConfigModal .fl select, #mcpConfigModal .fl input { height: 40px; }
#mcpConfigModal .acts .btn { height: 38px; border: 0; border-radius: 11px; background: var(--f-s4); color: var(--f-text); font: 600 13px Inter; padding: 0 16px; cursor: pointer; }
#mcpConfigModal .acts .btn.g { background: var(--f-accent); color: var(--f-bg); }
#mcpConfigModal .acts .btn:disabled { opacity: .4; cursor: not-allowed; }
#mcpConfigModal .acts .btn[hidden] { display: none; }
#mcpConfigModal .sw { border: 0; padding: 0; cursor: pointer; }
#mcpConfigModal .sw:focus-visible, #mcpConfigModal .tabs > span:focus-visible { outline: 2px solid var(--f-accent); outline-offset: 2px; }
@media (max-width: 760px) { .as { width: 100vw; } }

.as [hidden], #mcpConfigModal [hidden] { display: none !important; }
.as-sel .selected { color: var(--f-accent); }
.as-bad { color: var(--f-error); }
.as-vars { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.as-var { display: flex; gap: 8px; align-items: center; font: 400 12px 'Geist Mono', monospace; color: var(--f-text-2); }
.as-save-action { border: 0; cursor: pointer; margin-top: 8px; align-self: flex-start; }
.as-save-action:hover { background: var(--f-s4); }

.bar-assistant { margin-left: 12px; height: 26px; padding: 0 10px; border: 0; border-radius: 99px; background: var(--f-s2); color: var(--f-text-body); font: 500 12px Inter; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.bar-assistant:hover { background: var(--f-s4); }
.bar-assistant svg { width: 13px; height: 13px; color: var(--f-accent); }
.bar-assistant:focus-visible { outline: 2px solid var(--f-accent); outline-offset: 2px; }
