/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */
/* SPDX-License-Identifier: MIT-0 */
/* ==========================================================================
           RESET & BASE STYLES
           ========================================================================== */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* ==========================================================================
           UNIFIED DESIGN SYSTEM - Typography & Colors
           ========================================================================== */
        
        /* DESIGN TOKENS:
           
           Typography Scale:
           - text-xs: 11px (labels, captions)
           - text-sm: 12px (secondary text)
           - text-base: 14px (body text)
           - text-lg: 16px (headings)
           - text-xl: 18px (large headings)
           
           Font Weights:
           - font-normal: 400 (body text)
           - font-medium: 500 (emphasis)
           - font-semibold: 600 (subheadings)
           - font-bold: 700 (headings)
           
           Color Palette:
           - Primary: #374151 (main text)
           - Secondary: #6b7280 (secondary text)
           - Muted: #9ca3af (tertiary text)
           - Accent: #8b5cf6 (interactive elements)
           - Success: #10b981 (positive states)
           - Warning: #f59e0b (warning states)
           - Danger: #ef4444 (error states)
           
           Backgrounds:
           - Main: #fafafa
           - Card: #ffffff
           - Hover: rgba(139, 92, 246, 0.02-0.04)
        */
        
        /* Base Typography */
        html {
            scroll-behavior: smooth;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
            background: #fafafa;
            color: #374151;
            font-size: 14px;
            line-height: 1.5;
            overflow-x: hidden;
        }

        /* Unified Typography Scale */
        .text-xs { font-size: 11px; line-height: 1.3; }
        .text-sm { font-size: 12px; line-height: 1.4; }
        .text-base { font-size: 14px; line-height: 1.5; }
        .text-lg { font-size: 16px; line-height: 1.5; }
        .text-xl { font-size: 18px; line-height: 1.4; }

        /* Font Weights */
        .font-normal { font-weight: 400; }
        .font-medium { font-weight: 500; }
        .font-semibold { font-weight: 600; }
        .font-bold { font-weight: 700; }

        /* Unified Color System */
        .text-primary { color: #374151; }
        .text-secondary { color: #6b7280; }
        .text-muted { color: #9ca3af; }
        .text-accent { color: #8b5cf6; }
        .text-success { color: #10b981; }
        .text-warning { color: #f59e0b; }
        .text-danger { color: #ef4444; }

        /* ==========================================================================
           LAYOUT - FULL WIDTH HEADERS
           ========================================================================== */
        .full-width-headers {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            z-index: 100;
        }

        .top-nav {
            background: #ffffff;
            color: #374151;
            padding: 8px 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 12px;
            font-weight: 400;
            width: 100%;
            border-bottom: 1px solid #d0d0d0;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

        .main-header {
            background: #f8f8f8;
            color: #374151;
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 20px;
            width: 100%;
            border-bottom: 1px solid #d0d0d0;
        }

        /* ==========================================================================
           NAVIGATION COMPONENTS
           ========================================================================== */
        .top-nav-left {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .top-nav-right {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 600;
            font-size: 14px;
            color: #374151;
        }

        .logo-icon {
            width: 24px;
            height: 24px;
            background: #495057;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 14px;
        }

        .nav-item {
            color: #6b7280;
            text-decoration: none;
            font-size: 12px;
            font-weight: 400;
            transition: color 0.2s ease;
        }

        .nav-item:hover {
            color: #374151;
        }

        /* User Dropdown Styling */
        .user-dropdown {
            display: flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 4px;
            transition: all 0.2s ease;
        }

        .user-dropdown:hover {
            background: rgba(0, 0, 0, 0.05);
        }

        .user-name {
            font-size: 12px;
            font-weight: 500;
            color: #374151;
        }

        .dropdown-arrow {
            width: 14px;
            height: 14px;
            color: #6b7280;
            transition: transform 0.2s ease;
        }

        .user-dropdown:hover .dropdown-arrow {
            transform: translateY(1px);
        }

        /* ==========================================================================
           PATIENT INFO & HEADER ACTIONS
           ========================================================================== */
        .patient-info {
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .patient-avatar {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            color: white;
            overflow: hidden;
            background: #495057;
            flex-shrink: 0;
            position: relative;
        }

        .patient-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 50%;
            position: relative;
            z-index: 1;
        }

        .patient-details {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 14px;
            font-weight: 400;
            color: #6b7280;
        }
        
        .patient-details strong {
            font-weight: 700;
            font-size: 18px;
            color: #1f2937;
        }

        .patient-mrn {
            font-size: 14px;
            font-weight: 400;
            color: #9ca3af;
        }

        .patient-demographics {
            font-size: 14px;
            font-weight: 400;
            color: #9ca3af;
        }

        .patient-status-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 3px 8px;
            background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
            color: #059669;
            border-radius: 6px;
            font-size: 11px;
            font-weight: 600;
        }

        .patient-status-badge.allergies {
            background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
            color: #dc2626;
        }

        .header-actions {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-left: auto;
        }

        .start-consultation-btn {
            background: linear-gradient(135deg, 
                rgba(139, 92, 246, 0.7) 0%,
                rgba(124, 58, 237, 0.75) 25%,
                rgba(139, 92, 246, 0.7) 50%,
                rgba(124, 58, 237, 0.75) 75%,
                rgba(139, 92, 246, 0.7) 100%);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            color: white;
            border: 2px solid transparent;
            background-image: 
                linear-gradient(135deg, 
                    rgba(139, 92, 246, 0.7) 0%,
                    rgba(124, 58, 237, 0.75) 25%,
                    rgba(139, 92, 246, 0.7) 50%,
                    rgba(124, 58, 237, 0.75) 75%,
                    rgba(139, 92, 246, 0.7) 100%),
                linear-gradient(135deg, 
                    rgba(139, 92, 246, 0.4) 0%,
                    rgba(255, 255, 255, 0.2) 25%,
                    rgba(124, 58, 237, 0.4) 50%,
                    rgba(255, 255, 255, 0.2) 75%,
                    rgba(139, 92, 246, 0.4) 100%);
            background-origin: padding-box, border-box;
            background-clip: padding-box, border-box;
            padding: 10px 20px;
            border-radius: 12px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            box-shadow: 
                0 8px 24px rgba(139, 92, 246, 0.25),
                0 4px 12px rgba(124, 58, 237, 0.2),
                0 2px 6px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.2),
                inset 0 -1px 0 rgba(139, 92, 246, 0.1);
            position: relative;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        }

        .start-consultation-btn::before {
            content: '';
            position: absolute;
            top: -2px;
            left: -2px;
            right: -2px;
            bottom: -2px;
            background: linear-gradient(135deg, 
                rgba(139, 92, 246, 0.5) 0%,
                rgba(255, 255, 255, 0.3) 25%,
                rgba(124, 58, 237, 0.5) 50%,
                rgba(255, 255, 255, 0.3) 75%,
                rgba(139, 92, 246, 0.5) 100%);
            border-radius: 14px;
            z-index: -1;
            opacity: 0;
            transition: opacity 0.3s ease;
            animation: subtleGlow 4s ease-in-out infinite;
        }

        @keyframes subtleGlow {
            0%, 100% { 
                opacity: 0.2;
                filter: blur(1px);
            }
            50% { 
                opacity: 0.4;
                filter: blur(2px);
            }
        }

        .start-consultation-btn:hover {
            transform: translateY(-2px) scale(1.01);
            box-shadow: 
                0 12px 32px rgba(139, 92, 246, 0.3),
                0 6px 16px rgba(124, 58, 237, 0.25),
                0 3px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.3),
                inset 0 -1px 0 rgba(139, 92, 246, 0.2);
            background: linear-gradient(135deg, 
                rgba(139, 92, 246, 0.8) 0%,
                rgba(124, 58, 237, 0.85) 25%,
                rgba(139, 92, 246, 0.8) 50%,
                rgba(124, 58, 237, 0.85) 75%,
                rgba(139, 92, 246, 0.8) 100%);
        }

        .start-consultation-btn:hover::before {
            opacity: 0.6;
        }

        .start-consultation-btn:active {
            transform: translateY(-1px) scale(1.005);
            box-shadow: 
                0 6px 16px rgba(139, 92, 246, 0.25),
                0 3px 8px rgba(124, 58, 237, 0.2),
                0 1px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.2),
                inset 0 -1px 0 rgba(139, 92, 246, 0.1);
        }

        .start-consultation-btn .consultation-icon {
            width: 18px;
            height: 18px;
            filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.05));
        }

        /* Stop Consultation State Styling */
        .start-consultation-btn.stop-state {
            background: linear-gradient(135deg, 
                rgba(252, 165, 165, 0.8) 0%,
                rgba(248, 113, 113, 0.85) 25%,
                rgba(252, 165, 165, 0.8) 50%,
                rgba(248, 113, 113, 0.85) 75%,
                rgba(252, 165, 165, 0.8) 100%);
            background-image: 
                linear-gradient(135deg, 
                    rgba(252, 165, 165, 0.8) 0%,
                    rgba(248, 113, 113, 0.85) 25%,
                    rgba(252, 165, 165, 0.8) 50%,
                    rgba(248, 113, 113, 0.85) 75%,
                    rgba(252, 165, 165, 0.8) 100%),
                linear-gradient(135deg, 
                    rgba(252, 165, 165, 0.5) 0%,
                    rgba(255, 255, 255, 0.3) 25%,
                    rgba(248, 113, 113, 0.5) 50%,
                    rgba(255, 255, 255, 0.3) 75%,
                    rgba(252, 165, 165, 0.5) 100%);
            box-shadow: 
                0 12px 40px rgba(252, 165, 165, 0.3),
                0 6px 20px rgba(248, 113, 113, 0.2),
                0 3px 10px rgba(0, 0, 0, 0.15),
                inset 0 2px 0 rgba(255, 255, 255, 0.3),
                inset 0 -1px 0 rgba(252, 165, 165, 0.2);
        }

        .start-consultation-btn.stop-state::before {
            background: linear-gradient(135deg, 
                rgba(252, 165, 165, 0.6) 0%,
                rgba(255, 255, 255, 0.4) 25%,
                rgba(248, 113, 113, 0.6) 50%,
                rgba(255, 255, 255, 0.4) 75%,
                rgba(252, 165, 165, 0.6) 100%);
            animation: stopGlowLight 3s ease-in-out infinite;
        }

        @keyframes stopGlowLight {
            0%, 100% { 
                opacity: 0.3;
                filter: blur(1px);
            }
            50% { 
                opacity: 0.6;
                filter: blur(2px);
            }
        }

        .start-consultation-btn.stop-state:hover {
            background: linear-gradient(135deg, 
                rgba(252, 165, 165, 0.9) 0%,
                rgba(248, 113, 113, 0.95) 25%,
                rgba(252, 165, 165, 0.9) 50%,
                rgba(248, 113, 113, 0.95) 75%,
                rgba(252, 165, 165, 0.9) 100%);
            box-shadow: 
                0 16px 56px rgba(252, 165, 165, 0.4),
                0 8px 28px rgba(248, 113, 113, 0.3),
                0 4px 14px rgba(0, 0, 0, 0.2),
                inset 0 2px 0 rgba(255, 255, 255, 0.4),
                inset 0 -1px 0 rgba(252, 165, 165, 0.3);
        }

        /* Disabled Consultation State Styling */
        .start-consultation-btn.disabled-state {
            background: linear-gradient(135deg, 
                #9ca3af 0%,
                #6b7280 25%,
                #9ca3af 50%,
                #6b7280 75%,
                #9ca3af 100%);
            color: #ffffff;
            cursor: not-allowed;
            pointer-events: none;
            box-shadow: 
                0 4px 12px rgba(107, 114, 128, 0.15),
                0 2px 6px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            transform: none;
            opacity: 1;
        }

        .start-consultation-btn.disabled-state::before {
            display: none; /* Remove glow animation */
        }

        .start-consultation-btn.disabled-state svg {
            color: #ffffff;
            stroke: #ffffff;
            opacity: 1;
        }

        .start-consultation-btn.disabled-state:hover {
            transform: none;
            box-shadow: 
                0 4px 12px rgba(107, 114, 128, 0.15),
                0 2px 6px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            background: linear-gradient(135deg, 
                #9ca3af 0%,
                #6b7280 25%,
                #9ca3af 50%,
                #6b7280 75%,
                #9ca3af 100%);
        }

        .consultation-icon {
            width: 16px;
            height: 16px;
        }

        .actions-btn {
            background: #f8f9fa;
            border: 1px solid #dee2e6;
            color: #6b7280;
            padding: 8px 16px;
            border-radius: 6px;
            font-size: 12px;
            font-weight: 500;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            transition: all 0.2s ease;
            cursor: pointer;
        }

        .actions-btn:hover {
            background: #e9ecef;
            border-color: #adb5bd;
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
        }

        .actions-btn:active {
            transform: translateY(0);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        /* ==========================================================================
           PATIENT PORTAL BACKGROUND (70% WIDTH)
           ========================================================================== */
        .patient-portal-background {
            width: 70%;
            min-height: 100vh;
            position: fixed;
            left: 0;
            top: 120px;
            z-index: 1;
            padding-bottom: 80px; /* Space for chat input */
            background: #fafafa;
        }

        .tab-nav {
            background: white;
            border-bottom: 1px solid #ddd;
            padding: 0 16px;
            display: flex;
            gap: 20px;
            position: relative;
            z-index: 10;
        }

        .tab {
            padding: 12px 0;
            color: #6b7280;
            text-decoration: none;
            border-bottom: 2px solid transparent;
            font-size: 13px;
            font-weight: 500;
            transition: all 0.2s ease;
            line-height: 1.4;
        }

        .tab.active {
            color: #374151;
            font-weight: 600;
            border-bottom-color: #374151;
        }

        .tab:hover {
            color: #374151;
            font-weight: 500;
        }

        .main-content {
            display: flex;
            height: calc(100vh - 124px);
        }

        /* ==========================================================================
           SIDEBAR
           ========================================================================== */
        .sidebar {
            width: 60px;
            background: #ffffff;
            color: #333;
            overflow-y: auto;
            border-right: 1px solid #d0d0d0;
        }

        .sidebar-nav {
            list-style: none;
        }

        .sidebar-nav li {
            border-bottom: 1px solid #f0f0f0;
        }

        .sidebar-nav a {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 16px 0;
            color: #6b7280;
            text-decoration: none;
            font-size: 16px;
            transition: all 0.2s ease;
        }

        .sidebar-nav a:hover,
        .sidebar-nav a.active {
            background: #f0f0f0;
            color: #374151;
        }

        .sidebar-icon {
            width: 20px;
            height: 20px;
            text-align: center;
            font-size: 18px;
        }

        /* ==========================================================================
           CONTENT AREA
           ========================================================================== */
        /* ==========================================================================
           CONTENT AREA - Consistent Typography
           ========================================================================== */
        .content-area {
            flex: 1;
            display: flex;
            background: #ffffff;
        }

        .section-subheader {
            font-weight: 600;
            color: #8b5cf6;
            font-size: 12px;
            margin-bottom: 8px;
            margin-top: 12px;
        }

        .section-subheader:first-child {
            margin-top: 0;
        }

        .section-detail {
            font-size: 12px;
            color: #6b7280;
            font-weight: 400;
        }

        .section-note {
            font-size: 11px;
            color: #9ca3af;
            font-weight: 400;
        }

        .left-panel {
            width: 300px;
            border-right: 1px solid #ddd;
            overflow-y: auto;
        }

        .right-panel {
            flex: 1;
            padding: 16px;
            background: #f8f8f8;
        }

        .section {
            border-bottom: 1px solid #eee;
        }

        .section-header {
            background: #f8f8f8;
            color: #374151;
            padding: 8px 12px;
            font-weight: 600;
            font-size: 12px;
            display: flex;
            align-items: center;
            gap: 8px;
            border-bottom: 1px solid #e0e0e0;
        }

        .section-content {
            padding: 12px;
        }

        .flowsheet-item,
        .diagnosis-item,
        .allergy-item,
        .medication-item {
            padding: 6px 0;
            font-size: 12px;
            font-weight: 400;
            color: #6b7280;
            border-bottom: 1px solid #f0f0f0;
            transition: all 0.2s ease;
        }

        .diagnosis-item {
            color: #374151;
            cursor: pointer;
        }

        .diagnosis-item:hover {
            text-decoration: underline;
        }

        .allergy-severity {
            display: inline-block;
            padding: 2px 6px;
            border-radius: 3px;
            font-size: 10px;
            margin-left: 8px;
        }

        .severity-mild {
            background: #f39c12;
            color: white;
        }

        .severity-moderate {
            background: #e67e22;
            color: white;
        }

        /* Text blur effect for patient portal background */
        .patient-portal-background .patient-detail,
        .patient-portal-background .diagnosis-item,
        .patient-portal-background .allergy-item,
        .patient-portal-background .medication-item,
        .patient-portal-background .flowsheet-item,
        .patient-portal-background .section-content div {
            filter: blur(1.5px);
            transition: filter 0.2s ease;
        }

        /* Un-blur EHR details on hover to allow readable details */
        .patient-portal-background:hover .patient-detail,
        .patient-portal-background:hover .diagnosis-item,
        .patient-portal-background:hover .allergy-item,
        .patient-portal-background:hover .medication-item,
        .patient-portal-background:hover .flowsheet-item,
        .patient-portal-background:hover .section-content div {
            filter: blur(0px);
        }

        /* ==========================================================================
           PREVISIT IFRAME OVERLAY (30% WIDTH)
           ========================================================================== */
        .previsit-overlay {
            position: fixed;
            top: 120px;
            right: 0;
            width: 30vw;
            height: calc(100vh - 120px);
            z-index: 1000;
            background: #f8f8f8;
            border-radius: 0;
            box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
            border-left: 3px solid transparent;
            background-image: 
                linear-gradient(#f8f8f8, #f8f8f8),
                linear-gradient(180deg, 
                    rgba(139, 92, 246, 0.3) 0%,
                    rgba(59, 130, 246, 0.3) 25%,
                    rgba(16, 185, 129, 0.3) 50%,
                    rgba(59, 130, 246, 0.3) 75%,
                    rgba(139, 92, 246, 0.3) 100%);
            background-origin: padding-box, border-box;
            background-clip: padding-box, border-box;
            user-select: none;
            transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                        box-shadow 0.3s ease;
            display: block;
            transform: translateX(0);
        }

        .previsit-overlay.dragging {
            transition: none;
            box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
        }

        .previsit-overlay.fullwidth {
            box-shadow: none;
            border-left: none;
        }

        .previsit-overlay.fullwidth::before {
            opacity: 0;
        }

        .previsit-overlay.active {
            display: block;
        }

        /* Popped-out state */
        .previsit-overlay.popped-out {
            width: 800px !important;
            height: 85vh !important;
            max-height: 900px !important;
            border-radius: 20px !important;
            box-shadow: 
                0 25px 70px rgba(0, 0, 0, 0.25),
                0 10px 30px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset !important;
            border: 4px solid transparent;
            background-image: 
                linear-gradient(#f8f8f8, #f8f8f8),
                linear-gradient(135deg, 
                    rgba(139, 92, 246, 0.6) 0%,
                    rgba(59, 130, 246, 0.6) 25%,
                    rgba(16, 185, 129, 0.6) 50%,
                    rgba(59, 130, 246, 0.6) 75%,
                    rgba(139, 92, 246, 0.6) 100%);
            background-origin: padding-box, border-box;
            background-clip: padding-box, border-box;
            z-index: 10001 !important;
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
            overflow: hidden;
        }

        .previsit-overlay.popped-out.dragging {
            transition: none !important;
        }

        /* Remove the left-only gradient when popped out */
        .previsit-overlay.popped-out::before {
            display: none !important;
        }

        .previsit-overlay.popped-out::after {
            display: none; /* Remove resize handle when popped out */
        }

        .previsit-overlay.popped-out .previsit-header {
            cursor: move !important;
            border-radius: 16px 16px 0 0 !important;
        }

        .previsit-overlay.popped-out .previsit-iframe-container {
            border-radius: 0 0 16px 16px !important;
            overflow: hidden;
        }

        .previsit-overlay.popped-out .previsit-iframe {
            border-radius: 0 0 16px 16px !important;
        }

        /* Change icon when popped out */
        .previsit-overlay.popped-out .popout-btn .icon {
            transform: rotate(180deg);
            transition: transform 0.3s ease;
        }

        /* Smooth icon transition */
        .popout-btn .icon {
            transition: transform 0.3s ease;
        }

        /* ==========================================================================
           POPOUT BACKDROP - Darkens background when iframe is popped out
           ========================================================================== */
        .popout-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            z-index: 10000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            pointer-events: none;
        }

        .popout-backdrop.active {
            opacity: 1;
            visibility: visible;
        }

        /* Ensure popped-out overlay is above backdrop */
        .previsit-overlay.popped-out {
            z-index: 10001 !important;
        }

        .previsit-overlay::before {
            content: '';
            position: absolute;
            left: -3px;
            top: 0;
            bottom: 0;
            width: 3px;
            background: linear-gradient(180deg, 
                rgba(139, 92, 246, 0.4) 0%,
                rgba(59, 130, 246, 0.4) 25%,
                rgba(16, 185, 129, 0.4) 50%,
                rgba(59, 130, 246, 0.4) 75%,
                rgba(139, 92, 246, 0.4) 100%);
            animation: aiGradientFlow 8s ease-in-out infinite;
            pointer-events: none;
            transition: all 0.3s ease;
        }

        .previsit-overlay.resizing::before {
            width: 4px;
            left: -4px;
            box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
        }

        /* Resize handle overlay on the gradient border */
        .previsit-overlay::after {
            content: '';
            position: absolute;
            left: -8px;
            top: 0;
            bottom: 0;
            width: 16px;
            cursor: ew-resize;
            z-index: 10;
            transition: all 0.2s ease;
        }

        .previsit-overlay:not(.resizing)::after:hover {
            background: linear-gradient(90deg, 
                transparent 0%, 
                rgba(139, 92, 246, 0.12) 50%, 
                transparent 100%);
        }

        .previsit-overlay:not(.resizing):hover::before {
            width: 4px;
            left: -4px;
            box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
        }

        .previsit-overlay.resizing::after {
            left: -100vw;
            width: 100vw;
            cursor: ew-resize;
            background: rgba(139, 92, 246, 0.02);
        }

        @keyframes aiGradientFlow {
            0%, 100% { 
                background: linear-gradient(180deg, 
                    rgba(139, 92, 246, 0.4) 0%,
                    rgba(59, 130, 246, 0.4) 25%,
                    rgba(16, 185, 129, 0.4) 50%,
                    rgba(59, 130, 246, 0.4) 75%,
                    rgba(139, 92, 246, 0.4) 100%);
            }
            50% { 
                background: linear-gradient(180deg, 
                    rgba(59, 130, 246, 0.5) 0%,
                    rgba(16, 185, 129, 0.5) 25%,
                    rgba(139, 92, 246, 0.5) 50%,
                    rgba(16, 185, 129, 0.5) 75%,
                    rgba(59, 130, 246, 0.5) 100%);
            }
        }

        .previsit-overlay:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
        }

        .previsit-overlay.dragging {
            box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
            z-index: 1001;
        }

        /* ==========================================================================
           PREVISIT HEADER
           ========================================================================== */
        .previsit-header {
            background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
            color: #1f2937;
            padding: 16px 20px;
            border-radius: 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: grab;
            position: relative;
            border-bottom: 1px solid #f1f5f9;
            backdrop-filter: blur(10px);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        }

        .previsit-header:active {
            cursor: grabbing;
        }

        /* Subtle hint for double-click to reset */
        .previsit-overlay:not([style*="width: 30vw"]) .previsit-header::after,
        .previsit-overlay[style*="translateX"] .previsit-header::after {
            content: 'Double-click to reset';
            position: absolute;
            bottom: -24px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 11px;
            color: #9ca3af;
            background: rgba(255, 255, 255, 0.95);
            padding: 4px 10px;
            border-radius: 6px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
            white-space: nowrap;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            z-index: 100;
        }

        .previsit-overlay:not([style*="width: 30vw"]):hover .previsit-header::after,
        .previsit-overlay[style*="translateX"]:hover .previsit-header::after {
            opacity: 1;
        }

        .previsit-title {
            font-size: 15px;
            font-weight: 600;
            color: #374151;
            letter-spacing: 0.3px;
            display: flex;
            align-items: center;
            gap: 10px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
            position: relative;
            padding: 2px 0;
        }

        .previsit-title::before {
            content: '';
            width: 6px;
            height: 6px;
            background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #3b82f6 100%);
            border-radius: 50%;
            animation: aiPulseModern 3s ease-in-out infinite;
            box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
            flex-shrink: 0;
        }

        @keyframes aiPulseModern {
            0%, 100% { 
                opacity: 0.7; 
                transform: scale(1);
                box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
            }
            50% { 
                opacity: 1; 
                transform: scale(1.3);
                box-shadow: 0 0 12px rgba(139, 92, 246, 0.6), 0 0 20px rgba(139, 92, 246, 0.3);
            }
        }

        .previsit-controls {
            display: flex;
            gap: 4px;
            align-items: center;
        }

        /* ==========================================================================
           GOOGLE-STYLE ICON BUTTONS
           ========================================================================== */
        .google-icon-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: none;
            outline: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
            background: transparent;
            color: #5f6368;
            position: relative;
            overflow: hidden;
            box-shadow: none;
        }

        .google-icon-btn:focus {
            outline: none;
            box-shadow: none;
        }

        .google-icon-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: #f1f3f4;
            border-radius: 50%;
            opacity: 0;
            transform: scale(0.8);
            transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
        }

        .google-icon-btn:hover::before {
            opacity: 0;
            transform: scale(1);
        }

        .google-icon-btn:hover {
            color: #5f6368;
        }

        .google-icon-btn:active::before {
            background: #e8eaed;
        }

        .google-icon-btn svg {
            position: relative;
            z-index: 1;
            transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        }

        .google-icon-btn:hover svg {
            transform: none;
        }

        .google-icon-btn .icon {
            width: 20px;
            height: 20px;
        }

        .google-icon-btn:hover .icon {
            color: #5f6368;
            transform: none;
        }

        /* ==========================================================================
           IFRAME CONTAINER
           ========================================================================== */
        .previsit-iframe-container {
            width: 100%;
            height: calc(100% - 44px);
            border-radius: 0;
            overflow: hidden;
            position: relative;
            background: linear-gradient(135deg, 
                rgba(116, 185, 255, 0.03) 0%, 
                rgba(162, 155, 254, 0.03) 25%, 
                rgba(255, 255, 255, 0.01) 50%, 
                rgba(162, 155, 254, 0.03) 75%, 
                rgba(116, 185, 255, 0.03) 100%);
            transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        }

        .previsit-iframe-container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(45deg, 
                transparent 0%, 
                rgba(116, 185, 255, 0.02) 25%, 
                transparent 50%, 
                rgba(162, 155, 254, 0.02) 75%, 
                transparent 100%);
            pointer-events: none;
            z-index: 1;
            animation: aiGlow 8s ease-in-out infinite;
        }

        @keyframes aiGlow {
            0%, 100% { opacity: 0.3; }
            50% { opacity: 0.6; }
        }

        .previsit-iframe {
            width: 100%;
            height: 100%;
            border: none;
            display: block;
            border-radius: 0;
        }

        .resize-handle {
            display: none;
        }

        /* ==========================================================================
           IFRAME STATES - MINIMIZED & MAXIMIZED
           ========================================================================== */
        .minimized {
            height: 44px !important;
            bottom: 20px !important;
            right: 0px !important;
            top: auto !important;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
            border-radius: 0;
            overflow: hidden;
        }

        .minimized .previsit-iframe-container {
            display: none;
        }

        .minimized .resize-handle {
            display: none;
        }

        .minimized .previsit-header {
            border-radius: 0;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
        }

        .minimized .previsit-header:hover {
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .minimized .previsit-title {
            font-size: 14px;
            color: #374151;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .minimized .previsit-controls {
            display: flex;
            align-items: center;
        }

        .maximized {
            top: 100px !important;
            right: 0 !important;
            width: 50vw !important;
            height: calc(100vh - 100px) !important;
        }

        /* ==========================================================================
           CHAT OVERLAY
           ========================================================================== */
        .chat-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            z-index: 2000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .chat-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        .chat-container {
            position: absolute;
            right: 20px;
            top: 50%;
            transform: translateY(-50%);
            width: 400px;
            max-height: 600px;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            border-radius: 20px;
            border: 1px solid rgba(255, 255, 255, 0.3);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .chat-header {
            padding: 20px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .chat-header-info {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .ai-avatar {
            width: 32px;
            height: 32px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .ai-pulse-avatar {
            width: 8px;
            height: 8px;
            background: white;
            border-radius: 50%;
            display: none; /* Removed pulsating dot */
        }

        /* Removed unused animation */

        .chat-title {
            font-size: 16px;
            font-weight: 500;
            color: #374151;
        }

        .chat-close {
            width: 32px;
            height: 32px;
            border: none;
            background: #f3f4f6;
            border-radius: 50%;
            cursor: pointer;
            font-size: 16px;
            font-weight: 400;
            color: #6b7280;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
        }

        .chat-close:hover {
            background: #e5e7eb;
            color: #374151;
        }

        .chat-messages {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
            max-height: 400px;
        }

        .message {
            margin-bottom: 16px;
        }

        .ai-message .message-content {
            background: #f8fafc;
            color: #374151;
            padding: 12px 16px;
            border-radius: 16px 16px 16px 4px;
            font-size: 14px;
            font-weight: 400;
            line-height: 1.5;
            border: 1px solid #f1f5f9;
        }

        .chat-input-container {
            padding: 20px;
            border-top: 1px solid rgba(0, 0, 0, 0.05);
            display: flex;
            gap: 12px;
        }

        .chat-input {
            flex: 1;
            padding: 12px 16px;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 400;
            outline: none;
            transition: border-color 0.2s ease;
        }

        .chat-input:focus {
            border-color: #667eea;
        }

        .chat-send {
            width: 44px;
            height: 44px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            border-radius: 12px;
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
        }

        .chat-send:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        .chat-send svg {
            width: 18px;
            height: 18px;
        }



        /* ==========================================================================
           CONSULTATION OVERLAY SIZE 1 - SLEEK & MODERN (MATCHES IFRAME)
           ========================================================================== */
        .consultation-overlay {
            position: fixed !important;
            top: 50% !important;
            left: 50% !important;
            transform: translate(-50%, -50%) !important;
            width: 70vw;
            max-width: 800px;
            height: 80vh;
            max-height: 600px;
            background: linear-gradient(135deg, 
                rgba(255, 255, 255, 0.98) 0%, 
                rgba(248, 250, 252, 0.98) 100%);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: 24px;
            border: 1px solid rgba(255, 255, 255, 0.4);
            box-shadow: 
                0 25px 50px rgba(0, 0, 0, 0.08),
                0 15px 35px rgba(0, 0, 0, 0.05),
                0 5px 15px rgba(0, 0, 0, 0.03),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
            z-index: 3000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
            position: relative;
            overflow: hidden;
        }

        .consultation-overlay::before {
            content: '';
            position: absolute;
            top: -1px;
            left: -1px;
            right: -1px;
            bottom: -1px;
            background: linear-gradient(135deg, 
                rgba(139, 92, 246, 0.15) 0%,
                rgba(255, 255, 255, 0.1) 25%,
                rgba(16, 185, 129, 0.15) 50%,
                rgba(255, 255, 255, 0.1) 75%,
                rgba(139, 92, 246, 0.15) 100%);
            border-radius: 21px;
            z-index: -1;
            opacity: 0;
            animation: brandGlow 3s ease-in-out infinite;
        }

        @keyframes brandGlow {
            0%, 100% { opacity: 0.3; }
            50% { opacity: 0.6; }
        }

        .consultation-overlay::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: radial-gradient(circle at 25% 25%, 
                rgba(139, 92, 246, 0.04) 0%,
                transparent 50%),
                radial-gradient(circle at 75% 75%, 
                rgba(16, 185, 129, 0.04) 0%,
                transparent 50%);
            border-radius: 20px;
            pointer-events: none;
            animation: subtleShimmer 4s ease-in-out infinite;
        }

        @keyframes subtleShimmer {
            0%, 100% { opacity: 0.4; }
            50% { opacity: 0.8; }
        }

        .consultation-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        /* ==========================================================================
           CONSENT REMINDER STYLING - Clean & Delightful
           ========================================================================== */
        .consent-reminder-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 32px;
            max-width: 420px;
            width: 100%;
            padding: 40px;
            text-align: center;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
        }

        .consent-icon {
            width: 64px;
            height: 64px;
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            border: 1px solid #e2e8f0;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #64748b;
            box-shadow: 0 4px 12px rgba(100, 116, 139, 0.08);
        }

        .consent-header {
            margin-bottom: 8px;
        }

        .consent-header h2 {
            font-size: 24px;
            font-weight: 600;
            white-space: nowrap;
            color: #1e293b;
            margin: 0 0 16px 0;
            letter-spacing: -0.3px;
            line-height: 1.2;
        }

        .consent-header p {
            font-size: 16px;
            color: #475569;
            margin: 0;
            line-height: 1.5;
            font-weight: 400;
            font-style: italic;
            padding: 0 20px;
        }

        .consent-benefits {
            display: flex;
            flex-direction: column;
            gap: 16px;
            width: 100%;
            max-width: 320px;
        }

        .benefit-simple {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 15px;
            color: #334155;
            font-weight: 400;
            text-align: left;
        }

        .benefit-icon {
            color: #10b981;
            flex-shrink: 0;
            stroke-width: 2;
        }

        .benefit-dot {
            width: 6px;
            height: 6px;
            background: #10b981;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .consent-actions {
            display: flex;
            gap: 16px;
            justify-content: center;
            width: 100%;
            margin-top: 8px;
        }

        .consent-btn {
            padding: 12px 24px;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            border: none;
            outline: none;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            min-width: 140px;
        }

        .cancel-consent {
            background: #ffffff;
            color: #374151;
            border: 1px solid #e5e7eb;
            font-weight: 500;
        }

        .cancel-consent:hover {
            background: #f9fafb;
            border-color: #d1d5db;
        }

        .confirm-consent {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
        }

        .confirm-consent:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
        }

        .confirm-consent:active {
            transform: translateY(0);
        }

        /* ==========================================================================
           STOP CONFIRMATION CONTENT - IN-OVERLAY STYLING
           ========================================================================== */
        .stop-confirmation-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 32px;
            max-width: 480px;
            width: 100%;
            padding: 40px;
            text-align: center;
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, sans-serif;
        }

        .stop-confirmation-icon {
            width: 64px;
            height: 64px;
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            border: 1px solid #e2e8f0;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #64748b;
            box-shadow: 0 4px 12px rgba(100, 116, 139, 0.08);
        }

        .stop-confirmation-header {
            margin-bottom: 8px;
        }

        .stop-confirmation-header h2 {
            font-size: 20px;
            font-weight: 600;
            color: #1f2937;
            margin: 0 0 12px 0;
            letter-spacing: -0.02em;
            line-height: 1.4;
        }

        .stop-confirmation-header p {
            font-size: 14px;
            color: #6b7280;
            margin: 0;
            line-height: 1.6;
            font-weight: 400;
        }

        .stop-confirmation-actions {
            display: flex;
            gap: 12px;
            justify-content: center;
            width: 100%;
        }

        .stop-confirmation-btn {
            padding: 12px 24px;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
            border: none;
            outline: none;
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 140px;
            gap: 8px;
            white-space: nowrap;
        }

        .stop-confirmation-btn svg {
            flex-shrink: 0;
        }

        .stop-confirmation-content .cancel-stop {
            background: #ffffff;
            color: #374151;
            border: 1px solid #e5e7eb;
            font-weight: 500;
        }

        .stop-confirmation-content .cancel-stop:hover {
            background: #f9fafb;
            color: #374151;
        }

        .stop-confirmation-content .confirm-stop {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
        }

        .stop-confirmation-content .confirm-stop:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
        }

        .stop-confirmation-content .confirm-stop:active {
            transform: translateY(0);
        }

        /* ==========================================================================
           PROCESSING CONTENT - IN-OVERLAY STYLING
           ========================================================================== */
        .processing-content-inline {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 32px;
            max-width: 500px;
            width: 100%;
            padding: 40px;
            text-align: center;
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, sans-serif;
        }

        .processing-content-inline .processing-spinner {
            width: 64px;
            height: 64px;
            margin: 0 auto;
            position: relative;
        }

        .processing-content-inline .spinner-ring {
            width: 64px;
            height: 64px;
            border: 3px solid #f3f4f6;
            border-top-color: #8b5cf6;
            border-radius: 50%;
            animation: spin 1.5s linear infinite;
        }

        .processing-content-inline .processing-header {
            margin-bottom: 8px;
        }

        .processing-content-inline .processing-title {
            font-size: 22px;
            font-weight: 600;
            color: #1f2937;
            margin: 0 0 12px 0;
            letter-spacing: -0.4px;
        }

        .processing-content-inline .processing-subtitle {
            font-size: 14px;
            color: #6b7280;
            margin: 0;
            font-weight: 400;
        }

        .processing-content-inline .processing-steps {
            text-align: left;
            display: flex;
            flex-direction: column;
            gap: 12px;
            width: 100%;
        }

        .processing-content-inline .processing-step {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 16px;
            background: #f9fafb;
            border-radius: 12px;
            opacity: 0.4;
            transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
            border: 1px solid transparent;
        }

        .processing-content-inline .processing-step.active {
            opacity: 1;
            background: #f3f0ff;
            border: 1px solid #e9d5ff;
        }

        .processing-content-inline .processing-step.completed {
            opacity: 1;
            background: linear-gradient(90deg, #f0fdf4 0%, #f0fdf4 35%, transparent 100%);
            border: 1px solid #bbf7d0;
        }

        .processing-content-inline .step-icon {
            width: 24px;
            height: 24px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .processing-content-inline .step-icon svg {
            width: 20px;
            height: 20px;
        }

        .processing-content-inline .processing-step .step-icon {
            color: #d1d5db;
        }

        .processing-content-inline .processing-step.active .step-icon {
            color: #8b5cf6;
        }

        .processing-content-inline .processing-step.completed .step-icon {
            color: #10b981;
        }

        .processing-content-inline .step-spinner {
            width: 16px;
            height: 16px;
            border: 2px solid #e9d5ff;
            border-top-color: #8b5cf6;
            border-radius: 50%;
            animation: spin 1.2s linear infinite;
        }

        .processing-content-inline .step-text {
            flex: 1;
            font-size: 14px;
            color: #6b7280;
            font-weight: 500;
        }

        .processing-content-inline .processing-step.active .step-text {
            color: #7c3aed;
        }

        .processing-content-inline .processing-step.completed .step-text {
            color: #059669;
        }

        /* ==========================================================================
           CONSULTATION OVERLAY SIZE 2 - Positioned in Patient Portal
           ========================================================================== */
        .consultation-overlay-size2 {
            position: fixed;
            top: 12px;
            right: 20px;
            width: 400px;
            height: 0;
            overflow: hidden;
            background: linear-gradient(135deg, 
                rgba(139, 92, 246, 0.25) 0%,
                rgba(196, 181, 253, 0.20) 20%,
                rgba(255, 255, 255, 0.95) 40%,
                rgba(255, 255, 255, 0.97) 60%,
                rgba(167, 243, 208, 0.20) 80%,
                rgba(16, 185, 129, 0.25) 100%);
            backdrop-filter: blur(24px);
            -webkit-backdrop-filter: blur(24px);
            border-radius: 14px;
            border: 1.5px solid transparent;
            background-image: 
                linear-gradient(135deg, 
                    rgba(139, 92, 246, 0.25) 0%,
                    rgba(196, 181, 253, 0.20) 20%,
                    rgba(255, 255, 255, 0.95) 40%,
                    rgba(255, 255, 255, 0.97) 60%,
                    rgba(167, 243, 208, 0.20) 80%,
                    rgba(16, 185, 129, 0.25) 100%),
                linear-gradient(135deg, 
                    rgba(139, 92, 246, 0.35) 0%,
                    rgba(255, 255, 255, 0.8) 25%,
                    rgba(16, 185, 129, 0.35) 50%,
                    rgba(255, 255, 255, 0.8) 75%,
                    rgba(139, 92, 246, 0.35) 100%);
            background-origin: padding-box, border-box;
            background-clip: padding-box, border-box;
            box-shadow: 
                0 15px 35px rgba(139, 92, 246, 0.12),
                0 8px 20px rgba(16, 185, 129, 0.08),
                0 3px 10px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.9),
                inset 0 -1px 0 rgba(139, 92, 246, 0.1);
            z-index: 10000;
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
            cursor: move;
            user-select: none;
            position: relative;
        }

        .consultation-overlay-size2::before {
            content: '';
            position: absolute;
            top: -1.5px;
            left: -1.5px;
            right: -1.5px;
            bottom: -1.5px;
            background: linear-gradient(135deg, 
                rgba(139, 92, 246, 0.3) 0%,
                rgba(255, 255, 255, 0.1) 25%,
                rgba(16, 185, 129, 0.3) 50%,
                rgba(255, 255, 255, 0.1) 75%,
                rgba(139, 92, 246, 0.3) 100%);
            border-radius: 15px;
            z-index: -1;
            opacity: 0.4;
            transition: opacity 0.3s ease;
            animation: compactBrandGlow 5s ease-in-out infinite;
        }

        @keyframes compactBrandGlow {
            0%, 100% { opacity: 0.4; }
            50% { opacity: 0.7; }
        }

        .consultation-overlay-size2:hover {
            box-shadow: 
                0 12px 48px rgba(139, 92, 246, 0.2),
                0 6px 24px rgba(16, 185, 129, 0.15),
                0 3px 12px rgba(0, 0, 0, 0.12),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
            transform: translateY(-2px);
        }

        .consultation-overlay-size2:hover::before {
            opacity: 1;
        }

        .consultation-overlay-size2.dragging {
            box-shadow: 
                0 20px 64px rgba(139, 92, 246, 0.25),
                0 10px 32px rgba(16, 185, 129, 0.2),
                0 5px 16px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
            z-index: 2001;
            transition: none;
            transform: translateY(-4px) scale(1.02);
        }

        .consultation-overlay-size2.dragging::before {
            opacity: 1;
        }

        .consultation-overlay-size2.active {
            height: 52px;
            opacity: 1;
        }

        .consultation-overlay-size2 .scribe-interface {
            padding: 12px 20px;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            flex-direction: row;
            width: 100%;
        }

        .consultation-overlay-size2 .scribe-info {
            display: flex;
            align-items: center;
            gap: 12px;
            flex: 1;
            min-width: 0;
        }

        .consultation-overlay-size2 .scribe-title {
            font-size: 14px;
            font-weight: 700;
            color: #1f2937;
            margin: 0;
            line-height: 1;
            white-space: nowrap;
            text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
        }

        .consultation-overlay-size2 .recording-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .consultation-overlay-size2 .recording-dot {
            width: 6px;
            height: 6px;
            background: #ef4444;
            border-radius: 50%;
            animation: simplePulse 2s ease-in-out infinite;
        }

        .consultation-overlay-size2 .recording-timer {
            font-size: 11px;
            color: #6b7280;
            font-weight: 500;
            font-variant-numeric: tabular-nums;
            min-width: 40px;
            white-space: nowrap;
        }

        .consultation-overlay-size2 .control-buttons {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
            pointer-events: auto;
        }

        .consultation-overlay-size2 .control-btn {
            width: 30px;
            height: 30px;
            border-radius: 7px;
            border: 1px solid rgba(255, 255, 255, 0.4);
            background: rgba(255, 255, 255, 0.9);
            color: #374151;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            position: relative;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
            pointer-events: auto;
        }

        .consultation-overlay-size2 .control-btn:hover {
            background: rgba(255, 255, 255, 1);
            border-color: rgba(255, 255, 255, 0.6);
            transform: translateY(-1px) scale(1.05);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .consultation-overlay-size2 .control-btn:active {
            transform: translateY(0) scale(0.98);
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
            transition: all 0.1s ease;
        }

        .consultation-overlay-size2 .control-btn svg {
            width: 18px;
            height: 18px;
            flex-shrink: 0;
            pointer-events: none;
            transition: transform 0.2s ease;
        }

        .consultation-overlay-size2 .control-btn:hover svg {
            transform: scale(1.1);
        }

        .consultation-overlay-size2 .control-btn:active svg {
            transform: scale(0.95);
        }

        .consultation-overlay-size2 .pause-btn {
            color: #7c3aed;
        }

        .consultation-overlay-size2 .pause-btn:hover {
            background: rgba(139, 92, 246, 0.15);
            border-color: rgba(139, 92, 246, 0.3);
            color: #6d28d9;
        }

        .consultation-overlay-size2 .stop-btn {
            color: #dc2626;
        }

        .consultation-overlay-size2 .stop-btn:hover {
            background: rgba(239, 68, 68, 0.15);
            border-color: rgba(239, 68, 68, 0.3);
            color: #b91c1c;
        }

        .consultation-overlay-size2 .maximize-btn {
            color: #6b7280;
        }

        .consultation-overlay-size2 .maximize-btn:hover {
            background: rgba(107, 114, 128, 0.15);
            border-color: rgba(107, 114, 128, 0.3);
            color: #374151;
        }

        .consultation-overlay-size2 .flag-btn {
            color: #6b7280;
        }

        .consultation-overlay-size2 .flag-btn:hover {
            background: rgba(107, 114, 128, 0.12);
            border-color: rgba(107, 114, 128, 0.25);
            color: #4b5563;
        }

        .consultation-overlay-size2 .flag-btn.flagged {
            background: rgba(107, 114, 128, 0.12);
            color: #4b5563;
            animation: flagPulse 0.3s ease-out;
        }

        /* Ripple effect for button clicks */
        .consultation-overlay-size2 .control-btn::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(0, 0, 0, 0.1);
            transform: translate(-50%, -50%);
            transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
            opacity: 0;
            pointer-events: none;
        }

        .consultation-overlay-size2 .control-btn:active::before {
            width: 100%;
            height: 100%;
            opacity: 1;
            transition: width 0.1s ease, height 0.1s ease, opacity 0.1s ease;
        }

        /* Flag Counter Badge for Size 2 Overlay */
        .consultation-overlay-size2 .flag-btn {
            position: relative;
        }

        .consultation-overlay-size2 .flag-btn::after {
            content: attr(data-flag-count);
            position: absolute;
            top: -2px;
            right: -2px;
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: white;
            font-size: 8px;
            font-weight: 600;
            line-height: 1;
            padding: 0;
            border-radius: 50%;
            width: 14px;
            height: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 
                0 2px 6px rgba(239, 68, 68, 0.4),
                0 1px 2px rgba(0, 0, 0, 0.2);
            opacity: 0;
            transform: scale(0.8);
            transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
            border: 2px solid rgba(255, 255, 255, 1);
            z-index: 15;
        }

        .consultation-overlay-size2 .flag-btn[data-flag-count]:not([data-flag-count="0"])::after {
            opacity: 1;
            transform: scale(1);
        }

        .consultation-overlay-size2 .flag-btn[data-flag-count="0"]::after {
            display: none;
        }

        @keyframes flagPulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.1); }
            100% { transform: scale(1); }
        }

        /* ==========================================================================
           FLAG NOTIFICATION POPUP STYLING - CONTEXTUAL TO EACH OVERLAY
           ========================================================================== */
        
        /* Size 1 Overlay Flag Notification - Top of overlay */
        .flag-notification-size1 {
            position: absolute;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            color: #374151;
            padding: 10px 16px;
            border-radius: 12px;
            border: 1px solid rgba(0, 0, 0, 0.06);
            box-shadow: 
                0 8px 32px rgba(0, 0, 0, 0.08),
                0 4px 16px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
            z-index: 15;
            opacity: 0;
            transform: translateX(-50%) translateY(-12px) scale(0.92);
            transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
            min-width: 200px;
            max-width: 280px;
            pointer-events: none;
            white-space: nowrap;
        }

        .flag-notification-size1.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0) scale(1);
        }

        .flag-notification-size1-content {
            display: flex;
            align-items: center;
            gap: 10px;
            justify-content: center;
        }

        .flag-notification-size1-content svg {
            flex-shrink: 0;
            color: #10b981;
            filter: none;
        }

        .flag-notification-size1-content span {
            font-size: 13px;
            font-weight: 500;
            line-height: 1.3;
            color: #374151;
            text-shadow: none;
        }

        .flag-notification-size1::before {
            content: '';
            position: absolute;
            top: -1px;
            left: -1px;
            right: -1px;
            bottom: -1px;
            background: linear-gradient(135deg, 
                rgba(16, 185, 129, 0.08) 0%,
                rgba(255, 255, 255, 0.02) 50%,
                rgba(16, 185, 129, 0.08) 100%);
            border-radius: 13px;
            z-index: -1;
            opacity: 0;
            animation: subtleGlowSize1 4s ease-in-out infinite;
        }

        @keyframes subtleGlowSize1 {
            0%, 100% { opacity: 0; }
            50% { opacity: 0.4; }
        }

        /* Size 2 Overlay Flag Notification - Above the compact overlay */
        .flag-notification-size2 {
            position: absolute;
            top: -45px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.96);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            color: #374151;
            padding: 6px 12px;
            border-radius: 8px;
            border: 1px solid rgba(0, 0, 0, 0.06);
            box-shadow: 
                0 4px 20px rgba(0, 0, 0, 0.08),
                0 2px 8px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
            z-index: 15;
            opacity: 0;
            transform: translateX(-50%) translateY(-8px) scale(0.9);
            transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
            min-width: 140px;
            max-width: 200px;
            pointer-events: none;
            white-space: nowrap;
        }

        .flag-notification-size2.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0) scale(1);
        }

        .flag-notification-size2-content {
            display: flex;
            align-items: center;
            gap: 8px;
            justify-content: center;
        }

        .flag-notification-size2-content svg {
            flex-shrink: 0;
            color: #10b981;
            filter: none;
        }

        .flag-notification-size2-content span {
            font-size: 11px;
            font-weight: 500;
            line-height: 1.3;
            color: #374151;
            text-shadow: none;
        }

        .flag-notification-size2::before {
            content: '';
            position: absolute;
            top: -1px;
            left: -1px;
            right: -1px;
            bottom: -1px;
            background: linear-gradient(135deg, 
                rgba(16, 185, 129, 0.08) 0%,
                rgba(255, 255, 255, 0.02) 50%,
                rgba(16, 185, 129, 0.08) 100%);
            border-radius: 9px;
            z-index: -1;
            opacity: 0;
            animation: subtleGlowSize2 4s ease-in-out infinite;
        }

        @keyframes subtleGlowSize2 {
            0%, 100% { opacity: 0; }
            50% { opacity: 0.3; }
        }

        /* Arrow for Size 2 notification pointing down to overlay */
        .flag-notification-size2::after {
            content: '';
            position: absolute;
            bottom: -4px;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 0;
            border-left: 4px solid transparent;
            border-right: 4px solid transparent;
            border-top: 4px solid rgba(255, 255, 255, 0.96);
            filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.06));
        }

        /* ==========================================================================
           EHR SAVE NOTIFICATION
           ========================================================================== */
        .ehr-save-notification {
            position: absolute;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            color: #374151;
            padding: 12px 20px;
            border-radius: 12px;
            border: 1px solid rgba(16, 185, 129, 0.2);
            box-shadow: 
                0 8px 32px rgba(16, 185, 129, 0.15),
                0 4px 16px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
            z-index: 15;
            opacity: 0;
            transform: translateX(-50%) translateY(-12px) scale(0.92);
            transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
            min-width: 280px;
            pointer-events: none;
        }

        .ehr-save-notification.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0) scale(1);
        }

        .ehr-save-notification-content {
            display: flex;
            align-items: center;
            gap: 12px;
            justify-content: center;
        }

        .ehr-save-notification-content svg {
            flex-shrink: 0;
            color: #10b981;
        }

        .ehr-save-notification-content span {
            font-size: 14px;
            font-weight: 600;
            line-height: 1.3;
            color: #374151;
        }

        /* ==========================================================================
           COMPLETION OVERLAY
           ========================================================================== */
        /* Updated: 2026-02-05 - Consistent grey gradient across all overlays */
        .completion-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            background: radial-gradient(circle at center, 
                rgba(139, 92, 246, 0.06) 0%,
                rgba(15, 23, 42, 0.3) 40%,
                rgba(15, 23, 42, 0.5) 100%);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            z-index: 999999;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            visibility: hidden;
            transform: scale(0.98);
            transition: opacity 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
                        visibility 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
                        transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
        }

        .completion-overlay::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: radial-gradient(circle at 20% 30%, 
                rgba(139, 92, 246, 0.03) 0%,
                transparent 50%),
                radial-gradient(circle at 80% 70%, 
                rgba(16, 185, 129, 0.03) 0%,
                transparent 50%);
            animation: backdropBrandShimmer 12s ease-in-out infinite;
            pointer-events: none;
        }

        .completion-overlay.active {
            opacity: 1;
            visibility: visible;
            transform: scale(1);
        }

        /* Hide consultation backdrop when completion overlay is active */
        body:has(.completion-overlay.active) .consultation-backdrop {
            opacity: 1 !important;
            visibility: visible !important;
        }

        /* Remove background from completion overlay - let consultation-backdrop handle it */
        .completion-overlay {
            background: transparent !important;
        }

        /* AGGRESSIVE: Hide ALL chat elements when completion overlay is active */
        .completion-overlay.active ~ * .ai-avatar,
        .completion-overlay.active ~ * .ai-pulse-avatar,
        .completion-overlay.active ~ .patient-chat-container,
        .completion-overlay.active ~ * .chat-header,
        .completion-overlay.active ~ * .chat-container {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            z-index: -9999 !important;
        }

        /* Also hide when overlay is a sibling */
        body:has(.completion-overlay.active) .patient-chat-container,
        body:has(.completion-overlay.active) .ai-avatar,
        body:has(.completion-overlay.active) .ai-pulse-avatar,
        body:has(.completion-overlay.active) .chat-header,
        body:has(.completion-overlay.active) .chat-container {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            z-index: -9999 !important;
        }

        /* Nuclear option - hide anything with pulse animation */
        .completion-overlay.active ~ * [class*="pulse"],
        body:has(.completion-overlay.active) [class*="pulse"]:not(.completion-overlay *) {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            z-index: -9999 !important;
        }
        
        /* Hide AI avatars but NOT patient avatars */
        .completion-overlay.active ~ * .ai-avatar,
        body:has(.completion-overlay.active) .ai-avatar:not(.completion-overlay *) {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            z-index: -9999 !important;
        }
        
        /* Ensure patient avatar is always visible - highest priority */
        .main-header .patient-avatar,
        .patient-info .patient-avatar {
            display: flex !important;
            visibility: visible !important;
            opacity: 1 !important;
            width: 48px !important;
            height: 48px !important;
        }
        
        .main-header .patient-avatar img,
        .patient-info .patient-avatar img {
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
            width: 100% !important;
            height: 100% !important;
        }

        /* Hide the entire iframe container when completion overlay is active */
        body:has(.completion-overlay.active) #previsitContainer {
            z-index: -1 !important;
        }

        /* Patient Notes Overlay - Match SOAP Notes Style */
        #patientNotesOverlay {
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(8px);
            padding: 20px;
        }

        #patientNotesOverlay .completion-container {
            background: linear-gradient(135deg, 
                rgba(255, 255, 255, 0.98) 0%, 
                rgba(248, 250, 252, 0.98) 100%);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: 20px;
            border: 1px solid rgba(255, 255, 255, 0.4);
            max-width: 900px;
            width: 100%;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            box-shadow: 
                0 25px 50px rgba(0, 0, 0, 0.08),
                0 15px 35px rgba(0, 0, 0, 0.05),
                0 5px 15px rgba(0, 0, 0, 0.03),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
            padding: 0;
            position: relative;
            overflow: hidden;
        }
        
        #patientNotesOverlay .completion-container::before {
            content: '';
            position: absolute;
            top: -1px;
            left: -1px;
            right: -1px;
            bottom: -1px;
            background: linear-gradient(135deg, 
                rgba(139, 92, 246, 0.15) 0%,
                rgba(255, 255, 255, 0.1) 25%,
                rgba(16, 185, 129, 0.15) 50%,
                rgba(255, 255, 255, 0.1) 75%,
                rgba(139, 92, 246, 0.15) 100%);
            border-radius: 19px;
            z-index: -1;
            opacity: 0;
            animation: brandGlow 6s ease-in-out infinite;
        }
        
        #patientNotesOverlay .completion-container::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: radial-gradient(circle at 25% 25%, 
                rgba(139, 92, 246, 0.04) 0%,
                transparent 50%),
                radial-gradient(circle at 75% 75%, 
                rgba(16, 185, 129, 0.04) 0%,
                transparent 50%);
            border-radius: 20px;
            pointer-events: none;
            animation: subtleShimmer 8s ease-in-out infinite;
            z-index: 0;
        }

        #patientNotesOverlay .completion-header {
            padding: 20px 28px;
            border-bottom: 1px solid #e5e7eb;
            display: flex;
            align-items: center;
            gap: 12px;
            width: 100%;
            margin: 0;
            border-radius: 0;
            background: transparent;
            box-shadow: none;
            justify-content: flex-start;
            position: relative;
            z-index: 1;
        }

        #patientNotesOverlay .completion-header svg {
            width: 22px;
            height: 22px;
            color: #64748b;
        }

        #patientNotesOverlay .completion-title {
            font-size: 17px;
            font-weight: 600;
            color: #1f2937;
            margin: 0;
            text-align: left;
        }

        #patientNotesOverlay .completion-subtitle {
            font-size: 13px;
            color: #6b7280;
            margin: 0;
            text-align: left;
        }

        #patientNotesOverlay .completion-content {
            flex: 1;
            overflow-y: auto;
            padding: 24px 28px;
            background: transparent;
            border-radius: 0;
            margin: 0;
            position: relative;
            z-index: 1;
        }

        #patientNotesOverlay .completion-actions {
            padding: 16px 28px;
            border-top: 1px solid #e5e7eb;
            background: linear-gradient(135deg, #fafbfc 0%, #f9fafb 100%);
            border-radius: 0 0 20px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: relative;
            z-index: 1;
        }

        .completion-actions-right {
            display: flex;
            gap: 12px;
        }

        .completion-link-btn {
            background: none;
            border: none;
            color: #6b7280;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 0;
            transition: all 0.2s ease;
        }

        .completion-link-btn:hover {
            color: #374151;
        }

        .completion-link-btn svg {
            width: 16px;
            height: 16px;
        }

        /* Final Celebration Overlay */
        #completionOverlay {
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(8px);
            padding: 20px;
        }

        #completionOverlay .completion-container {
            background: linear-gradient(135deg, 
                rgba(255, 255, 255, 0.98) 0%, 
                rgba(248, 250, 252, 0.98) 100%);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: 24px;
            border: 1px solid rgba(255, 255, 255, 0.4);
            max-width: 800px;
            width: 100%;
            max-height: 85vh;
            display: flex;
            flex-direction: column;
            box-shadow: 
                0 25px 50px rgba(0, 0, 0, 0.08),
                0 15px 35px rgba(0, 0, 0, 0.05),
                0 5px 15px rgba(0, 0, 0, 0.03),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
            padding: 0;
            overflow: hidden;
            position: relative;
        }
        
        #completionOverlay .completion-container::before {
            content: '';
            position: absolute;
            top: -1px;
            left: -1px;
            right: -1px;
            bottom: -1px;
            background: linear-gradient(135deg, 
                rgba(139, 92, 246, 0.15) 0%,
                rgba(255, 255, 255, 0.1) 25%,
                rgba(16, 185, 129, 0.15) 50%,
                rgba(255, 255, 255, 0.1) 75%,
                rgba(139, 92, 246, 0.15) 100%);
            border-radius: 23px;
            z-index: -1;
            opacity: 0;
            animation: brandGlow 6s ease-in-out infinite;
        }
        
        #completionOverlay .completion-container::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: radial-gradient(circle at 25% 25%, 
                rgba(139, 92, 246, 0.04) 0%,
                transparent 50%),
                radial-gradient(circle at 75% 75%, 
                rgba(16, 185, 129, 0.04) 0%,
                transparent 50%);
            border-radius: 24px;
            pointer-events: none;
            animation: subtleShimmer 8s ease-in-out infinite;
            z-index: 0;
        }

        #completionOverlay .completion-checkmark {
            width: 48px;
            height: 48px;
            margin: 0 auto;
            border-radius: 50%;
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
            transform: scale(0);
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
            position: relative;
        }

        /* Completion Spinner - Match Processing Overlay Style */
        .completion-spinner {
            width: 48px;
            height: 48px;
            margin: 0 auto;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 1;
            transition: opacity 0.3s ease;
            flex-shrink: 0;
        }

        .completion-spinner.hidden {
            opacity: 0;
            pointer-events: none;
        }

        .spinner-ring {
            width: 48px !important;
            height: 48px !important;
            border: 2.5px solid #f3f4f6;
            border-top-color: #8b5cf6;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            aspect-ratio: 1 / 1;
            flex-shrink: 0;
            display: block;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        #completionOverlay .completion-header {
            padding: 32px 32px 24px 32px;
            border-bottom: 1px solid #e5e7eb;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            width: 100%;
            margin: 0;
            border-radius: 0;
            background: transparent;
            box-shadow: none;
            position: relative;
            overflow: visible;
            flex-shrink: 0;
            z-index: 1;
        }

        /* Visual anchor effect for Documentation Complete */
        #completionOverlay .completion-header::after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 2px;
            background: linear-gradient(90deg, 
                transparent 0%, 
                rgba(139, 92, 246, 0.6) 20%, 
                rgba(139, 92, 246, 0.8) 50%, 
                rgba(139, 92, 246, 0.6) 80%, 
                transparent 100%);
            transition: width 1.2s cubic-bezier(0.4, 0.0, 0.2, 1);
            opacity: 0;
        }

        #completionOverlay .completion-header.anchored::after {
            width: 200px;
            opacity: 1;
        }

        #completionOverlay .completion-title {
            font-size: 22px;
            font-weight: 600;
            color: #1f2937;
            margin: 0;
            text-align: center;
            letter-spacing: -0.4px;
            line-height: 1.2;
        }

        #completionOverlay .completion-subtitle {
            font-size: 14px;
            color: #6b7280;
            margin: 0;
            text-align: center;
            font-weight: 400;
            line-height: 1.4;
        }

        #completionOverlay .completion-content {
            flex: 1;
            overflow-y: auto;
            padding: 20px 32px 24px 32px;
            background: transparent;
            border-radius: 0;
            margin: 0;
            position: relative;
            z-index: 1;
        }

        #completionOverlay .completion-content::-webkit-scrollbar {
            width: 6px;
        }

        #completionOverlay .completion-content::-webkit-scrollbar-track {
            background: transparent;
        }

        #completionOverlay .completion-content::-webkit-scrollbar-thumb {
            background: #d1d5db;
            border-radius: 3px;
        }

        #completionOverlay .completion-content::-webkit-scrollbar-thumb:hover {
            background: #9ca3af;
        }

        #completionOverlay .completion-actions {
            padding: 18px 32px 20px 32px;
            border-top: 1px solid #e5e7eb;
            background: #fafbfc;
            border-radius: 0 0 24px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: relative;
            z-index: 1;
        }

        .completion-checkmark.animate {
            transform: scale(1);
            opacity: 1;
        }

        .completion-checkmark svg {
            width: 24px;
            height: 24px;
            color: #ffffff;
            stroke-width: 2.5;
        }

        .celebration-title {
            color: #10b981 !important;
            background: none !important;
            background-clip: unset !important;
            -webkit-background-clip: unset !important;
            -webkit-text-fill-color: unset !important;
            font-weight: 600 !important;
        }

        /* Confetti Animation - Subtle iOS-style */
        .confetti {
            position: absolute;
            width: 6px;
            height: 6px;
            opacity: 0;
            z-index: 10;
            border-radius: 50%;
            animation: none;
        }

        .confetti:nth-child(1) { left: 10%; animation-delay: 0s; background: #10b981; }
        .confetti:nth-child(2) { left: 20%; animation-delay: 0.05s; background: #059669; }
        .confetti:nth-child(3) { left: 30%; animation-delay: 0.1s; background: #10b981; }
        .confetti:nth-child(4) { left: 40%; animation-delay: 0.15s; background: #34d399; }
        .confetti:nth-child(5) { left: 50%; animation-delay: 0.2s; background: #10b981; }
        .confetti:nth-child(6) { left: 60%; animation-delay: 0.25s; background: #059669; }
        .confetti:nth-child(7) { left: 70%; animation-delay: 0.3s; background: #10b981; }
        .confetti:nth-child(8) { left: 80%; animation-delay: 0.35s; background: #34d399; }
        .confetti:nth-child(9) { left: 90%; animation-delay: 0.4s; background: #10b981; }
        .confetti:nth-child(10) { left: 15%; animation-delay: 0.08s; background: #059669; }
        .confetti:nth-child(11) { left: 45%; animation-delay: 0.18s; background: #10b981; }
        .confetti:nth-child(12) { left: 75%; animation-delay: 0.33s; background: #34d399; }

        @keyframes confettiFall {
            0% {
                top: -10px;
                opacity: 0;
                transform: translateY(0) scale(0);
            }
            10% {
                opacity: 0.8;
                transform: translateY(10px) scale(1);
            }
            100% {
                top: 80px;
                opacity: 0;
                transform: translateY(80px) scale(0.5);
            }
        }

        /* Sparkle Effect */
        .sparkle {
            position: absolute;
            width: 6px;
            height: 6px;
            background: linear-gradient(135deg, #8b5cf6, #10b981);
            border-radius: 50%;
            opacity: 0;
            animation: sparkleAnimation 2s ease-in-out infinite;
            box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
        }

        .sparkle:nth-child(1) { top: 15%; left: 10%; animation-delay: 0s; }
        .sparkle:nth-child(2) { top: 25%; right: 10%; animation-delay: 0.4s; }
        .sparkle:nth-child(3) { top: 35%; left: 20%; animation-delay: 0.8s; }
        .sparkle:nth-child(4) { top: 45%; right: 20%; animation-delay: 1.2s; }

        @keyframes sparkleAnimation {
            0%, 100% { 
                opacity: 0; 
                transform: scale(0) rotate(0deg); 
            }
            50% { 
                opacity: 1; 
                transform: scale(1.5) rotate(180deg); 
            }
        }

        /* Checklist Item Natural Animation */
        .completion-checklist-item {
            opacity: 0;
            transform: translateX(-20px) scale(0.95);
        }

        @keyframes checklistPop {
            0% {
                opacity: 0;
                transform: translateX(-20px) scale(0.95);
            }
            50% {
                transform: translateX(3px) scale(1.02);
            }
            100% {
                opacity: 1;
                transform: translateX(0) scale(1);
            }
        }

        .completion-checklist-item svg {
            width: 16px;
            height: 16px;
            color: #10b981;
            flex-shrink: 0;
            animation: checkmarkDraw 0.4s ease-out forwards;
            opacity: 0;
        }

        @keyframes checkmarkDraw {
            0% {
                opacity: 0;
                transform: scale(0) rotate(-45deg);
            }
            50% {
                transform: scale(1.2) rotate(0deg);
            }
            100% {
                opacity: 1;
                transform: scale(1) rotate(0deg);
            }
        }

        /* Follow-up Card Animation */
        .followup-suggestion {
            opacity: 0;
            transform: translateY(30px) scale(0.95);
            animation: fadeInUpScale 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 1.5s forwards;
        }

        @keyframes fadeInUpScale {
            0% {
                opacity: 0;
                transform: translateY(30px) scale(0.95);
            }
            100% {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        /* Section Title Animation */
        .completion-section-title {
            opacity: 0;
            transform: translateY(-10px);
            animation: fadeInDown 0.5s ease-out forwards;
        }

        .completion-section:nth-child(1) .completion-section-title {
            animation-delay: 0.4s;
        }

        .completion-section:nth-child(2) .completion-section-title {
            animation-delay: 1.4s;
        }

        @keyframes fadeInDown {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Title Animation */
        #completionOverlay .completion-title {
            opacity: 1;
            transform: scale(1);
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        #completionOverlay .completion-title.updating {
            opacity: 0;
            transform: scale(0.95);
        }

        @keyframes titlePop {
            0% {
                opacity: 0;
                transform: scale(0.8);
            }
            100% {
                opacity: 1;
                transform: scale(1);
            }
        }

        /* Subtitle Animation */
        #completionOverlay .completion-subtitle {
            opacity: 1;
            transition: opacity 0.3s ease;
        }

        #completionOverlay .completion-subtitle.updating {
            opacity: 0;
        }

        @keyframes fadeIn {
            to { opacity: 1; }
        }

        .completion-title {
            font-size: 22px;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 12px;
            letter-spacing: -0.4px;
        }

        .completion-subtitle {
            font-size: 14px;
            color: #6b7280;
            margin-bottom: 32px;
            font-weight: 400;
        }

        .completion-content {
            background: linear-gradient(135deg, #fafbfc 0%, #f9fafb 100%);
            border-radius: 16px;
            padding: 32px;
            margin-bottom: 32px;
            text-align: left;
        }

        .completion-section {
            margin-bottom: 24px;
            background: transparent;
            padding: 0;
            border-radius: 0;
            border: none;
        }

        .completion-section:last-child {
            margin-bottom: 0;
        }

        .completion-section-title-main {
            font-size: 13px;
            font-weight: 600;
            color: #374151;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .completion-section-title-main svg {
            width: 16px;
            height: 16px;
            color: #10b981;
        }

        .completion-section-title {
            font-size: 14px;
            font-weight: 600;
            color: #374151;
            margin-bottom: 14px;
            display: flex;
            align-items: center;
            gap: 8px;
            justify-content: space-between;
        }

        .completion-section-title .avs-badge {
            background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
            color: #3b82f6;
            font-size: 11px;
            font-weight: 600;
            padding: 4px 10px;
            border-radius: 12px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        /* After Visit Summary Styles */
        .after-visit-summary-content {
            background: #f8fafc;
            border-radius: 12px;
            padding: 16px;
            border: 1px solid #e2e8f0;
        }

        .avs-loading {
            display: flex;
            align-items: center;
            gap: 12px;
            color: #64748b;
            font-size: 14px;
            padding: 8px 0;
        }

        .avs-loading-spinner {
            width: 18px;
            height: 18px;
            border: 2px solid #e2e8f0;
            border-top-color: #3b82f6;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        .avs-paragraphs {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .avs-paragraph {
            font-size: 14px;
            line-height: 1.7;
            color: #334155;
            padding: 0;
            margin: 0;
        }

        .avs-paragraph:first-child {
            font-weight: 500;
            color: #1e293b;
        }

        .avs-highlight {
            background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
            padding: 2px 6px;
            border-radius: 4px;
            font-weight: 500;
        }

        .avs-action {
            background: #f0fdf4;
            border-left: 3px solid #22c55e;
            padding: 10px 14px;
            border-radius: 0 8px 8px 0;
            font-size: 14px;
            color: #166534;
        }

        .avs-followup {
            background: #eff6ff;
            border-left: 3px solid #3b82f6;
            padding: 10px 14px;
            border-radius: 0 8px 8px 0;
            font-size: 14px;
            color: #1e40af;
        }

        .followup-edit-btn {
            background: none;
            border: 1px solid #e5e7eb;
            color: #6b7280;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            border-radius: 8px;
            transition: all 0.2s ease;
            margin-left: auto;
        }

        .followup-edit-btn:hover {
            background: #f9fafb;
            border-color: #d1d5db;
            color: #374151;
        }

        .followup-edit-btn svg {
            width: 14px;
            height: 14px;
        }

        .completion-section-title svg {
            width: 16px;
            height: 16px;
            color: #8b5cf6;
        }

        /* Reuse processing-steps component in completion overlay */
        #completionOverlay .processing-steps {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        #completionOverlay .processing-step {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 14px;
            background: #f9fafb;
            border-radius: 10px;
            opacity: 0.4;
            transition: all 0.4s ease;
            border: 1px solid transparent;
        }

        #completionOverlay .processing-step.active {
            opacity: 1;
            background: #f3f0ff;
            border: 1px solid #e9d5ff;
        }

        #completionOverlay .processing-step.completed {
            opacity: 1;
            background: linear-gradient(90deg, #f0fdf4 0%, #f0fdf4 20%, transparent 100%);
            border: 1px solid #bbf7d0;
        }

        #completionOverlay .step-icon {
            width: 24px;
            height: 24px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #completionOverlay .step-icon svg {
            width: 20px;
            height: 20px;
        }

        #completionOverlay .step-spinner {
            width: 16px;
            height: 16px;
            border: 2px solid #e9d5ff;
            border-top-color: #8b5cf6;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        #completionOverlay .processing-step .step-icon {
            color: #d1d5db;
        }

        #completionOverlay .processing-step.active .step-icon {
            color: #8b5cf6;
        }

        #completionOverlay .processing-step.completed .step-icon {
            color: #10b981;
        }

        #completionOverlay .step-text {
            flex: 1;
            font-size: 14px;
            color: #6b7280;
            font-weight: 500;
        }

        #completionOverlay .processing-step.active .step-text {
            color: #7c3aed;
        }

        #completionOverlay .processing-step.completed .step-text {
            color: #059669;
        }

        .completion-patient-notes {
            background: #ffffff;
            border-radius: 10px;
            padding: 0;
            font-size: 14px;
            line-height: 1.6;
            color: #374151;
            text-align: left;
            border: 1px solid #e5e7eb;
        }

        .patient-summary-header {
            padding: 14px 20px;
            border-bottom: 1px solid #e5e7eb;
            background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
            border-radius: 10px 10px 0 0;
        }

        .patient-summary-meta {
            display: flex;
            gap: 20px;
            flex-wrap: wrap;
        }

        .patient-summary-meta-item {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: #6b7280;
        }

        .patient-summary-meta-item svg {
            width: 13px;
            height: 13px;
            color: #9ca3af;
        }

        .patient-summary-meta-item strong {
            color: #374151;
            font-weight: 500;
        }

        .patient-summary-sections {
            padding: 16px 20px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .patient-summary-loading {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 40px 20px;
            gap: 16px;
        }

        .patient-summary-loading .loading-spinner {
            width: 32px;
            height: 32px;
            border: 3px solid #e5e7eb;
            border-top-color: #8b5cf6;
            border-radius: 50%;
            animation: spin 1.5s linear infinite;
        }

        .patient-summary-loading p {
            color: #6b7280;
            font-size: 14px;
        }

        .patient-summary-section {
            background: #f9fafb;
            border-radius: 10px;
            padding: 14px 16px;
            border: 1px solid #e5e7eb;
            animation: slideInUp 0.4s ease-out forwards;
            opacity: 0;
        }

        .patient-summary-section:nth-child(1) {
            animation-delay: 0.1s;
        }

        .patient-summary-section:nth-child(2) {
            animation-delay: 0.2s;
        }

        .patient-summary-section:nth-child(3) {
            animation-delay: 0.3s;
        }

        .patient-summary-section:nth-child(4) {
            animation-delay: 0.4s;
        }

        /* For dynamically loaded content, reset animation */
        #patientSummaryContent .patient-summary-section {
            animation: slideInUp 0.4s ease-out forwards;
            opacity: 0;
        }

        #patientSummaryContent .patient-summary-section:nth-child(1) {
            animation-delay: 0.05s;
        }

        #patientSummaryContent .patient-summary-section:nth-child(2) {
            animation-delay: 0.1s;
        }

        #patientSummaryContent .patient-summary-section:nth-child(3) {
            animation-delay: 0.15s;
        }

        #patientSummaryContent .patient-summary-section:nth-child(4) {
            animation-delay: 0.2s;
        }

        @keyframes slideInUp {
            from {
                opacity: 0;
                transform: translateY(10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .patient-summary-section-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 14px;
            font-weight: 600;
            color: #6b46c1;
            margin-bottom: 10px;
        }

        .patient-summary-section-title svg {
            width: 16px;
            height: 16px;
            flex-shrink: 0;
            color: #6b46c1;
        }

        .patient-summary-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .patient-summary-item {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            font-size: 13px;
            line-height: 1.5;
            color: #4b5563;
            padding-left: 4px;
        }

        .patient-summary-item::before {
            content: "•";
            color: #9ca3af;
            font-weight: bold;
            flex-shrink: 0;
        }

        .patient-summary-highlight {
            background: #fef3c7;
            padding: 10px 12px;
            border-radius: 10px;
            border-left: 3px solid #f59e0b;
            margin-top: 10px;
            font-size: 13px;
            line-height: 1.5;
            color: #92400e;
            display: flex;
            align-items: flex-start;
            gap: 10px;
        }

        .patient-summary-highlight svg {
            width: 16px;
            height: 16px;
            color: #f59e0b;
            flex-shrink: 0;
            margin-top: 1px;
        }

        .patient-summary-medication-change {
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
            padding: 12px 14px;
            border-radius: 10px;
            border-left: 3px solid #8b5cf6;
            margin-bottom: 12px;
            font-size: 13px;
            line-height: 1.6;
            color: #374151;
        }

        .patient-summary-medication-change p {
            margin: 0;
        }

        .patient-summary-checklist {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .checklist-item {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 12px 14px;
            background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
            border: 1.5px solid #e5e7eb;
            border-radius: 10px;
            font-size: 13px;
            line-height: 1.6;
            color: #374151;
            transition: all 0.2s ease;
            cursor: pointer;
        }

        .checklist-item:hover {
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.02) 0%, rgba(99, 102, 241, 0.02) 100%);
            border-color: rgba(139, 92, 246, 0.2);
            transform: translateX(2px);
        }

        .checkbox-wrapper {
            width: 20px;
            height: 20px;
            flex-shrink: 0;
            margin-top: 1px;
        }

        .checkbox-wrapper svg {
            width: 20px;
            height: 20px;
            color: #9ca3af;
            transition: all 0.2s ease;
        }

        .checklist-item:hover .checkbox-wrapper svg {
            color: #8b5cf6;
        }

        .completion-actions {
            display: flex;
            gap: 12px;
            justify-content: space-between;
            align-items: center;
            padding-top: 4px;
        }

        .completion-btn {
            padding: 12px 24px;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            border: none;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .completion-btn.primary {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: #ffffff;
            box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
        }

        .completion-btn.primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
        }

        .completion-btn.secondary {
            background: #ffffff;
            color: #374151;
            border: 1px solid #e5e7eb;
            font-weight: 500;
        }

        .completion-btn.secondary:hover {
            background: #f9fafb;
            border-color: #d1d5db;
        }

        .completion-btn svg {
            width: 16px;
            height: 16px;
        }

        /* Follow-up Suggestion Styling */
        .followup-suggestion {
            display: block;
            background: linear-gradient(135deg, #fefefe 0%, #ffffff 100%);
            border-radius: 12px;
            padding: 20px;
            border: 1px solid #e5e7eb;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        }

        .followup-scheduling-info {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .scheduling-header {
            font-size: 13px;
            font-weight: 600;
            color: #374151;
            margin-bottom: 4px;
        }

        .scheduling-options {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .scheduling-option {
            font-size: 13px;
            color: #6b7280;
            line-height: 1.6;
        }

        .scheduling-option strong {
            color: #374151;
            font-weight: 600;
        }

        .portal-link {
            color: #8b5cf6;
            text-decoration: none;
            font-weight: 500;
            transition: all 0.2s ease;
        }

        .portal-link:hover {
            color: #7c3aed;
            text-decoration: underline;
        }

        .scheduling-reminder {
            font-size: 12px;
            color: #9ca3af;
            font-style: italic;
            margin-top: 4px;
        }

        .followup-date,
        .followup-time,
        .followup-type {
            text-align: center;
            padding: 8px;
            border-radius: 8px;
            background: #f9fafb;
            transition: all 0.2s ease;
        }

        .followup-date:hover,
        .followup-time:hover,
        .followup-type:hover {
            background: #f3f4f6;
            transform: translateY(-1px);
        }

        .followup-label {
            font-size: 11px;
            font-weight: 600;
            color: #9ca3af;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 8px;
        }

        .followup-value {
            font-size: 14px;
            font-weight: 600;
            color: #1f2937;
            line-height: 1.5;
        }

        /* AI Insight Section */
        .ai-insight-section {
            background: linear-gradient(135deg, 
                rgba(139, 92, 246, 0.04) 0%, 
                rgba(99, 102, 241, 0.04) 100%);
            border: 1px solid rgba(139, 92, 246, 0.15);
            border-radius: 12px;
            padding: 16px 18px;
            margin-bottom: 16px;
            display: flex;
            align-items: flex-start;
            gap: 12px;
            position: relative;
            overflow: hidden;
            opacity: 0;
            transform: translateY(20px);
            animation: fadeInUpScale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.3s forwards;
        }

        .ai-insight-section::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 3px;
            background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 100%);
            border-radius: 12px 0 0 12px;
        }

        .ai-insight-icon {
            width: 20px;
            height: 20px;
            color: #8b5cf6;
            flex-shrink: 0;
            margin-top: 2px;
        }

        .ai-insight-content {
            flex: 1;
        }

        .ai-insight-label {
            font-size: 11px;
            font-weight: 600;
            color: #8b5cf6;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 6px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .ai-insight-label svg {
            animation: aiPulse 2s ease-in-out infinite;
        }

        @keyframes aiPulse {
            0%, 100% { 
                opacity: 0.6;
                transform: scale(1);
            }
            50% { 
                opacity: 1;
                transform: scale(1.1);
            }
        }

        .ai-insight-text {
            font-size: 13px;
            color: #4b5563;
            line-height: 1.6;
            font-weight: 400;
            margin-bottom: 12px;
        }

        .ai-insight-footer {
            font-size: 12px;
            color: #6b7280;
            line-height: 1.5;
            padding-top: 12px;
            border-top: 1px solid rgba(139, 92, 246, 0.1);
        }

        .ai-insight-footer strong {
            color: #374151;
            font-weight: 600;
        }

        .ai-insight-footer .ai-insight-highlight {
            white-space: nowrap;
        }

        .ai-insight-highlight {
            font-weight: 600;
            color: #374151;
        }

        /* Full-Screen Darkening Backdrop */
        .consultation-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: radial-gradient(circle at center, 
                rgba(139, 92, 246, 0.06) 0%,
                rgba(15, 23, 42, 0.3) 40%,
                rgba(15, 23, 42, 0.5) 100%);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            z-index: 2999;
            opacity: 0;
            visibility: hidden;
            transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            pointer-events: none;
        }

        .consultation-backdrop::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: radial-gradient(circle at 20% 30%, 
                rgba(139, 92, 246, 0.03) 0%,
                transparent 50%),
                radial-gradient(circle at 80% 70%, 
                rgba(16, 185, 129, 0.03) 0%,
                transparent 50%);
            animation: backdropBrandShimmer 12s ease-in-out infinite;
        }

        @keyframes backdropBrandShimmer {
            0%, 100% { opacity: 0.4; }
            50% { opacity: 0.8; }
        }

        .consultation-backdrop.active {
            opacity: 1;
            visibility: visible;
        }

        /* ==========================================================================
           UNIFIED OVERLAY DESIGN SYSTEM - SLEEK, COHESIVE & MODERN
           ========================================================================== */
        
        /* Shared overlay backdrop */
        .stop-confirmation-overlay,
        .processing-overlay,
        .soap-notes-overlay {
            position: fixed;
            inset: 0;
            background: radial-gradient(circle at center, 
                rgba(139, 92, 246, 0.06) 0%,
                rgba(15, 23, 42, 0.3) 40%,
                rgba(15, 23, 42, 0.5) 100%);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            z-index: 10000;
            opacity: 0;
            visibility: hidden;
            transform: scale(0.98);
            transition: opacity 0.15s cubic-bezier(0.4, 0.0, 0.2, 1),
                        visibility 0.15s cubic-bezier(0.4, 0.0, 0.2, 1),
                        transform 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .stop-confirmation-overlay.active,
        .processing-overlay.active,
        .soap-notes-overlay.active {
            opacity: 1;
            visibility: visible;
            transform: scale(1);
        }

        /* Shared modal container */
        .stop-confirmation-modal,
        .processing-modal {
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: saturate(180%) blur(24px);
            -webkit-backdrop-filter: saturate(180%) blur(24px);
            border-radius: 20px;
            border: 1px solid rgba(255, 255, 255, 0.8);
            box-shadow: 
                0 24px 48px rgba(0, 0, 0, 0.12),
                0 12px 24px rgba(0, 0, 0, 0.08),
                0 4px 12px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 1);
            padding: 40px;
            max-width: 480px;
            width: 90%;
            text-align: center;
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, sans-serif;
            transform: scale(0.95) translateY(10px);
            opacity: 0;
            transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        .stop-confirmation-overlay.active .stop-confirmation-modal,
        .processing-overlay.active .processing-modal {
            transform: scale(1) translateY(0);
            opacity: 1;
        }

        /* Typography */
        .stop-confirmation-content h3 {
            font-size: 20px;
            font-weight: 600;
            color: #1f2937;
            margin: 0 0 12px 0;
            letter-spacing: -0.02em;
            line-height: 1.4;
        }

        .stop-confirmation-content p {
            font-size: 14px;
            color: #6b7280;
            margin: 0 0 24px 0;
            line-height: 1.6;
            font-weight: 400;
        }

        /* Button system */
        .stop-confirmation-actions {
            display: flex;
            gap: 12px;
            justify-content: center;
            width: 100%;
        }

        .stop-confirmation-btn {
            padding: 12px 24px;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
            border: none;
            outline: none;
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 140px;
            gap: 8px;
            white-space: nowrap;
        }

        .cancel-stop {
            background: #f3f4f6;
            color: #6b7280;
            border: 1px solid #e5e7eb;
        }

        .cancel-stop:hover {
            background: #e5e7eb;
            color: #374151;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        }

        .cancel-stop:active {
            transform: scale(0.98);
        }

        .confirm-stop {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
        }

        .confirm-stop:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
        }

        .confirm-stop:active {
            transform: scale(0.98) translateY(0);
        }

        /* Minimized Consultation State */
        .consultation-overlay.minimized {
            top: auto;
            bottom: 20px;
            right: 20px;
            left: auto;
            width: 280px;
            height: 80px;
            border-radius: 16px;
            background: rgba(55, 65, 81, 0.95);
            backdrop-filter: blur(20px);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        }

        .consultation-overlay.minimized:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
        }

        .consultation-overlay.minimized .scribe-interface {
            flex-direction: row;
            padding: 16px 20px;
            gap: 16px;
            max-width: none;
        }

        .consultation-overlay.minimized .scribe-header {
            text-align: left;
            margin: 0;
        }

        .consultation-overlay.minimized .scribe-title {
            font-size: 14px;
            font-weight: 500;
            color: white;
            margin-bottom: 2px;
        }

        .consultation-overlay.minimized .scribe-subtitle {
            font-size: 11px;
            color: rgba(255, 255, 255, 0.7);
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .consultation-overlay.minimized .scribe-subtitle .recording-timer {
            color: rgba(255, 255, 255, 0.9);
            font-weight: 500;
            margin-left: auto;
        }

        .consultation-overlay.minimized .recording-dot {
            width: 6px;
            height: 6px;
            background: #ef4444;
            border-radius: 50%;
            animation: simplePulse 2s ease-in-out infinite;
        }

        /* Hide full recording status in minimized mode */
        .consultation-overlay.minimized .recording-status {
            display: none;
        }

        /* Show controls in minimized mode */
        .consultation-overlay.minimized .scribe-controls {
            display: flex;
            gap: 8px;
        }

        .consultation-overlay.minimized .control-btn {
            width: 32px;
            height: 32px;
            font-size: 12px;
        }

        /* Main Scribe Interface - Minimal & Consistent */
        .scribe-interface {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 32px;
            max-width: 500px;
            width: 100%;
            padding: 40px;
            overflow: visible;
        }

        /* Header - Clean Typography Matching Iframe */
        .scribe-header {
            text-align: center;
            margin-bottom: 20px;
        }

        /* Overlay Minimize Button - Consistent with Clinical Documentation Close Button */
        .overlay-minimize-btn {
            position: absolute;
            top: 16px;
            right: 16px;
            width: 36px;
            height: 36px;
            border-radius: 10px;
            border: 1px solid #e5e7eb;
            background: #ffffff;
            color: #6b7280;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            z-index: 1000;
        }

        .overlay-minimize-btn:hover {
            background: #f9fafb;
            border-color: #d1d5db;
            color: #374151;
        }

        .overlay-minimize-btn:active {
            transform: scale(0.95);
            background: #f3f4f6;
        }

        .overlay-minimize-btn svg {
            width: 20px;
            height: 20px;
        }

        /* Hide minimize button during consent phase */
        .consultation-overlay .overlay-minimize-btn {
            display: none;
        }

        /* Show minimize button only during recording phase */
        .consultation-overlay.recording-active .overlay-minimize-btn {
            display: flex;
        }

        .scribe-title {
            font-size: 24px;
            font-weight: 500;
            color: #374151;
            margin-bottom: 8px;
            letter-spacing: -0.3px;
        }

        .scribe-subtitle {
            font-size: 14px;
            font-weight: 400;
            color: #6b7280;
            line-height: 1.5;
        }

        /* Sleek Floating 3D Sound Wave - No Container */
        .soundwave-container {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 120px;
            padding: 0;
            background: transparent;
            border: none;
            box-shadow: none;
            position: relative;
            overflow: visible;
        }

        .wave-svg {
            width: 400px;
            height: 100px;
            position: relative;
            z-index: 1;
        }

        .wave-path {
            fill: none;
            stroke-width: 4;
            stroke-linecap: round;
            stroke-linejoin: round;
            opacity: 0.9;
            transform-origin: center;
            filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
        }

        .wave-path-1 {
            stroke: url(#waveGradient1);
            animation: sleekWave1 5s ease-in-out infinite;
        }

        .wave-path-2 {
            stroke: url(#waveGradient2);
            opacity: 0.7;
            animation: sleekWave2 6s ease-in-out infinite 1.2s;
        }

        .wave-path-3 {
            stroke: url(#waveGradient3);
            opacity: 0.5;
            animation: sleekWave3 4.5s ease-in-out infinite 2.4s;
        }

        .wave-path-4 {
            stroke: url(#waveGradient4);
            opacity: 0.4;
            animation: sleekWave4 7s ease-in-out infinite 0.8s;
        }

        @keyframes sleekWave1 {
            0% { transform: scaleY(0.9) translateY(0px); opacity: 0.9; }
            25% { transform: scaleY(1.2) translateY(-3px); opacity: 1; }
            50% { transform: scaleY(0.8) translateY(2px); opacity: 0.8; }
            75% { transform: scaleY(1.3) translateY(-4px); opacity: 0.95; }
            100% { transform: scaleY(1.0) translateY(0px); opacity: 0.9; }
        }

        @keyframes sleekWave2 {
            0% { transform: scaleY(1.1) translateY(-2px); opacity: 0.7; }
            30% { transform: scaleY(0.7) translateY(4px); opacity: 0.9; }
            60% { transform: scaleY(1.4) translateY(-5px); opacity: 0.6; }
            90% { transform: scaleY(0.9) translateY(1px); opacity: 0.8; }
            100% { transform: scaleY(1.1) translateY(-2px); opacity: 0.7; }
        }

        @keyframes sleekWave3 {
            0% { transform: scaleY(1.0) translateY(0px); opacity: 0.5; }
            20% { transform: scaleY(1.5) translateY(-6px); opacity: 0.7; }
            40% { transform: scaleY(0.6) translateY(3px); opacity: 0.4; }
            60% { transform: scaleY(1.2) translateY(-2px); opacity: 0.6; }
            80% { transform: scaleY(0.8) translateY(2px); opacity: 0.45; }
            100% { transform: scaleY(1.0) translateY(0px); opacity: 0.5; }
        }

        @keyframes sleekWave4 {
            0% { transform: scaleY(0.8) translateY(2px); opacity: 0.4; }
            15% { transform: scaleY(1.6) translateY(-7px); opacity: 0.6; }
            35% { transform: scaleY(0.5) translateY(4px); opacity: 0.3; }
            55% { transform: scaleY(1.3) translateY(-3px); opacity: 0.5; }
            75% { transform: scaleY(0.7) translateY(3px); opacity: 0.35; }
            95% { transform: scaleY(1.4) translateY(-5px); opacity: 0.55; }
            100% { transform: scaleY(0.8) translateY(2px); opacity: 0.4; }
        }

        /* Recording Status - Matching Iframe Card Style */
        .recording-status {
            display: flex;
            align-items: center;
            gap: 16px;
            background: #ffffff;
            padding: 20px 24px;
            border-radius: 16px;
            border: 1px solid #f1f5f9;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        }

        .status-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .recording-dot {
            width: 8px;
            height: 8px;
            background: #ef4444;
            border-radius: 50%;
            animation: simplePulse 2s ease-in-out infinite;
        }

        @keyframes simplePulse {
            0%, 100% { 
                opacity: 1;
            }
            50% { 
                opacity: 0.5;
            }
        }

        .status-text {
            font-size: 14px;
            font-weight: 500;
            color: #374151;
        }

        .recording-timer {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
            font-size: 16px;
            font-weight: 600;
            color: #6b7280;
            letter-spacing: 0.5px;
            min-width: 60px;
            text-align: left;
            font-variant-numeric: tabular-nums;
        }

        /* Control Buttons - Matching Iframe Style */
        .scribe-controls {
            display: flex;
            gap: 24px;
            align-items: center;
            overflow: visible;
        }

        .scribe-control-btn {
            width: 140px;
            height: 48px;
            padding: 0 24px;
            border-radius: 24px;
            border-radius: 16px;
            border: 1px solid rgba(255, 255, 255, 0.4);
            background: rgba(255, 255, 255, 0.9);
            color: #6b7280;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            position: relative;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            box-shadow: 
                0 4px 12px rgba(0, 0, 0, 0.08),
                0 2px 6px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
            overflow: hidden;
        }

        .scribe-control-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, 
                transparent 0%, 
                rgba(255, 255, 255, 0.4) 50%, 
                transparent 100%);
            transition: left 0.5s ease;
        }

        .scribe-control-btn:hover::before {
            left: 100%;
        }

        .scribe-control-btn:hover {
            background: rgba(255, 255, 255, 1);
            border-color: rgba(255, 255, 255, 0.6);
            transform: translateY(-2px) scale(1.02);
            box-shadow: 
                0 8px 20px rgba(0, 0, 0, 0.12),
                0 4px 12px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 1);
        }

        .scribe-control-btn:active {
            transform: translateY(-1px) scale(1.01);
            box-shadow: 
                0 4px 12px rgba(0, 0, 0, 0.08),
                0 2px 6px rgba(0, 0, 0, 0.04);
        }

        .scribe-control-btn.pause:hover {
            background: rgba(139, 92, 246, 0.1);
            color: #7c3aed;
        }

        .scribe-control-btn.flag {
            color: #6b7280;
        }

        .scribe-control-btn.flag:hover {
            background: rgba(107, 114, 128, 0.08);
            border-color: rgba(107, 114, 128, 0.2);
            color: #4b5563;
            transform: none; /* Prevent flag button from moving on hover to avoid overlay shift */
        }

        .scribe-control-btn.flag.flagged {
            background: rgba(107, 114, 128, 0.12);
            border-color: rgba(107, 114, 128, 0.2);
            color: #4b5563;
            animation: flagPulse 0.3s ease-out;
        }

        .scribe-control-btn.flag:active {
            transform: none; /* Prevent any movement on click */
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
        }

        /* Flag Counter Badge for Size 1 Overlay */
        .scribe-control-btn.flag {
            position: relative;
        }

        .scribe-control-btn.flag::after {
            content: attr(data-flag-count);
            position: absolute;
            top: -4px;
            right: -4px;
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: white;
            font-size: 9px;
            font-weight: 600;
            line-height: 1;
            padding: 0;
            border-radius: 50%;
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 
                0 2px 8px rgba(239, 68, 68, 0.4),
                0 1px 3px rgba(0, 0, 0, 0.2);
            opacity: 0;
            transform: scale(0.8);
            transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
            border: 2px solid rgba(255, 255, 255, 1);
            z-index: 20;
        }

        .scribe-control-btn.flag[data-flag-count]:not([data-flag-count="0"])::after {
            opacity: 1;
            transform: scale(1);
        }

        .scribe-control-btn.flag[data-flag-count="0"]::after {
            display: none;
        }

        .scribe-control-btn.stop {
            background: rgba(239, 68, 68, 0.08);
            border-color: rgba(239, 68, 68, 0.2);
            color: #dc2626;
        }

        .scribe-control-btn.stop:hover {
            background: rgba(239, 68, 68, 0.12);
            border-color: rgba(239, 68, 68, 0.3);
            color: #b91c1c;
        }

        .scribe-control-btn svg {
            width: 20px;
            height: 20px;
        }

        /* Keyboard Shortcut Hint */
        .keyboard-hint {
            margin-top: 16px;
            text-align: center;
            font-size: 12px;
            color: #9ca3af;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .keyboard-hint kbd {
            display: inline-block;
            padding: 4px 8px;
            background: #f3f4f6;
            border: 1px solid #e5e7eb;
            border-radius: 6px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, monospace;
            font-size: 11px;
            font-weight: 600;
            color: #6b7280;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
            line-height: 1;
        }

        /* Scribe Control Button Labels */
        .scribe-btn-label {
            font-size: 13px;
            font-weight: 500;
            margin-top: 2px;
            pointer-events: none;
        }
        .scribe-control-btn.pause .scribe-btn-label { color: #3b82f6; }
        .scribe-control-btn.stop .scribe-btn-label { color: #ef4444; }

        /* Toggle Icons Row */
        .scribe-toggle-row {
            display: flex;
            justify-content: center;
            gap: 12px;
            margin-top: 8px;
        }

        .scribe-toggle-btn {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            border: 1.5px solid #e5e7eb;
            background: #f9fafb;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            color: #6b7280;
        }
        .scribe-toggle-btn:hover {
            background: #f3f4f6;
            border-color: #d1d5db;
            color: #374151;
        }
        .scribe-toggle-btn.active {
            background: #eff6ff;
            border-color: #3b82f6;
            color: #2563eb;
        }
        .scribe-toggle-btn svg {
            width: 18px;
            height: 18px;
        }

        /* Consultation overlay with sidebar layout */
        .consultation-overlay.has-sidebar {
            display: flex;
            align-items: flex-start;
            justify-content: center;
            gap: 16px;
        }
        .consultation-overlay.has-sidebar .scribe-interface {
            flex-shrink: 0;
            max-width: 480px;
        }

        /* Scribe Sidebar */
        .scribe-sidebar {
            position: fixed;
            top: 60px;
            right: 20px;
            bottom: 20px;
            width: 340px;
            display: none;
            flex-direction: column;
            gap: 12px;
            z-index: 10002;
            pointer-events: none;
        }
        .scribe-sidebar.visible {
            display: flex;
            pointer-events: auto;
        }

        .scribe-sidebar-panel {
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 24px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06);
            overflow: hidden;
            display: flex;
            flex-direction: column;
            min-height: 120px;
        }

        /* Fixed heights regardless of which panels are open */
        .scribe-sidebar-panel#transcriptPanel {
            height: 55vh;
        }
        .scribe-sidebar-panel#prioritiesPanel {
            height: 35vh;
            margin-top: auto;
        }

        .sidebar-panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 16px;
            border-bottom: 1px solid #f1f5f9;
            flex-shrink: 0;
        }

        .sidebar-panel-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 15px;
            font-weight: 600;
            color: #1e293b;
        }

        .sidebar-panel-close {
            width: 24px;
            height: 24px;
            border: none;
            background: none;
            cursor: pointer;
            font-size: 18px;
            color: #94a3b8;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
        }
        .sidebar-panel-close:hover {
            background: #f1f5f9;
            color: #475569;
        }

        .sidebar-panel-body {
            padding: 12px 16px;
            overflow-y: auto;
            flex: 1;
        }

        /* Transcript entries */
        .transcript-entry {
            padding: 10px 0;
            border-bottom: 1px solid #f1f5f9;
        }
        .transcript-entry:last-child { border-bottom: none; }
        .transcript-entry-text {
            font-size: 14px;
            color: #374151;
            line-height: 1.5;
        }
        .transcript-entry-time {
            font-size: 11px;
            color: #94a3b8;
            margin-top: 3px;
        }
        .transcript-placeholder {
            font-size: 14px;
            color: #94a3b8;
            text-align: center;
            padding: 20px 0;
        }
        .transcript-partial {
            color: #94a3b8;
            font-style: italic;
        }

        /* Priority checklist items in sidebar — card style matching insights page */
        .priority-check-item {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 12px 14px;
            background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
            border-radius: 12px;
            border: 1px solid #f1f5f9;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
            transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
            position: relative;
            overflow: hidden;
            margin-bottom: 8px;
        }
        .priority-check-item:last-child { margin-bottom: 0; }
        .priority-check-item::before {
            content: '';
            position: absolute;
            left: 0; top: 0; bottom: 0;
            width: 2px;
            border-radius: 12px 0 0 12px;
            opacity: 0.4;
        }
        .priority-check-item.high::before { background: #ef4444; }
        .priority-check-item.moderate::before { background: #f59e0b; }
        .priority-check-item:hover {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
            transform: translateY(-1px);
            border-color: rgba(139, 92, 246, 0.1);
        }
        .priority-check-item input[type="checkbox"] {
            width: 18px;
            height: 18px;
            margin: 0;
            flex-shrink: 0;
            margin-top: 3px;
            cursor: pointer;
            accent-color: #8b5cf6;
        }
        .priority-check-number {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 600;
            flex-shrink: 0;
        }
        .priority-check-item.high .priority-check-number {
            background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
            color: #dc2626;
        }
        .priority-check-item.moderate .priority-check-number {
            background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
            color: #d97706;
        }
        .priority-check-content { flex: 1; }
        .priority-check-title {
            font-size: 14px;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 2px;
            line-height: 1.3;
        }
        .priority-check-desc {
            font-size: 12px;
            color: #6b7280;
            line-height: 1.4;
        }
        .priority-check-item.checked-off .priority-check-title,
        .priority-check-item.checked-off .priority-check-desc {
            text-decoration: line-through;
            color: #94a3b8;
        }
        .priority-check-item.checked-off { opacity: 0.6; }
        .priority-subsection-header {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: #94a3b8;
            padding: 8px 0 4px;
        }
        .priority-check-label {
            font-size: 14px;
            color: #374151;
            line-height: 1.5;
            cursor: pointer;
        }
        .priority-check-label.checked {
            text-decoration: line-through;
            color: #94a3b8;
        }

        /* Remove all other complex styling */
        .scribe-background,
        .particle,
        .control-label {
            display: none;
        }

        /* Responsive Design - Minimal */
        @media (max-width: 768px) {
            .scribe-interface {
                padding: 32px 20px;
                gap: 28px;
            }
            
            .scribe-title {
                font-size: 22px;
            }
            
            .scribe-subtitle {
                font-size: 13px;
            }
            
            .soundwave-container {
                height: 70px;
                padding: 20px;
            }
            
            .wave-svg {
                width: 240px;
                height: 40px;
            }
            
            .recording-status {
                padding: 16px 20px;
                gap: 14px;
            }
            
            .recording-timer {
                font-size: 15px;
            }
            
            .scribe-control-btn {
                width: 44px;
                height: 44px;
            }
            
            .scribe-control-btn svg {
                width: 18px;
                height: 18px;
            }
            
            .scribe-controls {
                gap: 14px;
            }
        }

        /* ==========================================================================
           SYNC TIMESTAMP - Clean Design
           ========================================================================== */
        .sync-timestamp {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: #6b7280;
            font-weight: 500;
        }

        .sync-dot {
            width: 6px;
            height: 6px;
            background: #10b981;
            border-radius: 50%;
        }

        /* Removed unused animation */

        .refresh-btn-header {
            width: 20px;
            height: 20px;
            border: none;
            background: transparent;
            color: #8b5cf6;
            cursor: pointer;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            margin-right: 4px;
        }

        .refresh-btn-header:hover {
            background: rgba(139, 92, 246, 0.1);
            color: #7c3aed;
        }

        .refresh-btn-header svg {
            width: 12px;
            height: 12px;
        }

        /* Back Button */
        .back-btn {
            width: 36px;
            height: 36px;
            border: none;
            background: rgba(139, 92, 246, 0.1);
            color: #8b5cf6;
            cursor: pointer;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            margin-right: 12px;
            flex-shrink: 0;
        }

        .back-btn:hover {
            background: rgba(139, 92, 246, 0.2);
            color: #7c3aed;
            transform: translateX(-2px);
        }

        .back-btn svg {
            width: 18px;
            height: 18px;
        }

        /* ==========================================================================
           TOPIC PILLS ABOVE CHAT INPUT
           ========================================================================== */
        .chat-topic-pills-container {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            width: calc(70% - 40px);
            max-width: 500px;
            z-index: 51;
            display: flex;
            justify-content: center;
            pointer-events: none;
        }

        .chat-topic-pills {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            max-width: 480px;
            justify-content: center;
            align-items: center;
            padding: 0;
            margin: 0;
        }

        .topic-pill {
            display: flex;
            align-items: center;
            gap: 6px;
            background: rgba(255, 255, 255, 0.85);
            color: #6b7280;
            padding: 6px 12px;
            border-radius: 16px;
            font-size: 12px;
            font-weight: 500;
            backdrop-filter: blur(20px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
            border: 1px solid rgba(139, 92, 246, 0.15);
            pointer-events: auto;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
            animation: pillSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            user-select: none;
        }

        .topic-pill:hover {
            transform: translateY(-1px) scale(1.02);
            box-shadow: 0 4px 16px rgba(139, 92, 246, 0.12);
            background: rgba(255, 255, 255, 0.95);
            border-color: rgba(139, 92, 246, 0.25);
            color: #4b5563;
        }

        .topic-pill-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            color: #8b5cf6;
            opacity: 0.8;
        }

        .topic-pill-icon svg {
            width: 14px;
            height: 14px;
            color: inherit;
        }

        .topic-pill-text {
            font-weight: 500;
            line-height: 1.2;
            color: #374151;
        }

        .topic-pill-close {
            margin-left: 4px;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: rgba(107, 114, 128, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            font-weight: 500;
            transition: all 0.2s ease;
            cursor: pointer;
            color: #9ca3af;
            line-height: 1;
            padding: 0;
            border: none;
            outline: none;
        }

        .topic-pill-close:hover {
            background: rgba(139, 92, 246, 0.1);
            color: #8b5cf6;
            transform: scale(1.1);
        }

        .topic-pill-close:hover {
            background: rgba(139, 92, 246, 0.1);
            color: #8b5cf6;
            transform: scale(1.1);
        }

        .topic-pill.removing {
            animation: pillSlideOut 0.3s ease forwards;
        }

        @keyframes pillSlideIn {
            0% {
                opacity: 0;
                transform: translateY(20px) scale(0.8);
            }
            100% {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        @keyframes pillSlideOut {
            0% {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
            100% {
                opacity: 0;
                transform: translateY(-20px) scale(0.8);
            }
        }

        /* Responsive adjustments */
        @media (max-width: 1200px) {
            .chat-topic-pills-container {
                left: 50%;
                width: calc(100% - 40px);
                max-width: 600px;
            }
        }

        @media (max-width: 768px) {
            .chat-topic-pills-container {
                left: 50%;
                width: calc(100% - 20px);
                bottom: 70px;
                max-width: none;
            }
            
            .topic-pill {
                font-size: 11px;
                padding: 6px 10px;
            }
        }

        /* ==========================================================================
           CHAT INPUT AT BOTTOM OF PATIENT PORTAL
           ========================================================================== */
        .patient-chat-input-container {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            width: calc(70% - 40px);
            max-width: 500px;
            z-index: 50;
            display: flex;
            justify-content: center;
        }

        .patient-chat-input-wrapper {
            display: flex;
            align-items: center;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            border-radius: 50px;
            padding: 12px 20px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
            border: 1px solid rgba(255, 255, 255, 0.3);
            max-width: 480px;
            width: 100%;
            gap: 16px;
            transition: all 0.3s ease;
        }

        .patient-chat-input-wrapper:hover {
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
            transform: translateY(-2px);
        }

        .patient-chat-input-wrapper:focus-within {
            box-shadow: 0 12px 40px rgba(139, 92, 246, 0.2);
            border-color: rgba(139, 92, 246, 0.3);
        }

        .chat-input-icon {
            width: 20px;
            height: 20px;
            background: #f3f4f6;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            box-shadow: none;
            transition: all 0.2s ease;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            border: 1px solid #e5e7eb;
        }

        .chat-input-icon::before {
            content: '';
            width: 4px;
            height: 4px;
            background: #d1d5db;
            border-radius: 50%;
            transition: all 0.2s ease;
        }

        /* Single topic states - very subtle */
        .chat-input-icon.medication-adherence {
            background: #f8fafc;
            border-color: rgba(139, 92, 246, 0.3);
        }

        .chat-input-icon.avg-glucose {
            background: #fef2f2;
            border-color: rgba(239, 68, 68, 0.3);
        }

        .chat-input-icon.weight-change {
            background: #eff6ff;
            border-color: rgba(59, 130, 246, 0.3);
        }

        .chat-input-icon.lifestyle {
            background: #f0fdf4;
            border-color: rgba(16, 185, 129, 0.3);
        }

        /* Multiple topics state - subtle mixed border */
        .chat-input-icon.multiple {
            background: #f9fafb;
            border: 2px solid transparent;
            background-image: 
                linear-gradient(#f9fafb, #f9fafb),
                linear-gradient(45deg, 
                    rgba(139, 92, 246, 0.4), 
                    rgba(239, 68, 68, 0.4), 
                    rgba(59, 130, 246, 0.4), 
                    rgba(16, 185, 129, 0.4)
                );
            background-origin: padding-box, border-box;
            background-clip: padding-box, border-box;
            border-radius: 50%;
        }

        /* Active state content */
        .chat-input-icon.medication-adherence::before {
            background: rgba(139, 92, 246, 0.6);
        }

        .chat-input-icon.avg-glucose::before {
            background: rgba(239, 68, 68, 0.6);
        }

        .chat-input-icon.weight-change::before {
            background: rgba(59, 130, 246, 0.6);
        }

        .chat-input-icon.lifestyle::before {
            background: rgba(16, 185, 129, 0.6);
        }

        /* Topic count for multiple selections */
        .chat-input-icon.multiple::after {
            content: attr(data-count);
            position: absolute;
            color: #6b7280;
            font-size: 8px;
            font-weight: 600;
            line-height: 1;
        }

        .chat-input-icon.multiple::before {
            display: none;
        }

        /* Hover effects - very subtle */
        .chat-input-icon:hover {
            transform: scale(1.05);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

        /* Click feedback */
        .chat-input-icon:active {
            transform: scale(0.95);
        }

        @keyframes clearFeedback {
            0% { transform: scale(1); }
            50% { transform: scale(1.1); border-color: rgba(16, 185, 129, 0.5); }
            100% { transform: scale(1); }
        }

        @keyframes fadeInUp {
            0% {
                opacity: 0;
                transform: translateX(-50%) translateY(10px);
            }
            100% {
                opacity: 1;
                transform: translateX(-50%) translateY(0);
            }
        }

        .patient-chat-input {
            flex: 1;
            border: none;
            outline: none;
            background: transparent;
            font-size: 14px;
            color: #374151;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            font-weight: 400;
            line-height: 1.5;
        }

        .patient-chat-input::placeholder {
            color: #9ca3af;
            font-size: 12px;
            font-weight: 400;
            font-style: italic;
            opacity: 0.7;
        }

        .chat-input-actions {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
        }

        .chat-input-send-btn,
        .chat-input-voice-btn {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
            position: relative;
            overflow: hidden;
        }

        /* Send button styling */
        .chat-input-send-btn {
            background: #f3f4f6;
            color: #6b7280;
            border: 1px solid #e5e7eb;
        }

        .chat-input-send-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(139, 92, 246, 0.1);
            border-radius: 50%;
            opacity: 0;
            transform: scale(0.8);
            transition: all 0.2s ease;
        }

        .chat-input-send-btn:hover {
            background: #e5e7eb;
            color: #6b7280;
            transform: translateY(-1px) scale(1.05);
        }

        .chat-input-send-btn:hover::before {
            opacity: 1;
            transform: scale(1);
        }

        .chat-input-send-btn:active {
            transform: translateY(0) scale(1.02);
        }

        .chat-input-send-btn svg {
            position: relative;
            z-index: 1;
            transition: transform 0.2s ease;
            color: #6b7280;
            stroke: #6b7280;
        }

        .chat-input-send-btn:hover svg {
            transform: translateX(1px);
            color: #6b7280;
            stroke: #6b7280;
        }

        /* Send button enabled state with text */
        /* Send button enabled state with text */
        .chat-input-send-btn:not(.disabled) {
            background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
            color: white;
            border: none;
            box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
        }

        .chat-input-send-btn:not(.disabled)::before {
            background: rgba(255, 255, 255, 0.2);
        }

        .chat-input-send-btn:not(.disabled):hover {
            box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
        }

        .chat-input-send-btn:not(.disabled) svg {
            color: white;
            stroke: white;
        }

        .chat-input-send-btn:not(.disabled):hover svg {
            color: white;
            stroke: white;
        }

        /* Send button disabled state */
        .chat-input-send-btn.disabled {
            background: #f3f4f6;
            color: #6b7280;
            cursor: not-allowed;
            box-shadow: none;
            border: 1px solid #e5e7eb;
        }

        .chat-input-send-btn.disabled:hover {
            transform: none;
            box-shadow: none;
            background: #f3f4f6;
            color: #6b7280;
        }

        .chat-input-send-btn.disabled::before {
            display: none;
        }

        .chat-input-send-btn.disabled svg {
            color: #6b7280;
            stroke: #6b7280;
        }

        /* Voice button styling */
        .chat-input-voice-btn {
            background: #f3f4f6;
            color: #6b7280;
            border: 1px solid #e5e7eb;
        }

        .chat-input-voice-btn:hover {
            background: #e5e7eb;
            color: #6b7280;
            transform: translateY(-1px) scale(1.05);
        }

        .chat-input-voice-btn:active {
            transform: translateY(0) scale(1.02);
        }

        .chat-input-voice-btn svg {
            position: relative;
            z-index: 1;
            transition: all 0.2s ease;
            color: #6b7280;
            stroke: #6b7280;
        }

        .chat-input-voice-btn:hover svg {
            color: #6b7280;
            stroke: #6b7280;
        }

        /* Voice button recording state */
        .chat-input-voice-btn.recording {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: white;
            border-color: #ef4444;
            animation: voicePulse 1.5s ease-in-out infinite;
        }

        .chat-input-voice-btn.recording .voice-icon {
            display: none;
        }

        .chat-input-voice-btn.recording .recording-icon {
            display: block !important;
        }

        @keyframes voicePulse {
            0%, 100% { 
                box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3), 0 0 0 0 rgba(239, 68, 68, 0.4);
            }
            50% { 
                box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4), 0 0 0 6px rgba(239, 68, 68, 0.1);
            }
        }

        /* Voice button listening state */
        .chat-input-voice-btn.listening {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
            border-color: #10b981;
            animation: voiceListening 2s ease-in-out infinite;
        }

        @keyframes voiceListening {
            0%, 100% { 
                box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3), 0 0 0 0 rgba(16, 185, 129, 0.4);
            }
            50% { 
                box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4), 0 0 0 4px rgba(16, 185, 129, 0.2);
            }
        }

        /* Voice button processing state */
        .chat-input-voice-btn.processing {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            color: white;
            border-color: #f59e0b;
            animation: voiceProcessing 1s linear infinite;
        }

        @keyframes voiceProcessing {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Responsive adjustments */
        @media (max-width: 1200px) {
            .patient-chat-input-container {
                left: 50%;
                width: calc(100% - 40px);
                max-width: 600px;
            }
        }

        @media (max-width: 768px) {
            .patient-chat-input-container {
                left: 50%;
                width: calc(100% - 20px);
                bottom: 10px;
                max-width: none;
            }
            
            .patient-chat-input-wrapper {
                padding: 10px 16px;
                gap: 12px;
            }
            
            .chat-input-icon,
            .chat-input-send-btn,
            .chat-input-voice-btn {
                width: 24px;
                height: 24px;
            }
            
            .chat-input-icon::before {
                width: 3px;
                height: 3px;
            }
            
            .chat-input-actions {
                gap: 4px;
            }
            
            .patient-chat-input {
                font-size: 14px;
            }
        }
        
        @media (max-width: 1200px) {
            .patient-portal-background {
                width: 100%;
            }
            
            .previsit-overlay {
                width: 350px;
                right: 20px;
            }

            .chat-container {
                width: 90vw;
                right: 5vw;
            }
        }

        @media (max-width: 768px) {
            .previsit-overlay {
                width: 300px;
                height: 500px;
            }
            
            .instructions {
                display: none;
            }

            .chat-container {
                width: 90vw;
                right: 5vw;
            }
        }

        /* ==========================================================================
           PROCESSING WORKFLOW OVERLAY
           ========================================================================== */
        .processing-overlay {
            position: fixed;
            inset: 0;
            background: radial-gradient(circle at center, 
                rgba(139, 92, 246, 0.06) 0%,
                rgba(15, 23, 42, 0.3) 40%,
                rgba(15, 23, 42, 0.5) 100%);
            backdrop-filter: blur(12px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            opacity: 0;
            pointer-events: none;
            transform: scale(0.98);
            transition: opacity 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
                        transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
        }

        .processing-overlay.active {
            opacity: 1;
            pointer-events: auto;
            transform: scale(1);
        }

        .processing-modal {
            background: white;
            border-radius: 20px;
            padding: 48px 40px;
            max-width: 480px;
            width: 90%;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            text-align: center;
        }

        .processing-spinner {
            width: 64px;
            height: 64px;
            margin: 0 auto 32px;
            position: relative;
        }

        .spinner-ring {
            width: 64px;
            height: 64px;
            border: 3px solid #f3f4f6;
            border-top-color: #8b5cf6;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .processing-title {
            font-size: 20px;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 12px;
        }

        .processing-subtitle {
            font-size: 14px;
            color: #6b7280;
            margin-bottom: 32px;
        }

        .processing-steps {
            text-align: left;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .processing-step {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 16px;
            background: #f9fafb;
            border-radius: 12px;
            opacity: 0.4;
            transition: all 0.4s ease;
        }

        .processing-step.active {
            opacity: 1;
            background: #f3f0ff;
            border: 1px solid #e9d5ff;
        }

        .processing-step.completed {
            opacity: 1;
            background: linear-gradient(90deg, #f0fdf4 0%, #f0fdf4 35%, transparent 100%);
            border: 1px solid #bbf7d0;
        }

        .step-icon {
            width: 24px;
            height: 24px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .step-icon svg {
            width: 20px;
            height: 20px;
        }

        .processing-step .step-icon {
            color: #d1d5db;
        }

        .processing-step.active .step-icon {
            color: #8b5cf6;
        }

        .processing-step.completed .step-icon {
            color: #10b981;
        }

        .step-spinner {
            width: 16px;
            height: 16px;
            border: 2px solid #e9d5ff;
            border-top-color: #8b5cf6;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        .step-text {
            flex: 1;
            font-size: 14px;
            color: #6b7280;
            font-weight: 500;
        }

        .processing-step.active .step-text {
            color: #7c3aed;
        }

        .processing-step.completed .step-text {
            color: #059669;
        }

        /* ==========================================================================
           SOAP NOTES OVERLAY
           ========================================================================== */
        .soap-notes-overlay {
            position: fixed;
            inset: 0;
            background: radial-gradient(circle at center, 
                rgba(139, 92, 246, 0.06) 0%,
                rgba(15, 23, 42, 0.3) 40%,
                rgba(15, 23, 42, 0.5) 100%);
            backdrop-filter: blur(12px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            opacity: 0;
            pointer-events: none;
            transform: scale(0.98);
            transition: opacity 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
                        transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
            padding: 20px;
        }

        .soap-notes-overlay.active {
            opacity: 1;
            pointer-events: auto;
            transform: scale(1);
        }

        .soap-notes-modal {
            background: linear-gradient(135deg, 
                rgba(255, 255, 255, 0.98) 0%,
                rgba(245, 252, 248, 0.96) 50%,
                rgba(240, 253, 244, 0.94) 100%);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: 24px;
            border: 1px solid rgba(255, 255, 255, 0.4);
            max-width: 900px;
            width: 100%;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            box-shadow: 
                0 25px 50px rgba(0, 0, 0, 0.08),
                0 15px 35px rgba(0, 0, 0, 0.05),
                0 5px 15px rgba(0, 0, 0, 0.03),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
        }

        .soap-notes-header {
            padding: 24px 32px;
            border-bottom: 1px solid #e5e7eb;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .soap-notes-header-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .soap-notes-icon {
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            border: 1px solid #e2e8f0;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #64748b;
            box-shadow: 0 4px 12px rgba(100, 116, 139, 0.08);
        }

        .soap-notes-header-text h2 {
            font-size: 18px;
            font-weight: 600;
            color: #1f2937;
            margin: 0 0 4px 0;
        }

        .soap-notes-header-text p {
            font-size: 13px;
            color: #6b7280;
            margin: 0;
        }

        .soap-notes-close {
            width: 36px;
            height: 36px;
            border: 1px solid #e5e7eb;
            background: #ffffff;
            border-radius: 10px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #6b7280;
            transition: all 0.2s ease;
        }

        .soap-notes-close:hover {
            background: #f9fafb;
            border-color: #d1d5db;
            color: #374151;
        }

        .soap-notes-close:active {
            transform: scale(0.95);
            background: #f3f4f6;
        }

        .soap-notes-content {
            flex: 1;
            overflow-y: auto;
            display: flex;
            gap: 0;
            padding: 0;
        }

        /* Two Column Layout */
        .soap-notes-main {
            flex: 0 0 70%;
            padding: 32px;
            overflow-y: auto;
            border-right: 1px solid rgba(0, 0, 0, 0.06);
        }

        .soap-notes-main[contenteditable="true"] {
            caret-color: #10b981;
            cursor: text;
        }

        .soap-notes-main[contenteditable="true"]:focus {
            outline: none;
        }

        /* Enhanced cursor visibility in edit mode */
        .soap-notes-main[contenteditable="true"] * {
            caret-color: #10b981;
        }

        /* Make text selection more visible in edit mode */
        .soap-notes-main[contenteditable="true"]::selection {
            background: rgba(16, 185, 129, 0.2);
            color: inherit;
        }

        .soap-notes-main[contenteditable="true"] *::selection {
            background: rgba(16, 185, 129, 0.2);
            color: inherit;
        }

        .soap-notes-sidebar {
            flex: 0 0 30%;
            padding: 32px 24px;
            background: linear-gradient(180deg, 
                rgba(240, 253, 244, 0.6) 0%, 
                rgba(249, 250, 251, 0.8) 100%);
            overflow-y: auto;
        }

        .soap-section {
            margin-bottom: 40px;
        }

        .soap-section:last-child {
            margin-bottom: 0;
        }

        .soap-section-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
        }

        .soap-section-letter {
            display: none;
        }

        .soap-section-title {
            font-size: 16px;
            font-weight: 600;
            color: #374151;
        }

        .soap-section-content {
            padding-left: 0;
            color: #374151;
            font-size: 14px;
            line-height: 1.6;
            margin-top: 12px;
        }

        .soap-section-content p {
            margin: 0 0 16px 0;
            font-size: 14px;
            line-height: 1.6;
            color: #374151;
        }

        .soap-section-content p:last-child {
            margin-bottom: 0;
        }

        .soap-section-content .soap-text {
            margin: 0 0 12px 0;
            font-size: 14px;
            line-height: 1.7;
            color: #374151;
        }

        .soap-section-content .soap-text:last-child {
            margin-bottom: 0;
        }

        .soap-section-content .soap-empty {
            color: #9ca3af;
            font-style: italic;
        }

        .soap-section-content .soap-subsections {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 12px;
            padding: 12px 16px;
            background: #f9fafb;
            border-radius: 8px;
            border-left: 3px solid #e5e7eb;
        }

        .soap-section-content .soap-subsection {
            font-size: 13px;
            line-height: 1.6;
        }

        .soap-section-content .soap-subsection-label {
            font-weight: 600;
            color: #4b5563;
        }

        .soap-section-content .soap-subsection-content {
            color: #374151;
        }

        .soap-section-content .soap-subsection-group {
            margin-top: 16px;
            padding: 14px 16px;
            background: #f9fafb;
            border-radius: 8px;
            border-left: 3px solid #8b5cf6;
        }

        .soap-section-content .soap-subsection-title {
            font-size: 13px;
            font-weight: 600;
            color: #6b7280;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 10px;
        }

        .soap-section-content .soap-subsection-item {
            font-size: 14px;
            line-height: 1.6;
            margin-bottom: 6px;
        }

        .soap-section-content .soap-subsection-item:last-child {
            margin-bottom: 0;
        }

        .soap-section-content .soap-list {
            margin: 8px 0;
            padding-left: 20px;
        }

        .soap-section-content .soap-list li {
            margin-bottom: 6px;
            font-size: 14px;
            line-height: 1.6;
            color: #374151;
        }

        .soap-section-content .soap-assessment-list {
            margin: 8px 0;
            padding-left: 24px;
        }

        .soap-section-content .soap-assessment-list li {
            margin-bottom: 8px;
            font-size: 14px;
            line-height: 1.6;
            color: #374151;
            font-weight: 500;
        }

        .soap-section-content .soap-medication-list {
            margin: 0;
            padding-left: 20px;
        }

        .soap-section-content .soap-medication-list li {
            margin-bottom: 4px;
            font-size: 14px;
            color: #374151;
        }

        .soap-section-content .soap-plan-item {
            margin-top: 12px;
            padding: 12px 16px;
            background: #f0fdf4;
            border-radius: 8px;
            border-left: 3px solid #22c55e;
        }

        .soap-section-content .soap-plan-condition {
            font-weight: 600;
            color: #166534;
            margin-bottom: 8px;
        }

        .soap-section-content .soap-plan-actions {
            margin: 0;
            padding-left: 20px;
        }

        .soap-section-content .soap-plan-actions li {
            margin-bottom: 4px;
            font-size: 14px;
            color: #374151;
        }

        .soap-section-content strong {
            font-weight: 600;
            color: #1f2937;
        }

        .soap-section-content ul {
            margin: 12px 0 16px 0;
            padding-left: 20px;
        }

        .soap-section-content li {
            margin-bottom: 8px;
            font-size: 14px;
            line-height: 1.6;
            color: #374151;
        }

        /* Medical Codes Sidebar */
        .medical-codes-sidebar-title {
            font-size: 14px;
            font-weight: 600;
            color: #374151;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .medical-codes-sidebar-title svg {
            width: 16px;
            height: 16px;
            color: #8b5cf6;
        }

        .code-list-sidebar {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .code-item-sidebar {
            padding: 12px;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
            position: relative;
        }

        .code-item-sidebar.active {
            border-color: #8b5cf6;
            background: #f3f0ff;
            box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
        }

        .code-badge-sidebar {
            padding: 4px 8px;
            background: #ede9fe;
            color: #7c3aed;
            border-radius: 6px;
            font-size: 12px;
            font-weight: 700;
            font-family: 'Courier New', monospace;
            display: inline-block;
            margin-bottom: 6px;
        }

        .code-item-sidebar.active .code-badge-sidebar {
            background: #ddd6fe;
            color: #6d28d9;
        }

        .code-item-sidebar.active .code-badge-sidebar {
            background: #c4b5fd;
            color: #5b21b6;
        }

        .code-description-sidebar {
            font-size: 12px;
            color: #6b7280;
            line-height: 1.4;
        }

        /* Medical codes loading state */
        .codes-loading {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 24px;
            gap: 12px;
            color: #6b7280;
            font-size: 13px;
        }

        .codes-loading-spinner {
            width: 24px;
            height: 24px;
            border: 3px solid #e5e7eb;
            border-top-color: #8b5cf6;
            border-radius: 50%;
            animation: codesSpinner 0.8s linear infinite;
        }

        @keyframes codesSpinner {
            to { transform: rotate(360deg); }
        }

        /* SOAP notes loading state */
        .soap-loading {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 48px 24px;
            gap: 16px;
            color: #6b7280;
            font-size: 14px;
            min-height: 300px;
        }

        .soap-loading-spinner {
            width: 32px;
            height: 32px;
            border: 3px solid #e5e7eb;
            border-top-color: #8b5cf6;
            border-radius: 50%;
            animation: codesSpinner 0.8s linear infinite;
        }

        .no-codes-message {
            padding: 12px 16px;
            text-align: center;
            color: #9ca3af;
            font-size: 13px;
        }

        .code-section-header {
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: #6b7280;
            padding: 10px 16px 6px;
            border-bottom: 1px solid #f1f5f9;
        }

        .code-hint {
            font-size: 11px;
            color: #9ca3af;
            margin-top: 6px;
            font-style: italic;
        }

        .code-confidence {
            font-size: 11px;
            font-weight: 600;
            margin-top: 0;
            display: flex;
            align-items: center;
            gap: 4px;
            margin-left: auto;
        }

        .code-confidence.conf-high {
            color: #10b981;
        }

        .code-confidence.conf-medium {
            color: #f59e0b;
        }

        .code-confidence.conf-low {
            color: #ef4444;
        }

        .code-confidence::before {
            content: '✓';
            font-size: 12px;
        }

        .code-confidence.conf-low::before {
            content: '⚠';
        }

        /* Code item header with checkbox */
        .code-item-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
        }

        /* Custom checkbox */
        .code-checkbox-label {
            display: flex;
            align-items: center;
            cursor: pointer;
            flex-shrink: 0;
        }

        .code-checkbox {
            display: none;
        }

        .code-checkbox-custom {
            width: 18px;
            height: 18px;
            border: 2px solid #d1d5db;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s ease;
            background: white;
        }

        .code-checkbox:checked + .code-checkbox-custom {
            background: #8b5cf6;
            border-color: #8b5cf6;
        }

        .code-checkbox:checked + .code-checkbox-custom::after {
            content: '✓';
            color: white;
            font-size: 12px;
            font-weight: 700;
        }

        .code-item-sidebar:not(.selected) {
            opacity: 0.55;
        }

        .code-item-sidebar:not(.selected) .code-badge-sidebar {
            background: #f3f4f6;
            color: #9ca3af;
        }

        /* Other predictions collapsible */
        .other-predictions-section {
            margin-top: 12px;
            border-top: 1px dashed #e5e7eb;
            padding-top: 8px;
        }

        .other-predictions-toggle {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 8px 4px;
            font-size: 11px;
            color: #9ca3af;
            cursor: pointer;
            user-select: none;
        }

        .other-predictions-toggle svg {
            transition: transform 0.2s ease;
        }

        .other-predictions-section.expanded .other-predictions-toggle svg {
            transform: rotate(180deg);
        }

        .other-predictions-list {
            display: none;
            gap: 8px;
            flex-direction: column;
        }

        .other-predictions-section.expanded .other-predictions-list {
            display: flex;
        }

        /* Highlighted text in notes */
        .code-linked-text.highlighted {
            background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
            padding: 2px 4px;
            border-radius: 4px;
            border-bottom-color: transparent;
            box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
            transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        }

        /* Code-linked text markers */
        .code-linked-text {
            position: relative;
            padding: 2px 0;
            border-bottom: 2px dotted rgba(139, 92, 246, 0.4);
            transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
        }

        .code-linked-text[data-code="E11.9"] {
            border-bottom-color: rgba(139, 92, 246, 0.4);
        }

        .code-linked-text[data-code="Z79.84"] {
            border-bottom-color: rgba(139, 92, 246, 0.4);
        }

        .code-linked-text[data-code="E66.3"] {
            border-bottom-color: rgba(139, 92, 246, 0.4);
        }

        .code-linked-text[data-code="Z91.120"] {
            border-bottom-color: rgba(139, 92, 246, 0.4);
        }

        .code-linked-text[data-code="99214"] {
            border-bottom-color: rgba(139, 92, 246, 0.4);
        }

        .code-linked-text[data-code="I10"] {
            border-bottom-color: rgba(139, 92, 246, 0.4);
        }

        .code-linked-text.highlighted {
            background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
            padding: 2px 4px;
            border-radius: 4px;
            border-bottom-color: transparent;
            box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
        }

        .medical-codes {
            background: #f9fafb;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            padding: 16px;
            margin-top: 24px;
        }

        .medical-codes-title {
            font-size: 14px;
            font-weight: 600;
            color: #374151;
            margin-bottom: 12px;
        }

        .code-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .code-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
        }

        .code-badge {
            padding: 4px 8px;
            background: #ede9fe;
            color: #7c3aed;
            border-radius: 6px;
            font-size: 12px;
            font-weight: 600;
            font-family: 'Courier New', monospace;
        }

        .code-description {
            flex: 1;
            font-size: 13px;
            color: #4b5563;
        }

        .soap-notes-footer {
            padding: 20px 32px;
            border-top: 1px solid #e5e7eb;
            background: rgba(255, 255, 255, 0.8);
            border-bottom-left-radius: 24px;
            border-bottom-right-radius: 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .soap-notes-actions {
            display: flex;
            gap: 12px;
        }

        .soap-notes-link-btn {
            background: none;
            border: none;
            color: #6b7280;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 0;
            transition: all 0.2s ease;
        }

        .soap-notes-link-btn:hover {
            color: #374151;
        }

        .soap-notes-link-btn svg {
            width: 16px;
            height: 16px;
        }

        .soap-notes-btn {
            padding: 12px 24px;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            border: none;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .soap-notes-btn.secondary {
            background: #ffffff;
            color: #374151;
            border: 1px solid #e5e7eb;
            font-weight: 500;
        }

        .soap-notes-btn.secondary:hover {
            background: #f9fafb;
            border-color: #d1d5db;
        }

        .soap-notes-btn.primary {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
        }

        .soap-notes-btn.primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
        }

        .soap-notes-btn svg {
            width: 16px;
            height: 16px;
        }

        /* ==========================================================================
           EVIDENCE MAPPING - AUDIO PLAYBACK STYLES
           ========================================================================== */
        
        /* Evidence Links - Clickable segments with audio */
        .evidence-link {
            position: relative;
            cursor: pointer;
            transition: all 0.2s ease;
            padding: 2px 4px;
            margin: -2px -4px;
            border-radius: 3px;
        }

        /* Evidence link without code-linked class gets purple dotted underline */
        .evidence-link:not(.code-linked-text) {
            border-bottom: 2px dotted rgba(139, 92, 246, 0.4);
        }

        .evidence-link:hover {
            background: #f3f0ff;
        }

        .evidence-link:not(.code-linked-text):hover {
            border-bottom-color: #7c3aed;
        }

        .evidence-link.playing {
            background: #ede9fe;
            animation: evidencePulse 1.5s ease-in-out infinite;
        }

        .evidence-link.code-linked-text.playing {
            border-bottom: 2px solid #8b5cf6;
        }

        @keyframes evidencePulse {
            0%, 100% {
                background: #ede9fe;
            }
            50% {
                background: #ddd6fe;
            }
        }

        .evidence-link::after {
            content: '🔊';
            font-size: 10px;
            margin-left: 4px;
            opacity: 0;
            transition: opacity 0.2s ease;
        }

        .evidence-link:hover::after {
            opacity: 0.6;
        }

        .evidence-link.playing::after {
            opacity: 1;
            animation: speakerBounce 0.6s ease-in-out infinite;
        }

        @keyframes speakerBounce {
            0%, 100% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.2);
            }
        }

        /* Audio Player Overlay - Floating Hands-Free Design */
        .audio-player-overlay {
            position: fixed;
            top: 80px;
            left: 50%;
            transform: translateX(-50%) translateY(-20px);
            background: linear-gradient(135deg, 
                rgba(255, 255, 255, 0.98) 0%,
                rgba(249, 250, 251, 0.98) 100%);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: 24px;
            padding: 16px 24px;
            box-shadow: 
                0 20px 60px rgba(0, 0, 0, 0.12),
                0 8px 24px rgba(139, 92, 246, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
            border: 1px solid rgba(139, 92, 246, 0.15);
            z-index: 10001;
            min-width: 400px;
            max-width: 500px;
            opacity: 0;
            pointer-events: none;
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        .audio-player-overlay.active {
            opacity: 1;
            pointer-events: auto;
            transform: translateX(-50%) translateY(0);
        }

        .audio-player-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
        }

        .audio-player-icon {
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            flex-shrink: 0;
            box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
            animation: micPulse 2s ease-in-out infinite;
        }

        @keyframes micPulse {
            0%, 100% { 
                box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
                transform: scale(1);
            }
            50% { 
                box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
                transform: scale(1.05);
            }
        }

        .audio-player-info {
            flex: 1;
            min-width: 0;
        }

        .audio-player-title {
            font-size: 14px;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 3px;
        }

        .audio-player-timestamp {
            font-size: 11px;
            color: #6b7280;
            font-weight: 500;
        }

        .audio-player-close {
            width: 32px;
            height: 32px;
            border: none;
            background: rgba(107, 114, 128, 0.08);
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #6b7280;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .audio-player-close:hover {
            background: rgba(107, 114, 128, 0.15);
            color: #374151;
        }

        .audio-player-controls {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .audio-play-btn {
            width: 32px;
            height: 32px;
            border: none;
            background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .audio-play-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
        }

        .audio-play-btn:active {
            transform: scale(0.95);
        }

        /* Wave visualization - 3D wave similar to consultation overlay */
        .audio-wave-container {
            flex: 1;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            background: linear-gradient(135deg, #fafbfc 0%, #f9fafb 100%);
            border-radius: 8px;
            padding: 0;
            overflow: hidden;
        }

        .audio-wave-svg {
            width: 100%;
            height: 100%;
        }

        .audio-wave-path {
            fill: none;
            stroke-width: 3;
            stroke-linecap: round;
            stroke-linejoin: round;
            opacity: 0.3;
            transform-origin: center;
        }

        .audio-wave-path-1 {
            stroke: #8b5cf6;
            opacity: 0.8;
        }

        .audio-wave-path-2 {
            stroke: #a78bfa;
            opacity: 0.6;
        }

        .audio-wave-path-3 {
            stroke: #c4b5fd;
            opacity: 0.4;
        }

        /* Animate waves when playing */
        .audio-player-overlay.playing .audio-wave-path-1 {
            animation: audioWave1 3s ease-in-out infinite;
        }

        .audio-player-overlay.playing .audio-wave-path-2 {
            animation: audioWave2 3.5s ease-in-out infinite 0.5s;
        }

        .audio-player-overlay.playing .audio-wave-path-3 {
            animation: audioWave3 4s ease-in-out infinite 1s;
        }

        @keyframes audioWave1 {
            0% { transform: scaleY(0.8) translateY(0px); opacity: 0.8; }
            25% { transform: scaleY(1.3) translateY(-2px); opacity: 1; }
            50% { transform: scaleY(0.7) translateY(2px); opacity: 0.7; }
            75% { transform: scaleY(1.4) translateY(-3px); opacity: 0.9; }
            100% { transform: scaleY(0.8) translateY(0px); opacity: 0.8; }
        }

        @keyframes audioWave2 {
            0% { transform: scaleY(1.0) translateY(-1px); opacity: 0.6; }
            30% { transform: scaleY(0.6) translateY(3px); opacity: 0.8; }
            60% { transform: scaleY(1.5) translateY(-4px); opacity: 0.5; }
            90% { transform: scaleY(0.8) translateY(1px); opacity: 0.7; }
            100% { transform: scaleY(1.0) translateY(-1px); opacity: 0.6; }
        }

        @keyframes audioWave3 {
            0% { transform: scaleY(0.9) translateY(1px); opacity: 0.4; }
            35% { transform: scaleY(1.2) translateY(-2px); opacity: 0.6; }
            65% { transform: scaleY(0.5) translateY(4px); opacity: 0.3; }
            95% { transform: scaleY(1.1) translateY(-1px); opacity: 0.5; }
            100% { transform: scaleY(0.9) translateY(1px); opacity: 0.4; }
        }

        .audio-time {
            font-size: 11px;
            color: #6b7280;
            font-weight: 600;
            font-family: 'Courier New', monospace;
            min-width: 32px;
            text-align: right;
            flex-shrink: 0;
        }

        /* Small arrow pointing to the evidence link */
        .audio-player-overlay::before {
            content: '';
            position: absolute;
            top: -6px;
            left: 20px;
            width: 12px;
            height: 12px;
            background: white;
            border-left: 1px solid #e5e7eb;
            border-top: 1px solid #e5e7eb;
            transform: rotate(45deg);
        }

        /* Evidence indicator badge */
        .evidence-indicator {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            background: #f3f0ff;
            color: #7c3aed;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 600;
            margin-left: 8px;
            cursor: help;
        }

        .evidence-indicator svg {
            width: 12px;
            height: 12px;
        }

        /* ==========================================================================
           PATIENT SCHEDULE SCREEN
           ========================================================================== */
        .schedule-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
            z-index: 10000;
            overflow-y: auto;
        }

        .schedule-screen.hidden {
            display: none;
        }

        .schedule-top-bar {
            background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
            border-bottom: 1px solid #e5e7eb;
            padding: 12px 40px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
        }

        .schedule-top-left {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .schedule-logo {
            font-size: 15px;
            font-weight: 600;
            color: #374151;
        }

        .schedule-top-right {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .schedule-icon-btn {
            position: relative;
            width: 36px;
            height: 36px;
            border-radius: 8px;
            border: 1px solid #e5e7eb;
            background: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .schedule-icon-btn:hover {
            background: #f9fafb;
            border-color: #d1d5db;
        }

        .schedule-icon-btn svg {
            width: 16px;
            height: 16px;
            color: #6b7280;
        }

        .schedule-notification-badge {
            position: absolute;
            top: -4px;
            right: -4px;
            width: 16px;
            height: 16px;
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 9px;
            font-weight: 600;
            color: #ffffff;
            border: 2px solid #ffffff;
        }

        .schedule-doctor-info {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 6px 12px;
            background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
            border-radius: 8px;
            border: 1px solid #e5e7eb;
        }

        .schedule-doctor-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #ffffff;
            font-size: 12px;
            font-weight: 600;
        }

        .schedule-doctor-name {
            font-size: 13px;
            font-weight: 600;
            color: #1f2937;
        }

        .schedule-header {
            background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
            border-bottom: 1px solid #e5e7eb;
            padding: 20px 40px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
        }

        .schedule-title-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 10px;
        }

        .schedule-title {
            font-size: 24px;
            font-weight: 600;
            background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 50%, #10b981 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .schedule-date-nav {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .schedule-nav-btn {
            width: 32px;
            height: 32px;
            border-radius: 6px;
            border: 1px solid #e5e7eb;
            background: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .schedule-nav-btn:hover {
            background: #f9fafb;
            border-color: #8b5cf6;
        }

        .schedule-nav-btn svg {
            width: 14px;
            height: 14px;
            color: #6b7280;
        }

        .schedule-nav-btn:hover svg {
            color: #8b5cf6;
        }

        .schedule-today-btn {
            padding: 6px 14px;
            border-radius: 6px;
            border: 1px solid #e5e7eb;
            background: #ffffff;
            font-size: 12px;
            font-weight: 600;
            color: #374151;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .schedule-today-btn:hover {
            background: #f9fafb;
            border-color: #8b5cf6;
            color: #8b5cf6;
        }

        .schedule-subtitle {
            font-size: 14px;
            color: #6b7280;
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .schedule-date {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 500;
            color: #374151;
        }

        .schedule-stats {
            display: flex;
            align-items: center;
            gap: 8px;
            padding-left: 20px;
            border-left: 1px solid #d1d5db;
        }

        .schedule-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 40px 40px 80px 40px;
        }

        .patient-card {
            background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
            border-radius: 16px;
            border: 1px solid #e5e7eb;
            padding: 20px 24px;
            margin-bottom: 16px;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            display: grid;
            grid-template-columns: 100px 60px minmax(200px, 1fr) auto;
            align-items: center;
            gap: 24px;
            box-shadow: 
                0 2px 8px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
            position: relative;
            overflow: hidden;
        }

        .patient-card::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            background: linear-gradient(180deg, 
                rgba(139, 92, 246, 0.6) 0%,
                rgba(59, 130, 246, 0.6) 100%);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .patient-card:hover {
            border-color: rgba(139, 92, 246, 0.3);
            box-shadow: 
                0 8px 24px rgba(139, 92, 246, 0.12),
                0 4px 12px rgba(0, 0, 0, 0.06),
                inset 0 1px 0 rgba(255, 255, 255, 1);
            transform: translateY(-2px);
        }

        .patient-card:hover::before {
            opacity: 1;
        }

        .patient-card:active {
            transform: translateY(0);
        }

        .patient-time {
            font-size: 14px;
            font-weight: 600;
            color: #374151;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 2px;
            line-height: 1.6;
        }

        .patient-time-main {
            font-size: 16px;
            color: #374151;
            line-height: 1.5;
        }

        .patient-time-duration {
            font-size: 11px;
            color: #9ca3af;
            font-weight: 500;
            line-height: 1.4;
        }

        .patient-avatar {
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: linear-gradient(135deg, #f3f0ff 0%, #eff6ff 50%, #f0fdf4 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #7c3aed;
            font-size: 20px;
            font-weight: 600;
            flex-shrink: 0;
            box-shadow: 0 2px 8px rgba(139, 92, 246, 0.08);
            position: relative;
            border: 1px solid #e9d5ff;
        }

        .patient-avatar::after {
            content: '';
            position: absolute;
            inset: -2px;
            border-radius: 50%;
            padding: 2px;
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(16, 185, 129, 0.2));
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            mask-composite: exclude;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .patient-card:hover .patient-avatar::after {
            opacity: 1;
        }

        .patient-info {
            flex: 1;
            min-width: 0;
        }

        .patient-name {
            font-size: 16px;
            font-weight: 600;
            color: #374151;
            margin-bottom: 6px;
            letter-spacing: -0.01em;
            white-space: nowrap;
            line-height: 1.5;
        }

        .patient-details {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 12px;
            color: #6b7280;
            font-weight: 500;
            line-height: 1.5;
            flex-wrap: wrap;
        }

        .patient-details > span {
            display: flex;
            align-items: center;
            white-space: nowrap;
        }

        .patient-details .separator {
            color: #d1d5db;
            font-weight: 400;
            margin: 0 2px;
        }

        .patient-detail-item {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .patient-detail-item svg {
            color: #9ca3af;
            display: none;
        }

        .patient-badges {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            justify-content: flex-end;
        }

        .patient-badge {
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 11px;
            font-weight: 600;
            white-space: nowrap;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            transition: all 0.2s ease;
            line-height: 1.4;
        }

        .patient-badge.visit-type {
            background: linear-gradient(135deg, #f3f0ff 0%, #ede9fe 100%);
            color: #7c3aed;
        }

        .patient-badge.status {
            background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
            color: #059669;
        }

        .patient-badge.alert {
            background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
            color: #dc2626;
        }

        .patient-badge.prep {
            background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
            color: #2563eb;
        }

        .patient-badge.warning {
            background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
            color: #d97706;
        }

        .patient-card:hover .patient-badge {
            transform: translateY(-1px);
        }

        .icon-sm {
            width: 14px;
            height: 14px;
        }

        /* Empty state for no patients */
        .schedule-empty {
            text-align: center;
            padding: 80px 20px;
            color: #9ca3af;
        }

        .schedule-empty svg {
            width: 64px;
            height: 64px;
            margin-bottom: 16px;
            opacity: 0.3;
        }


/* ==========================================================================
   LIVE TRANSCRIPT STYLES
   ========================================================================== */

.live-transcript {
    margin: 20px;
    padding: 20px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    min-height: 180px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
}

.live-transcript .transcript-content {
    font-size: 16px;
    line-height: 1.8;
    color: #1f2937;
}

.live-transcript .transcript-final {
    margin: 0 0 12px 0;
    padding: 0;
    font-weight: 400;
}

.live-transcript .transcript-partial {
    margin: 0;
    padding: 0;
    color: #3b82f6;
    font-style: italic;
    border-left: 3px solid #3b82f6;
    padding-left: 12px;
}

.live-transcript .transcript-placeholder {
    margin: 0;
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 40px 0;
}

/* Streaming Status Indicator */
.streaming-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.streaming-status.connecting {
    background: #fef3c7;
    color: #92400e;
}

.streaming-status.streaming {
    background: #dcfce7;
    color: #166534;
}

.streaming-status.stopped,
.streaming-status.disconnected {
    background: #f3f4f6;
    color: #6b7280;
}

/* Streaming Error Toast */
.streaming-error-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    opacity: 0;
    transition: all 0.3s ease;
}

.streaming-error-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.streaming-error-toast svg {
    flex-shrink: 0;
}


/* Make soundwave smaller when transcript is active */
.scribe-interface .soundwave-container {
    transform: scale(0.6);
    margin: -20px 0;
    opacity: 0.7;
}

/* Add a label above transcript */
.live-transcript::before {
    content: 'Live Transcript';
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b7280;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}


/* Fix scribe interface for two-column layout */
.consultation-overlay .scribe-interface {
    max-height: none;
    overflow: visible;
    padding: 0;
    max-width: none;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure the overlay content is NOT scrollable - only transcript scrolls */
#consultationOverlay {
    overflow: hidden;
}

#consultationOverlay .scribe-interface {
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    max-width: 480px;
    margin: 0 auto;
}


/* ==========================================================================
   TWO-COLUMN SCRIBE LAYOUT - Controls Left, Transcript Right
   ========================================================================== */

/* Two-column container */
.scribe-two-column-layout {
    display: flex;
    flex-direction: row;
    gap: 24px;
    width: 100%;
    max-width: 900px;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

/* Left column - Controls */
.scribe-controls-column {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

/* Right column - Transcript */
.scribe-transcript-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

/* Transcript header */
.transcript-header {
    padding: 14px 20px;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.transcript-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Live transcript area - scrollable */
.scribe-transcript-column .live-transcript {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    margin: 0 !important;
    min-height: 200px !important;
    max-height: none !important;
    background: #ffffff;
}

/* Remove the ::before label since we have a header now */
.scribe-transcript-column .live-transcript::before {
    display: none;
}

/* Transcript content styling */
.scribe-transcript-column .transcript-content {
    font-size: 14px;
    line-height: 1.7;
    color: #374151;
}

.scribe-transcript-column .transcript-placeholder {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* Transcript entries */
.scribe-transcript-column .transcript-entry {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 3px solid #8b5cf6;
}

.scribe-transcript-column .transcript-entry.partial {
    opacity: 0.7;
    border-left-color: #d1d5db;
    background: #fafafa;
}

.scribe-transcript-column .transcript-entry.final {
    opacity: 1;
    border-left-color: #10b981;
    background: #f0fdf4;
}

/* Scrollbar styling for transcript */
.scribe-transcript-column .live-transcript::-webkit-scrollbar {
    width: 6px;
}

.scribe-transcript-column .live-transcript::-webkit-scrollbar-track {
    background: transparent;
}

.scribe-transcript-column .live-transcript::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.scribe-transcript-column .live-transcript::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Adjust controls column elements */
.scribe-controls-column .scribe-header {
    margin-bottom: 10px;
}

.scribe-controls-column .soundwave-container {
    transform: scale(0.8);
    margin: -10px 0;
}

.scribe-controls-column .recording-status {
    padding: 14px 18px;
}

.scribe-controls-column .scribe-controls {
    margin-top: 10px;
}

.scribe-controls-column .keyboard-hint {
    margin-top: 10px;
}

/* Override the old scribe-interface styles for two-column layout */
.scribe-two-column-layout .scribe-interface {
    max-width: none;
    padding: 0;
}

/* Responsive - stack on smaller screens */
@media (max-width: 768px) {
    .scribe-two-column-layout {
        flex-direction: column;
        gap: 16px;
    }
    
    .scribe-controls-column {
        flex: none;
        width: 100%;
    }
    
    .scribe-transcript-column {
        min-height: 200px;
    }
}


/* ==========================================================================
   SMS NOTIFICATION SECTION
   ========================================================================== */

/* SMS Section Container */
.sms-notification-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.sms-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.sms-section-header svg {
    width: 20px;
    height: 20px;
    color: #16a34a;
}

.sms-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #166534;
}

.sms-section-badge {
    background: #16a34a;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Phone Input Group */
.sms-phone-group {
    margin-bottom: 16px;
}

.sms-phone-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sms-phone-inline .sms-phone-label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0;
    white-space: nowrap;
    font-size: 13px;
    color: #374151;
}

.sms-patient-name {
    font-weight: 700;
    color: #111827;
}

.sms-phone-input-inline {
    width: 180px;
    flex: none;
    padding: 8px 12px;
    font-size: 13px;
}

.sms-phone-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.sms-phone-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sms-phone-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: all 0.2s ease;
}

.sms-phone-input:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.sms-phone-input::placeholder {
    color: #9ca3af;
}

/* Message Preview */
.sms-message-group {
    margin-bottom: 16px;
}

.sms-message-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.sms-char-counter {
    font-size: 11px;
    color: #6b7280;
    font-weight: 400;
}

.sms-char-counter.warning {
    color: #f59e0b;
}

.sms-char-counter.danger {
    color: #ef4444;
}

.sms-message-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    background: white;
    resize: vertical;
    transition: all 0.2s ease;
}

.sms-message-textarea:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.sms-message-textarea::placeholder {
    color: #9ca3af;
}

/* SMS Actions */
.sms-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sms-send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: #16a34a;
    border: 2px solid #16a34a;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.sms-send-btn:hover {
    background: rgba(22, 163, 74, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.15);
}

.sms-send-btn:active {
    transform: translateY(0);
}

.sms-send-btn:disabled {
    background: transparent;
    color: #9ca3af;
    border-color: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sms-send-btn svg {
    width: 16px;
    height: 16px;
}

.sms-skip-btn {
    padding: 10px 16px;
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sms-skip-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* SMS Status Messages */
.sms-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
    animation: smsStatusFadeIn 0.3s ease;
}

@keyframes smsStatusFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sms-status.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.sms-status.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.sms-status.sending {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #7dd3fc;
}

.sms-status svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sms-status.sending svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* SMS Sent Confirmation */
.sms-sent-confirmation {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #86efac;
    border-radius: 10px;
    margin-top: 12px;
}

.sms-sent-icon {
    width: 40px;
    height: 40px;
    background: #16a34a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sms-sent-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.sms-sent-details {
    flex: 1;
}

.sms-sent-title {
    font-size: 14px;
    font-weight: 600;
    color: #166534;
    margin-bottom: 2px;
}

.sms-sent-subtitle {
    font-size: 12px;
    color: #15803d;
}

/* Hide SMS section initially, show after animation */
.sms-notification-section.hidden {
    display: none;
}

/* ==========================================================================
   CLINICAL DOCUMENTATION IN EHR BODY
   ========================================================================== */

.clinical-doc-ehr {
    padding: 24px 32px;
    max-width: 800px;
}

.clinical-doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.clinical-doc-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.clinical-doc-actions {
    display: flex;
    gap: 10px;
}

.clinical-doc-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    transition: all 0.2s;
}

.clinical-doc-btn.approve {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
}

.clinical-doc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.clinical-doc-section {
    margin-bottom: 20px;
}

.clinical-doc-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.clinical-doc-section p {
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
    margin: 0 0 6px 0;
}

/* ==========================================================================
   MEDICAL CODES SIDEBAR
   ========================================================================== */

.medical-codes-sidebar {
    padding: 0;
}

.medical-codes-header {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}

.medical-codes-list {
    padding: 8px 12px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.medical-code-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid #f8fafc;
}

.medical-code-item:last-child {
    border-bottom: none;
}

.medical-code-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

.medical-code-info {
    flex: 1;
}

.medical-code-desc {
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}

.medical-code-confidence {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}


/* ==========================================================================
   SOAP NOTES INLINE (IN RIGHT PANEL)
   ========================================================================== */
.soap-notes-inline {
    background: white;
    border-radius: 8px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.soap-notes-header-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.soap-notes-header-inline h2 {
    font-size: 17px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.soap-inline-actions {
    display: flex;
    gap: 8px;
}

.soap-inline-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.soap-inline-btn svg {
    width: 14px;
    height: 14px;
}

.soap-inline-btn.primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.soap-inline-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.soap-inline-btn.secondary {
    background: white;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.soap-inline-btn.secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.soap-inline-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.soap-inline-section {
    margin-bottom: 20px;
}

.soap-inline-section:last-child {
    margin-bottom: 0;
}

.soap-inline-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #f3f4f6;
}

.soap-inline-section-title.s-title { color: #3b82f6; }
.soap-inline-section-title.o-title { color: #10b981; }
.soap-inline-section-title.a-title { color: #8b5cf6; }
.soap-inline-section-title.p-title { color: #f59e0b; }

.soap-inline-section p {
    font-size: 13px;
    line-height: 1.7;
    color: #374151;
    margin: 0 0 8px 0;
}

.soap-inline-section p:last-child {
    margin-bottom: 0;
}

/* Code-linked text highlighting */
.code-linked-text {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 3px;
    padding: 1px 3px;
    margin: 0 -3px;
}

.code-linked-text:hover {
    background: rgba(139, 92, 246, 0.1);
}

.code-linked-text.highlighted {
    background: rgba(139, 92, 246, 0.2);
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}
