.ide-layout { display: flex; height: 80vh; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #f8f9fa; position: relative; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
        .ide-sidebar { width: 260px; background: #ffffff; border-right: 1px solid #e5e7eb; display: flex; flex-direction: column; transition: margin 0.3s ease; z-index: 10; flex-shrink: 0; }
        .ide-sidebar.collapsed { margin-left: -260px; }
        .ide-main { flex-grow: 1; display: flex; flex-direction: column; position: relative; background: #f3f4f6; min-width: 0; }
        
        /* Toolbar Google Docs Style avec Icônes (Modifié avec scroll horizontal) */
        .ide-toolbar { 
            display: flex; 
            overflow-x: scroll; 
            gap: 6px; 
            padding: 8px 16px; 
            border-bottom: 1px solid #e5e7eb; 
            background: #ffffff; 
            align-items: center; 
            min-height: 48px; 
            scrollbar-width: thin; /* Firefox */
            -ms-overflow-style: none;  /* IE and Edge */
        }
        .ide-toolbar::-webkit-scrollbar { display: none; /* Chrome, Safari and Opera */ }
        
        .toolbar-divider { width: 1px; height: 24px; background: #e5e7eb; margin: 0 4px; flex-shrink: 0; }
        
        .ide-btn { height: 32px; background: transparent; border: none; color: #4b5563; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 500; transition: background 0.15s; display: inline-flex; align-items: center; justify-content: center; outline: none; padding: 0 8px; gap: 6px; flex-shrink: 0; }
        .ide-btn:hover { background: #f3f4f6; color: #111827; }
        .ide-btn.icon-only { width: 32px; padding: 0; font-size: 18px; }
        
        .ide-btn.save-btn { color: #ea4335; font-size: 20px; }
        .ide-btn.save-btn:hover { background: rgba(234, 67, 53, 0.1); }

        .ide-btn.new-chap-btn { color: #10b981; font-size: 20px; }
        .ide-btn.new-chap-btn:hover { background: rgba(16, 185, 129, 0.1); }

        select.ide-btn { appearance: none; padding-right: 24px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 6px center; }
        
        input[type="color"].ide-btn { padding: 0; width: 28px; cursor: pointer; }
        input[type="color"].ide-btn::-webkit-color-swatch-wrapper { padding: 2px; }
        input[type="color"].ide-btn::-webkit-color-swatch { border: 1px solid #d1d5db; border-radius: 2px; }
        
        .ia-status-badge { font-size: 11px; color: #6b7280; background: #f3f4f6; padding: 4px 8px; border-radius: 12px; display: flex; align-items: center; gap: 4px; margin-left: 5px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; flex-shrink: 0; }
        .ia-status-badge.active { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); }
        .ia-status-badge i { font-size: 14px; }

        /* Page de traitement de texte */
        .ide-page-wrapper { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 40px 20px; position: relative; }
        .ide-page { background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06); display: flex; flex-direction: column; transition: width 0.3s, min-height 0.3s; position: relative; color: #000; border: 1px solid #e5e7eb; }
        
        .ide-page {transform-origin: top center;transition: transform 0.15s ease-in-out;}

        .ide-page[data-format="A4"][data-orientation="portrait"] { width: 210mm; min-height: 297mm; }
        .ide-page[data-format="A4"][data-orientation="landscape"] { width: 297mm; min-height: 210mm; }
        .ide-page[data-format="Letter"][data-orientation="portrait"] { width: 215.9mm; min-height: 279.4mm; }
        .ide-page[data-format="Letter"][data-orientation="landscape"] { width: 279.4mm; min-height: 215.9mm; }
        
        .ide-header, .ide-footer { padding: 20px 40px; color: #9ca3af; font-size: 12px; text-align: center; border: 1px dashed transparent; outline: none; min-height: 50px; }
        .ide-header:focus, .ide-footer:focus { border-color: #d1d5db; color: #4b5563; }
        
        .ide-editor { flex-grow: 1; padding: 20px 60px; font-size: 15px; line-height: 1.6; outline: none; font-family: 'Arial', sans-serif; }
        .ide-editor p { margin-bottom: 12px; }
        .ide-editor h1 { font-size: 24px; margin-bottom: 15px; font-weight: normal; }
        .ide-editor h2 { font-size: 18px; margin-bottom: 10px; font-weight: normal; color: #434343; }
        
        .ide-statusbar { background: #ffffff; border-top: 1px solid #e5e7eb; padding: 6px 16px; font-size: 12px; display: flex; justify-content: space-between; align-items: center; color: #6b7280; }
        
        .ghost-span { color: #9ca3af; font-style: italic; pointer-events: none; user-select: none; }
        
        /* Style pour la transcription vocale en direct */
        .dictation-interim { color: var(--primary); border-bottom: 1px dotted var(--primary); pointer-events: none; }
        
        .mobile-accept-btn { position: absolute; bottom: 60px; right: 40px; background: #8b5cf6; color: white; border: none; border-radius: 30px; padding: 12px 20px; font-weight: bold; font-size: 14px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); cursor: pointer; display: none; z-index: 100; align-items: center; gap: 8px; }
        

        /* =========================================
           CORRECTION ASSISTÉE : SURLIGNAGE
           ========================================= */
        .ai-error { 
            cursor: pointer; 
            position: relative; 
            border-radius: 4px; 
            transition: all 0.2s ease; 
            padding: 2px 4px;
            margin: 0 1px;
            font-weight: 500;
        }
        .ai-error:hover { 
            box-shadow: 0 2px 6px rgba(0,0,0,0.15);
            transform: translateY(-1px);
        }
        /* Rouge pour l'orthographe */
        .ai-error[data-type="orthographe"] { 
            background-color: rgba(239, 68, 68, 0.15); 
            border-bottom: 2px solid #ef4444; 
            color: #b91c1c; 
        }
        /* Bleu pour la grammaire */
        .ai-error[data-type="grammaire"] { 
            background-color: rgba(59, 130, 246, 0.15); 
            border-bottom: 2px solid #3b82f6; 
            color: #1d4ed8; 
        }
        /* Orange pour la frappe */
        .ai-error[data-type="frappe"] { 
            background-color: rgba(249, 115, 22, 0.15); 
            border-bottom: 2px solid #f97316; 
            color: #c2410c; 
        }
        /* Violet pour le sens/incompréhensible */
        .ai-error[data-type="incomprehensible"] { 
            background-color: rgba(168, 85, 247, 0.15); 
            border-bottom: 2px solid #a855f7; 
            color: #7e22ce; 
        }

        /* Mot corrigé automatiquement en mode Autonome */
        .ai-corrected { 
            background-color: rgba(139, 92, 246, 0.2); 
            border-bottom: 2px solid #8b5cf6; 
            color: #6d28d9;
            cursor: pointer; 
            border-radius: 4px; 
            padding: 2px 4px;
            margin: 0 1px;
            font-weight: 500;
            transition: all 0.2s ease; 
        }
        .ai-corrected:hover { 
            background-color: rgba(139, 92, 246, 0.35); 
            box-shadow: 0 2px 6px rgba(139, 92, 246, 0.2);
            transform: translateY(-1px);
        }

        /* Tooltip interactif */
        .correction-tooltip { position: absolute; background: #ffffff; border: 1px solid #e5e7eb; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); padding: 12px; width: 260px; z-index: 25000; display: none; flex-direction: column; gap: 8px; font-family: -apple-system, sans-serif; }
        .tooltip-header { font-weight: 700; font-size: 11px; color: #6b7280; display: flex; align-items: center; gap: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
        .tooltip-reason { font-size: 13px; color: #111827; line-height: 1.4; }
        .tooltip-actions { display: flex; gap: 6px; margin-top: 4px; }
        .tooltip-actions button { flex: 1; padding: 6px; font-size: 12px; border-radius: 4px; border: 1px solid #d1d5db; background: #ffffff; color: #374151; cursor: pointer; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
        .tooltip-actions button.primary { background: #3b82f6; color: white; border-color: #3b82f6; }

        /* Sidebar UI */
        .sidebar-header { padding: 16px; border-bottom: 1px solid #e5e7eb; display: flex; flex-direction: column; gap: 10px; }
        .project-list { flex-grow: 1; overflow-y: auto; padding: 8px; }
        .project-item { padding: 8px 12px; border-radius: 6px; cursor: pointer; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: #374151; border: 1px solid transparent; }
        .project-item:hover { background: #f3f4f6; }
        .project-item.active { background: #eff6ff; color: #1d4ed8; }
        .chapter-list { margin-left: 12px; margin-top: 4px; display: none; flex-direction: column; gap: 2px; border-left: 2px solid #e5e7eb; padding-left: 8px; }
        .project-item.active .chapter-list { display: flex; }
        .chapter-item { font-size: 12px; color: #6b7280; font-weight: 400; padding: 6px; cursor: pointer; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; }
        .chapter-item:hover { background: #f3f4f6; color: #111827; }

        /* Modales */
        .ide-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 20000; display: none; align-items: center; justify-content: center; }
        .ide-modal { background: #ffffff; border-radius: 8px; padding: 24px; width: 400px; max-width: 90vw; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
        .ide-modal h4 { margin: 0 0 8px 0; color: #111827; font-size: 16px; display: flex; align-items: center; gap: 8px; }
        .ide-modal p { margin: 0 0 16px 0; color: #6b7280; font-size: 13px; }
        .ide-modal input { width: 100%; border: 1px solid #d1d5db; padding: 10px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; outline: none; }
        .ide-modal input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
        .ide-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
        .ide-modal-actions button { padding: 8px 16px; border-radius: 6px; border: 1px solid #d1d5db; background: white; cursor: pointer; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
        .ide-modal-actions button.primary { background: #3b82f6; color: white; border: none; }

        .ide-context-menu .tone-option:hover {
            background: #3f3f46 !important;
            border-color: #52525b !important;
        }
        .ctx-syn-badge {
            background: #27272a; 
            border: 1px solid #3f3f46; 
            color: #e4e4e7; 
            padding: 4px 8px; 
            border-radius: 6px; 
            font-size: 11px; 
            cursor: pointer;
            transition: background 0.2s;
        }
        .ctx-syn-badge:hover {
            background: #a855f7;
            border-color: #c084fc;
            color: white;
        }

        @keyframes pulse {
        0%, 100% {
            opacity: 1;
        }
        50% {
            opacity: .5;
        }
        }