/* raglab-app.css — UI principale (hors panel DEV) */

/* === Bouton reset === */
#reset-btn {
    background: none;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: #5a5a5a;
    transition: all 0.15s;
}
#reset-btn:hover { background: #f5f5f5; border-color: #bbb; }

/* === Zone de chat === */
#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 0rem 1.4rem;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
}
.message {
    margin-bottom: 1.75rem;
    display: flex;
    flex-direction: column;
}
.message.user { align-items: flex-end; }
.message.assistant { align-items: flex-start; }

.bubble {
    max-width: 85%;
    padding: 0.85rem 1.1rem;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 1.05rem;
}
.user .bubble {
    background: #f0f0f0;
    color: #2d2d2d;
    border-radius: 1.25rem 1.25rem 0.3rem 1.25rem;
    white-space: pre-wrap;
    word-break: break-word;
}
.bubble-attachment { margin-top: 6px; }
.bubble-attachment-img {
    display: block;
    max-width: 220px; max-height: 160px;
    border-radius: 8px;
    object-fit: cover;
    border: 1.5px solid rgba(0,0,0,0.08);
}
.bubble-attachment-file {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(0,0,0,0.07); border-radius: 6px;
    padding: 3px 9px; font-size: 0.75rem; color: #444;
}
.assistant .bubble {
    background: transparent;
    color: #2d2d2d;
    border-radius: 0;
    padding: 0;
    max-width: 100%;
}

.label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    margin-bottom: 0.35rem;
    padding: 0 0.2rem;
}

/* === Zone de saisie === */
#input-area {
    border-top: 1px solid #e5e5e5;
    background: #ffffff;
    padding: 0.5rem 1rem 1rem;
}
#img-attachment-strip {
    display: none;
    align-items: center; gap: 10px;
    padding: 6px 4px 4px;
}
#img-attachment-strip.visible { display: flex; }
#img-attachment-thumb {
    width: 52px; height: 52px;
    object-fit: cover; border-radius: 5px;
    border: 1.5px solid #42543d;
    flex-shrink: 0;
}
#img-attachment-icon {
    display: none;
    width: 52px; height: 52px; border-radius: 5px;
    border: 1.5px solid #42543d;
    flex-shrink: 0;
    align-items: center; justify-content: center;
    font-size: 1.6rem; background: #f0f4f0; color: #42543d;
}
#img-attachment-label {
    flex: 1; font-size: 0.76rem; color: #42543d;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#img-attachment-sublabel { font-size: 0.68rem; color: #888; white-space: nowrap; }
#img-attachment-cancel {
    border: none; background: none; cursor: pointer;
    color: #888; font-size: 1rem; padding: 2px 6px;
    border-radius: 4px; flex-shrink: 0;
    transition: background 0.1s, color 0.1s;
}
#img-attachment-cancel:hover { background: #fee2e2; color: #dc2626; }

.ex-num {
    width: 38px; font-size: 0.82rem; text-align: center;
    border: 1px solid #ccc; border-radius: 4px;
    padding: 1px 3px; -moz-appearance: textfield;
}
.ex-num::-webkit-inner-spin-button,
.ex-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ex-pm {
    border: 1px solid #ccc; background: #f5f5f5;
    border-radius: 3px; padding: 0 5px;
    font-size: 0.85rem; line-height: 1.4; cursor: pointer;
}
.ex-pm:hover { background: #e8e8e8; }
#exemple {
    display: none; align-items: center; gap: 8px;
    padding: 4px 0 6px; max-width: 850px; margin: 0 auto;
    font-size: 0.74rem; color: #888; flex-wrap: wrap;
}
.ex-grp  { display: flex; align-items: center; gap: 4px; }
.ex-turn { font-weight: 600; font-size: 0.8rem; }
.ex-sl   { width: 60px; height: 3px; cursor: pointer; accent-color: #888; vertical-align: middle; }
.ex-val  { min-width: 22px; color: #666; font-size: 0.72rem; }
.ex-lbl  { color: #bbb; font-size: 0.7rem; }
.ex-cost { color: #888; font-size: 0.72rem; }
.ex-dot    { color: #ddd; user-select: none; padding: 0 2px; }
.ex-toggle { background: none; border: 1px solid #ddd; border-radius: 3px; color: #bbb; cursor: pointer; font-size: 0.7rem; padding: 1px 5px; line-height: 1.3; }
.ex-toggle.on { background: #e8f5e9; border-color: #81c784; color: #388e3c; }
.ex-commit { background: none; border: 1px solid #c8d8ff; border-radius: 3px; color: #5c7cfa; cursor: pointer; font-size: 0.68rem; padding: 1px 6px; margin-left: 2px; white-space: nowrap; }
.ex-commit:hover { background: #eef2ff; }
.ex-off-label { color: #bbb; font-style: italic; font-size: 0.72rem; }

#input-form {
    max-width: 850px; margin: 0 auto;
    display: flex; gap: 0.5rem; align-items: flex-end;
}
#user-input {
    flex: 1; padding: 0.75rem 1rem;
    border: 1px solid #d4d4d4; border-radius: 12px;
    font-size: 0.95rem; outline: none;
    background: #fafafa; color: #2d2d2d;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    font-family: inherit; line-height: 1.45;
    resize: none; overflow-y: auto;
    max-height: 160px; min-height: 44px; box-sizing: border-box;
}
#user-input:focus { border-color: #999; background: #fff; box-shadow: 0 0 0 3px rgba(0,0,0,0.04); }
#user-input::placeholder { color: #aaa; }
#send-btn {
    background: #2d2d2d; color: white;
    border: none; border-radius: 12px;
    padding: 0.75rem 1.25rem; font-size: 0.95rem;
    cursor: pointer; transition: all 0.15s;
}
#send-btn:hover { background: #444; }
#send-btn:disabled { background: #ccc; cursor: not-allowed; }

/* === Bouton micro === */
#mic-btn {
    background: #fff; color: #2d2d2d;
    border: 1px solid #d4d4d4; border-radius: 12px;
    width: 42px; height: 42px; font-size: 1.05rem;
    cursor: pointer; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
#mic-btn:hover:not(:disabled) { background: #f5f5f5; border-color: #999; }
#mic-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#mic-btn.recording {
    background: #c83e3e; color: #fff; border-color: #c83e3e;
    animation: pulse 1.4s ease-in-out infinite;
}
#mic-btn.transcribing { background: #f0f0f0; color: #777; cursor: wait; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200, 62, 62, 0.5); }
    50%       { box-shadow: 0 0 0 8px rgba(200, 62, 62, 0); }
}

/* === États === */
.typing { color: #999; font-style: italic; }
.welcome {
    text-align: center; color: #999;
    padding: 4rem 2rem; line-height: 1.7; font-size: 0.95rem;
}
.welcome strong { color: #2d2d2d; font-weight: 600; }

/* === Message rejeu / live === */
.message.replay .label::after { content: " · rejeu"; color: #c59a1a; font-weight: 600; }
.message.live .bubble { background: #fff5d6; color: #5a4b00; font-style: italic; }
.message.live .bubble::after { content: "..."; margin-left: 0.3rem; opacity: 0.6; }

/* === Markdown dans les bulles assistant === */
.assistant .bubble h1, .assistant .bubble h2, .assistant .bubble h3 {
    font-size: 0.95rem; font-weight: 700;
    margin: 1rem 0 0.3rem; color: #2d2d2d;
}
.assistant .bubble h1:first-child,
.assistant .bubble h2:first-child,
.assistant .bubble h3:first-child { margin-top: 0; }
.assistant .bubble p { margin: 0.5rem 0; }
.assistant .bubble ul, .assistant .bubble ol { margin: 0.5rem 0; padding-left: 1.5rem; }
.assistant .bubble li { margin: 0.2rem 0; }
.assistant .bubble code {
    background: #f0f0f0; padding: 0.15rem 0.4rem;
    border-radius: 4px; font-size: 0.85em;
    font-family: "SF Mono", "Fira Code", monospace;
}
.assistant .bubble pre {
    background: #f5f5f5; border-radius: 8px;
    padding: 0.75rem 1rem; overflow-x: auto; margin: 0.5rem 0;
}
.assistant .bubble pre code { background: none; padding: 0; }
.assistant .bubble blockquote {
    border-left: 3px solid #d4d4d4; margin: 0.5rem 0;
    padding-left: 0.85rem; color: #666;
}
.assistant .bubble strong { color: #2d2d2d; }
.assistant .bubble em { color: #555; }

/* === Playground (zone de contenu centrale) === */
#playground {
    flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
#tabconversations {
    flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}

/* === Top bar === */
#top-bar {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 1rem; background: #f5f4f8;
    border-bottom: 1px solid #e0dce8; flex-shrink: 0;
}
#top-bar-title { font-weight: 600; font-size: 0.9rem; color: #3a2d5a; letter-spacing: 0.02em; margin-right: auto; }
#top-bar-title .tbt-app     { color: #3a2d5a; }
#top-bar-title .tbt-sep     { color: #b0a8c4; font-weight: 400; margin: 0 4px; }
#top-bar-title .tbt-variante{ color: #7c5cbf; }
.top-bar-actions { display: flex; align-items: center; gap: 0.4rem; }
.top-bar-label   { font-size: 0.78rem; color: #666; white-space: nowrap; }

/* Toggle DEV (admin only — dans top-bar, visible même quand dev est off) */
.dev-mode-switch {
    display: inline-flex; align-items: center; gap: 5px;
    cursor: pointer; user-select: none;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
}
.dev-mode-switch input { display: none; }
.dev-mode-track {
    width: 30px; height: 16px; border-radius: 8px;
    background: #d0d0d8; position: relative;
    transition: background 0.18s; flex-shrink: 0;
}
.dev-mode-track::after {
    content: ""; position: absolute;
    width: 12px; height: 12px; border-radius: 50%;
    background: #fff; top: 2px; left: 2px;
    transition: transform 0.18s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.dev-mode-switch input:checked ~ .dev-mode-track { background: #7c5cbf; }
.dev-mode-switch input:checked ~ .dev-mode-track::after { transform: translateX(14px); }
.dev-mode-label { color: #aaa; transition: color 0.18s; }
.dev-mode-switch input:checked ~ .dev-mode-label { color: #7c5cbf; }

/* Sélecteurs / boutons header */
.hdr-select {
    padding: 0.35rem 0.6rem; border: 1px solid #d4d4d4;
    border-radius: 8px; background: #fff;
    font-size: 0.82rem; color: #2d2d2d; cursor: pointer;
}
.hdr-btn {
    padding: 0.35rem 0.55rem; border: 1px solid #d4d4d4;
    border-radius: 8px; background: #fff;
    font-size: 0.82rem; color: #2d2d2d; cursor: pointer;
}
.hdr-btn:hover { background: #f0f0f0; border-color: #bbb; }

.hdr-btn-edit { color: #6a4ca8; border-color: #c9b8f0; font-size: 1rem; }
.hdr-btn-edit:hover { background: #f2eefb; border-color: #9b6ddf; }

/* Admin-only */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: inline-flex !important; }
#user-menu-btn { padding: 4px 8px; min-width: 60px; }

/* === Barre d'onglets === */
#tab-bar {
    display: flex; align-items: stretch; gap: 4px;
    padding: 4px 8px 0 8px;
    background: var(--color-paper); border-bottom: 1px solid var(--color-border);
}
#tab-bar.hidden { display: none; }
#tabs-list {
    display: flex; gap: 2px;
    overflow-x: auto; overflow-y: hidden;
    flex: 1; align-items: stretch; scrollbar-width: thin;
}
#tabs-list::-webkit-scrollbar { height: 4px; }
#tabs-list::-webkit-scrollbar-thumb { background: #bbb; border-radius: 2px; }
.tab {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 8px; background: var(--color-paper-light);
    border: 1px solid var(--color-border); border-bottom: none;
    border-radius: 6px 6px 0 0;
    min-width: 150px; max-width: 280px;
    cursor: pointer; font-size: 0.82rem;
    color: var(--color-ink-muted); user-select: none;
    position: relative; top: 1px; opacity: 0.78;
    transition: background 0.1s, opacity 0.1s, color 0.1s;
}
.tab:hover { background: #f6f7f9; opacity: 0.95; color: #333; }
.tab.active {
    background: var(--color-paper);
    border-color: var(--color-accent);
    border-top: 3px solid var(--color-accent);
    padding-top: 2px;
    box-shadow: 0 -2px 6px -2px rgba(40, 40, 40, 0.15),
                0 -1px 0 var(--color-accent) inset;
    color: var(--color-ink); font-weight: 600; opacity: 1; z-index: 2;
}
.tab.active .agent-badge { box-shadow: 0 0 0 2px var(--color-paper), 0 0 0 3px var(--color-accent); }
.tab.active .tab-meta { color: #555; }
.tab.status-new { font-style: italic; }
.tab.status-new:not(.active) { opacity: 0.55; }
.tab.dragging { opacity: 0.4; }
.tab .agent-badge {
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 0.68rem; flex: 0 0 auto;
    background: #aab0be;
}
.tab .tab-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tab .tab-meta {
    font-size: 0.7rem; color: #777; flex: 0 0 auto; font-weight: 400;
    display: flex; align-items: center; gap: 4px;
}
.tab .tab-meta .tab-count::before { content: "↔ "; opacity: 0.5; }
.tab .tab-meta .tab-cost::before  { content: "€ "; opacity: 0.5; }
.tab .tab-meta .tab-model { background: var(--color-accent-subtle); color: var(--color-accent); padding: 1px 4px; border-radius: 3px; font-size: 0.65rem; }
.tab .tab-project-badge {
    font-size: 0.66rem; font-weight: 500; color: #6366f1;
    background: #eef2ff; padding: 1px 6px; border-radius: 8px;
    flex-shrink: 0; white-space: nowrap;
}
.tab .tab-close {
    margin-left: 2px; width: 16px; height: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; color: #888; border-radius: 3px; flex: 0 0 auto; line-height: 1;
}
.tab .tab-close:hover { background: #e0e4ea; color: #333; }
.tab .tab-drift {
    color: #d49100; font-size: 0.7rem; line-height: 1;
    cursor: pointer; padding: 2px 4px; border-radius: 50%; margin-left: 2px;
    transition: transform 0.15s ease, background 0.15s ease;
}
.tab .tab-drift:hover { background: #fff5e0; transform: scale(1.2); }
#tab-new-btn {
    background: transparent; border: 1px dashed #aab0be; color: #666;
    border-radius: 6px 6px 0 0; padding: 4px 10px;
    cursor: pointer; flex: 0 0 auto; font-size: 1rem;
    align-self: flex-end; margin-bottom: 0;
}
#tab-new-btn:hover { background: #fff; color: #333; border-color: #888; }
#tabs-list .tab-close-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px;
    border: none; border-radius: 3px; background: transparent;
    color: #888; cursor: pointer; font-size: 14px; line-height: 1; margin-left: 4px; opacity: 0.5;
}
#tabs-list .tab-close-btn:hover { background: #ddd; color: #c00; opacity: 1; }

/* Menu contextuel onglet */
.tab-context-menu {
    position: fixed; min-width: 160px;
    background: #fff; border: 1px solid #d0d4dd;
    border-radius: 6px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 4px 0; z-index: var(--z-dropdown);
    font-size: 0.85rem; user-select: none;
}
.tab-context-menu.hidden { display: none; }
.tab-context-menu-item { padding: 6px 14px; cursor: pointer; color: #333; white-space: nowrap; }
.tab-context-menu-item:hover { background: #f0f3f8; }
.tab-context-menu-item.danger {
    color: #b03a3a; border-top: 1px solid #e6e8ee;
    margin-top: 2px; padding-top: 8px;
}
.tab-context-menu-item.danger:hover { background: #fdecec; }
.tab-context-menu-item .ctx-hint { font-size: 0.7rem; opacity: 0.6; margin-left: 8px; }

/* Modale de confirmation */
.confirm-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(20, 22, 30, 0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: var(--z-modal);
}
.confirm-modal-overlay.hidden { display: none; }
.confirm-modal {
    background: #fff; border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    max-width: 420px; width: calc(100% - 32px); padding: 20px 22px 16px;
}
.confirm-modal-title   { font-size: 1rem; font-weight: 600; margin: 0 0 8px; color: #222; }
.confirm-modal-body    { font-size: 0.88rem; color: #444; line-height: 1.45; margin: 0 0 16px; }
.confirm-modal-body strong { color: #222; }
.confirm-modal-body .warn { display: block; margin-top: 8px; color: #b03a3a; font-size: 0.82rem; }
.confirm-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.confirm-modal-actions button {
    border: 1px solid #d0d4dd; background: #fff; border-radius: 5px;
    padding: 6px 14px; font-size: 0.85rem; cursor: pointer;
}
.confirm-modal-actions button:hover { background: #f0f3f8; }
.confirm-modal-actions button.danger { background: #b03a3a; color: #fff; border-color: #b03a3a; }
.confirm-modal-actions button.danger:hover { background: #962f2f; }

/* === Drawer gauche === */
#conv-drawer-toggle { padding: 4px 10px; font-size: 1rem; }
#conv-drawer {
    display: none; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--conv-drawer-width);
    background: #fafafa; border-right: 1px solid #d8dce3;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
    overflow: hidden; z-index: var(--z-drawer);
}
body.conv-drawer-open #conv-drawer { display: flex; }
body.conv-drawer-open { padding-left: var(--conv-drawer-width); transition: padding-left 0.15s; }

#conv-drawer-resize {
    position: absolute; right: -3px; top: 0; bottom: 0;
    width: 6px; cursor: ew-resize; z-index: 6;
    background: transparent; transition: background 0.1s;
}
#conv-drawer-resize:hover,
body.conv-drawer-resizing #conv-drawer-resize { background: rgba(40, 40, 40, 0.12); }
body.conv-drawer-resizing { user-select: none; cursor: ew-resize; }

/* Accordéon drawer */
.cdracc-section {
    display: flex; flex-direction: column;
    flex: 0 0 auto; border-bottom: 1px solid #e5e5e5; min-height: 0;
}
.cdracc-section.cdracc-open { flex: 1; }
#cdracc-dev { margin-top: auto; }
.cdracc-header {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 0.9rem; flex-shrink: 0;
    cursor: pointer; user-select: none;
    background: #f0f0f3; transition: background 0.1s;
}
.cdracc-header:hover { background: #e8e8ed; }
.cdracc-title { flex: 1; font-size: 0.79rem; font-weight: 600; color: #555; letter-spacing: 0.04em; text-transform: uppercase; }
.cdracc-chev { color: #bbb; font-size: 0.7rem; transition: transform 0.15s; }
.cdracc-section:not(.cdracc-open) .cdracc-chev { transform: rotate(-90deg); }
.cdracc-body { display: none; flex: 1; min-height: 0; overflow-y: auto; flex-direction: column; }
.cdracc-section.cdracc-open .cdracc-body { display: flex; }

/* Toggle "archives" dans les headers du drawer */
.cdracc-toggle {
    display: flex; align-items: center; gap: 3px;
    cursor: pointer; padding: 1px 5px;
    border-radius: 4px; font-size: 0.68rem;
    color: #999; user-select: none;
    transition: color 0.1s;
    stop-propagation: yes; /* arrêter le clic vers le header */
}
.cdracc-toggle:hover { color: #666; }
.cdracc-toggle input[type="checkbox"] { width: 11px; height: 11px; accent-color: #888; cursor: pointer; margin: 0; }
.cdracc-toggle:has(input:checked) { color: #444; }

/* Dropdown nouvel assistant */
/* Select agent dans le header drawer conversations */
.cdracc-agent-select {
    font-size: 0.72rem; color: #555; background: none;
    border: 1px solid #ddd; border-radius: 4px;
    padding: 1px 4px; max-width: 90px; cursor: pointer;
}
.cdracc-agent-select:focus { outline: 1px solid #aaa; }

/* Select agent en tête du panel DEV */
.dev-agent-row {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 6px 10px; border-bottom: 1px solid #e0e0e8;
    background: #f0f0f3;
}
.dev-agent-label { font-size: 0.75rem; font-weight: 600; color: #555; white-space: nowrap; }

.cdracc-new-wrap { position: relative; }
.cdracc-mode-dropdown {
    position: absolute; right: 0; top: calc(100% + 4px);
    background: #fff; border: 1px solid #ddd; border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    min-width: 160px; z-index: var(--z-dropdown);
    overflow: hidden;
}
.cdracc-mode-dropdown button {
    display: block; width: 100%; text-align: left;
    padding: 7px 12px; border: none; background: none;
    font-size: 0.82rem; color: #333; cursor: pointer;
}
.cdracc-mode-dropdown button:hover { background: #f3f4f6; }

/* Items de conversation */
#conv-drawer-list { padding: 0.3rem; flex: 1; }
.conv-drawer-item {
    padding: 0.42rem 0.55rem; border-radius: 6px; cursor: pointer;
    display: flex; flex-direction: column; gap: 0.1rem;
    margin-bottom: 0.12rem; border: 1px solid transparent;
}
.conv-drawer-item:hover  { background: #ececec; }
.conv-drawer-item.active { background: #e0e7ff; border-color: #c7d2fe; }
.conv-drawer-item.is-closed { opacity: 0.6; }
.cd-row  { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cd-title { flex: 1; font-size: 0.83rem; font-weight: 500; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-icons { display: flex; gap: 1px; flex-shrink: 0; opacity: 0; transition: opacity 0.1s; }
.conv-drawer-item:hover .cd-icons,
.conv-drawer-item.active .cd-icons { opacity: 1; }
.cd-icon-btn { border: none; background: none; cursor: pointer; padding: 1px 4px; border-radius: 3px; font-size: 0.82rem; color: #bbb; line-height: 1; }
.cd-icon-btn:hover { background: rgba(0,0,0,0.07); color: #444; }
.cd-icon-btn.cd-archive:hover { background: #fee2e2; color: #dc2626; }
.cd-meta { font-size: 0.68rem; color: #bbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-project-badge {
    font-size: 0.68rem; font-weight: 500; color: #6366f1;
    background: #eef2ff; padding: 1px 6px; border-radius: 8px;
    flex-shrink: 0; white-space: nowrap;
}

/* === FileManager === */
.fm-wrap { display: flex; flex-direction: column; min-height: 0; }
.outils-breadcrumb {
    display: flex; align-items: center; gap: 3px; flex-wrap: wrap;
    padding: 5px 10px; border-bottom: 1px solid #eee;
    font-size: 0.74rem; color: #888; flex-shrink: 0; background: #f8f8fa;
}
.outils-crumb     { cursor: pointer; color: #5a7fd6; }
.outils-crumb:hover { text-decoration: underline; }
.outils-crumb-sep { color: #ccc; }
.fm-toolbar {
    display: flex; align-items: center; gap: 5px;
    padding: 4px 8px; border-bottom: 1px solid #eee;
    background: #f8f8fa; flex-shrink: 0;
}
.fm-btn { border: 1px solid #ddd; background: #fff; border-radius: 4px; padding: 2px 7px; font-size: 0.72rem; cursor: pointer; color: #555; white-space: nowrap; }
.fm-btn:hover { background: #f0f0f3; border-color: #bbb; }
.fm-drop-active { outline: 2px dashed #5a7fd6; outline-offset: -2px; }
.outils-tree { flex: 1; overflow-y: auto; padding: 0.2rem; position: relative; }
.outils-entry { display: flex; align-items: center; gap: 7px; padding: 4px 8px; border-radius: 5px; cursor: pointer; font-size: 0.81rem; color: #2d2d2d; }
.outils-entry:hover { background: #ececec; }
.outils-entry:hover .fm-entry-actions { opacity: 1; }
.outils-entry-icon { font-size: 0.82rem; flex-shrink: 0; color: #888; }
.outils-entry-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outils-entry-meta { font-size: 0.67rem; color: #ccc; flex-shrink: 0; }
.fm-entry-actions { display: flex; gap: 2px; flex-shrink: 0; opacity: 0; transition: opacity .1s; }
.fm-entry-btn { border: none; background: none; cursor: pointer; font-size: 0.7rem; padding: 1px 4px; border-radius: 3px; color: #888; }
.fm-entry-btn:hover { background: #ddd; color: #333; }
.fm-entry-btn.danger:hover { background: #fdd; color: #c00; }
.fm-scope-private { font-size: 0.65rem; flex-shrink: 0; opacity: 0.55; line-height: 1; }
.fm-entry-btn-publish { color: #5a7fd6; font-size: 0.65rem; }
.fm-entry-btn-publish:hover { background: #e8edf8; color: #3a5fbb; }
.outils-back { border: none; background: none; cursor: pointer; color: #5a7fd6; font-size: 0.75rem; padding: 5px 10px; text-align: left; width: 100%; }
.outils-back:hover { background: #f0f0f3; }
.outils-viewer {
    flex: 1; overflow-y: auto; padding: 8px 12px; min-height: 0;
    font-size: 0.76rem; font-family: "SF Mono", "Fira Code", monospace;
    white-space: pre-wrap; word-break: break-word;
    background: #f8f8fa; line-height: 1.5;
}

/* === FileWindow === */
#fw-layer { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-dropdown); }
.fw-window {
    position: absolute; pointer-events: all;
    display: flex; flex-direction: column;
    background: #fff; border: 1.5px solid #42543d;
    border-radius: 7px; box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    min-width: 280px; min-height: 180px;
    width: 480px; height: 360px;
    overflow: hidden; resize: both; transition: border-radius 0.15s;
}
.fw-window--txt { width: 600px; height: 820px; max-height: calc(100vh - 40px); }

.fw-window--fs-img {
    position: fixed !important; inset: 0 !important;
    width: 100% !important; height: 100% !important;
    border-radius: 0; resize: none; border: none;
    background: #111; z-index: 9999 !important;
}
.fw-window--fs-img .fw-body          { background: #111; }
.fw-window--fs-img .fw-body-img      { background: #111; padding: 0; }
.fw-window--fs-img .fw-body-img img  { max-width: 100%; max-height: 100%; }
.fw-zoom-controls { position: absolute; bottom: 12px; right: 12px; display: flex; gap: 4px; z-index: 2; }
.fw-zoom-btn { border: none; background: rgba(255,255,255,0.18); color: #fff; border-radius: 4px; padding: 4px 10px; font-size: 1rem; cursor: pointer; backdrop-filter: blur(4px); }
.fw-zoom-btn:hover { background: rgba(255,255,255,0.32); }

.fw-window--fs-txt {
    position: fixed !important; inset: 0 !important;
    width: 100% !important; height: 100% !important;
    border-radius: 0; resize: none; border: none;
    background: #fff; z-index: 9999 !important;
}
.fw-window--fs-txt .fw-body { display: flex; justify-content: center; overflow-y: auto; background: #fff; }
.fw-zen-inner {
    width: 100%; max-width: 860px;
    background: #fff; margin: 32px 24px 60px; padding: 0;
    font-size: 0.9rem; line-height: 1.8; color: var(--color-ink, #1a1a1a);
    font-family: var(--font-messages, Georgia, serif);
    white-space: pre-wrap; word-break: break-word;
}
.fw-zen-inner.fw-body-md-preview { white-space: normal; }

.fw-header {
    display: flex; align-items: center; gap: 6px;
    background: #42543d; color: #e8ede6;
    padding: 6px 10px; cursor: move; user-select: none; flex-shrink: 0;
}
.fw-title { flex: 1; font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-btn { border: none; background: rgba(255,255,255,0.12); color: #d8e8d4; border-radius: 4px; padding: 2px 7px; font-size: 0.76rem; cursor: pointer; transition: background 0.1s; }
.fw-btn:hover     { background: rgba(255,255,255,0.25); }
.fw-btn-close     { font-size: 0.9rem; padding: 2px 6px; }
.fw-body          { flex: 1; overflow: auto; min-height: 0; font-size: 0.79rem; position: relative; }
.fw-body-text     { padding: 10px 14px; font-family: "SF Mono", "Fira Code", monospace; white-space: pre-wrap; word-break: break-word; line-height: 1.55; color: #222; }
.fw-body-md-preview {
    padding: 10px 16px; line-height: 1.6; color: #222;
    font-family: var(--font-messages, Georgia, serif); font-size: 1rem;
}
.fw-body-md-preview h1, .fw-body-md-preview h2, .fw-body-md-preview h3 { margin: 0.7em 0 0.3em; font-family: var(--font-body, inherit); }
.fw-body-md-preview p    { margin: 0 0 0.5em; }
.fw-body-md-preview code { background: #f0f0f4; padding: 1px 4px; border-radius: 3px; font-size: 0.9em; font-family: var(--font-mono, monospace); }
.fw-body-md-preview pre code { display: block; padding: 8px; overflow-x: auto; }
.fw-body-img { display: flex; align-items: center; justify-content: center; padding: 8px; background: #f4f4f4; min-height: 100%; }
.fw-body-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.fw-edit-area { width: 100%; height: 100%; box-sizing: border-box; padding: 10px 14px; border: none; outline: none; resize: none; font-family: "SF Mono", "Fira Code", monospace; font-size: 0.79rem; line-height: 1.55; color: #222; background: #fdfdfd; }
.fw-toolbar { display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-top: 1px solid #e0e0e0; background: #f7f7f9; flex-shrink: 0; }
.fw-toolbar .fw-btn       { color: #42543d; background: none; }
.fw-toolbar .fw-btn:hover { background: #e8ede6; }
.fw-toolbar .fw-btn.active{ background: #42543d; color: #e8ede6; }
.fw-send-img-btn { margin-left: auto; background: #42543d; color: #e8ede6; border: none; border-radius: 4px; padding: 3px 10px; font-size: 0.76rem; cursor: pointer; transition: background 0.1s; }
.fw-send-img-btn:hover    { background: #354430; }
.fw-send-img-btn:disabled { opacity: 0.5; cursor: default; }

/* === Modale Agents === */
#agents-modal { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: var(--z-modal); align-items: center; justify-content: center; padding: 2rem; }
#agents-modal.open { display: flex; }
.agents-modal-dialog { background: #fff; border-radius: 12px; width: min(820px, 96vw); max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
.agents-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.2rem; border-bottom: 1px solid #eee; }
.agents-modal-header h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.agents-modal-body  { padding: 1rem 1.2rem; overflow-y: auto; flex: 1; }
.agents-list { list-style: none; padding: 0; margin: 0; }
.agents-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; border: 1px solid #eee; border-radius: 8px; margin-bottom: 0.4rem; }
.agents-list .agent-info { flex: 1; min-width: 0; }
.agents-list .agent-name { font-weight: 600; font-size: 0.9rem; }
.agents-list .agent-desc { font-size: 0.78rem; color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agents-list .agent-meta { font-size: 0.72rem; color: #888; }
.agents-form label { display: block; font-size: 0.8rem; color: #555; margin-top: 0.7rem; margin-bottom: 0.25rem; }
.agents-form input[type=text], .agents-form textarea, .agents-form select { width: 100%; box-sizing: border-box; padding: 0.4rem 0.55rem; border: 1px solid #d4d4d4; border-radius: 6px; font-size: 0.85rem; font-family: inherit; }
.agents-form textarea { resize: vertical; min-height: 80px; }
.agents-form .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.agents-modal-footer { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.8rem 1.2rem; border-top: 1px solid #eee; }

/* Onglets admin (Application | Variantes | Agents) */
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid #eee; padding: 0 1.2rem; background: #fafafa; }
.admin-tab  { background: transparent; border: 0; padding: 0.6rem 0.9rem; font-size: 0.85rem; color: #555; border-bottom: 2px solid transparent; cursor: pointer; }
.admin-tab:hover  { color: #2d2d2d; }
.admin-tab.active { color: #2d2d2d; font-weight: 600; border-bottom-color: #6a4ca8; }
.admin-pane       { display: none; }
.admin-pane.active{ display: block; }

/* Variantes */
.variante-help { font-size: 0.78rem; color: #777; margin: 0 0 0.6rem 0; }
.variante-block-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.7rem; }
.variante-block-row label { margin: 0; font-size: 0.8rem; color: #555; flex: 0 0 auto; }
.variante-active-badge     { display: inline-block; font-size: 0.7rem; padding: 1px 6px; border-radius: 8px; background: #efe7fb; color: #5a3a8a; }
.variante-passthrough-badge{ display: inline-block; font-size: 0.7rem; padding: 1px 6px; border-radius: 8px; background: #f5f5f5; color: #888; }

/* Erreur override */
.error-row { border: 1px solid #eee; border-radius: 8px; padding: 0.6rem 0.8rem; margin-bottom: 0.6rem; }
.error-row.has-override { border-color: #c0a8e8; background: #faf7ff; }
.error-row .er-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.error-row .er-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; color: #6a4ca8; background: #f3eefb; padding: 1px 6px; border-radius: 4px; }
.error-row .er-default-title { font-size: 0.78rem; color: #777; }
.error-row .er-reset { margin-left: auto; font-size: 0.75rem; background: transparent; border: 1px solid #ccc; border-radius: 4px; padding: 1px 6px; cursor: pointer; color: #666; }
.error-row .er-reset:hover:not(:disabled) { background: #fdecec; border-color: #b03a3a; color: #b03a3a; }
.error-row .er-reset:disabled { opacity: 0.4; cursor: not-allowed; }
.error-row label { display: block; font-size: 0.75rem; color: #555; margin: 0.4rem 0 0.2rem 0; }
.error-row input[type=text], .error-row textarea { width: 100%; box-sizing: border-box; padding: 0.35rem 0.5rem; border: 1px solid #d4d4d4; border-radius: 4px; font-size: 0.82rem; font-family: inherit; }
.error-row textarea { resize: vertical; min-height: 50px; }

/* === Modale Auth === */
#auth-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: calc(var(--z-modal) + 1); display: flex; align-items: center; justify-content: center; padding: 2rem; }
#auth-modal[hidden] { display: none; }
.auth-modal-dialog { background: #fff; border-radius: 12px; width: min(420px, 96vw); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); overflow: hidden; }
.auth-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.2rem; border-bottom: 1px solid #eee; }
.auth-modal-header h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.auth-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid #eee; }
.auth-tab { flex: 1; padding: 8px 6px; background: transparent; border: none; cursor: pointer; border-bottom: 2px solid transparent; font-size: 0.85rem; color: #666; }
.auth-tab.active { border-bottom-color: #2563eb; font-weight: 600; color: #111; }
.auth-pane { padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.7rem; }
.auth-pane[hidden] { display: none; }
.auth-pane label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: #444; }
.auth-pane input  { padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9rem; }
.auth-pane input:focus { outline: 2px solid #2563eb; outline-offset: -1px; }
.auth-pane input[readonly] { background: #f3f4f6; color: #6b7280; cursor: not-allowed; }
.auth-primary-btn, .auth-secondary-btn { padding: 8px 12px; border: 1px solid #2563eb; border-radius: 6px; background: #2563eb; color: #fff; cursor: pointer; font-size: 0.9rem; }
.auth-secondary-btn { background: #fff; color: #2563eb; }
.auth-primary-btn:hover { background: #1d4ed8; }
.auth-error { color: #dc2626; font-size: 0.82rem; min-height: 1em; }
.auth-variantes-section { display: flex; flex-direction: column; gap: 0.4rem; }
.auth-section-label { font-size: 0.78rem; color: #4b5563; font-weight: 600; }
.auth-variante-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 6px; background: #f9fafb; font-size: 0.82rem; cursor: pointer; transition: background 0.1s, border-color 0.1s; }
.auth-variante-row:hover { background: #f3f4f6; }
.auth-variante-row input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.auth-variante-row:has(input:checked) { background: #eff6ff; border-color: #93c5fd; }
.auth-variante-info { flex: 1; }
.auth-variante-info strong { display: block; }
.auth-variante-info span  { display: block; font-size: 0.72rem; color: #6b7280; margin-top: 2px; }
.auth-variante-tag { font-size: 0.68rem; color: #2563eb; font-weight: 600; white-space: nowrap; }

/* === Voice player === */
.voice-player {
    display: flex; align-items: center; gap: 0.6rem;
    background: #f0f0f0; border-radius: 1.5rem;
    padding: 0.45rem 0.85rem 0.45rem 0.45rem;
    max-width: 560px; width: 100%; user-select: none;
}
.vp-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: #2d2d2d; color: #fff; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; flex-shrink: 0; transition: background 0.15s;
}
.vp-btn:hover:not(:disabled) { background: #444; }
.vp-btn:disabled { background: #bbb; cursor: wait; }
.vp-track { flex: 1; position: relative; height: 48px; min-width: 0; }
.vp-waveform { position: absolute; inset: 0; cursor: pointer; display: flex; align-items: center; overflow: hidden; }
.vp-waveform-bar { flex: 1; min-width: 2px; max-width: 5px; border-radius: 1px; background: #bbb; transition: background 0.05s; }
.vp-waveform-bar.played { background: #2d2d2d; }
.vp-waveform-placeholder { width: 100%; height: 4px; background: #d4d4d4; border-radius: 2px; }
.vp-time { position: absolute; bottom: 3px; right: 0; font-size: 0.68rem; color: #aaa; font-family: "SF Mono", "Fira Code", monospace; z-index: 1; pointer-events: none; }
.voice-player.loading .vp-btn { background: #999; }
.voice-player.loading .vp-waveform-placeholder {
    background: linear-gradient(90deg, #d4d4d4 25%, #bbb 50%, #d4d4d4 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* === Bandeau canal system === */
.system-banner {
    margin: 4px 0; display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 6px; background: #fff7d6;
    border-left: 3px solid #e7b530; color: #b48a0c;
    font-size: 0.78rem; line-height: 1.2;
    border-radius: 0 4px 4px 0; cursor: help;
}
.system-banner::before { content: "⚠"; color: #b48a0c; font-weight: 700; flex: 0 0 auto; }
.system-banner .sb-text { display: none; }

/* === Bloc refs === */
.refs-block {
    margin: 8px 0 4px 0; padding: 8px 12px;
    background: var(--color-paper); border-left: 3px solid var(--color-ink);
    color: var(--color-ink-muted); font-size: 1rem; line-height: 1.35;
    font-family: var(--font-body); border-radius: 0 4px 4px 0;
}
.refs-block .rb-title { font-weight: 600; color: var(--color-ink); font-size: 0.88rem; letter-spacing: 0.04em; text-transform: uppercase; font-family: var(--font-body); margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
.refs-block .rb-title::before { content: "📚"; font-size: 0.95rem; }
.refs-block .rb-body { color: var(--color-ink-muted); font-family: var(--font-body); }
.refs-block .rb-body ul { margin: 2px 0 0 20px; padding: 0; }
.refs-block .rb-body li { margin: 2px 0; }
.refs-block .rb-body a  { color: var(--color-accent); text-decoration: underline; }

/* === Error bubble (partie visible) === */
.error-bubble .err-msg { line-height: 1.4; }

/* === Cartes tools / activité agentic === */
.agent-tools-section       { margin-top: 0.8rem; }
.agent-tools-section > label { display: block; margin-bottom: 6px; }
.agent-tools-list          { display: flex; flex-direction: column; gap: 6px; }
.tool-card { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid #e0e0e0; border-radius: 6px; cursor: pointer; user-select: none; transition: background 0.1s, border-color 0.1s; }
.tool-card:hover:not(.tool-card-soon) { background: #f5f5f5; }
.tool-card.tool-card-active { border-color: #2ca860; background: #f0faf4; }
.tool-card.tool-card-soon  { opacity: 0.55; cursor: default; }
.tool-card-check { width: 15px; height: 15px; flex-shrink: 0; margin-top: 3px; accent-color: #2ca860; cursor: pointer; }
.tool-card-soon .tool-card-check { cursor: default; }
.tool-card-body  { flex: 1; min-width: 0; }
.tool-card-label { font-weight: 600; font-size: 0.86rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tool-soon-badge { font-size: 0.65rem; font-weight: 400; background: #ebebeb; color: #777; padding: 1px 7px; border-radius: 8px; }
.tool-card-desc  { font-size: 0.78rem; color: #444; margin-top: 3px; line-height: 1.35; }
.tool-card-impl  { font-size: 0.72rem; color: #999; margin-top: 3px; }
.tool-card-levels { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #d8d8d8; }
.tool-level-row   { display: flex; align-items: flex-start; gap: 8px; font-size: 0.78rem; cursor: pointer; }
.tool-level-cb    { width: 13px; height: 13px; margin-top: 2px; accent-color: #2ca860; flex-shrink: 0; cursor: pointer; }
.tool-level-text  { flex: 1; min-width: 0; }
.tool-level-label { font-weight: 600; color: #333; }
.tool-level-desc  { color: #666; margin-top: 1px; }

.tool-activity-row { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 12px 2px; margin-bottom: 2px; }
.tool-chip         { font-size: 0.72rem; padding: 2px 8px; border-radius: 10px; color: white; white-space: nowrap; }
.tool-chip-pending { background: #aaa; }
.tool-chip-done    { background: #2ca860; }

/* === Widget assistant === */
.widget-root {
    position: fixed;
    z-index: var(--z-widget-small); font-family: inherit;
    transition: right 0.2s ease, left 0.2s ease, top 0.2s ease, bottom 0.2s ease;
}
/* Position par défaut tant que JS n'a pas posé le coin (br) */
.widget-root:not([data-corner]) { bottom: 20px; right: 20px; }
.widget-bubble {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--color-paper-warm); border: 2px solid var(--color-border-strong);
    color: var(--color-ink); font-size: 1.4rem; font-weight: 600;
    font-family: var(--font-messages);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease; user-select: none;
}
.widget-bubble:hover { transform: scale(1.06); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28); }
.widget-root.open .widget-bubble { display: none; }
.widget-panel {
    display: none; width: 380px; height: 430px;
    max-width: calc(100vw - 40px); max-height: calc(100vh - 40px);
    background: #fff; border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
    flex-direction: column; overflow: hidden;
}
.widget-root.open .widget-panel { display: flex; }
.widget-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--color-paper); border-bottom: 1px solid var(--color-border-strong); }
.widget-agent-badge { width: 32px; height: 32px; border-radius: 50%; background: var(--color-paper-warm); border: 1px solid var(--color-border-strong); color: var(--color-ink); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem; font-family: var(--font-messages); flex: 0 0 auto; }
.widget-agent-label { flex: 1; font-weight: 600; color: #222; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.widget-project-badge {
    font-size: 0.68rem; font-weight: 500; color: #6366f1;
    background: #eef2ff; padding: 2px 7px; border-radius: 8px;
    flex-shrink: 0; white-space: nowrap;
}
.widget-header-btn  { background: transparent; border: none; cursor: pointer; padding: 4px 6px; color: var(--color-ink-muted); font-size: 1rem; border-radius: 4px; line-height: 1; }
.widget-header-btn:hover { background: var(--color-accent-subtle); color: var(--color-ink); }
.widget-settings-btn { display: none; }
.widget-root.widget-dev .widget-settings-btn { display: inline-flex; }
.widget-agent-drift { display: none; background: transparent; border: none; cursor: pointer; padding: 2px 4px; color: #d49100; font-size: 0.7rem; line-height: 1; border-radius: 50%; transition: transform 0.15s ease, background 0.15s ease; }
.widget-agent-drift:hover { background: #fff5e0; transform: scale(1.2); }
.widget-root.widget-dev .widget-agent-drift.show { display: inline-flex; align-items: center; }
.widget-chat { flex: 1; overflow-y: auto; padding: 12px; background: #fff; font-size: 0.95rem; }
/* Wrapper qui englobe bulle + boutons DEV. Les boutons sont en frère de
   la bulle (cohérent avec tabconversation : .message > .bubble + .msg-dev-actions). */
.widget-msg-wrap { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; max-width: 88%; }
.widget-msg-wrap-user { margin-left: auto; align-items: flex-end; }
.widget-msg-wrap-assistant { margin-right: auto; align-items: flex-start; }
.widget-msg { padding: 8px 12px; border-radius: 10px; line-height: 1.5; word-wrap: break-word; font-size: 1.01rem; }
.widget-msg-user      { background: #f0f0f0; color: #2d2d2d; border-bottom-right-radius: 3px; }
.widget-msg-assistant { background: var(--color-paper); color: var(--color-ink); border-bottom-left-radius: 3px; padding: 10px 14px; font-family: var(--font-messages); }
.widget-msg-assistant p { margin: 0 0 6px; }
.widget-msg-assistant p:last-child { margin-bottom: 0; }
.widget-msg-assistant ul, .widget-msg-assistant ol { margin: 4px 0 6px; padding-left: 22px; }
.widget-msg-assistant li { margin: 2px 0; }
.widget-msg-assistant pre { background: var(--color-paper-light); padding: 6px 8px; border-radius: 4px; overflow-x: auto; font-size: 0.82rem; margin: 4px 0; }
.widget-msg-assistant code { background: var(--color-paper-light); padding: 1px 4px; border-radius: 3px; font-size: 0.85em; font-family: var(--font-mono); }
.widget-msg-assistant pre code { background: transparent; padding: 0; }
.widget-msg-assistant blockquote { margin: 4px 0; padding: 2px 0 2px 10px; border-left: 3px solid #b8bedf; color: #555; }
.widget-msg-assistant.widget-msg-no-display { background: transparent; padding: 0; border-bottom-left-radius: 0; }
.widget-msg-no-display .widget-msg-speech, .widget-msg-no-display .widget-msg-refs { margin-top: 0; padding-top: 0; border-top: none; }
.widget-msg-no-display .widget-msg-system { margin-bottom: 0; }
.widget-msg-empty  { color: #999; font-style: italic; text-align: center; padding: 20px 10px; }
/* Typing indicator (3 dots animés pendant l'attente de la 1re delta) */
.widget-msg-typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.widget-msg-typing span {
    display: inline-block; width: 6px; height: 6px;
    background: #aab; border-radius: 50%;
    animation: widgetTypingDot 1.2s infinite ease-in-out;
}
.widget-msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.widget-msg-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes widgetTypingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-3px); opacity: 1; }
}
/* Boutons DEV par message dans le widget (cachés sauf si .widget-dev).
   Placés à l'extérieur de la bulle, dans le wrapper, comme dans tabconversation. */
.widget-msg-dev-acts { display: none; gap: 3px; opacity: 0.5; transition: opacity 0.1s; }
.widget-msg-wrap:hover .widget-msg-dev-acts { opacity: 1; }
.widget-dev .widget-msg-dev-acts { display: flex; }
.widget-msg-dev-btn {
    border: none; background: rgba(0,0,0,0.05); cursor: pointer;
    padding: 2px 6px; border-radius: 3px;
    font-size: 0.78rem; color: #555; line-height: 1.2;
}
.widget-msg-dev-btn:hover { background: rgba(0,0,0,0.12); color: #222; }
/* User bubble en édition */
.widget-msg-bubble { outline: none; }
.widget-msg-bubble-editing { background: #fff8d6; border-radius: 4px; padding: 2px 6px; box-shadow: 0 0 0 1px #e7b530 inset; }
.widget-msg-edit-acts { display: flex; gap: 4px; margin-top: 4px; }
.widget-msg-system { display: flex; align-items: flex-start; gap: 6px; padding: 5px 8px; margin: 0 0 6px; background: #fff7d6; border-left: 3px solid #e7b530; color: #6b4f00; font-size: 0.78rem; line-height: 1.35; border-radius: 0 4px 4px 0; }
.widget-msg-system::before { content: "⚠"; color: #b48a0c; font-weight: 700; flex: 0 0 auto; }
.widget-msg-refs { margin: 8px 0 0; }
.widget-msg-refs-toggle { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 6px; font-size: 0.95rem; font-weight: 500; color: var(--color-accent); background: var(--color-accent-subtle); padding: 3px 10px 3px 8px; border-radius: 12px; transition: background 0.15s ease; font-family: var(--font-body); }
.widget-msg-refs-toggle:hover { background: rgba(40, 40, 40, 0.08); }
.widget-msg-refs-toggle::before { content: "📚"; opacity: 1; font-size: 0.95rem; }
.widget-msg-refs-toggle::after  { content: "▶"; font-size: 0.6rem; opacity: 0.7; transition: transform 0.15s ease; }
.widget-msg-refs.open .widget-msg-refs-toggle::after { transform: rotate(90deg); }
.widget-msg-refs-body { display: none; margin: 4px 0 2px; padding: 6px 8px; background: var(--color-paper-light); border-radius: 4px; font-size: 0.95rem; line-height: 1.4; color: var(--color-ink-muted); font-family: var(--font-body); }
.widget-msg-refs.open .widget-msg-refs-body { display: block; }
.widget-msg-refs-body p { margin: 0 0 4px; }
.widget-msg-refs-body p:last-child { margin-bottom: 0; }
.widget-msg-refs-body ul, .widget-msg-refs-body ol { margin: 2px 0; padding-left: 18px; }
.widget-msg-refs-body li { margin: 1px 0; }
.widget-msg-refs-body a { color: var(--color-accent); text-decoration: underline; }
.widget-msg-speech { margin: 6px 0 0; border-top: 1px dashed #d8dce3; padding-top: 6px; }
.widget-msg-speech .voice-player { margin: 0; max-width: 100%; }
.widget-footer { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid #e6e8ee; background: #fff; }
.widget-input  { flex: 1; border: 1px solid #d0d4dd; border-radius: 18px; padding: 8px 12px; font-size: 0.9rem; font-family: inherit; resize: none; min-height: 36px; max-height: 100px; outline: none; }
.widget-input:focus { border-color: var(--color-accent); }
.widget-send   { border: none; background: var(--color-accent); color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.widget-send:hover:not(:disabled) { background: #1a1a1a; }
.widget-send:disabled { background: #ccc; cursor: not-allowed; }

/* Pastille d'apparition widget */
.widget-pastille {
    position: fixed; z-index: calc(var(--z-widget-small) - 1);
    bottom: 20px; width: 56px; height: 56px; border-radius: 50%;
    background: var(--color-paper-warm, #f5f3ee); border: 2px solid var(--color-border-strong, #ccc);
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    transform: scale(0); transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}
.widget-pastille.show { transform: scale(1); }

/* === App Admin — Récap / Groupes === */
.app-recap-header { display: flex; align-items: center; gap: 0.8rem; background: #f8f7fb; border-radius: 8px; padding: 0.6rem 0.9rem; margin-bottom: 1rem; }
.app-recap-name  { font-weight: 600; font-size: 0.95rem; }
.app-recap-model { font-size: 0.78rem; color: var(--color-ink-muted); margin-top: 1px; }
.app-quick-vars  { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-bottom: 0.7rem; }
.app-quick-vars textarea { min-height: 110px; }
.app-quick-save  { margin-bottom: 1.2rem; display: flex; align-items: center; gap: 0.6rem; }
.app-group-section-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--color-ink-muted); margin-bottom: 0.5rem; }
.app-group-grid  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.app-group-card  { border: 1px solid #e0dce8; border-radius: 8px; padding: 0.75rem 0.8rem; cursor: pointer; background: #fff; transition: all 0.13s; }
.app-group-card:hover { border-color: var(--color-accent); background: #f5f2fb; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(106,76,168,.1); }
.app-group-icon  { font-size: 1.1rem; display: block; margin-bottom: 0.25rem; }
.app-group-label { font-weight: 600; font-size: 0.82rem; }
.app-group-desc  { font-size: 0.72rem; color: var(--color-ink-muted); margin-top: 0.15rem; }

/* App Admin — éditeur plein écran */
#app-detail-modal { display: none; position: fixed; inset: 0; z-index: var(--z-modal); background: #fff; flex-direction: column; }
#app-detail-modal.open { display: flex; }
.app-detail-header { display: flex; align-items: center; gap: 0.8rem; padding: 0.75rem 1.2rem; border-bottom: 1px solid #eee; background: #fafafa; flex-shrink: 0; }
.app-detail-back  { background: none; border: 1px solid #d0d0d0; border-radius: 6px; padding: 0.3rem 0.75rem; font-size: 0.8rem; cursor: pointer; color: #555; }
.app-detail-back:hover  { background: #f0f0f0; }
.app-detail-title { font-weight: 600; font-size: 1rem; flex: 1; color: #2d2d2d; }
.app-detail-close { background: none; border: none; font-size: 1rem; cursor: pointer; color: #888; padding: 0.2rem 0.4rem; border-radius: 4px; }
.app-detail-close:hover { background: #f0f0f0; color: #333; }
.app-detail-body  { display: flex; flex: 1; overflow: hidden; }
.app-detail-nav   { width: 17%; border-right: 1px solid #eee; padding: 0.8rem 0; overflow-y: auto; flex-shrink: 0; background: #fafafa; }
.app-detail-nav-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 1rem; cursor: pointer; font-size: 0.83rem; color: #555; border-left: 3px solid transparent; transition: all 0.1s; }
.app-detail-nav-item:hover  { background: #f0edf8; color: #2d2d2d; }
.app-detail-nav-item.active { color: #6a4ca8; font-weight: 600; border-left-color: #6a4ca8; background: #f2eefb; }
.app-detail-nav-icon    { font-size: 0.95rem; width: 1.2rem; text-align: center; }
.app-detail-content     { flex: 1; overflow-y: auto; padding: 1.5rem 2rem; }
.app-detail-pane        { display: none; }
.app-detail-pane.active { display: block; }
.app-detail-pane h3     { font-size: 0.95rem; font-weight: 600; margin: 0 0 1.2rem; padding-bottom: 0.5rem; border-bottom: 1px solid #eee; color: #2d2d2d; }
.app-detail-footer      { padding: 0.75rem 1.2rem; border-top: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; background: #fafafa; flex-shrink: 0; }
#app-detail-feedback    { font-size: 0.8rem; color: #c00; }
.app-detail-placeholder { color: var(--color-ink-muted); font-size: 0.88rem; font-style: italic; padding: 1rem 0; }

/* ── Variante detail modal (calqué sur app-detail) ─────────────────────────── */
#variante-detail-modal { display: none; position: fixed; inset: 0; z-index: var(--z-modal); background: #fff; flex-direction: column; }
#variante-detail-modal.open { display: flex; }
.vd-header  { display: flex; align-items: center; gap: 0.8rem; padding: 0.75rem 1.2rem; border-bottom: 1px solid #eee; background: #fafafa; flex-shrink: 0; }
.vd-back    { background: none; border: 1px solid #d0d0d0; border-radius: 6px; padding: 0.3rem 0.75rem; font-size: 0.8rem; cursor: pointer; color: #555; }
.vd-back:hover { background: #f0f0f0; }
.vd-title   { font-weight: 600; font-size: 1rem; flex: 1; color: #2d2d2d; }
.vd-close   { background: none; border: none; font-size: 1rem; cursor: pointer; color: #888; padding: 0.2rem 0.4rem; border-radius: 4px; }
.vd-close:hover { background: #f0f0f0; color: #333; }
.vd-body    { display: flex; flex: 1; overflow: hidden; }
.vd-nav     { width: 17%; border-right: 1px solid #eee; padding: 0.8rem 0; overflow-y: auto; flex-shrink: 0; background: #fafafa; }
.vd-nav-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 1rem; cursor: pointer; font-size: 0.83rem; color: #555; border-left: 3px solid transparent; transition: all 0.1s; }
.vd-nav-item:hover  { background: #f0edf8; color: #2d2d2d; }
.vd-nav-item.active { color: #6a4ca8; font-weight: 600; border-left-color: #6a4ca8; background: #f2eefb; }
.vd-nav-icon   { font-size: 0.95rem; width: 1.2rem; text-align: center; }
.vd-content    { flex: 1; overflow-y: auto; padding: 1.5rem 2rem; }
.vd-pane       { display: none; }
.vd-pane.active { display: block; }
.vd-pane h3    { font-size: 0.95rem; font-weight: 600; margin: 0 0 1.2rem; padding-bottom: 0.5rem; border-bottom: 1px solid #eee; color: #2d2d2d; }
.vd-footer     { padding: 0.75rem 1.2rem; border-top: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; background: #fafafa; flex-shrink: 0; }
#vd-feedback   { font-size: 0.8rem; color: #c00; }
.vd-placeholder { color: var(--color-ink-muted); font-size: 0.88rem; font-style: italic; padding: 1rem 0; }

/* ── Pills mode (inherit / concat / replace) ─────────────────────────────── */
.mode-pills   { display: inline-flex; border: 1px solid #d8d8d8; border-radius: 6px; overflow: hidden; font-size: 0.72rem; }
.mode-pill    { background: none; border: none; border-right: 1px solid #d8d8d8; padding: 0.18rem 0.6rem; cursor: pointer; color: #666; transition: background 0.1s, color 0.1s; white-space: nowrap; }
.mode-pill:last-child { border-right: none; }
.mode-pill:hover { background: #f4f4f4; color: #333; }
.mode-pill.active[data-mode="inherit"] { background: #fff;    color: #333; font-weight: 600; }
.mode-pill.active[data-mode="concat"]  { background: #e8e8e8; color: #333; font-weight: 600; }
.mode-pill.active[data-mode="replace"] { background: #7a1a1a; color: #fff; font-weight: 600; }

/* ── Bloc Rouages (valeur Application + editor) ───────────────────────────── */
.vd-block          { margin-bottom: 2rem; }
.vd-block-header   { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.vd-block-label    { font-size: 0.85rem; font-weight: 600; color: #2d2d2d; flex: 1; }
.vd-strike { text-decoration: line-through; opacity: 0.65; }

/* Canal OFF : cache l'Application + le textarea/EasyMDE pour gagner de la place.
   Le header (toggle + label + pills) et les boutons d'action restent visibles. */
.vd-channel-off .vd-block-app-tag,
.vd-channel-off .vd-block-app-val,
.vd-channel-off textarea,
.vd-channel-off .EasyMDEContainer { display: none !important; }
.vd-channel-off { opacity: 0.85; }
.vd-channel-off .vd-block-header { margin-bottom: 0.3rem; }

/* Mode "hérite" : la valeur locale du bloc ne compte pas. On rétracte la
   textarea (et l'EasyMDE qui la remplace) ainsi que les boutons d'action.
   Le header (label + pills) et le rappel App / App+Variante restent visibles
   pour montrer ce qui sera utilisé en cascade. */
.vd-block-inherit textarea,
.vd-block-inherit .EasyMDEContainer,
.vd-block-inherit > .field-actions { display: none !important; }
.vd-block-inherit { margin-bottom: 1rem; }

/* Mode "remplace" : la valeur héritée est barrée (déjà géré par .vd-strike sur
   .vd-block-app-val). On masque en plus le tag d'origine ("Application" /
   "Application + Variante") qui n'a plus de sens — la couche en dessous est
   ignorée, le tag induirait en erreur. */
.vd-block-replace .vd-block-app-tag { display: none; }

.vd-block-app-val  { background: #f7f7fb; border: 1px solid #e8e8f0; border-radius: 5px; padding: 0.5rem 0.75rem; margin-bottom: 0.4rem; font-size: 0.78rem; color: #666; font-style: italic; white-space: pre-wrap; max-height: 80px; overflow-y: auto; line-height: 1.5; }
.vd-block-app-val.empty  { color: #aaa; }
.vd-block-app-tag  { display: inline-block; font-size: 0.65rem; font-style: normal; color: #9b6ddf; background: #f2eefb; border: 1px solid #d4bfff; border-radius: 8px; padding: 1px 6px; margin-bottom: 0.25rem; }
.vd-block-dirty    { display: none; font-size: 0.65rem; font-style: italic; color: #b07800; font-weight: 400; }
.vd-block-dirty.session { display: inline; font-style: normal; font-weight: 600; color: #5a2d9c; background: #f0ebfc; border: 1px solid #9b6ddf; border-radius: 10px; padding: 1px 6px; }

/* ── Recap (system-prompt décomposé) ─────────────────────────────────────── */
.vd-recap-toggle   { background: none; border: 1px solid #d0d0d0; border-radius: 6px; padding: 0.3rem 0.75rem; font-size: 0.8rem; cursor: pointer; color: #555; margin-bottom: 1rem; }
.vd-recap-toggle:hover { background: #f0f0f0; }
.vd-recap-body     { display: none; }
.vd-recap-body.open { display: block; }
.vd-recap-block    { margin-bottom: 1.2rem; }
.vd-recap-block-title { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #999; margin-bottom: 0.3rem; display: flex; align-items: center; gap: 0.4rem; }
.vd-recap-block-title .src-app     { color: #6a4ca8; }
.vd-recap-block-title .src-variante { color: #2563eb; }
.vd-recap-block-title .src-conv    { color: #d97706; }
.vd-recap-text     { background: #f8f8f8; border: 1px solid #eee; border-radius: 5px; padding: 0.6rem 0.8rem; font-size: 0.78rem; white-space: pre-wrap; color: #333; font-family: monospace; line-height: 1.6; max-height: 180px; overflow: auto; }
.vd-recap-var      { background: #fff3cd; border-radius: 2px; padding: 0 2px; font-style: italic; }

/* Toggle ON/OFF/hérite pour les canaux dans admin-2 */
.vd-enable-toggle {
    background: #f7f7f9; border: 1px solid #d4d4dc; border-radius: 4px;
    padding: 0.15rem 0.5rem; font-size: 0.72rem; cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    margin-right: 0.5rem; line-height: 1.2;
    color: #555;
}
.vd-enable-toggle:hover { background: #eef0f3; }
.vd-enable-toggle.vd-enable-on  { background: #e3f5ea; color: #1a7f37; border-color: #b3d7c0; font-weight: 600; }
.vd-enable-toggle.vd-enable-off { background: #fde8e6; color: #b42318; border-color: #f0bdb6; font-weight: 600; }
.vda-enable.vda-enable-inherit { background: #f0eafa; color: #6a4ca8; border-color: #d4c4f0; font-weight: 600; }
.vda-enable.vda-enable-on      { background: #e3f5ea; color: #1a7f37; border-color: #b3d7c0; font-weight: 600; }
.vda-enable.vda-enable-off     { background: #fde8e6; color: #b42318; border-color: #f0bdb6; font-weight: 600; }
.vd-enable-toggle.vd-enable-inherit { color: #888; font-style: italic; }

.vd-maxwords-input {
    width: 56px;
    padding: 0.1rem 0.3rem;
    margin-left: 0.4rem;
    font-size: 0.72rem;
    border: 1px solid #d4d4dc;
    border-radius: 4px;
    text-align: right;
    font-family: ui-monospace, Menlo, Consolas, monospace;
}
.vd-maxwords-input:focus {
    outline: none;
    border-color: #6a4ca8;
    background: #faf9fd;
}
.vd-maxwords-input::placeholder { color: #b8b8c0; font-style: italic; }
.vd-subnav {
    display: flex;
    gap: 0.1rem;
    border-bottom: 2px solid #e6e6ea;
    margin-bottom: 1rem;
}
.vd-subnav-item {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.vd-subnav-item:hover { color: #555; }
.vd-subnav-item.active {
    color: #6a4ca8;
    border-bottom-color: #6a4ca8;
    font-weight: 600;
}
.vd-subpane { display: block; }

.vd-subpane #vd-msg-placeholder.empty { color: #b8b8c0; font-style: italic; }

.vd-err-row.has-override { background: #fff8e7 !important; border-color: #f0d58c !important; }

.vd-maxwords-label {
    font-size: 0.7rem;
    color: #888;
    margin-left: 0.2rem;
    margin-right: 0.5rem;
}



/* === Récap admin-2 : payload Anthropic stylé === */
.vd-model-edit {
    background: #faf9fd;
    border: 1px solid #e0d7f0;
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.8rem;
    font-size: 0.8rem;
}
.vd-model-edit-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}
.vd-model-edit-row label {
    font-weight: 600;
    color: #555;
    font-size: 0.75rem;
}
.vd-model-edit-row select,
.vd-model-edit-row input[type="number"] {
    padding: 0.2rem 0.4rem;
    font-size: 0.78rem;
    border: 1px solid #d4d4dc;
    border-radius: 4px;
    font-family: inherit;
}
.vd-model-edit-row select:focus,
.vd-model-edit-row input:focus {
    outline: none;
    border-color: #6a4ca8;
}
.vd-model-edit-row input::placeholder {
    color: #b8b8c0;
    font-style: italic;
}

.vd-payload {
    font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
    font-size: 0.78rem;
    color: #555;
    background: #fafafb;
    border: 1px solid #e6e6ea;
    border-radius: 6px;
    padding: 0.9rem 1rem;
    line-height: 1.5;
}
.vd-payload-line { white-space: pre; }
.vd-payload-indent { padding-left: 1.4rem; }
.vd-pk { color: #2563eb; }
.vd-pv-null { color: #b3b3bf; font-style: italic; }
.vd-pv-str { color: #6a4ca8; }
.vd-pv-num { color: #0a7a3a; }

/* Canal désactivé dans le tool (OFF) — montré pâle pour info */
.vd-seg-disabled { opacity: 0.55; }

/* Template (chunks, variables) — fond très légèrement teinté */
.vd-seg-template { background: #fafaf6; }

/* Header ## seul (e.g. "## Règles" avant les ### sous-blocs) */
.vd-seg-header-only {
    padding-bottom: 0.15rem;
    border-bottom: 1px solid #ececf2;
    margin-bottom: 0;
}
.vd-seg-header-only .vd-seg-headerline { font-weight: 600; color: #555; }

/* Segment vide */
.vd-seg-empty { color: #888; font-style: italic; padding: 0.5rem; }


/* Container des segments concaténés (le system.text) */
.vd-payload-text {
    margin: 0.2rem 0 0.2rem 1.4rem;
    padding: 0.1rem 0;
    background: #fff;
    border-left: 2px solid #e0e0ea;
    border-radius: 3px;
}

/* Un segment : juxtaposé au précédent, sans gap (concat fidèle) */
.vd-seg {
    position: relative;
    padding: 0.55rem 0.9rem 0.55rem 0.9rem;
    border-bottom: 1px dashed #ececf2;
}
.vd-seg:last-child { border-bottom: none; }
.vd-seg-tag {
    position: absolute;
    top: 0.25rem;
    right: 0.55rem;
    font-size: 0.62rem;
    font-family: system-ui, -apple-system, sans-serif;
    display: flex;
    gap: 0.3rem;
    align-items: center;
    background: rgba(255,255,255,0.92);
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
}
.vd-seg-label { font-weight: 600; color: #777; text-transform: lowercase; }
.vd-seg-src { color: #999; font-style: italic; }

/* Coloration de la source */
.vd-seg[data-source="application"] .vd-seg-src { color: #6a4ca8; }
.vd-seg[data-source="variante"]    .vd-seg-src { color: #2563eb; }
.vd-seg[data-source="concat"]      .vd-seg-src { color: #16a34a; }
.vd-seg[data-source="default"]     .vd-seg-src { color: #9a9aa6; }
.vd-seg[data-source="empty"]       .vd-seg-src { color: #c0c0cc; }

/* Bandeau gauche par source — accent discret */
.vd-seg[data-source="application"] { box-shadow: inset 2px 0 0 #d4c4f0; }
.vd-seg[data-source="variante"]    { box-shadow: inset 2px 0 0 #bcd0f5; }
.vd-seg[data-source="concat"]      { box-shadow: inset 2px 0 0 #bce5cf; }
.vd-seg[data-source="default"]     { box-shadow: inset 2px 0 0 #e8e8ee; }

/* Header de canal (# Canal 'display') */
.vd-seg-headerline {
    color: #888;
    font-style: italic;
    font-size: 0.74rem;
    margin-bottom: 0.25rem;
    padding-right: 5rem;  /* éviter chevauchement avec le tag */
}

/* Le corps du texte segment */
.vd-seg-body {
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #333;
    font-size: 0.78rem;
    line-height: 1.55;
}


/* ── Corpus — liste collections ─────────────────────────────────────────── */
.corpus-col-item   { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.75rem; border: 1px solid #e8e8f0; border-radius: 6px; margin-bottom: 0.4rem; cursor: pointer; transition: background 0.1s; }
.corpus-col-item:hover { background: #f7f7fb; }
.corpus-col-item.active { border-color: #6a4ca8; background: #f2eefb; }
.corpus-col-cb     { width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; accent-color: #6a4ca8; }
.corpus-col-title  { font-size: 0.85rem; font-weight: 600; color: #2d2d2d; flex: 1; }
.corpus-col-meta   { font-size: 0.72rem; color: #888; white-space: nowrap; }
.corpus-col-chunks { font-size: 0.72rem; font-family: monospace; color: #6a4ca8; background: #f2eefb; border-radius: 10px; padding: 1px 7px; }
.corpus-node-chunks { font-size: 0.7rem; color: #aaa; margin-left: 0.25rem; }
.corpus-col-ingdate { font-size: 0.7rem; color: #999; margin-left: 0.35rem; }
.corpus-col-empty  { font-size: 0.72rem; color: #bbb; font-style: italic; }
.corpus-col-expand { background: none; border: none; cursor: pointer; font-size: 0.75rem; color: #888; padding: 0 4px; transition: transform 0.15s; }
.corpus-col-ingest {
    background: none; border: 1px solid #d0d0d8; border-radius: 4px;
    cursor: pointer; font-size: 0.78rem; color: #6a4ca8;
    padding: 0.05rem 0.32rem; margin-right: 0.25rem;
    line-height: 1.1; transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.corpus-col-ingest:hover { background: #f3eefc; color: #4a2f88; }
.corpus-col-ingest:disabled { cursor: wait; opacity: 0.7; }
.corpus-col-ingest.ingest-loading {
    color: #6a4ca8; background: #f7f3fd; border-color: #d4c4f0;
    animation: ingest-pulse 1.2s ease-in-out infinite;
}
.corpus-col-ingest.ingest-error {
    color: #c0392b; border-color: #e6b0a8; background: #fff5f3;
}
@keyframes ingest-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

.corpus-col-expand.open { transform: rotate(90deg); }
.corpus-nodes      { display: none; padding: 0.3rem 0 0.1rem 1.8rem; border-left: 2px solid #e8e8f0; margin: 0.3rem 0 0 1.4rem; }
.corpus-nodes.open { display: block; }
.corpus-node-item  { display: flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0.4rem; font-size: 0.8rem; color: #444; border-radius: 4px; cursor: pointer; }
.corpus-node-item:hover { background: #f4f4f4; }
.corpus-node-cb    { width: 14px; height: 14px; cursor: pointer; accent-color: #6a4ca8; flex-shrink: 0; }
.corpus-node-depth1 { padding-left: 1.2rem; }
.corpus-node-depth2 { padding-left: 2.4rem; }
.corpus-node-depth3 { padding-left: 3.6rem; }

/* ── Agents — équipe variante (admin-2) ──────────────────────────────────── */
.vd-agents-list { list-style: none; padding: 0; margin: 0; }
.vd-agents-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem; border: 1px solid #e8e8f0; border-radius: 6px; margin-bottom: 0.4rem; transition: background 0.1s, border-color 0.1s; }
.vd-agents-list li.is-member { border-color: #6a4ca8; background: #f7f3fd; }
.vd-agents-list li.is-default { border-color: #4a2f88; background: #efe6fb; box-shadow: inset 3px 0 0 #6a4ca8; }
.vd-agents-list .vd-agent-toggles { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.vd-agents-list .vd-agent-toggles input[type="checkbox"],
.vd-agents-list .vd-agent-toggles input[type="radio"] { width: 16px; height: 16px; cursor: pointer; accent-color: #6a4ca8; }
.vd-agents-list .vd-agent-info { flex: 1; min-width: 0; }
.vd-agents-list .vd-agent-name { font-size: 0.88rem; font-weight: 600; color: #2d2d2d; }
.vd-agents-list .vd-agent-desc { font-size: 0.75rem; color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-agents-list .vd-agent-meta { font-size: 0.7rem; color: #888; font-family: monospace; }
.vd-agents-list .vd-agent-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.vd-agents-list .vd-agent-actions button { background: none; border: 1px solid #d0d0d8; border-radius: 4px; cursor: pointer; padding: 0.1rem 0.4rem; font-size: 0.85rem; color: #555; transition: background 0.1s; }
.vd-agents-list .vd-agent-actions button:hover { background: #f0f0f0; }

/* Sous-vue form d'édition d'un agent */
.vda-section { margin-bottom: 1.6rem; padding-bottom: 1.2rem; border-bottom: 1px solid #efeff3; }
.vda-section:last-child { border-bottom: none; }
.vda-section-title { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #6a4ca8; margin-bottom: 0.7rem; }
.vda-section-placeholder { opacity: 0.6; }
.vda-section input[type="text"],
.vda-section input[type="number"]:not(.vd-maxwords-input),
.vda-section textarea,
.vda-section select { width: 100%; padding: 0.35rem 0.55rem; font-size: 0.85rem; border: 1px solid #d8d8e0; border-radius: 5px; background: #fff; color: #222; box-sizing: border-box; font-family: inherit; }
/* Sliders ElevenLabs : laisser leur largeur naturelle */
.vda-section input[type="range"] { flex: 1; }
.vda-section label { display: block; font-size: 0.78rem; font-weight: 600; color: #555; margin: 0.3rem 0 0.2rem; }
.vda-section .field-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.vda-section .field-row > div { flex: 0 0 auto; }
.vda-section textarea { min-height: 2rem; resize: vertical; }

/* ── Config.py ───────────────────────────────────────────────────────────── */
.vd-configpy-path  { font-size: 0.72rem; color: #888; font-family: monospace; margin-bottom: 0.5rem; }
#vd-configpy-ta    { width: 100%; min-height: 400px; font-family: monospace; font-size: 0.78rem; line-height: 1.6; border: 1px solid #e0e0e8; border-radius: 5px; padding: 0.75rem; background: #f8f8fa; color: #2d2d2d; resize: vertical; }

/* Field groups */
.field-group { margin-bottom: 1.2rem; }
.field-group-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.field-group-header label { margin: 0; font-weight: 600; font-size: 0.82rem; flex: 1; }
.field-dirty-badge { display: none; font-size: 0.65rem; font-style: italic; color: #b07800; font-weight: 400; }
.field-dirty-badge.visible { display: inline; }
.field-dirty-badge.session { font-style: normal; font-weight: 600; color: #5a2d9c; background: #f0ebfc; border: 1px solid #9b6ddf; border-radius: 10px; padding: 1px 6px; }
.field-layer   { font-size: 0.68rem; color: #999; margin-bottom: 0.25rem; letter-spacing: 0.02em; }
.field-actions { display: flex; gap: 0.4rem; margin-top: 0.3rem; }
.fa-btn { background: none; border: 1px solid #d0d0d0; border-radius: 5px; padding: 0.2rem 0.55rem; font-size: 0.75rem; cursor: pointer; color: #444; transition: all 0.1s; }
.fa-btn:hover { background: #f0f0f0; border-color: #aaa; }
.fa-btn.primary { border-color: #6a4ca8; color: #6a4ca8; }
.fa-btn.primary:hover { background: #f2eefb; }
.fa-btn:disabled { opacity: 0.4; cursor: default; }

/* Corpus admin */
.corpus-section { margin-bottom: 1rem; }
.corpus-section-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #888; margin-bottom: .4rem; }
.cv-row { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: 6px; cursor: default; border: 1px solid transparent; transition: background .12s; margin-bottom: .2rem; }
.cv-row.active { border-color: #d0c4f0; background: #faf7ff; }
.cv-row:hover  { background: #f5f2fc; }
.cv-row input[type=checkbox] { flex-shrink: 0; accent-color: #7c5cbf; width: 1rem; height: 1rem; cursor: pointer; }
.cv-info  { flex: 1; min-width: 0; }
.cv-label { font-weight: 600; font-size: 0.82rem; color: #2d2d2d; }
.cv-desc  { font-size: 0.72rem; color: #888; margin-left: .3rem; }
.cv-count { font-size: 0.72rem; color: #aaa; flex-shrink: 0; white-space: nowrap; }
.cv-arrow { font-size: 0.7rem; color: #bbb; cursor: pointer; padding: 0 .2rem; transition: transform .15s; user-select: none; }
.cv-arrow.open { transform: rotate(90deg); }
.cv-files { padding-left: 1.8rem; margin-bottom: .4rem; }
.cf-row  { display: flex; align-items: center; gap: .5rem; padding: .3rem .3rem; border-radius: 4px; transition: background .1s; }
.cf-row:hover    { background: #f0edf8; }
.cf-row.excluded { opacity: .45; }
.cf-row input[type=checkbox] { flex-shrink: 0; accent-color: #7c5cbf; width: .85rem; height: .85rem; cursor: pointer; }
.cf-name  { flex: 1; font-size: 0.75rem; color: #444; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-count { font-size: 0.68rem; color: #bbb; flex-shrink: 0; }

/* === Chips multi-attachements === */
#attach-strip {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 6px 4px 2px; min-height: 0;
}
#attach-strip:empty { display: none; }
.att-chip {
    display: flex; align-items: center; gap: 5px;
    border: 1.5px solid #42543d; border-radius: 6px;
    background: #f0f4f0; padding: 3px 6px 3px 4px;
    font-size: 0.74rem; color: #42543d; max-width: 180px;
}
.att-chip-thumb {
    width: 36px; height: 36px; object-fit: cover;
    border-radius: 3px; flex-shrink: 0;
}
.att-chip-icon { font-size: 1.3rem; flex-shrink: 0; }
.att-chip-name {
    flex: 1; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; font-size: 0.7rem;
}
.att-chip-rm {
    border: none; background: none; cursor: pointer;
    color: #888; font-size: 0.75rem; padding: 1px 3px;
    border-radius: 3px; flex-shrink: 0; line-height: 1;
}
.att-chip-rm:hover { background: #fee2e2; color: #dc2626; }

/* Widget — attachments */
.widget-attach-strip {
    display: flex; flex-wrap: wrap; gap: 5px;
    padding: 4px 8px 0; min-height: 0;
}
.widget-attach-strip:empty { display: none; }
.widget-attach-btn {
    border: none; background: transparent; cursor: pointer;
    padding: 4px 6px; color: #666; font-size: 1.1rem; line-height: 1;
}
.widget-attach-btn:hover { color: #222; }
.widget-msg-attachments {
    display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px;
}
.widget-msg-att-img {
    max-width: 160px; max-height: 120px; border-radius: 4px;
    border: 1px solid #d0d4dd; object-fit: cover;
}
.widget-msg-att-file {
    display: inline-flex; align-items: center; gap: 4px;
    background: #f0f4f0; border: 1px solid #42543d; color: #42543d;
    border-radius: 4px; padding: 2px 6px; font-size: 0.74rem;
}
/* Drag&drop sur le panel widget */
.widget-panel.widget-dragover {
    outline: 3px dashed var(--color-accent);
    outline-offset: -3px;
}

/* Widget : éléments error + destroy + dev-only */
.widget-msg-error {
    font-size: 0.78rem; color: #b03030; font-style: italic;
    padding: 4px 8px; background: #fdf0f0; border-radius: 4px; margin: 4px 0;
}
.widget-dev-only { display: none; }
.widget-root.widget-dev .widget-dev-only { display: inline-flex; }
.widget-destroy:hover { color: #c03030 !important; }

/* ── Comments mode (FileWindow) ──────────────────────────────────────── */
.fw-window--comments .fw-body { overflow: hidden; padding: 0; }

/* Surlignages par type — pastels aquarelle */
mark.fw-anchor {
    border-radius: 2px;
    padding: 0 1px;
    cursor: pointer;
    transition: background 0.15s;
}
mark.fw-anchor--comment    { background: transparent; border-bottom: 1.5px dashed #9E9E9E; }
mark.fw-anchor--question   { background: rgba(227,242,253,0.85); }
mark.fw-anchor--suggestion { background: rgba(255,253,231,0.95); }
mark.fw-anchor--memoire    { background: rgba(232,245,233,0.9); }
mark.fw-anchor--tension    { background: rgba(252,228,236,0.9); }
mark.fw-anchor:hover       { filter: brightness(0.92); }
mark.fw-anchor--pending    { background: transparent; border-bottom: 1.5px dashed #9E9E9E; opacity: 0.85; }

/* Carte de thread en marge */
.fw-thread-card {
    position: absolute;
    left: -3em;
    max-width: 420px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-left: 9px solid #BDBDBD;
    border-radius: 6px;
    padding: 6px 8px 5px;
    font-size: 0.72rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.15s;
    cursor: default;
}
.fw-thread-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.10); }

/* Couleurs bordure par type */
.fw-thread-card--comment    { border-left-color: #BDBDBD; }
.fw-thread-card--question   { border-left-color: #42A5F5; }
.fw-thread-card--suggestion { border-left-color: #FFD54F; }
.fw-thread-card--memoire    { border-left-color: #66BB6A; }
.fw-thread-card--tension    { border-left-color: #F06292; }
.fw-thread-card--new        { background: #fdfcff; width: 360px; max-width: 420px; }

/* En-tête de thread (auteur + badge type) */
.fw-thread-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
}

/* Séparateur léger entre messages */
hr.fw-thread-sep-light {
    border: none;
    border-top: 1px solid #f0eefa;
    margin: 5px 0;
}

/* Bouton toggle plier/déplier */
.fw-thread-toggle {
    position: absolute;
    top: 3px;
    right: 4px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.6rem;
    color: #ccc;
    padding: 1px 3px;
    border-radius: 3px;
    line-height: 1;
}
.fw-thread-toggle:hover { background: #f0eefa; color: #7c3aed; }

/* Corps pliable */
.fw-thread-body { overflow: hidden; }
.fw-thread-card.fw-collapsed .fw-thread-body {
    max-height: 4.2em;
}
/* Dégradé uniquement si le contenu déborde réellement */
.fw-thread-card.fw-collapsed .fw-thread-body.fw-thread-body--overflow {
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

/* Indicateur "voir plus" — cliquable, visible seulement en mode plié */
.fw-thread-more {
    display: none;
    font-size: 0.6rem;
    color: #b0a8c4;
    cursor: pointer;
    padding: 1px 0 2px;
    user-select: none;
}
.fw-thread-more:hover { color: #7c3aed; }
.fw-thread-card.fw-collapsed .fw-thread-more:not(:empty) { display: block; }

/* Séparateur entre corps et actions */
.fw-thread-sep {
    border-top: 1px solid #ede9f6;
    margin: 5px 4px 3px 0px;
}

.fw-thread-quote {
    font-style: italic;
    color: #7c6fa0;
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fw-thread-quote-original {
    font-size: 0.60rem;
    color: #BDBDBD;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.fw-thread-extra-msgs { display: flex; flex-direction: column; }
.fw-thread-msg { line-height: 1.35; }
.fw-msg-meta {
    font-size: 0.62rem;
    color: #9ca3af;
    display: flex;
    gap: 4px;
    margin-bottom: 1px;
    align-items: center;
}
.fw-msg-type {
    font-size: 0.58rem;
    padding: 0 4px;
    border-radius: 3px;
    background: #F5F5F5;
    color: #757575;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
select.fw-msg-type {
    border: none;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}
.fw-msg-type--comment    { background: #F5F5F5;  color: #757575; }
.fw-msg-type--question   { background: #E3F2FD;  color: #1565C0; }
.fw-msg-type--suggestion { background: #FFFDE7;  color: #F57F17; }
.fw-msg-type--memoire    { background: #E8F5E9;  color: #2E7D32; }
.fw-msg-type--tension    { background: #FCE4EC;  color: #AD1457; }
.fw-msg-type--validation { background: #d1fae5;  color: #059669; }
.fw-msg-content { color: #374151; }

/* +1 button */
.fw-thread-actions {
    display: flex;
    gap: 4px;
    margin-top: 0;
    align-items: center;
    flex-wrap: wrap;
}
.fw-btn-plusone {
    font-size: 0.65rem;
    padding: 1px 7px;
    border: 1px solid #c4b5fd;
    border-radius: 10px;
    background: #f5f3ff;
    color: #7c3aed;
    cursor: pointer;
    transition: background 0.1s;
    font-weight: 600;
}
.fw-btn-plusone:hover { background: #ede9fe; }
.fw-plusone-count {
    font-size: 0.65rem;
    color: #7c3aed;
    font-weight: 600;
}

/* Section threads orphelins (en bas) */
.fw-orphan-section {
    border-top: 2px dashed #e5e3f0;
    margin-top: 1rem;
    padding-top: 0.8rem;
}
.fw-orphan-title {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
    font-style: italic;
}
.fw-orphan-card {
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.72rem;
    margin-bottom: 6px;
    opacity: 0.7;
    pointer-events: auto;
}
.fw-orphan-card .fw-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    gap: 4px;
}

/* Floating bubble pour nouveau commentaire (sélection texte) */
.fw-comment-bubble {
    position: fixed;
    z-index: 9999;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 0.72rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(124,58,237,0.4);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.fw-comment-bubble:hover { background: #6d28d9; }

/* ── Nouvelle card commentaire (dans la marge) ─────────────────────── */
.fw-thread-card--new {
    background: #fdfcff;
}

/* Sélecteur de type discret */
.fw-type-select {
    font-size: 0.65rem;
    border: 1px solid #d9d3ef;
    border-radius: 4px;
    background: #f5f3ff;
    color: #7c3aed;
    padding: 1px 4px;
    cursor: pointer;
    margin-bottom: 4px;
}
.fw-type-select--sm { font-size: 0.6rem; }
.fw-new-type-row { margin-bottom: 4px; }

/* Textarea dans la marge */
.fw-new-ta {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d9d3ef;
    border-radius: 4px;
    padding: 5px;
    font-size: 0.73rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 5px;
}
.fw-new-ta--sm { min-height: 40px; font-size: 0.68rem; }

/* Actions nouvelle card + reply form */
.fw-new-actions, .fw-reply-form { display: flex; flex-direction: column; gap: 4px; }
.fw-reply-form { margin-top: 6px; padding-top: 6px; border-top: 1px solid #f0eefa; }

/* Boutons actions thread */
.fw-btn {
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #d9d3ef;
    background: #f5f3ff;
    color: #7c3aed;
    cursor: pointer;
    transition: background 0.1s;
}
.fw-btn:hover { background: #ede9fe; }
.fw-btn--save  { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.fw-btn--save:hover { background: #6d28d9; }
.fw-btn--save:disabled { opacity: 0.5; cursor: default; }
.fw-btn--cancel { background: #f9fafb; color: #6b7280; border-color: #e5e7eb; }
.fw-btn--resolve { color: #059669; border-color: #a7f3d0; background: #f0fdf4; }
.fw-btn--resolve:hover { background: #d1fae5; }
.fw-btn--reject { color: #9ca3af; border-color: #e5e7eb; background: #f9fafb; }
.fw-btn--reject:hover { background: #f3f4f6; }
.fw-btn--delete { color: #dc2626; border-color: #fecaca; background: #fff5f5; margin-left: auto; }
.fw-btn--delete:hover { background: #fee2e2; }
.fw-btn--reopen { color: #6b7280; border-color: #e5e7eb; background: #f9fafb; }
.fw-btn--reopen:hover { background: #ede9fe; color: #7c3aed; border-color: #d9d3ef; }

/* Cards archivées (résolu / rejeté) */
.fw-thread-card--archived {
    opacity: 0.55;
    filter: grayscale(30%);
}
.fw-thread-card--archived:hover { opacity: 0.85; filter: none; }

/* Actions bouton supprimer sur un message */
.fw-msg-del {
    font-size: 0.6rem;
    border: none;
    background: none;
    color: #d1d5db;
    cursor: pointer;
    padding: 0 2px;
    margin-left: auto;
    line-height: 1;
}
.fw-msg-del:hover { color: #dc2626; }

/* Auteur dans un message */
.fw-msg-author {
    font-weight: 600;
    color: #374151;
    font-size: 0.68rem;
}

/* Likes — zone chips, visible seulement si non vide */
.fw-thread-likes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}
.fw-thread-likes:empty { display: none; }
.fw-like-chip {
    font-size: 0.62rem;
    background: #f0fdf4;
    border: 1px solid #a7f3d0;
    color: #059669;
    border-radius: 10px;
    padding: 1px 6px;
    cursor: default;
}
.fw-like-chip--mine {
    cursor: pointer;
    background: #d1fae5;
    font-weight: 600;
}
.fw-like-chip--mine:hover:not(:disabled) { background: #a7f3d0; }
.fw-like-chip--mine:disabled { cursor: default; opacity: 0.7; }
.fw-like-chip--max { opacity: 0.75; border-style: dashed; }
.fw-like-chip--max:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.fw-like-add {
    font-size: 0.65rem;
    font-weight: 700;
    background: none;
    border: 1px dashed #a7f3d0;
    color: #059669;
    border-radius: 10px;
    padding: 0 6px;
    cursor: pointer;
    line-height: 1.6;
    transition: background 0.1s;
}
.fw-like-add:hover { background: #f0fdf4; }

/* Toggle comments button */
.fw-btn--comments-on { background: #ede9fe; color: #7c3aed; }

/* ── Authoring mode — tab bar prose ─────────────────────────────────── */
.pg-prose-tabs {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0 0.6rem;
    border-bottom: 1px solid #e5e3f0;
    background: #faf9fd;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.pg-prose-tabs::-webkit-scrollbar { display: none; }

.pg-prose-tab {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: none;
    background: none;
    padding: 5px 10px;
    font-size: 0.73rem;
    cursor: pointer;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.12s;
    margin-bottom: -1px;
    border-radius: 0;
}
.pg-prose-tab:hover { color: #374151; background: #f0eefa; }
.pg-prose-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
    font-weight: 600;
}
.ps-tab-icon { font-size: 0.82em; line-height: 1; }
.pg-prose-tab--version {
    font-family: monospace;
    font-size: 0.67rem;
    color: #9ca3af;
}
.pg-prose-tab--version .ps-tab-label { font-family: monospace; }
.pg-prose-tab--version.active { color: #7c3aed; }
.pg-prose-tab--other { color: #9ca3af; }
.pg-prose-tab--other .ps-tab-label { font-style: italic; }
.pg-prose-tab--other.active { color: #7c3aed; }
.pg-prose-tab--other.active .ps-tab-label { font-style: normal; }

.pg-prose-tab-sep {
    color: #d1d5db;
    padding: 0 6px;
    font-size: 0.8rem;
    align-self: center;
    flex-shrink: 0;
    user-select: none;
}

/* Dérives dropdown */
.pg-prose-tab-derives { position: relative; display: flex; align-items: stretch; }
.pg-prose-tab--derives { color: #6b7280; }
.pg-prose-tab--derives.active { color: #7c3aed; font-weight: 600; border-bottom: 2px solid #7c3aed; margin-bottom: -1px; }

.pg-prose-derives-dropdown {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    background: #fff;
    border: 1px solid #e5e3f0;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
    z-index: 200;
    min-width: 180px;
    padding: 4px 0;
}
.pg-prose-derives-item {
    display: block;
    width: 100%;
    padding: 6px 14px;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.73rem;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
}
.pg-prose-derives-item:hover { background: #f5f3ff; color: #7c3aed; }
.pg-prose-derives-item.active { color: #7c3aed; font-weight: 600; }
