:root {
            --background-start: #667eea;
            --background-end: #764ba2;
            --text-color: #1f2937;
            --text-color-light: #4b5563;
            --card-bg: white;
            --header-title-color: white;
            --header-icon-color: #d8b4fe;
            --practitioner-guide-bg: #f3f4f6;
            --practitioner-guide-border: #818cf8;
            --input-bg: white;
            --input-border: #d1d5db;
            --text-muted: #6b7280;
            --highlight-indigo-bg: #e0e7ff;
            --highlight-indigo-text: #3730a3;
            --highlight-green-bg: #d1fae5;
            --highlight-green-text: #065f46;
            --highlight-red-bg: #fee2e2;
            --highlight-red-text: #991b1b;
        }

        html.dark {
            --background-start: #1f2937;
            --background-end: #111827;
            --text-color: #e5e7eb;
            --text-color-light: #9ca3af;
            --card-bg: #1f2937;
            --header-title-color: #e5e7eb;
            --header-icon-color: #a78bfa;
            --practitioner-guide-bg: #374151;
            --practitioner-guide-border: #a78bfa;
            --input-bg: #374151;
            --input-border: #4b5563;
            --text-muted: #9ca3af;
            --highlight-indigo-bg: #4338ca;
            --highlight-indigo-text: #e0e7ff;
            --highlight-green-bg: #065f46;
            --highlight-green-text: #a7f3d0;
            --highlight-red-bg: #b91c1c;
            --highlight-red-text: #fecaca;
        }

        body {
            font-family: 'Inter', sans-serif;
            background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
            min-height: 100vh;
            color: var(--text-color);
            transition: background 0.3s ease-in-out, color 0.3s ease-in-out;
        }
        .content-card {
            background: var(--card-bg);
            border-radius: 1rem;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
            transition: background-color 0.3s ease-in-out;
        }
        .practitioner-guide {
            background-color: var(--practitioner-guide-bg);
            border-radius: 0.75rem;
            border-left: 4px solid var(--practitioner-guide-border);
            padding: 1rem;
            height: 100%;
        }
        input, textarea, select {
            background-color: var(--input-bg) !important;
            color: var(--text-color) !important;
            border-color: var(--input-border) !important;
        }
        label {
            color: var(--text-color-light);
        }
        html.dark label {
            color: var(--text-color);
        }
        .practitioner-guide p, .practitioner-guide span {
            color: var(--text-color-light);
        }
        html.dark .practitioner-guide p, html.dark .practitioner-guide span {
            color: var(--text-color);
        }

        .dynamic-text {
            font-weight: 600;
            padding: 2px 5px;
            border-radius: 4px;
        }
        .highlight-indigo {
            background-color: var(--highlight-indigo-bg);
            color: var(--highlight-indigo-text) !important;
        }
        .highlight-green {
            background-color: var(--highlight-green-bg);
            color: var(--highlight-green-text) !important;
        }
        .highlight-red {
            background-color: var(--highlight-red-bg);
            color: var(--highlight-red-text) !important;
        }
        .session-text-card {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            border: 2px solid #e9ecef;
            border-radius: 0.5rem;
            padding: 1.5rem;
            font-size: 1.1rem;
        }
        .dark .session-text-card {
            background: var(--card-bg);
            border-color: #374151;
        }
        .session-text-card h3 {
            font-size: 1.25rem;
        }
        .session-text-card p, .session-text-card li {
            font-size: 1rem;
        }
        .highlight-btn {
            background: linear-gradient(90deg, #4f46e5, #a855f7);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            transform: scale(1);
        }
        @keyframes pulse-glow {
            0%, 100% { box-shadow: 0 0 1rem 0 rgba(147, 111, 235, 0.6); }
            50% { box-shadow: 0 0 2.5rem 0.7rem rgba(147, 111, 235, 0.5); }
        }
        .animate-pulse-glow {
            animation: pulse-glow 3s infinite ease-in-out;
        }
        .session-text-card .bg-orange-50 { background-color: #fff7ed !important; }
        .session-text-card .bg-slate-50 { background-color: #f8fafc !important; }
        .session-text-card .bg-orange-50 h3,
        .session-text-card .bg-slate-50 h3 {
            color: #9a3412 !important;
        }
        .next-session-box {
            background-color: #fee2e2;
            border: 4px solid #dc2626;
            border-radius: 0.5rem;
            padding: 0.5rem;
            font-size: 1.25rem;
            color: #dc2626;
            font-weight: 800;
            text-align: center;
        }
        #form-container, #session-result, #summary-preview {
            max-width: 100% !important;
        }
        .container {
            max-width: 100% !important;
            padding-left: 1rem;
            padding-right: 1rem;
        }
        .action-btn {
            background: linear-gradient(90deg, #4f46e5, #a855f7);
            color: white;
            padding: 0.75rem 1.5rem;
            border-radius: 0.5rem;
            font-weight: 500;
            font-size: 0.875rem;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        }
        .action-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
        }
        .action-btn:active {
            transform: scale(0.95);
        }
        .action-btn-highlight {
            background: linear-gradient(90deg, #059669, #10b981); /* Emerald green */
        }
        .action-btn-highlight:hover {
            background: linear-gradient(90deg, #047857, #059669);
        }
        /* Enregistrement & transcription de séance (ajout 03/07/2026) */
        .rec-badge {
            display: inline-flex; align-items: center; gap: 0.4rem;
            padding: 0.35rem 0.9rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
        }
        .rec-badge-idle { background: #e5e7eb; color: #374151; }
        .rec-badge-live { background: #fee2e2; color: #b91c1c; animation: rec-pulse 1.4s infinite; }
        .rec-badge-busy { background: #fef3c7; color: #92400e; }
        .rec-badge-err  { background: #fee2e2; color: #991b1b; }
        @keyframes rec-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

        /* Toggle façon Apple (rappel SMS automatique) — ajout 03/07/2026 */
        .apple-toggle { position: relative; display: inline-block; width: 51px; height: 31px; flex-shrink: 0; }
        .apple-toggle input { opacity: 0; width: 0; height: 0; }
        .apple-toggle .slider {
            position: absolute; cursor: pointer; inset: 0;
            background-color: #e5e7eb; transition: background-color .2s; border-radius: 999px;
        }
        .apple-toggle .slider::before {
            content: ""; position: absolute; height: 27px; width: 27px; left: 2px; bottom: 2px;
            background-color: white; transition: transform .2s; border-radius: 50%;
            box-shadow: 0 1px 3px rgba(0,0,0,.3);
        }
        .apple-toggle input:checked + .slider { background-color: #34c759; }
        .apple-toggle input:checked + .slider::before { transform: translateX(20px); }
        .header-title {
            color: var(--header-title-color);
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
        }
        .header-icon {
            color: var(--header-icon-color);
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
        }
        .theme-toggle-track {
            cursor: pointer;
            width: 60px;
            height: 32px;
            border-radius: 9999px;
            background-color: rgba(0, 0, 0, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.3);
            display: flex;
            align-items: center;
            padding: 4px;
            transition: background-color 0.3s ease;
        }
        .dark .theme-toggle-track {
            background-color: rgba(255, 255, 255, 0.2);
        }
        .theme-toggle-knob {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background-color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.3s ease;
        }
        .dark .theme-toggle-knob {
            transform: translateX(28px);
        }
        @media (max-width: 768px) {
            .grid.md\:grid-cols-2 {
                grid-template-columns: 1fr;
            }
            .action-btn {
                width: 100%;
                margin-bottom: 0.5rem;
            }
            .flex.flex-nowrap {
                flex-wrap: wrap;
                gap: 0.5rem;
            }
            .header-title {
                font-size: 2.5rem;
            }
            .header-icon {
                font-size: 3rem;
            }
        }
        @media (max-width: 640px) {
            .text-4xl {
                font-size: 2rem;
            }
            .text-xl {
                font-size: 1rem;
            }
            .session-text-card {
                padding: 1rem;
            }
            .header-title {
                font-size: 2rem;
            }
            .header-icon {
                font-size: 2.5rem;
            }
        }
        @media print {
            body {
                background: white !important;
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
                color-adjust: exact !important;
                margin: 0 !important;
                padding: 0.75cm !important;
            }
            #therapist-footer {
                position: fixed;
                bottom: 15px;
                left: 0;
                right: 0;
                width: 100%;
                z-index: 100;
            }
            .no-print { display: none !important; }
            .print\:block { display: block !important; }
            .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
            .bg-blue-100 { background-color: #dbeafe !important; }
            .border-blue-600 { border-color: #2563eb !important; }
            .text-blue-800 { color: #1e40af !important; }
            .bg-yellow-50 { background-color: #fefce8 !important; }
            .border-yellow-500 { border-color: #eab308 !important; }
            .text-yellow-800 { color: #a16207 !important; }
            .bg-gray-100 { background-color: #f3f4f6 !important; }
            .border-gray-500 { border-color: #6b7280 !important; }
            .text-gray-800 { color: #1f2937 !important; }
            .text-purple-700 { color: #6d28d9 !important; }
            .bg-orange-50 { background-color: #fff7ed !important; }
            .border-orange-500 { border-color: #f97316 !important; }
            .text-orange-800 { color: #9a3412 !important; }
            .bg-slate-50 { background-color: #f8fafc !important; }
            .border-slate-500 { border-color: #64748b !important; }
            .text-slate-800 { color: #1e293b !important; }
            .bg-red-50 { background-color: #fef2f2 !important; }
            .border-red-500 { border-color: #ef4444 !important; }
            .text-red-800 { color: #991b1b !important; }
            .bg-purple-50 { background-color: #faf5ff !important; }
            .border-purple-500 { border-color: #a855f7 !important; }
            .text-purple-800 { color: #6b21a8 !important; }
            .bg-green-50 { background-color: #f0fdf4 !important; }
            .border-green-500 { border-color: #22c55e !important; }
            .text-green-800 { color: #166534 !important; }
            .bg-indigo-50 { background-color: #eef2ff !important; }
            .border-indigo-500 { border-color: #6366f1 !important; }
            .text-indigo-800 { color: #3730a3 !important; }
            .bg-red-100 { background-color: #fee2e2 !important; }
            .border-red-600 { border-color: #dc2626 !important; }
            .text-red-600 { color: #dc2626 !important; }
            .bg-indigo-100 { background-color: #e0e7ff !important; }
            .border-indigo-600 { border-color: #4f46e5 !important; }
            .text-indigo-600 { color: #5829b0 !important; }
        }
        
        /* Therapist Protocol PDF Styles */
        .pdf-protocol-text {
            font-size: 0.8em !important;
            line-height: 1.3 !important;
        }
        .pdf-protocol-text p, .pdf-protocol-text div, .pdf-protocol-text span, .pdf-protocol-text li {
            font-size: 1em !important;
            line-height: 1.3 !important;
        }
        .pdf-protocol-text h1, .pdf-protocol-text h2, .pdf-protocol-text h3 {
            font-size: 1.1em !important;
            line-height: 1.25 !important;
        }
        .pdf-protocol-text .pdf-session-date {
            font-size: 1.2em !important;
        }
        .pdf-protocol-text .patient-name-protocol-pdf {
            font-size: 1.8em !important;
            font-weight: 700 !important;
        }
        .pdf-protocol-text .patient-age-protocol-pdf,
        .pdf-protocol-text .patient-phone-protocol-pdf {
            font-size: 1.4em !important;
            font-weight: 700 !important;
        }
        .pdf-protocol-text .pdf-protocol-main-issue {
            font-size: 1.3em !important;
            font-weight: 700 !important;
        }
        .pdf-protocol-text #next-session-display {
            font-size: 1.8em !important;
        }


        /* Patient Summary PDF Styles */
        .pdf-summary-text {
            font-size: 0.85em !important;
            line-height: 1.3 !important;
        }
        .pdf-summary-text h1, .pdf-summary-text h2, .pdf-summary-text h3 {
            font-size: 1.35em !important;
            line-height: 1.3 !important;
        }
        .pdf-summary-text p, .pdf-summary-text div, .pdf-summary-text span, .pdf-summary-text li {
            font-size: 0.95em !important;
            line-height: 1.3 !important;
        }
        .pdf-summary-text .pdf-patient-name {
            font-size: 2.2em !important;
            font-weight: bold !important;
        }
        .pdf-summary-text .pdf-patient-age {
            font-size: 1.5em !important;
        }
        .pdf-summary-text .pdf-patient-phone {
            font-size: 1.8em !important;
            font-weight: bold !important;
        }
        .pdf-summary-text .bg-red-100 p.pdf-summary-next-session-large {
            font-size: 2.2em !important;
        }
        .pdf-card-spacing {
            padding-bottom: 1.5rem !important;
        }

        /* Protocole EMDR-DSA - Textes plus gros pour l'écran web */
        #session-result .bg-blue-100 span,
        #session-result .bg-blue-100 p,
        #summary-preview .bg-blue-100 p {
            font-size: 1.3rem !important;
        }
        #session-result .bg-blue-100 span.patient-name-protocol-pdf {
            font-size: 1.8rem !important;
        }
        #summary-preview h2.no-print {
            font-size: 3rem;
        }
        #session-result .bg-blue-100 .text-xs.font-semibold.text-blue-800 {
            font-size: 1.3rem !important;
        }
        #session-result .bg-blue-100 .patient-name-protocol-pdf {
            font-size: 2rem !important;
        }
        #session-result .bg-blue-100 p.text-xs.font-semibold.text-blue-800 {
            font-size: 1.4rem !important;
        }
        
        /* Tous les textes du protocole plus grands */
        #session-result .bg-white p,
        #session-result .bg-white div {
            font-size: 1.2rem !important;
        }
        
        /* Instructions et étapes du protocole */
        #session-result .text-base {
            font-size: 1.3rem !important;
        }
        
        /* Titres des sections du protocole */
        #session-result h3 {
            font-size: 1.4rem !important;
        }
        
        /* SYNTHÈSE PATIENT - Textes plus gros pour l'écran web */
        #summary-preview .pdf-patient-name,
        #summary-preview .text-lg {
            font-size: 1.5rem !important;
        }
        
        #summary-preview .text-base {
            font-size: 1.2rem !important;
        }
        
        #summary-preview .text-sm {
            font-size: 1.1rem !important;
        }
        
        #summary-preview .text-xs {
            font-size: 1rem !important;
        }
        
        #summary-preview h3 {
            font-size: 1.3rem !important;
        }
        
        #summary-preview p {
            font-size: 1.1rem !important;
        }
        
        #summary-preview .pdf-summary-next-session-large {
            font-size: 1.8rem !important;
        }

        /* Modal Styles */
        
        .modal {
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .modal.hidden {
            display: none !important;
        }
        .modal-content {
            background-color: var(--card-bg);
            padding: 2rem;
            border-radius: 0.75rem;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            width: 90%;
            max-width: 600px;
            max-height: 90%;
            overflow-y: auto;
            position: relative;
        }
        .close-button {
            position: absolute;
            top: 1rem;
            right: 1rem;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--text-muted);
        }
        .close-button:hover {
            color: var(--text-color);
        }
        #modal-message pre, #edit-modal-textarea {
            background-color: #f9fafb;
            color: #333;
            font-size: 1rem;
            white-space: pre-wrap;
            word-wrap: break-word;
            padding: 0.75rem;
            border: 1px solid #e2e8f0;
            border-radius: 0.25rem;
            width: 100%;
            min-height: 150px;
        }
        /* Updated modal text color for dark mode */
        .dark #modal-message,
        .dark #confirm-modal-message,
        .dark #edit-modal-title {
            color: white !important; /* Ensures text is clearly visible */
        }
        .dark #modal-message pre,
        .dark #edit-modal-textarea {
            background-color: #4b5563;
            color: white !important; /* Changed to white for better readability */
            border-color: #6b7280;
        }