function updateKT3Content() {
    const content = document.getElementById('hypstart-content');
    if (!content || content.dataset.lastHtml === 'kt3') return;
    if (window.isKT3AutoProcessing) return;

    // --- Tetkik (KT3) Otomasyonu ve İçerik Kontrolü ---
    let renderUI = (hasChecked) => {
        let currentHtml = '';

        if (hasChecked) {
            // EK FORM ARAYÜZÜ: Kolesterol, HDL, LDL inputları eklenecek
            // Gelişmiş veri çekme işlemi
            const scrapeTetkikValue = (keywords) => {
                const allElements = Array.from(document.querySelectorAll('div, span, td, label, .hyp-title'));
                let targetRow = null;

                for (let el of allElements) {
                    // İç içe çok fazla element barından ana taşıyıcıları geç
                    if (el.children.length > 3) continue;

                    const text = (el.innerText || el.textContent || '').toLowerCase().trim();
                    // Doğrudan eşleşme veya başlık varyasyonları
                    if (keywords.some(k => text === k || text === k + ':' || text.startsWith(k + ' '))) {
                        targetRow = el.closest('.ui-g, tr, form, div.row, .hyp-row');
                        if (targetRow) break;
                    }
                }

                if (targetRow) {
                    // Belirlenen satır içindeki değer taşıyabilecek hücreler
                    const valueContainers = targetRow.querySelectorAll('.hyp-row-item, td, .ui-g-3, .ui-g-2, .ui-g-4');
                    for (let container of valueContainers) {
                        const containerText = (container.innerText || container.textContent || '').toLowerCase();

                        // Başlığın kendisini değer zannetmesini engellemek için atla
                        if (keywords.some(k => containerText.includes(k))) continue;

                        // Gereksiz pop-up veya tooltip (p-overlaypanel) rakamları karıştırmasın diye klonlayıp temizle
                        const clone = container.cloneNode(true);
                        const popups = clone.querySelectorAll('p-overlaypanel, .ui-overlaypanel, .tooltip');
                        popups.forEach(p => p.remove());

                        const cleanText = (clone.innerText || clone.textContent || '').trim();
                        // 159.72 veya 260 veya 36,87 gibi sayı formatını regex ile yakala
                        const match = cleanText.match(/\d+([\.,]\d+)?/);
                        if (match) {
                            return match[0].replace(',', '.');
                        }
                    }
                }
                return '';
            };

            const t_kol = scrapeTetkikValue(['kolesterol', 'total kolesterol']);
            const t_hdl = scrapeTetkikValue(['hdl']);
            const t_ldl = scrapeTetkikValue(['ldl']);

            // Kontrol: Eğer hiçbir değer bulunamadıysa otomatiği durdur
            if (!t_kol && !t_hdl && !t_ldl) {
                renderUI(false);
                return;
            }

            // 3. ADIM: "Dış Laboratuvar Sonucu Ekle" butonuna otomatik tıkla
            setTimeout(() => {
                const extLabBtn = Array.from(document.querySelectorAll('span.ui-button-text, button')).find(b =>
                    (b.innerText || '').trim() === 'Dış Laboratuvar Sonucu Ekle'
                );
                if (extLabBtn) {
                    extLabBtn.click();

                    // 4. ADIM: Açılan modal formundaki ilgili alanlara veriyi kopyala
                    setTimeout(() => {
                        const modalRows = document.querySelectorAll('hyp-external-lab-test-row');
                        modalRows.forEach(row => {
                            const labelEl = row.querySelector('.hyp-title');
                            if (!labelEl) return;

                            const labelText = (labelEl.innerText || '').toLowerCase().trim();
                            con