:root {
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --primary: #4f46e5; /* Indigo */
    --primary-hover: #4338ca;
    --secondary: #0d9488; /* Teal */
}
body { font-family: 'Inter', sans-serif; background-color: var(--bg-main); color: var(--text-main); }
.writing-area, .scene-card, .character-card, .world-card, .planning-card { font-family: 'Lora', serif; background-color: var(--bg-card); border: 1px solid var(--border-color); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.sidebar-btn { transition: all 0.2s ease-in-out; }
.sidebar-btn.active { background-color: var(--primary); color: white; font-weight: 600; }
.sidebar-btn:hover:not(.active) { background-color: #f3f4f6; }
.structure-card { border: 2px dashed var(--border-color); transition: all 0.2s ease-in-out; }
.structure-card:hover { border-style: solid; border-color: var(--primary); background-color: #f7f7fe; transform: translateY(-2px); }
.btn-primary { background-color: var(--primary); color: white; transition: background-color 0.2s; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: #e5e7eb; color: var(--text-main); transition: background-color 0.2s; }
.btn-secondary:hover { background-color: #d1d5db; }
.view { display: none; }
.view.active { display: flex; }
textarea { resize: none; }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.3s ease-in-out; }
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal-content { background: white; padding: 2rem; border-radius: 0.5rem; box-shadow: 0 5px 15px rgba(0,0,0,0.3); text-align: left; transform: scale(0.9); transition: all 0.3s ease-in-out; width: 90%; max-width: 500px; }
.modal-overlay.visible .modal-content { transform: scale(1); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #111827; color: white; padding: 10px 20px; border-radius: 8px; z-index: 2000; opacity: 0; transition: opacity 0.5s ease-in-out; }
.toast.show { opacity: 1; }
.character-input::placeholder, textarea::placeholder { color: #9ca3af; font-style: italic; }

.tag { padding: 2px 8px; border-radius: 9999px; font-size: 0.8rem; font-family: 'Inter', sans-serif; font-weight: 500; }
.tag-filter.active { box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); font-weight: 600; }
.tag-dropdown { position: absolute; z-index: 10; background: white; border-radius: 0.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.15); max-height: 200px; overflow-y: auto; }

.scene-card-controls button { background: #f3f4f6; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s; color: #4b5563; }
.scene-card-controls button:hover { background-color: #e5e7eb; }
.scene-card-controls button:disabled { opacity: 0.5; cursor: not-allowed; }
.scene-card-controls button.delete-scene-btn:hover { background-color: #fecaca; color: #dc2626; }

#status-bar { border-top: 1px solid var(--border-color); background-color: var(--bg-sidebar); }
.progress-bar { background-color: #d1d5db; border-radius: 9999px; overflow: hidden; }
.progress-bar-inner { background-color: var(--secondary); transition: width 0.3s ease-in-out; }

.act-container { background-color: rgba(243, 244, 246, 0.5); padding: 1rem; border-radius: 0.5rem; }

/* Timeline styles */
.timeline-item { position: relative; padding-left: 3rem; border-left: 2px solid var(--border-color); }
.timeline-item:last-child { border-left: 2px solid transparent; }
.timeline-dot { position: absolute; left: -0.5rem; top: 0; width: 1rem; height: 1rem; border-radius: 50%; background-color: var(--bg-main); border: 2px solid var(--primary); }

/* Drag and drop styles */
.dragging { opacity: 0.5; border: 2px dashed var(--primary); }
.drag-over-act { box-shadow: 0 0 0 2px var(--primary); }
.drag-over-scene-list { background-color: #eff6ff; }
.drag-handle { cursor: move; }

/* Character Tabs */
.character-tab-btn { border-bottom: 2px solid transparent; padding-bottom: 0.5rem; }
.character-tab-btn.active { border-bottom-color: var(--primary); color: var(--primary); font-weight: 600; }
.character-tab-content { display: none; }
.character-tab-content.active { display: block; }
.character-gallery-card { transition: transform 0.2s, box-shadow 0.2s; }
.character-gallery-card:hover { transform: translateY(-4px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.trait-item { background-color: #f3f4f6; padding: 4px 8px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; }
.archetype-trait-btn { background-color: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; padding: 2px 6px; border-radius: 4px; cursor: pointer; transition: background-color 0.2s; }
.archetype-trait-btn:hover { background-color: #c7d2fe; }

/* Corkboard */
.corkboard-card { width: 300px; min-height: 150px; background-color: #fffbe9; border: 1px solid #fef3c7; box-shadow: 2px 2px 5px rgba(0,0,0,0.05); }

/* Mention Dropdown */
.mention-dropdown { position: absolute; z-index: 50; background-color: white; border: 1px solid var(--border-color); border-radius: 0.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.1); max-height: 150px; overflow-y: auto; font-family: 'Inter', sans-serif; }
.mention-item { padding: 0.5rem 1rem; cursor: pointer; }
.mention-item:hover { background-color: #f3f4f6; }

/* Scene View Toggle */
.scene-view-toggle { border-bottom: 2px solid transparent; }
.scene-view-toggle.active { border-bottom-color: var(--primary); font-weight: 600; }

/* Markdown & Lore Links */
.prose-preview h1, .prose-preview h2, .prose-preview h3 { font-family: 'Inter', sans-serif; }
.lore-link { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; }
.lore-link:hover { color: var(--primary-hover); }
.lore-tooltip { position: absolute; z-index: 60; background: #1f2937; color: white; padding: 0.5rem 1rem; border-radius: 0.5rem; max-width: 300px; font-size: 0.875rem; display: none; }

/* IA Contextuelle — Panneau latéral */
#ai-panel {
    position: fixed; top: 0; right: 0; height: 100%; width: 400px;
    background: white; box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    border-left: 1px solid #e5e7eb;
    display: flex; flex-direction: column; z-index: 200;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#ai-panel.open { transform: translateX(0); }

#ai-panel-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.2);
    z-index: 199;
    transition: opacity 0.3s;
}
#ai-panel-backdrop.hidden { display: none; }

.ai-panel-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    flex-shrink: 0;
}
.ai-panel-header button#ai-panel-close {
    color: #9ca3af; font-size: 1rem; line-height: 1; padding: 0.25rem;
    border-radius: 0.25rem; transition: color 0.2s;
    background: transparent; border: none; cursor: pointer;
}
.ai-panel-header button#ai-panel-close:hover { color: #374151; }

.ai-panel-messages {
    flex: 1; overflow-y: auto; padding: 1rem;
    display: flex; flex-direction: column; gap: 0.75rem;
}
.ai-panel-footer {
    padding: 0.75rem 1rem 1rem; border-top: 1px solid #e5e7eb;
    flex-shrink: 0; background: #fafafa;
}

.ai-quick-actions {
    display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 0.75rem;
}
.ai-quick-btn {
    font-size: 0.75rem; padding: 0.3rem 0.7rem; border-radius: 9999px;
    background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe;
    cursor: pointer; transition: background-color 0.15s, border-color 0.15s;
    font-family: 'Inter', sans-serif;
}
.ai-quick-btn:hover { background: #ddd6fe; border-color: #c4b5fd; }

.ai-input-row {
    display: flex; gap: 0.5rem; align-items: flex-end;
}
#ai-input {
    flex: 1; padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb; border-radius: 0.75rem;
    font-size: 0.875rem; font-family: 'Inter', sans-serif;
    background: white; color: #1f2937;
    resize: none; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}
#ai-input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(165,180,252,0.25); }
#ai-send-btn {
    width: 40px; height: 40px; border-radius: 0.75rem; flex-shrink: 0;
    background: #4f46e5; color: white; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background-color 0.2s; padding: 0;
}
#ai-send-btn:hover { background: #4338ca; }
#ai-send-btn:disabled { background: #c7d2fe; cursor: not-allowed; }

/* Messages IA */
.ai-msg-user {
    align-self: flex-end;
    background: #ede9fe; border-radius: 1rem 1rem 0.25rem 1rem;
    padding: 0.625rem 0.875rem; font-size: 0.875rem; color: #1f2937;
    max-width: 85%;
}
.ai-msg-assistant {
    align-self: flex-start;
    background: white; border: 1px solid #e5e7eb;
    border-radius: 1rem 1rem 1rem 0.25rem;
    padding: 0.625rem 0.875rem; font-size: 0.875rem; color: #1f2937;
    max-width: 95%;
}
.ai-msg-assistant.prose { font-family: 'Inter', sans-serif; line-height: 1.6; }
.ai-msg-assistant p { margin: 0.25rem 0; }
.ai-msg-assistant ul, .ai-msg-assistant ol { margin: 0.375rem 0; padding-left: 1.25rem; }
.ai-msg-assistant li { margin: 0.15rem 0; }
.ai-msg-assistant strong { font-weight: 600; color: #111827; }
.ai-msg-assistant h1, .ai-msg-assistant h2, .ai-msg-assistant h3 {
    font-family: 'Inter', sans-serif; font-weight: 600; margin: 0.5rem 0 0.25rem;
}

/* Animation points de chargement */
@keyframes ai-pulse {
    0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}
.ai-dot { display: inline-block; font-size: 0.75rem; animation: ai-pulse 1.2s infinite; }

/* Bouton ✨ dans les cartes scène */
.scene-card-controls button.ai-analyse-btn {
    background: #ede9fe; color: #5b21b6; font-size: 0.875rem;
}
.scene-card-controls button.ai-analyse-btn:hover {
    background: #ddd6fe;
}

/* Annotations */
.scene-notes-section { font-family: 'Inter', sans-serif; }
.scene-notes-input { font-family: 'Inter', sans-serif; color: #78350f; }

/* Courbe dramatique */
.courbe-point { transition: r 0.15s ease; }
.courbe-point:hover { r: 10; }

/* ===== DARK MODE ===== */
body.dark {
    --bg-main: #111827;
    --bg-sidebar: #1f2937;
    --bg-card: #1f2937;
    --text-main: #f3f4f6;
    --text-light: #9ca3af;
    --border-color: #374151;
    color-scheme: dark;
}
body.dark aside,
body.dark #status-bar { background-color: #1f2937 !important; }
body.dark .bg-white { background-color: #1f2937 !important; }
body.dark .bg-gray-50 { background-color: #111827 !important; }
body.dark .bg-gray-100 { background-color: #374151 !important; }
body.dark .bg-gray-200 { background-color: #4b5563 !important; }
body.dark .text-gray-800, body.dark .text-gray-700 { color: #e5e7eb !important; }
body.dark .text-gray-600, body.dark .text-gray-500 { color: #9ca3af !important; }
body.dark .text-gray-400 { color: #6b7280 !important; }
body.dark .border-gray-200, body.dark .border-gray-300 { border-color: #374151 !important; }
body.dark input:not(#focus-title), body.dark textarea:not(#focus-textarea), body.dark select {
    background-color: #374151 !important; color: #f3f4f6 !important; border-color: #4b5563 !important;
}
body.dark .sidebar-btn:hover:not(.active) { background-color: #374151 !important; }
body.dark .modal-content { background-color: #1f2937 !important; color: #f3f4f6 !important; }

/* ===== SIDEBAR COLLAPSE ===== */
#sidebar { transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; }
#sidebar.sidebar-collapsed { width: 0 !important; padding: 0 !important; border-right: none !important; }
#last-saved-indicator { font-family: 'Inter', sans-serif; transition: color 0.5s; }

/* ===== MODE FOCUS ===== */
#focus-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: #fafaf9; display: flex; flex-direction: column;
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s ease;
}
#focus-overlay.open { opacity: 1; visibility: visible; }
body.dark #focus-overlay { background: #111827; }
.focus-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem; border-bottom: 1px solid #e5e7eb; flex-shrink: 0;
    background: white;
}
body.dark .focus-header { background: #1f2937 !important; border-color: #374151 !important; }
.focus-title-input {
    font-family: 'Lora', serif; font-size: 1.25rem; font-weight: 600;
    background: transparent !important; border: none !important; outline: none;
    color: #1f2937; flex: 1; margin-right: 2rem;
}
body.dark .focus-title-input { color: #f3f4f6 !important; }
.focus-word-count { font-size: 0.8rem; color: #9ca3af; font-family: 'Inter', sans-serif; }
.focus-close-btn {
    font-size: 0.8rem; color: #6b7280; padding: 0.4rem 0.8rem;
    border: 1px solid #e5e7eb; border-radius: 0.375rem;
    cursor: pointer; transition: all 0.15s; background: transparent !important;
    font-family: 'Inter', sans-serif;
}
.focus-close-btn:hover { color: #1f2937; border-color: #9ca3af; }
.focus-textarea {
    flex: 1; padding: 3rem 20%; font-family: 'Lora', serif;
    font-size: 1.1rem; line-height: 1.9; color: #1f2937;
    background: transparent !important; border: none !important; outline: none; resize: none;
    max-width: 100%;
}
body.dark .focus-textarea { color: #f3f4f6 !important; background: transparent !important; }

/* Dialogue seul */
.dialogue-line { border-left: 3px solid #8b5cf6; padding: 4px 0 4px 10px; font-style: italic; font-size: 0.9rem; color: #374151; }

/* Snapshots */
.snapshot-entry { border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 0.75rem; transition: border-color 0.15s; }
.snapshot-entry:hover { border-color: #c4b5fd; }
.snapshot-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.375rem; }
.snapshot-date { font-size: 0.75rem; color: #6b7280; font-weight: 500; }
.snapshot-preview { font-size: 0.8rem; color: #9ca3af; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Project selector */
body.dark #project-selector { background-color: #374151 !important; color: #f3f4f6 !important; border-color: #4b5563 !important; }
body.dark .border-b { border-bottom-color: #374151 !important; }

/* ===== DASHBOARD ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
    align-items: start;
}
.dashboard-card {
    background: white; border: 1px solid var(--border-color);
    border-radius: 0.75rem; padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dashboard-card-title {
    font-family: 'Inter', sans-serif; font-weight: 700;
    font-size: 0.95rem; color: #1f2937; margin-bottom: 1rem;
}
.dash-bar-track {
    background: #f3f4f6; border-radius: 9999px;
    height: 8px; overflow: hidden;
}
.dash-bar-fill {
    height: 100%; border-radius: 9999px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.dash-stat-pill {
    background: #f9fafb; border-radius: 0.5rem; padding: 0.625rem 0.25rem;
    display: flex; flex-direction: column; align-items: center;
}
.dash-stat-value { font-size: 1.25rem; font-weight: 700; color: #1f2937; line-height: 1; }
.dash-stat-label { font-size: 0.7rem; color: #9ca3af; margin-top: 0.2rem; text-transform: uppercase; letter-spacing: 0.05em; }
.dash-stat-warning .dash-stat-value { color: #d97706; }
body.dark .dashboard-card { background: #1f2937 !important; border-color: #374151 !important; }
body.dark .dashboard-card-title { color: #f3f4f6; }
body.dark .dash-bar-track { background: #374151; }
body.dark .dash-stat-pill { background: #374151; }
body.dark .dash-stat-value { color: #f3f4f6; }

/* Relations map zoom controls */
.relations-zoom-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #e5e7eb; background: #f9fafb; color: #374151; font-size: 1.1rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.relations-zoom-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
.relations-zoom-reset { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #e5e7eb; background: #f9fafb; color: #6b7280; font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.relations-zoom-reset:hover { background: #f3f4f6; color: #374151; }
body.dark .relations-zoom-btn, body.dark .relations-zoom-reset { background: #374151; border-color: #4b5563; color: #d1d5db; }
body.dark .relations-zoom-btn:hover, body.dark .relations-zoom-reset:hover { background: #4b5563; }

/* ── Structures v2 — Cartes ───────────────────────────────── */
.struct-section { margin-bottom: 2rem; }
.struct-section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #9ca3af; margin-bottom: 1rem; }
.struct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.struct-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; transition: box-shadow 0.2s, border-color 0.2s; }
.struct-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); border-color: #d1d5db; }
.struct-card-header { display: flex; flex-direction: column; gap: 0.4rem; }
.struct-card-title { font-size: 1rem; font-weight: 700; color: #1f2937; line-height: 1.3; }
.struct-card-desc { font-size: 0.85rem; color: #6b7280; line-height: 1.5; margin: 0; }
.card-arc-bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; gap: 2px; }
.card-arc-seg { border-radius: 3px; transition: opacity 0.15s; }
.card-arc-seg:hover { opacity: 0.8; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.struct-tag { font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 999px; }
.tag-easy { background: #d1fae5; color: #065f46; }
.tag-mid  { background: #fef3c7; color: #92400e; }
.tag-hard { background: #fee2e2; color: #991b1b; }
.tag-for  { background: #ede9fe; color: #5b21b6; }
.card-steps-preview { display: flex; flex-direction: column; gap: 0.3rem; }
.card-step-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: #4b5563; }
.card-step-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.card-step-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-step-pct { font-size: 0.7rem; color: #9ca3af; flex-shrink: 0; }
.card-step-more { font-size: 0.75rem; color: #9ca3af; padding-left: 1.2rem; }
.struct-card-actions { display: flex; gap: 0.5rem; margin-top: auto; padding-top: 0.25rem; }
.card-btn-consult { flex: 1; padding: 0.4rem 0.75rem; border-radius: 8px; border: 1px solid #e5e7eb; background: #f9fafb; color: #374151; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.card-btn-consult:hover { background: #f3f4f6; border-color: #d1d5db; }
.card-btn-apply { flex: 1; padding: 0.4rem 0.75rem; border-radius: 8px; background: var(--primary); color: white; font-size: 0.8rem; font-weight: 600; cursor: pointer; border: none; transition: background 0.15s; }
.card-btn-apply:hover { background: var(--primary-hover); }
.card-btn-delete { padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid #fee2e2; background: #fff; color: #ef4444; font-size: 0.85rem; cursor: pointer; transition: background 0.15s; }
.card-btn-delete:hover { background: #fef2f2; }
.btn-create-struct { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.25rem; border-radius: 10px; border: 2px dashed #d1d5db; background: transparent; color: #6b7280; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.btn-create-struct:hover { border-color: var(--primary); color: var(--primary); background: #f0f0fe; }

/* ── Modale consultation ─────────────────────────────────── */
.structure-consult-content { max-width: 720px !important; width: 95vw; max-height: 90vh; display: flex; flex-direction: column; padding: 0 !important; }
.consult-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid #f3f4f6; flex-shrink: 0; }
.consult-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }
.consult-arc { display: flex; height: 12px; gap: 3px; padding: 0 1.5rem; flex-shrink: 0; margin: 0.75rem 0; }
.consult-arc-seg { border-radius: 4px; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: opacity 0.15s; }
.consult-arc-seg span { font-size: 0.55rem; font-weight: 700; color: rgba(255,255,255,0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; }
.consult-theory { padding: 0 1.5rem; flex-shrink: 0; }
.consult-theory p { font-size: 0.875rem; color: #4b5563; line-height: 1.7; margin-bottom: 0.75rem; }
.consult-steps-list { flex: 1; overflow-y: auto; padding: 0 1.5rem 0.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.consult-step { background: #f9fafb; border: 1px solid #f3f4f6; border-radius: 10px; padding: 1rem; }
.consult-step-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.consult-step-color { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.consult-step-title { font-size: 0.9rem; font-weight: 700; color: #1f2937; flex: 1; }
.consult-step-pct { font-size: 0.75rem; color: #9ca3af; font-weight: 600; flex-shrink: 0; }
.consult-step-desc { font-size: 0.82rem; color: #4b5563; line-height: 1.6; margin-bottom: 0.4rem; }
.consult-step-flag { font-size: 0.8rem; color: #374151; line-height: 1.5; margin-top: 0.3rem; display: flex; align-items: flex-start; gap: 0.4rem; }
.consult-flag-badge { flex-shrink: 0; font-size: 0.68rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 999px; white-space: nowrap; }
.badge-must { background: #d1fae5; color: #065f46; }
.badge-avoid { background: #fef3c7; color: #92400e; }
.consult-footer { padding: 1rem 1.5rem; border-top: 1px solid #f3f4f6; flex-shrink: 0; text-align: right; }

/* ── Modale apply preview ────────────────────────────────── */
.preview-steps-list { list-style: none; padding: 0.75rem 0; margin: 0.5rem 0; display: flex; flex-direction: column; gap: 0.35rem; }
.preview-steps-list li { font-size: 0.85rem; color: #374151; padding: 0.25rem 0; padding-left: 1.1rem; position: relative; }
.preview-steps-list li::before { content: '–'; position: absolute; left: 0; color: #9ca3af; }
.preview-more { color: #9ca3af !important; }
.preview-warning { font-size: 0.85rem; color: #b45309; background: #fef3c7; border-radius: 6px; padding: 0.5rem 0.75rem; margin-top: 0.5rem; }
.preview-hint { font-size: 0.82rem; color: #6366f1; margin-top: 0.5rem; }

/* ── Éditeur structure personnalisée ─────────────────────── */
.custom-act-row { display: flex; align-items: center; gap: 0.5rem; }
.custom-act-num { width: 20px; text-align: center; font-size: 0.75rem; color: #9ca3af; flex-shrink: 0; }
.custom-act-title { flex: 1; border: 1px solid #e5e7eb; border-radius: 6px; padding: 0.35rem 0.6rem; font-size: 0.85rem; outline: none; }
.custom-act-title:focus { border-color: #6366f1; }
.custom-act-pct { width: 56px; border: 1px solid #e5e7eb; border-radius: 6px; padding: 0.35rem 0.4rem; font-size: 0.82rem; text-align: center; outline: none; }
.custom-act-pct:focus { border-color: #6366f1; }
.custom-act-color { width: 32px; height: 32px; border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer; padding: 2px; background: none; }
.custom-act-del { width: 28px; height: 28px; border: none; background: none; color: #9ca3af; cursor: pointer; font-size: 0.9rem; border-radius: 4px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.custom-act-del:hover { color: #ef4444; background: #fee2e2; }

/* ── Barre de référence (vue Scènes) ─────────────────────── */
#structure-ref-bar { border-radius: 10px; overflow: hidden; border: 1px solid #e0e7ff; background: #f5f3ff; }
.ref-bar-inner { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; }
.ref-bar-title { font-size: 0.78rem; font-weight: 700; color: #4f46e5; white-space: nowrap; cursor: pointer; background: none; border: none; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.ref-bar-title:hover { color: #3730a3; }
.ref-bar-arc { flex: 1; display: flex; height: 20px; gap: 2px; border-radius: 4px; overflow: hidden; min-width: 0; }
.ref-bar-segment { display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 2px; }
.ref-bar-label { font-size: 0.6rem; font-weight: 600; color: rgba(255,255,255,0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; pointer-events: none; }
.ref-bar-close { background: none; border: none; color: #9ca3af; cursor: pointer; font-size: 0.9rem; padding: 0.1rem 0.2rem; border-radius: 4px; flex-shrink: 0; }
.ref-bar-close:hover { color: #6366f1; background: #ede9fe; }

/* ── Dark mode structures ────────────────────────────────── */
body.dark .struct-card { background: #1f2937; border-color: #374151; }
body.dark .struct-card:hover { border-color: #4b5563; }
body.dark .struct-card-title { color: #f3f4f6; }
body.dark .struct-card-desc { color: #9ca3af; }
body.dark .card-step-item { color: #d1d5db; }
body.dark .card-btn-consult { background: #374151; border-color: #4b5563; color: #d1d5db; }
body.dark .card-btn-consult:hover { background: #4b5563; }
body.dark .btn-create-struct { border-color: #4b5563; color: #9ca3af; }
body.dark .btn-create-struct:hover { border-color: #818cf8; color: #818cf8; background: #1e1b4b; }
body.dark .structure-consult-content { background: #1f2937; }
body.dark .consult-header { border-color: #374151; }
body.dark .consult-header h2 { color: #f3f4f6; }
body.dark .consult-theory p { color: #9ca3af; }
body.dark .consult-step { background: #111827; border-color: #374151; }
body.dark .consult-step-title { color: #f3f4f6; }
body.dark .consult-step-desc { color: #9ca3af; }
body.dark .consult-step-flag { color: #d1d5db; }
body.dark .consult-footer { border-color: #374151; }
body.dark #structure-ref-bar { background: #1e1b4b; border-color: #3730a3; }
body.dark .custom-act-title, body.dark .custom-act-pct { background: #374151; border-color: #4b5563; color: #f3f4f6; }

/* ── Personnage détail — layout avec nav latérale ────────────── */
.char-detail-layout { display: flex; gap: 0; height: 100%; min-height: 0; }
.char-nav-panel { width: 200px; flex-shrink: 0; border-right: 1px solid #e5e7eb; display: flex; flex-direction: column; overflow: hidden; }
.char-nav-back { padding: 0.6rem 0.75rem; font-size: 0.75rem; font-weight: 600; color: #6366f1; text-align: left; background: none; border: none; border-bottom: 1px solid #e5e7eb; cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.char-nav-back:hover { background: #f5f3ff; }
.char-nav-list { flex: 1; overflow-y: auto; padding: 0.5rem 0; display: flex; flex-direction: column; gap: 1px; }
.char-nav-item { display: flex; flex-direction: column; align-items: flex-start; padding: 0.5rem 0.75rem; background: none; border: none; cursor: pointer; text-align: left; border-radius: 0; transition: background 0.12s; gap: 0.1rem; }
.char-nav-item:hover { background: #f3f4f6; }
.char-nav-active { background: #ede9fe !important; border-right: 3px solid #6366f1; }
.char-nav-initial { display: none; }
.char-nav-name { font-size: 0.82rem; font-weight: 600; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.char-nav-active .char-nav-name { color: #4f46e5; }
.char-nav-role { font-size: 0.7rem; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.char-nav-empty { font-size: 0.78rem; color: #9ca3af; padding: 0.75rem; font-style: italic; }
.char-detail-main { flex: 1; min-width: 0; padding-left: 1.75rem; display: flex; flex-direction: column; overflow: hidden; }
/* Dark mode */
body.dark .char-nav-panel { border-color: #374151; }
body.dark .char-nav-back { color: #a5b4fc; border-color: #374151; }
body.dark .char-nav-back:hover { background: #1e1b4b; }
body.dark .char-nav-item:hover { background: #1f2937; }
body.dark .char-nav-active { background: #1e1b4b !important; }
body.dark .char-nav-name { color: #f3f4f6; }
body.dark .char-nav-active .char-nav-name { color: #a5b4fc; }
body.dark .char-nav-role { color: #6b7280; }

/* ── Relations — cartes & formulaire ────────────────────────── */
.rel-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 0.75rem 1rem; }
.rel-card-left { flex: 1; min-width: 0; }
.rel-card-header { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.25rem; }
.rel-type-tag { font-size: 0.72rem; font-weight: 700; background: #ede9fe; color: #5b21b6; padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.rel-bi-badge { font-size: 0.75rem; color: #6366f1; font-weight: 700; cursor: help; }
.rel-arrow { font-size: 0.75rem; color: #9ca3af; }
.rel-desc { font-size: 0.82rem; color: #6b7280; line-height: 1.5; margin: 0; }
.delete-relation-btn { flex-shrink: 0; width: 24px; height: 24px; border: none; background: none; color: #d1d5db; font-size: 1.1rem; line-height: 1; cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.delete-relation-btn:hover { color: #ef4444; background: #fee2e2; }
.rel-reciprocal-label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.rel-reciprocal-text { font-size: 0.78rem; color: #6366f1; font-weight: 500; }
.rel-reciprocal-label input[type=checkbox] { accent-color: #6366f1; width: 14px; height: 14px; }
/* Dark mode */
body.dark .rel-card { background: #1f2937; border-color: #374151; }
body.dark .rel-type-tag { background: #312e81; color: #c7d2fe; }
body.dark .rel-desc { color: #9ca3af; }

/* Relations map dark mode */
body.dark #relations-svg-wrapper { background: #1f2937 !important; border-color: #374151 !important; }
body.dark #relations-svg-wrapper text { fill: #d1d5db; }
body.dark #relations-svg-wrapper circle { fill: #374151 !important; }

/* ── Scene card : séparation fiche / rédaction ───────────────────────── */
.scene-meta-label { display: block; font-size: 0.75rem; font-weight: 600; color: #6b7280; margin-bottom: 0.25rem; }
.scene-meta-panel { overflow: hidden; }
.scene-meta-toggle { cursor: pointer; font-family: 'Inter', sans-serif; transition: background-color 0.15s; }
.scene-meta-summary { color: #9ca3af; }
.scene-writing-zone-header { font-family: 'Inter', sans-serif; }
body.dark .scene-writing-zone-header { background-color: #1e1b4b !important; }
body.dark .scene-writing-zone-header span { color: #a5b4fc !important; }
body.dark .scene-meta-toggle:hover { background-color: #374151 !important; }
body.dark .scene-meta-label { color: #9ca3af; }

/* ── Assemblage ─────────────────────────────────────────────────────── */
.assemblage-mode-btn { color: #6b7280; font-family: 'Inter', sans-serif; }
.assemblage-mode-btn.active-mode { background-color: white; color: #4f46e5; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.assemblage-act-block { margin-bottom: 3rem; }
.assemblage-act-title { font-size: 1.5rem; font-weight: 800; color: #374151; border-bottom: 2px solid #e5e7eb; padding-bottom: 0.5rem; margin-bottom: 1.5rem; }
.assemblage-scene-title { font-size: 1.1rem; font-weight: 700; color: #6b7280; margin-bottom: 0.75rem; margin-top: 0; font-style: italic; }
.assemblage-scene-block { margin-bottom: 1rem; }
.assemblage-scene-sep { text-align: center; color: #d1d5db; margin: 1.5rem 0; font-size: 1.2rem; letter-spacing: 0.5em; }
.assemblage-act-hr { border: none; border-top: 2px dashed #e5e7eb; margin: 2.5rem 0; }
.assemblage-clean-sep { text-align: center; color: #d1d5db; margin: 2rem 0; font-size: 1.1rem; letter-spacing: 0.5em; }
.assemblage-body { line-height: 1.9; }
body.dark .assemblage-mode-btn { color: #9ca3af; }
body.dark .assemblage-mode-btn.active-mode { background-color: #374151; color: #a5b4fc; box-shadow: none; }
body.dark .assemblage-act-title { color: #e5e7eb; border-color: #374151; }
body.dark .assemblage-scene-title { color: #9ca3af; }
body.dark .assemblage-act-hr { border-color: #374151; }
body.dark .assemblage-clean-sep, body.dark .assemblage-scene-sep { color: #4b5563; }

/* ── Préparation narrative ──────────────────────────────────────── */
.scene-prep-toggle { cursor: pointer; font-family: 'Inter', sans-serif; transition: background-color 0.15s; }
.prep-group { margin-bottom: 0.75rem; }
.prep-group:last-child { margin-bottom: 0; }
.prep-group-label { font-family: 'Inter', sans-serif; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #0f766e; margin-bottom: 0.375rem; }
.prep-field-label { display: block; font-family: 'Inter', sans-serif; font-size: 0.7rem; font-weight: 600; color: #6b7280; margin-bottom: 0.2rem; }
body.dark .scene-prep-toggle:hover { background-color: #134e4a !important; }
body.dark .scene-prep-body { background-color: transparent; }
body.dark .prep-group-label { color: #5eead4; }
body.dark .prep-field-label { color: #9ca3af; }
body.dark .scene-prep-field { background-color: #1f2937 !important; border-color: #0f766e !important; color: #d1fae5 !important; }
body.dark .scene-prep-field:focus { border-color: #14b8a6 !important; }

/* ── Scene card tabs ────────────────────────────────────────────── */
.scene-tabs-bar { font-family: 'Inter', sans-serif; background: #f9fafb; }
.scene-tab-btn { flex: 1; padding: 0.5rem 0.25rem; font-size: 0.7rem; font-weight: 500; color: #9ca3af; border-bottom: 2px solid transparent; transition: all 0.15s; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-tab-btn:hover { color: #4f46e5; background: #eef2ff; }
.scene-tab-btn.active { color: #4f46e5; border-bottom-color: #4f46e5; background: white; font-weight: 600; }
.scene-tab-pill { display: inline-block; background: #e0e7ff; color: #4338ca; font-size: 0.6rem; padding: 0 4px; border-radius: 9999px; margin-left: 2px; font-weight: 600; vertical-align: middle; }
.scene-tab-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #6b7280; margin-left: 3px; vertical-align: middle; }
.scene-tab-dot.teal { background: #0f766e; }
body.dark .scene-tabs-bar { background: #1f2937; }
body.dark .scene-tab-btn { color: #6b7280; }
body.dark .scene-tab-btn:hover { color: #818cf8; background: #1e1b4b; }
body.dark .scene-tab-btn.active { color: #818cf8; border-bottom-color: #818cf8; background: #111827; }
body.dark .scene-tab-pill { background: #1e1b4b; color: #a5b4fc; }

/* ── Scene compact mode ─────────────────────────────────────────── */
.scene-compact-strip { display: flex; align-items: center; gap: 0.5rem; background: white; border: 1px solid #e5e7eb; border-radius: 0.375rem; padding: 0.375rem 0.75rem; font-family: 'Inter', sans-serif; }
.scene-compact-strip:hover { border-color: #a5b4fc; background: #fafafa; }
.scene-compact-idx { font-size: 0.65rem; color: #d1d5db; font-weight: 700; width: 1.2rem; text-align: center; flex-shrink: 0; }
.scene-compact-type-badge { font-size: 0.6rem; font-weight: 600; padding: 1px 6px; border-radius: 9999px; flex-shrink: 0; white-space: nowrap; }
.scene-compact-wc { font-size: 0.65rem; color: #9ca3af; flex-shrink: 0; }
.scene-move-act-select { font-size: 0.65rem; border: 1px solid #e5e7eb; border-radius: 0.25rem; padding: 1px 4px; color: #6b7280; background: white; flex-shrink: 0; max-width: 10rem; }
.scene-compact-open-btn { font-size: 0.75rem; color: #6366f1; padding: 0 4px; flex-shrink: 0; }
.scene-compact-open-btn:hover { color: #4f46e5; }
.act-container-compact { background: rgba(243,244,246,0.5); padding: 0.75rem; border-radius: 0.5rem; }
body.dark .scene-compact-strip { background: #1f2937; border-color: #374151; }
body.dark .scene-compact-strip:hover { border-color: #4f46e5; }
body.dark .scene-compact-wc { color: #4b5563; }
body.dark .scene-move-act-select { background: #111827; border-color: #374151; color: #9ca3af; }

/* ── Psychologie — couches 5 niveaux ────────────────────────────────── */
.psycho-layer { margin-bottom: 0; border: 1px solid #e5e7eb; border-radius: 0; overflow: hidden; }
.psycho-layer:first-child { border-radius: 0.75rem 0.75rem 0 0; }
.psycho-layer:last-child { border-radius: 0 0 0.75rem 0.75rem; }
.psycho-layer + .psycho-layer { border-top: none; }
.psycho-layer-header { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1rem; background: #f9fafb; cursor: pointer; user-select: none; gap: 0.75rem; }
.psycho-layer-header:hover { background: #f3f4f6; }
.psycho-layer-title { font-weight: 700; font-size: 0.85rem; color: #374151; }
.psycho-layer-desc { font-size: 0.75rem; color: #9ca3af; }
.psycho-layer-body { padding: 1rem; background: white; }
.psycho-layer-body.hidden { display: none; }
.psycho-layer-chevron { font-size: 0.65rem; color: #9ca3af; display: inline-block; transition: transform 0.2s; transform: rotate(0deg); }
.psycho-layer-chevron.open { transform: rotate(180deg); }

/* Mode toggle */
.psycho-mode-toggle { display: flex; gap: 2px; background: #e5e7eb; border-radius: 6px; padding: 2px; flex-shrink: 0; }
.psycho-mode-btn { font-size: 0.68rem; padding: 2px 7px; border-radius: 4px; border: none; background: transparent; cursor: pointer; color: #6b7280; transition: all 0.12s; white-space: nowrap; }
.psycho-mode-btn.active { background: white; color: #4f46e5; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* Trait pills */
.trait-pill { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.72rem; background: #ede9fe; color: #5b21b6; padding: 2px 8px; border-radius: 9999px; white-space: nowrap; }
.delete-trait-btn { background: none; border: none; cursor: pointer; color: currentColor; opacity: 0.5; font-size: 0.9rem; line-height: 1; padding: 0; margin: 0; }
.delete-trait-btn:hover { opacity: 1; }

/* Inspire panel */
.psycho-inspire-panel { background: #faf5ff; border: 1px solid #e9d5ff; border-radius: 0.5rem; padding: 0.75rem; margin-top: 0.75rem; }
.psycho-inspire-chip { font-size: 0.68rem; padding: 2px 9px; background: white; border: 1px solid #c4b5fd; border-radius: 9999px; cursor: pointer; color: #6d28d9; transition: background 0.1s; white-space: nowrap; }
.psycho-inspire-chip:hover { background: #ede9fe; }

/* Thésaurus modal */
.thesaurus-trait-btn { font-size: 0.72rem; padding: 3px 10px; background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 6px; cursor: pointer; color: #374151; transition: all 0.1s; white-space: nowrap; }
.thesaurus-trait-btn:hover { background: #e0e7ff; border-color: #6366f1; color: #4f46e5; }
.thesaurus-trait-btn.thesaurus-trait-added { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.thesaurus-cat-btn { font-size: 0.72rem; padding: 3px 10px; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 999px; cursor: pointer; color: #6b7280; transition: all 0.1s; }
.thesaurus-cat-btn.active { background: #e0e7ff; border-color: #6366f1; color: #4f46e5; font-weight: 600; }
.thesaurus-target-btn { font-size: 0.72rem; padding: 3px 10px; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer; color: #6b7280; transition: all 0.1s; }
.thesaurus-target-btn.active { background: #6366f1; border-color: #4f46e5; color: white; font-weight: 600; }

/* Dark mode — psychologie */
body.dark .psycho-layer { border-color: #374151; }
body.dark .psycho-layer-header { background: #1f2937; }
body.dark .psycho-layer-header:hover { background: #374151; }
body.dark .psycho-layer-title { color: #f3f4f6; }
body.dark .psycho-layer-desc { color: #4b5563; }
body.dark .psycho-layer-body { background: #111827; }
body.dark .psycho-mode-toggle { background: #374151; }
body.dark .psycho-mode-btn { color: #9ca3af; }
body.dark .psycho-mode-btn.active { background: #111827; color: #818cf8; }
body.dark .psycho-inspire-panel { background: #1e1b4b; border-color: #4c1d95; }
body.dark .psycho-inspire-chip { background: #1e1b4b; border-color: #6d28d9; color: #c4b5fd; }
body.dark .psycho-inspire-chip:hover { background: #2e1065; }
body.dark .trait-pill { background: #312e81; color: #c7d2fe; }
body.dark .thesaurus-trait-btn { background: #1f2937; border-color: #374151; color: #d1d5db; }
body.dark .thesaurus-trait-btn:hover { background: #1e1b4b; border-color: #4f46e5; color: #a5b4fc; }
body.dark .thesaurus-cat-btn { background: #1f2937; border-color: #374151; color: #9ca3af; }
body.dark .thesaurus-cat-btn.active { background: #1e1b4b; border-color: #6366f1; color: #a5b4fc; }
body.dark .thesaurus-target-btn { background: #1f2937; border-color: #374151; color: #9ca3af; }
body.dark .thesaurus-target-btn.active { background: #4f46e5; border-color: #6366f1; color: white; }
body.dark #trait-thesaurus-modal > div { background: #1f2937; color: #f3f4f6; }
body.dark #trait-thesaurus-modal h3 { color: #f3f4f6; }
body.dark #trait-thesaurus-modal input { background: #111827; border-color: #374151; color: #f3f4f6; }

/* Descriptions inline mode Guidé */
.psycho-layer-body p strong { color: #4b5563; font-weight: 700; }
body.dark .psycho-layer-body p strong { color: #9ca3af; }

/* ── Tooltip universel (traits, distorsions, chips inspire) ──────────── */
.trait-tooltip-box {
    position: fixed;
    z-index: 9999;
    background: #1f2937;
    color: #f3f4f6;
    border-radius: 0.5rem;
    padding: 0.55rem 0.8rem;
    font-size: 0.72rem;
    max-width: 270px;
    line-height: 1.45;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
.trait-tooltip-box.visible { opacity: 1; }
.tip-label { font-size: 0.63rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.15rem; }
.tip-good { color: #6ee7b7; }
.tip-bad  { color: #fca5a5; margin-top: 0.5rem; }
.tip-text { color: #d1d5db; }

/* ============================================================ */
/* HISTORIQUE CANEVAS + PANNEAU DE RÉFÉRENCE                    */
/* ============================================================ */

.canevas-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-card, #fff);
    gap: 0.75rem;
}
.canevas-history-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}
.canevas-history-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main, #111827);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.canevas-history-meta { font-size: 0.75rem; color: #9ca3af; }
.canevas-history-item-actions { display: flex; align-items: center; flex-shrink: 0; }

/* Split layout */
.canevas-split-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.canevas-split-layout #canevas-list {
    flex: 3;
    min-width: 0;
}

/* Panneau de référence */
.canevas-ref-panel {
    flex: 2;
    min-width: 260px;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: var(--bg-sidebar, #f9fafb);
    overflow: hidden;
    position: sticky;
    top: 1rem;
}
.canevas-ref-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    flex-shrink: 0;
    background: var(--bg-sidebar, #f9fafb);
}
.canevas-ref-panel-notes {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.canevas-ref-note {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    background: white;
    border: 1px solid #f3f4f6;
}
.canevas-ref-note-title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-main, #111827);
    margin-bottom: 0.2rem;
}
.canevas-ref-note-content {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.5;
}
body.dark .canevas-history-item   { border-color: var(--border-color); background: var(--bg-card); }
body.dark .canevas-history-label  { color: var(--text-main); }
body.dark .canevas-ref-panel      { background: var(--bg-sidebar); border-color: var(--border-color); }
body.dark .canevas-ref-panel-header { background: var(--bg-sidebar); border-color: var(--border-color); }
body.dark .canevas-ref-note       { background: var(--bg-card); border-color: var(--border-color); }
body.dark .canevas-ref-note-title { color: var(--text-main); }
