/* Info Badge Styling */
.info-badge {
    position: relative;
    display: inline-block;
    margin-left: 6px;
    font-size: 14px;
    cursor: help;
}

.info-badge:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1000;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.info-badge:hover::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
}

/* Safety Flags Styling - Medora Theme */
.safety-flags-container {
    padding: 12px;
    background: #ffffff;
    border-left: 3px solid #00bcd4;
    border-radius: 6px;
    margin: 8px 0;
    box-shadow: 0 1px 3px rgba(0, 188, 212, 0.1);
}

.safety-flag-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 10px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e3f2fd;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.safety-flag-icon {
    color: #00bcd4;
    font-size: 16px;
    margin-right: 10px;
    flex-shrink: 0;
}

.safety-flag-content {
    flex: 1;
}

.safety-flag-text {
    color: #1a1a1a;
    font-weight: 500;
    margin-bottom: 6px;
    line-height: 1.4;
}

.safety-flag-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 8px;
}

.safety-flag-source {
    font-size: 11px;
    color: #00bcd4;
    background: rgba(0, 188, 212, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
    border: 1px solid rgba(0, 188, 212, 0.2);
}

.safety-flag-expand {
    cursor: pointer;
    color: #00bcd4;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 188, 212, 0.1);
    border: 1px solid rgba(0, 188, 212, 0.3);
    transition: all 0.2s ease;
    font-family: inherit;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 188, 212, 0.1);
}

.safety-flag-expand:hover {
    background: #00bcd4;
    color: white;
    border-color: #00bcd4;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 188, 212, 0.3);
}

.safety-flag-expand:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 188, 212, 0.2);
}

.safety-flag-details {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #fecaca;
    font-size: 12px;
}

.safety-flag-details.expanded {
    display: block;
}

.safety-flag-evidence {
    margin: 10px 0;
    padding: 12px;
    background: #f8fffe;
    border-radius: 6px;
    border-left: 3px solid #00bcd4;
    border: 1px solid rgba(0, 188, 212, 0.1);
}

.safety-flag-evidence strong {
    color: #1a1a1a;
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.safety-flag-evidence em {
    color: #4a4a4a;
    font-style: italic;
    line-height: 1.4;
}

.evidence-content, .action-content {
    color: #4a4a4a;
    line-height: 1.5;
    margin-top: 4px;
}

.evidence-content {
    font-style: italic;
}

.safety-flag-action {
    background: rgba(0, 188, 212, 0.05);
    padding: 10px 12px;
    border-radius: 6px;
    margin-top: 10px;
    font-weight: 500;
    color: #1a1a1a;
    border: 1px solid rgba(0, 188, 212, 0.2);
}

/* Rainbow animation keyframes */
@keyframes rainbowFlow {
    0% { background-position: 300% 0; }
    100% { background-position: -300% 0; }
}

/* Service Border Rainbow Animations */
.service-loading {
    position: relative;
    overflow: visible;
}

.service-loading::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, 
        #ff0000 0%, 
        #ff7f00 12.5%, 
        #ffff00 25%, 
        #00ff00 37.5%, 
        #0000ff 50%, 
        #4b0082 62.5%, 
        #9400d3 75%, 
        #ff0000 100%);
    background-size: 400% 400%;
    animation: rainbowBorder 3s linear infinite;
    border-radius: inherit;
    z-index: -1;
}

@keyframes rainbowBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.service-loading-spinner {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    z-index: 1000;
}

.service-rainbow-spinner {
    width: 100%;
    height: 100%;
    position: relative;
    animation: spinService 2s linear infinite;
}

.service-spinner-arc {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
}

.service-spinner-arc.arc-1 {
    border-top-color: #ff0080;
    animation: spinService 0.8s linear infinite;
}

.service-spinner-arc.arc-2 {
    border-right-color: #00ff88;
    animation: spinService 1.2s linear infinite reverse;
}

.service-spinner-arc.arc-3 {
    border-bottom-color: #00bfff;
    animation: spinService 1.6s linear infinite;
}

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

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

@keyframes sourceItemPulse {
    0%, 70%, 100% { opacity: 0.3; transform: scale(1); }
    35% { opacity: 1; transform: scale(1.3); }
}

/* IMS Sync Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Override ALL old loader styles */
.simple-medical-loader,
.medical-loading-container,
.lds-ring,
.spinner-container {
    display: none !important;
    visibility: hidden !important;
}

/* Force bulletproof loader visibility */
.bulletproof-loader {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
/* Progressive disclosure - hide empty sections initially */
.initial-hidden {
    display: none !important;
}

/* Show sections when patient is selected */
body.patient-selected .show-on-patient {
    display: block !important;
}

/* Show sections when visit is active */
body.visit-started .show-on-visit {
    display: block !important;
}

/* Show sections when transcript exists */
body.transcript-ready .show-on-transcript {
    display: block !important;
}

/* Show sections when recording is active - higher specificity */
.initial-hidden.show-on-recording {
    display: block !important;
}

/* Override specific button hiding with ID selectors for recording state */
#pause-listening-btn.show-on-recording,
#submit-transcript-btn.show-on-recording {
    display: block !important;
}

/* Tabbed Right Panel - Medora Theme */
.feature-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #00bcd4;
    margin-bottom: 0;
}

.feature-tab {
    flex: 1;
    padding: 12px 16px;
    background: #f8f9fa;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.feature-tab:hover {
    background: #e3f2fd;
    color: #00bcd4;
}

.feature-tab.active {
    background: #ffffff;
    color: #00bcd4;
    border-bottom-color: #00bcd4;
    font-weight: 600;
}

.tab-content {
    background: #ffffff;
    min-height: auto;
}

.tab-panel {
    display: none;
    padding: 8px;
    min-height: 300px;
    overflow-y: auto;
}

.tab-panel.active {
    display: block;
}

/* FORCE SPACING REDUCTIONS - HIGHEST PRIORITY */
#ai-insights-tab .ai-insights-collapsed,
#ai-insights-tab .insights-section,
.ai-insights-collapsed,
.insights-section {
    margin: 4px 0 !important;
    padding: 10px !important;
}

#allergeniq-tab .allergeniq-section,
.allergeniq-section {
    margin: 6px 0 !important;
    padding: 12px !important;
}

#references-tab .references-section,
.references-section {
    margin: 6px 0 !important;
    padding: 12px !important;
}

/* Make AllergenIQ card more obviously clickable and VISIBLE */
.allergeniq-collapsed {
    cursor: pointer !important;
    transition: all 0.3s ease;
    border: 2px solid #00BFFF !important;
    background: white !important;
    padding: 12px !important;
    margin: 4px 0 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 191, 255, 0.1) !important;
    min-height: 120px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.allergeniq-collapsed:hover {
    background: #f0f9ff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.3) !important;
}

/* AllergenIQ content styling */
.allergeniq-collapsed * {
    visibility: visible !important;
    opacity: 1 !important;
}

/* AllergenIQ Rainbow Loader Styles */
.allergeniq-rainbow-loader {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.rainbow-spinner-mini {
    width: 30px;
    height: 30px;
    position: relative;
    animation: spinAllergen 2s linear infinite;
}

.spinner-arc {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
}

.spinner-arc.arc-1 {
    border-top-color: #ff0080;
    animation: spinAllergen 0.8s linear infinite;
}

.spinner-arc.arc-2 {
    border-right-color: #00ff88;
    animation: spinAllergen 1.2s linear infinite reverse;
}

.spinner-arc.arc-3 {
    border-bottom-color: #00bfff;
    animation: spinAllergen 1.6s linear infinite;
}

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

/* Ensure tab content is properly visible */
.references-container, .insights-section {
    width: 100%;
    min-height: 200px;
}

.references-empty {
    text-align: center;
    padding: 20px;
    color: #6B7280;
}

/* References content styling */
.references-container, #references-grid, #references-empty {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: auto;
}

/* Make References grid items visible */
.references-grid .reference-card {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 15px !important;
    margin: 10px 0 !important;
}

/* TAB SYSTEM STYLES */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: #f8fafc;
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.tab-btn.active {
    background: white;
    color: #00BFFF;
    border-bottom-color: #00BFFF;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.right-panel {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 320px !important;
    min-height: 600px !important;
    background: #F8FAFC !important;
    border-left: 1px solid #E5E7EB !important;
    padding: 8px !important;
    overflow-y: auto !important;
}

/* FORCE TIGHT TAB CONTENT SPACING */
.tab-content {
    padding: 0 !important;
    margin: 0 !important;
}

.tab-content > * {
    margin-top: 0 !important;
    margin-bottom: 6px !important;
}

.tab-content > *:last-child {
    margin-bottom: 0 !important;
}

/* FORCE COMPACT H3 SPACING IN RIGHT PANEL */
.right-panel h3,
.tab-content h3,
.allergeniq-section h3,
.references-section h3,
.insights-section h3 {
    margin: 0 0 8px 0 !important;
    padding-bottom: 6px !important;
}

/* OVERRIDE ANY JAVASCRIPT APPLIED MARGINS */
div[style*="margin"] .allergeniq-section,
div[style*="margin"] .references-section,
div[style*="margin"] .insights-section {
    margin: 6px 0 !important;
}

.tab-content {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: auto;
}

/* Tab panel text styling */
.tab-panel *, .allergeniq-collapsed *, .references-container * {
    color: #333 !important;
    font-size: 14px !important;
}

/* ==============================
    MEDORA THEME: ALLERGENIQ MODAL 
    ============================== */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

/* AI Insights Modal Container - Medora White Theme */
.ai-insights-modal {
    background: white !important;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 191, 255, 0.2);
    border: 2px solid #00BFFF;
    max-width: 90%;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    color: #333 !important;
    display: flex;
    flex-direction: column;
}

/* Legacy support for allergeniq-modal class */
.allergeniq-modal {
    background: white !important;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e1e5e9;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    color: #333 !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal Header - Neon Blue Accent */
.modal-header {
    background: linear-gradient(135deg, #00BFFF 0%, #0099CC 100%);
    color: white;
    padding: 20px 24px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #0088DD;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

.new-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Modal Content - White Background */
.modal-content {
    padding: 24px;
    background: white;
    color: #333;
}

/* Modal Grid Layout */
.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Modal Cards - White with Neon Blue Accents */
.modal-card {
    background: white;
    border: 2px solid #E8F4FD;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 191, 255, 0.1);
    transition: all 0.2s ease;
}

.modal-card:hover {
    border-color: #00BFFF;
    box-shadow: 0 4px 16px rgba(0, 191, 255, 0.2);
}

.modal-card.full-width {
    grid-column: 1 / -1;
    margin-top: 10px;
}

/* Card Headers with Neon Blue */
.modal-card-header {
    background: linear-gradient(135deg, #00BFFF 0%, #0099CC 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 16px;
}

.modal-card-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.modal-card-title {
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Card Content */
.modal-card-content,
#modal-diagnosis-content,
#modal-allergens-content,
#modal-symptoms-content,
#modal-medications-content {
    padding: 20px;
    background: white;
    color: #333;
    line-height: 1.6;
}

/* Loading Messages */
.loading-message {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* Action Buttons - Medora Blue Theme */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #E8F4FD;
}

.btn {
    padding: 12px 24px;
    border: 2px solid #00BFFF;
    border-radius: 6px;
    background: white;
    color: #00BFFF;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn:hover {
    background: #00BFFF;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.3);
}

.btn-primary {
    background: #00BFFF;
    color: white;
}

.btn-primary:hover {
    background: #0099CC;
    border-color: #0099CC;
}

/* Symptom Heat Map - Medora Theme */
.symptom-heatmap-container {
    background: white;
    border-radius: 6px;
    padding: 16px;
}

.symptom-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 8px 0;
    background: #F8FCFF;
    border-radius: 6px;
    border-left: 4px solid #00BFFF;
    transition: all 0.2s ease;
}

.symptom-row:hover {
    background: #E8F4FD;
    transform: translateX(4px);
}

.symptom-name {
    flex: 1;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.intensity-bar-container {
    flex: 2;
    height: 8px;
    background: #E8F4FD;
    border-radius: 4px;
    margin: 0 16px;
    overflow: hidden;
}

.intensity-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00BFFF 0%, #0099CC 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.symptom-score {
    font-weight: 700;
    color: #00BFFF;
    font-size: 14px;
    min-width: 50px;
    text-align: right;
}

/* Medications Table - Medora Theme */
.medications-table-container {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #E8F4FD;
}

.medications-table {
    width: 100%;
    border-collapse: collapse;
}

.medications-table th {
    background: #00BFFF;
    color: white;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.medications-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #E8F4FD;
    color: #333;
    font-size: 14px;
}

.medication-row:hover {
    background: #F8FCFF;
}

.medication-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.medication-pill-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #00BFFF 0%, #0099CC 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.medication-name {
    font-weight: 600;
    color: #333;
}

.status-indicator {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-active {
    background: #E8F4FD;
    color: #00BFFF;
}

.status-inactive {
    background: #F3F4F6;
    color: #6B7280;
}

/* ===========================================
    FORCE PROPER TEXT CONTRAST - HIGH PRIORITY
    =========================================== */

/* Override any dark theme on AllergenIQ Modal */
#allergeniq-modal-overlay,
#allergeniq-modal-overlay *,
.allergeniq-modal,
.allergeniq-modal *,
.ai-insights-modal,
.ai-insights-modal * {
    color: #333 !important;
    background-color: transparent !important;
}

/* Specific targeting for AI Insights modal */
.ai-insights-modal {
    background: white !important;
    color: #333 !important;
}

.ai-insights-modal .modal-content {
    background: white !important;
    color: #333 !important;
}

.ai-insights-modal .modal-card {
    background: white !important;
    color: #333 !important;
}

.ai-insights-modal .modal-card-content {
    background: white !important;
    color: #333 !important;
}

/* Force white backgrounds where needed */
.allergeniq-modal {
    background: white !important;
    color: #333 !important;
}

.modal-content {
    background: white !important;
    color: #333 !important;
}

.modal-card {
    background: white !important;
    color: #333 !important;
}

/* MEDICAL-GRADE HEADER STYLING - MATCHES AI INSIGHTS & SOAP NOTES */
.modal-header,
.modal-card-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%) !important;
    color: #1f2937 !important;
    border-bottom: 2px solid #e1e5e9 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
}

.modal-header *,
.modal-card-header * {
    color: #1f2937 !important;
}

/* Force dark text in content areas */
#modal-diagnosis-content,
#modal-allergens-content,
#modal-symptoms-content,
#modal-medications-content,
.modal-card-content {
    background: white !important;
    color: #333 !important;
}

#modal-diagnosis-content *,
#modal-allergens-content *,
#modal-symptoms-content *,
#modal-medications-content *,
.modal-card-content * {
    color: #333 !important;
}

/* Symptom heat map text contrast */
.symptom-name,
.symptom-score {
    color: #333 !important;
}

/* Medication table text contrast */
.medications-table td,
.medication-name,
.medication-dosage,
.medication-frequency {
    color: #333 !important;
}

/* Button text contrast */
.btn {
    color: #00BFFF !important;
    background: white !important;
    border: 2px solid #00BFFF !important;
}

.btn-primary {
    color: white !important;
    background: #00BFFF !important;
}

/* Loading message contrast */
.loading-message {
    color: #666 !important;
}

/* Diagnosis content specific styling */
.diagnosis-card,
.diagnosis-primary-title,
.diagnosis-secondary-info {
    color: #333 !important;
}

/* Allergen content styling */
.allergen-category-tag {
    color: #333 !important;
    background: #E8F4FD !important;
}

/* Table headers - keep blue background with white text */
.medications-table th {
    background: #00BFFF !important;
    color: white !important;
}

/* ============================================
    MAXIMUM SPECIFICITY FOR AI INSIGHTS MODAL
    ============================================ */

/* All text in AI Insights modal should be dark */
.ai-insights-modal * {
    color: #333 !important;
}

/* All backgrounds in AI Insights modal should be white (except headers) */
.ai-insights-modal div:not(.modal-header):not(.modal-card-header) {
    background: white !important;
}

/* Specific content areas */
.ai-insights-modal #modal-diagnosis-content,
.ai-insights-modal #modal-allergens-content, 
.ai-insights-modal #modal-symptoms-content,
.ai-insights-modal #modal-medications-content {
    background: white !important;
    color: #333 !important;
}

/* Headers should remain blue with white text */
.ai-insights-modal .modal-header,
.ai-insights-modal .modal-card-header {
    background: linear-gradient(135deg, #00BFFF 0%, #0099CC 100%) !important;
    color: white !important;
}

/* Main modal header title should be black on white */
.ai-insights-modal .modal-header .modal-card-title {
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 18px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-shadow: none !important;
    background: transparent !important;
    z-index: 999999 !important;
    position: relative !important;
}

/* Section headers should be white on blue */
.ai-insights-modal .modal-card-header .modal-card-title {
    color: white !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8) !important;
    background: transparent !important;
    z-index: 999999 !important;
    position: relative !important;
}

.ai-insights-modal .modal-header .modal-card-title {
    color: #000000 !important;
}

.ai-insights-modal .modal-card-header * {
    color: white !important;
}

/* Symptom and medication data should be clearly readable */
.ai-insights-modal .symptom-name,
.ai-insights-modal .symptom-score,
.ai-insights-modal .medication-name,
.ai-insights-modal .medication-dosage,
.ai-insights-modal .medication-frequency,
.ai-insights-modal .diagnosis-card,
.ai-insights-modal .allergen-category-tag {
    color: #333 !important;
    background: white !important;
}

/* ============================================
    NUCLEAR OPTION: FORCE WHITE THEME WITH MAXIMUM PRIORITY
    ============================================ */

/* Target AllergenIQ modal with absolute maximum specificity */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal {
    background: white !important;
    color: #333 !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal * {
    color: #333 !important;
    background: white !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.modal-content {
    background: white !important;
    color: #333 !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.modal-card {
    background: white !important;
    color: #333 !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div#modal-diagnosis-content,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div#modal-allergens-content,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div#modal-symptoms-content,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div#modal-medications-content {
    background: white !important;
    color: #333 !important;
}

/* Force headers to stay blue */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.modal-header,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.modal-card-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%) !important;
    color: #1f2937 !important;
    border-bottom: 2px solid #e1e5e9 !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.modal-header *,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.modal-card-header * {
    color: #1f2937 !important;
}

/* Force all text content to be readable */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal span,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal p,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal td,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal th,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.symptom-name,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.medication-name {
    color: #333 !important;
    background: transparent !important;
}

/* ============================================
    ENHANCED MEDORA GRAPHICS & VISUAL ELEMENTS
    ============================================ */

/* Symptom Heat Map - Enhanced Visibility */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .symptom-heatmap-container {
    background: #F8FCFF !important;
    border: 2px solid #E8F4FD !important;
    border-radius: 8px !important;
    padding: 20px !important;
    margin: 16px 0 !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .symptom-row {
    background: white !important;
    border: 1px solid #e1e5e9 !important;
    border-left: 4px solid #6b7280 !important;
    border-radius: 4px !important;
    padding: 16px !important;
    margin: 12px 0 !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    transition: all 0.2s ease !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .symptom-row:hover {
    background: #F0F9FF !important;
    transform: translateX(4px) !important;
    box-shadow: 0 4px 8px rgba(0, 191, 255, 0.2) !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .symptom-name {
    flex: 1 !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    color: #333 !important;
    margin-right: 16px !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .intensity-bar-container {
    flex: 2 !important;
    height: 12px !important;
    background: #E8F4FD !important;
    border-radius: 6px !important;
    margin: 0 16px !important;
    overflow: hidden !important;
    position: relative !important;
    border: 1px solid #D1E9FF !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .intensity-bar-fill {
    height: 100% !important;
    background: linear-gradient(90deg, #6b7280 0%, #4b5563 50%, #374151 100%) !important;
    border-radius: 6px !important;
    transition: all 0.5s ease !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Add animated shimmer effect to intensity bars */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .intensity-bar-fill::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent) !important;
    animation: shimmer 2s infinite !important;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .symptom-score {
    font-weight: 700 !important;
    font-size: 16px !important;
    color: #00BFFF !important;
    min-width: 60px !important;
    text-align: right !important;
    background: #F0F9FF !important;
    padding: 8px 12px !important;
    border-radius: 20px !important;
    border: 2px solid #00BFFF !important;
}

/* Medication Table Enhancement */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .medications-table-container {
    background: white !important;
    border: 2px solid #E8F4FD !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.1) !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .medications-table {
    width: 100% !important;
    border-collapse: collapse !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .medications-table th {
    background: linear-gradient(135deg, #00BFFF 0%, #0099CC 100%) !important;
    color: white !important;
    padding: 16px 12px !important;
    text-align: left !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .medications-table td {
    padding: 16px 12px !important;
    border-bottom: 1px solid #E8F4FD !important;
    color: #333 !important;
    font-size: 14px !important;
    background: white !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .medications-table tr:nth-child(even) td {
    background: #F8FCFF !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .medications-table tr:hover td {
    background: #F0F9FF !important;
    transform: scale(1.01) !important;
    transition: all 0.2s ease !important;
}

/* Medication Pills Icons */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .medication-pill-icon {
    width: 36px !important;
    height: 36px !important;
    background: linear-gradient(135deg, #00BFFF 0%, #0099CC 100%) !important;
    color: white !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    margin-right: 12px !important;
    box-shadow: 0 2px 6px rgba(0, 191, 255, 0.3) !important;
}

/* Status Indicators */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .status-indicator {
    padding: 6px 12px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .status-active {
    background: linear-gradient(135deg, #E8F4FD 0%, #D1E9FF 100%) !important;
    color: #00BFFF !important;
    border: 2px solid #00BFFF !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .status-inactive {
    background: #F3F4F6 !important;
    color: #6B7280 !important;
    border: 2px solid #E5E7EB !important;
}

/* Progress and Loading Elements */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .loading-message {
    color: #00BFFF !important;
    font-style: italic !important;
    text-align: center !important;
    padding: 40px 20px !important;
    background: #F8FCFF !important;
    border: 2px dashed #00BFFF !important;
    border-radius: 8px !important;
    font-size: 16px !important;
}

/* Allergen Tags */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .allergen-category-tag {
    background: linear-gradient(135deg, #E8F4FD 0%, #D1E9FF 100%) !important;
    color: #333 !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    border: 2px solid #00BFFF !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    display: inline-block !important;
    margin: 4px 8px 4px 0 !important;
}

/* Diagnosis Cards */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .diagnosis-card {
    background: white !important;
    border: 2px solid #E8F4FD !important;
    border-radius: 8px !important;
    padding: 20px !important;
    margin: 12px 0 !important;
    color: #333 !important;
    line-height: 1.6 !important;
    box-shadow: 0 2px 8px rgba(0, 191, 255, 0.1) !important;
}

html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .diagnosis-primary-title {
    font-weight: 700 !important;
    font-size: 18px !important;
    color: #00BFFF !important;
    margin-bottom: 12px !important;
}

/* ============================================
    FORCE HEADINGS TO BE VISIBLE - DARK TEXT
    ============================================ */

/* All headings in modal content (not headers) should be dark */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal h1:not(.modal-header h1):not(.modal-card-header h1),
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal h2:not(.modal-header h2):not(.modal-card-header h2),
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal h3:not(.modal-header h3):not(.modal-card-header h3),
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal h4:not(.modal-header h4):not(.modal-card-header h4),
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal h5:not(.modal-header h5):not(.modal-card-header h5),
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal h6:not(.modal-header h6):not(.modal-card-header h6) {
    color: #333 !important;
    font-weight: 700 !important;
    margin: 16px 0 12px 0 !important;
    line-height: 1.3 !important;
}

/* Section headings should be blue accent */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .modal-card-content h1,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .modal-card-content h2,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .modal-card-content h3,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-diagnosis-content h1,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-diagnosis-content h2,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-diagnosis-content h3,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-allergens-content h1,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-allergens-content h2,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-allergens-content h3,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-symptoms-content h1,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-symptoms-content h2,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-symptoms-content h3,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-medications-content h1,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-medications-content h2,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-medications-content h3 {
    color: #00BFFF !important;
    font-weight: 700 !important;
    font-size: 18px !important;
    margin: 20px 0 16px 0 !important;
    border-bottom: 2px solid #E8F4FD !important;
    padding-bottom: 8px !important;
}

/* Subheadings should be dark */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .modal-card-content h4,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .modal-card-content h5,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .modal-card-content h6,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-diagnosis-content h4,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-diagnosis-content h5,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-diagnosis-content h6,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-allergens-content h4,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-allergens-content h5,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-allergens-content h6,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-symptoms-content h4,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-symptoms-content h5,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-symptoms-content h6,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-medications-content h4,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-medications-content h5,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal #modal-medications-content h6 {
    color: #333 !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    margin: 16px 0 12px 0 !important;
}

/* Labels and strong text should be visible */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal strong,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal b,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal label,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .label,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .title {
    color: #333 !important;
    font-weight: 600 !important;
}

/* Title elements that act as headings - HIGH SPECIFICITY */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .diagnosis-primary-title,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .empty-title,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal .cross-reactivity-label {
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 18px !important;
    margin: 16px 0 12px 0 !important;
    border-bottom: 2px solid #E8F4FD !important;
    padding-bottom: 8px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ============================================
    ALLERGENIQ PROFILE WHITE THEME FIX
    ============================================ */

/* Force white background and black text for AllergenIQ modal */
#allergeniq-modal-overlay .medora-modal {
    background: white !important;
    color: #000000 !important;
}

#allergeniq-modal-overlay .medora-modal * {
    background-color: transparent !important;
    color: #000000 !important;
}

/* Modal header should have white background */
#allergeniq-modal-overlay .medora-modal-header {
    background: white !important;
    border-bottom: 2px solid #00BFFF !important;
}

/* Main title should be visible */
#allergeniq-modal-overlay .medora-modal-title {
    color: #00BFFF !important;
    font-weight: 700 !important;
    font-size: 24px !important;
}

/* Cards should have white background */
#allergeniq-modal-overlay .medora-card {
    background: white !important;
    border: 1px solid #E8F4FD !important;
}

/* Card headers should be visible */
#allergeniq-modal-overlay .medora-card-header {
    color: #00BFFF !important;
    font-weight: 600 !important;
    border-bottom: 1px solid #E8F4FD !important;
}

/* All text content should be black */
#allergeniq-modal-overlay .medora-card-body,
#allergeniq-modal-overlay .medora-card-body * {
    color: #000000 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force diagnosis content to be visible */
#allergeniq-modal-overlay #modal-diagnosis-content,
#allergeniq-modal-overlay #modal-diagnosis-content * {
    color: #000000 !important;
    background: transparent !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* Diagnosis list items */
#allergeniq-modal-overlay .medora-diagnosis-list,
#allergeniq-modal-overlay .medora-diagnosis-list li {
    color: #000000 !important;
    list-style: disc !important;
    display: list-item !important;
    margin: 8px 0 !important;
}

/* Force allergen content to be visible */
#allergeniq-modal-overlay #modal-allergens-content,
#allergeniq-modal-overlay #modal-allergens-content * {
    color: #000000 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Allergen chips */
#allergeniq-modal-overlay .medora-allergen-chip {
    background: white !important;
    border: 1px solid #00BFFF !important;
    display: inline-flex !important;
}

#allergeniq-modal-overlay .medora-allergen-name {
    color: #000000 !important;
    font-weight: 600 !important;
}

/* Force symptom heatmap to be visible */
#allergeniq-modal-overlay #modal-symptoms-content,
#allergeniq-modal-overlay #modal-symptoms-content * {
    color: #000000 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Symptom rows and sliders */
#allergeniq-modal-overlay .medora-symptom-row {
    display: grid !important;
    grid-template-columns: 1fr 3fr auto !important;
    gap: 16px !important;
    background: white !important;
    padding: 12px !important;
    border: 1px solid #E8F4FD !important;
    border-radius: 8px !important;
    margin: 8px 0 !important;
}

#allergeniq-modal-overlay .medora-symptom-label {
    color: #000000 !important;
    font-weight: 600 !important;
}

#allergeniq-modal-overlay .medora-slider {
    display: block !important;
    width: 100% !important;
    background: #E8F4FD !important;
}

#allergeniq-modal-overlay .medora-symptom-value {
    background: #00BFFF !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
}

/* Empty states */
#allergeniq-modal-overlay .medora-empty {
    text-align: center !important;
    padding: 40px !important;
}

#allergeniq-modal-overlay .medora-empty-title {
    color: #000000 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

#allergeniq-modal-overlay .medora-empty-subtitle {
    color: #666666 !important;
    font-size: 14px !important;
}

/* Buttons should be visible */
#allergeniq-modal-overlay .medora-btn {
    border: 1px solid #00BFFF !important;
}

#allergeniq-modal-overlay .medora-btn-primary {
    background: #00BFFF !important;
    color: white !important;
}

#allergeniq-modal-overlay .medora-btn-secondary {
    background: white !important;
    color: #00BFFF !important;
}


/* Modal Overlay */
#allergeniq-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: none;
    overflow-y: auto;
    padding: 2rem 0;
}

#allergeniq-modal-overlay.active {
    display: flex;
}

/* Medora Modal Container */
.medora-modal {
    background: white !important;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Modal Header */
.medora-modal-header {
    display: flex;
    align-items: center;
    justify-content: between;
    padding: 24px 32px;
    border-bottom: 1px solid rgb(226, 232, 240);
    background: white !important;
}

.medora-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: rgb(15, 23, 42) !important;
    margin: 0;
    flex: 1;
}

.medora-close-btn {
    background: none;
    border: none;
    color: rgb(100, 116, 139);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.medora-close-btn:hover {
    background: rgb(248, 250, 252);
    color: rgb(51, 65, 85);
}

.medora-close-btn:focus-visible {
    outline: 2px solid #1D8BF1;
    outline-offset: 2px;
}

/* Modal Content */
.medora-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.medora-container {
    max-width: 1152px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Top Grid Layout */
.medora-top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .medora-top-grid {
        grid-template-columns: 1fr;
    }
}

/* Medora Cards */
.medora-card {
    border-radius: 16px;
    background: white;
    border: 1px solid rgb(226, 232, 240);
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.06);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
}

.medora-full-width {
    grid-column: 1 / -1;
}

/* Card Headers */
.medora-card-header {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(100, 116, 139);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgb(248, 250, 252);
}

/* Card Body */
.medora-card-body {
    flex: 1;
    color: rgb(51, 65, 85);
    line-height: 1.6;
}

/* Loading State */
.medora-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: rgb(100, 116, 139);
    font-style: italic;
}

/* Primary Diagnosis Bullets */
.medora-diagnosis-list {
    list-style: disc;
    list-style-position: inside;
    color: rgb(51, 65, 85);
    margin: 0;
    padding: 0;
    max-width: 65ch;
}

.medora-diagnosis-list li {
    margin: 8px 0;
    line-height: 1.75;
}

/* Allergen Chips */
.medora-allergen-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.medora-allergen-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 9999px;
    border: 1px solid rgb(226, 232, 240);
    background: white;
    padding: 6px 12px;
    font-size: 14px;
}

.medora-allergen-name {
    font-weight: 500;
    color: rgb(15, 23, 42);
}

.medora-allergen-reaction {
    font-size: 12px;
    color: rgb(100, 116, 139);
}

/* Symptom Rows */
.medora-symptom-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
}

.medora-symptom-row {
    display: grid;
    grid-template-columns: 1fr 3fr auto;
    align-items: center;
    gap: 16px;
}

.medora-symptom-label {
    font-size: 14px;
    color: rgb(51, 65, 85);
    font-weight: 500;
}

@media (min-width: 768px) {
    .medora-symptom-label {
        font-size: 16px;
    }
}

/* Symptom Slider Container */
.medora-slider-container {
    position: relative;
}

.medora-slider {
    width: 100%;
    height: 8px;
    appearance: none;
    background: rgb(226, 232, 240);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.medora-slider::-webkit-slider-thumb {
    appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #1D8BF1;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(29, 139, 241, 0.3);
}

.medora-slider::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #1D8BF1;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(29, 139, 241, 0.3);
}

.medora-slider:focus-visible {
    outline: 2px solid #1D8BF1;
    outline-offset: 2px;
}

/* Slider Ticks */
.medora-slider-ticks {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    font-size: 10px;
    color: rgb(100, 116, 139);
}

/* Symptom Value Badge */
.medora-symptom-value {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 9999px;
    background: rgb(239, 246, 255);
    color: rgb(29, 78, 216);
    border: 1px solid rgb(191, 219, 254);
    font-weight: 500;
    min-width: 45px;
    text-align: center;
}

/* Empty States */
.medora-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgb(100, 116, 139);
}

.medora-empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.medora-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: rgb(51, 65, 85);
    margin-bottom: 4px;
}

.medora-empty-subtitle {
    font-size: 14px;
    color: rgb(100, 116, 139);
}

/* Action Buttons */
.medora-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid rgb(248, 250, 252);
}

.medora-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.medora-btn:focus-visible {
    outline: 2px solid #1D8BF1;
    outline-offset: 2px;
}

.medora-btn-primary {
    background: #1D8BF1;
    color: white;
    border-color: #1D8BF1;
}

.medora-btn-primary:hover {
    background: #1476CC;
    border-color: #1476CC;
}

.medora-btn-secondary {
    background: white;
    color: rgb(51, 65, 85);
    border-color: rgb(226, 232, 240);
}

.medora-btn-secondary:hover {
    background: rgb(248, 250, 252);
}

/* Responsive Design */
@media (max-width: 640px) {
    .medora-container {
        padding: 16px;
        gap: 16px;
    }
    
    .medora-modal-header {
        padding: 16px 20px;
    }
    
    .medora-card {
        padding: 16px 20px;
    }
    
    .medora-actions {
        flex-direction: column;
    }
    
    .medora-symptom-row {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: left;
    }
    
    .medora-symptom-value {
        justify-self: start;
    }
}

/* ============================================
    NUCLEAR HEADING VISIBILITY - ULTRA HIGH PRIORITY
    ============================================ */

/* Target EVERY possible heading element in the modal with maximum specificity */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.modal-content *[class*="title"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.modal-content *[class*="heading"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div.modal-content *[class*="header"]:not(div.modal-header):not(div.modal-card-header),
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[id*="modal"][id*="content"] *[class*="title"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[id*="modal"][id*="content"] *[class*="heading"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[id*="modal"][id*="content"] h1,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[id*="modal"][id*="content"] h2,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[id*="modal"][id*="content"] h3,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[id*="modal"][id*="content"] h4,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[id*="modal"][id*="content"] h5,
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[id*="modal"][id*="content"] h6 {
    color: #00BFFF !important;
    font-weight: 700 !important;
    font-size: 18px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 16px 0 12px 0 !important;
    line-height: 1.4 !important;
    background: transparent !important;
    border-bottom: 2px solid #E8F4FD !important;
    padding-bottom: 8px !important;
}

/* Force visibility on any text element that might be a heading */
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[style*="font-weight: bold"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[style*="font-weight:bold"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[style*="font-weight: 700"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal div[style*="font-weight:700"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal span[style*="font-weight: bold"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal span[style*="font-weight:bold"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal span[style*="font-weight: 700"],
html body div#allergeniq-modal-overlay.modal-overlay.active div.ai-insights-modal span[style*="font-weight:700"] {
    color: #00BFFF !important;
    font-weight: 700 !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.summary-count, .summary-label, .alert-text {
    color: #00BFFF !important;
    font-weight: bold !important;
}

/* Make counts bigger and more visible */
.summary-count {
    font-size: 24px !important;
    display: block !important;
}
.summary-label {
    font-size: 12px !important;
    display: block !important;
}

/* ==========================================
   ALLERGENIQ MEDICAL-GRADE FINAL TOUCHES
   ========================================== */

#allergeniq-modal-overlay .close-btn {
    color: #6b7280 !important;
    background: none !important;
    border: none !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

#allergeniq-modal-overlay .close-btn:hover {
    background: #f3f4f6 !important;
    color: #374151 !important;
}

/* ==========================================
   MEDICAL-GRADE ALLERGENIQ LAYOUT - SPACE EFFICIENT
   ========================================== */

.medical-grade-content {
    padding: 16px !important;
    background: #fafbfc !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
}

.medical-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
}

.medical-card {
    background: white !important;
    border: 1px solid #e1e5e9 !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    overflow: hidden !important;
}

.medical-card-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%) !important;
    color: #1f2937 !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid #e1e5e9 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

.card-icon {
    font-size: 16px !important;
    flex-shrink: 0 !important;
}

.card-title {
    flex: 1 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #374151 !important;
}

.card-content {
    padding: 12px 16px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: #4b5563 !important;
}

.loading-state {
    color: #9ca3af !important;
    font-style: italic !important;
    font-size: 12px !important;
}

/* Symptoms Heatmap - Full Width */
.symptoms-heatmap-card {
    grid-column: 1 / -1 !important;
    margin-bottom: 16px !important;
}

.header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.symptom-count-badge {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
}

.refresh-btn {
    background: none !important;
    border: none !important;
    font-size: 14px !important;
    color: #6b7280 !important;
    cursor: pointer !important;
    padding: 4px !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

.refresh-btn:hover {
    background: #f3f4f6 !important;
    color: #374151 !important;
    transform: rotate(90deg) !important;
}

.heatmap-content {
    padding: 16px !important;
}

/* Summary Card - Full Width */
.summary-card {
    grid-column: 1 / -1 !important;
}

/* Compact Allergen List */
.allergen-item {
    padding: 8px 0 !important;
    border-bottom: 1px solid #f3f4f6 !important;
    font-size: 12px !important;
}

.allergen-item:last-child {
    border-bottom: none !important;
}

.allergen-name {
    font-weight: 500 !important;
    color: #1f2937 !important;
}

.allergen-severity {
    color: #6b7280 !important;
    font-size: 11px !important;
}

/* Compact Medication List */
.medication-item {
    padding: 8px 0 !important;
    border-bottom: 1px solid #f3f4f6 !important;
    font-size: 12px !important;
}

.medication-item:last-child {
    border-bottom: none !important;
}

.medication-name {
    font-weight: 500 !important;
    color: #1f2937 !important;
}

.medication-context {
    color: #6b7280 !important;
    font-size: 11px !important;
    margin-top: 2px !important;
}

/* Medical-Grade Heatmap Styling */
.symptom-heatmap-container {
    background: #fafbfc !important;
    border: 1px solid #f3f4f6 !important;
    border-radius: 6px !important;
    padding: 12px !important;
}

.symptom-row {
    display: flex !important;
    align-items: center !important;
    padding: 8px 12px !important;
    margin: 6px 0 !important;
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-left: 3px solid #6b7280 !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    transition: all 0.2s ease !important;
}

.symptom-row:hover {
    background: #f9fafb !important;
    border-left-color: #4b5563 !important;
    transform: translateX(2px) !important;
}

.symptom-name {
    flex: 1 !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    color: #1f2937 !important;
}

.severity-indicator {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 120px !important;
}

.severity-bar-container {
    width: 60px !important;
    height: 8px !important;
    background: #f3f4f6 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
}

.severity-bar-fill {
    height: 100% !important;
    background: linear-gradient(90deg, #6b7280 0%, #4b5563 100%) !important;
    border-radius: 4px !important;
    transition: width 0.3s ease !important;
}

.severity-score {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #4b5563 !important;
    min-width: 35px !important;
    text-align: right !important;
}

/* Empty State */
.empty-state-message {
    text-align: center !important;
    padding: 24px 16px !important;
    color: #9ca3af !important;
    font-size: 13px !important;
}

/* Enhanced Clinical AllergenIQ Styles */
.clinical-heatmap-container {
    background: #ffffff !important;
    border-radius: 8px !important;
    padding: 16px !important;
    margin: 8px 0 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.heatmap-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 16px !important;
    padding-bottom: 12px !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

.heatmap-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    display: flex !important;
    align-items: center !important;
}

.severity-legend {
    display: flex !important;
    gap: 12px !important;
    font-size: 11px !important;
}

.legend-item {
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-weight: 500 !important;
    border: 1px solid !important;
}

.legend-item.severe {
    background: #fee2e2 !important;
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}

.legend-item.moderate {
    background: #fef3c7 !important;
    border-color: #d97706 !important;
    color: #d97706 !important;
}

.legend-item.mild {
    background: #d1fae5 !important;
    border-color: #16a34a !important;
    color: #16a34a !important;
}

.clinical-symptom-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    padding: 12px !important;
    margin: 8px 0 !important;
    border-radius: 6px !important;
    border: 1px solid #e2e8f0 !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}

.clinical-symptom-row:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    transform: translateY(-1px) !important;
}

.clinical-symptom-row.severe {
    border-left: 4px solid #dc2626 !important;
    background: #fef7f7 !important;
}

.clinical-symptom-row.moderate {
    border-left: 4px solid #d97706 !important;
    background: #fffaf0 !important;
}

.clinical-symptom-row.mild {
    border-left: 4px solid #16a34a !important;
    background: #f7fef7 !important;
}

.symptom-info {
    flex: 1 !important;
    margin-right: 16px !important;
}

.symptom-name-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 4px !important;
}

.urgency-indicator {
    font-size: 14px !important;
}

.symptom-name {
    font-weight: 600 !important;
    color: #1e293b !important;
    font-size: 14px !important;
}

.symptom-frequency {
    font-size: 12px !important;
    color: #64748b !important;
    font-style: italic !important;
}

.symptom-context {
    font-size: 12px !important;
    color: #64748b !important;
    margin-top: 4px !important;
    line-height: 1.4 !important;
}

.clinical-severity {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    min-width: 120px !important;
    text-align: center !important;
}

.severity-score {
    font-weight: 700 !important;
    font-size: 14px !important;
    color: #1e293b !important;
    margin-bottom: 4px !important;
}

.severity-bar-container {
    width: 80px !important;
    height: 8px !important;
    background: #e2e8f0 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    margin-bottom: 4px !important;
}

.severity-bar-fill.severe {
    background: linear-gradient(90deg, #dc2626, #ef4444) !important;
}

.severity-bar-fill.moderate {
    background: linear-gradient(90deg, #d97706, #f59e0b) !important;
}

.severity-bar-fill.mild {
    background: linear-gradient(90deg, #16a34a, #22c55e) !important;
}

.severity-label {
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.clinical-summary {
    margin-top: 16px !important;
    padding-top: 16px !important;
    border-top: 1px solid #e2e8f0 !important;
}

.summary-stats {
    display: flex !important;
    justify-content: space-around !important;
    text-align: center !important;
}

.stat-item {
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
}

.stat-item.severe {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #fecaca !important;
}

.stat-item.moderate {
    background: #fef3c7 !important;
    color: #d97706 !important;
    border-color: #fed7aa !important;
}

.stat-item.mild {
    background: #d1fae5 !important;
    color: #16a34a !important;
    border-color: #bbf7d0 !important;
}

.clinical-empty-state {
    text-align: center !important;
    padding: 32px !important;
    color: #64748b !important;
    font-style: italic !important;
    background: #f8fafc !important;
    border-radius: 8px !important;
    border: 2px dashed #cbd5e1 !important;
}

.clinical-empty-state i {
    font-size: 24px !important;
    margin-bottom: 8px !important;
    display: block !important;
}

/* Clinical Assessment Styles */
.clinical-assessment-container {
    background: #ffffff !important;
    border-radius: 8px !important;
    padding: 16px !important;
    margin: 8px 0 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.assessment-section {
    margin-bottom: 16px !important;
}

.assessment-header {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    margin-bottom: 8px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.assessment-content {
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: #374151 !important;
    background: #f8fafc !important;
    padding: 12px !important;
    border-radius: 6px !important;
    /* border-left removed for clean subtle appearance */
}

.assessment-recommendations {
    background: #f9fafb !important;
    border-left-color: #e5e7eb !important;
}

.assessment-plan {
    background: #f0fdf4 !important;
    border-left-color: #16a34a !important;
}

/* Risk Assessment Badges */
.assessment-overview {
    margin-bottom: 20px !important;
    display: flex !important;
    justify-content: center !important;
}

.risk-assessment {
    display: flex !important;
    gap: 16px !important;
    align-items: center !important;
}

.risk-badge, .severity-badge {
    padding: 8px 16px !important;
    border-radius: 20px !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.risk-minimal, .severity-low {
    background: #d1fae5 !important;
    color: #16a34a !important;
    border: 2px solid #22c55e !important;
}

.risk-moderate, .severity-moderate {
    background: #fef3c7 !important;
    color: #d97706 !important;
    border: 2px solid #f59e0b !important;
}

.risk-significant, .severity-high {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border: 2px solid #ef4444 !important;
}

/* Emergency Protocol Styling */
.emergency-protocol .assessment-content {
    background: #fef2f2 !important;
    border: 2px solid #fca5a5 !important;
    border-left: 4px solid #dc2626 !important;
    color: #991b1b !important;
    font-weight: 600 !important;
}

.emergency-protocol .assessment-header {
    color: #dc2626 !important;
}

/* Assessment Footer */
.assessment-footer {
    margin-top: 20px !important;
    padding-top: 16px !important;
    border-top: 1px solid #e2e8f0 !important;
    text-align: center !important;
}

.assessment-footer small {
    color: #6b7280 !important;
    font-size: 11px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

/* Assessment Lists */
.assessment-content ul {
    margin: 0 !important;
    padding-left: 20px !important;
    list-style-type: disc !important;
}

.assessment-content li {
    margin-bottom: 4px !important;
    line-height: 1.4 !important;
}

/* Font Awesome Icons */
.assessment-header i {
    width: 16px !important;
    text-align: center !important;
}

/* Ensure all medical-grade styling is applied */
#allergeniq-modal-overlay .modal-card-header {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
}
