/**
 * OncoAI Accessibility Suite - WCAG 2.1 / 2.2 AA Compliance
 * Features:
 *  - Skip to main content navigation
 *  - Screen-reader-only utility (.sr-only, .visually-hidden)
 *  - WCAG AA color contrast enhancements & high-contrast mode (.a11y-high-contrast)
 *  - Universal visible focus indicators (:focus-visible)
 *  - Accessible modal dialogs & evidence drawers
 *  - Reduced motion overrides (.a11y-reduced-motion)
 *  - Dyslexia-friendly typography (.a11y-dyslexic-font)
 *  - Dynamic font scaling (.a11y-font-medium, .a11y-font-large)
 */

/* ==========================================================================
   1. Skip Navigation Link (WCAG 2.4.1 Bypass Blocks)
   ========================================================================== */
.skip-link {
  position: absolute !important;
  top: -120px !important;
  left: 16px !important;
  background: #004d57 !important;
  color: #ffffff !important;
  padding: 12px 20px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  border-radius: 0 0 8px 8px !important;
  z-index: 999999 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
  border: 2px solid #ffffff !important;
  transition: top 0.15s ease-in-out !important;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0 !important;
  outline: 3px solid #38bdf8 !important;
  outline-offset: 2px !important;
}

/* ==========================================================================
   2. Screen Reader Only Utilities (WCAG 1.1.1, 1.3.1, 4.1.2)
   ========================================================================== */
.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ==========================================================================
   3. Universal Visible Focus Ring (WCAG 2.4.7 Focus Visible, 2.4.11 / 2.4.13)
   ========================================================================== */
:focus-visible {
  outline: 3px solid #0284c7 !important;
  outline-offset: 2px !important;
  border-radius: 4px;
}

/* Enhanced focus for elements in teal topbar */
.app-topbar a:focus-visible,
.app-topbar button:focus-visible,
.app-topbar select:focus-visible,
.app-topbar input:focus-visible {
  outline: 3px solid #ffffff !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.45) !important;
}

/* Enhanced focus for primary action buttons */
.primary-button:focus-visible,
.btn-primary:focus-visible {
  outline: 3px solid #000000 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.35) !important;
}

/* ==========================================================================
   4. High Contrast & WCAG AA Colors (WCAG 1.4.3 Minimum Contrast)
   ========================================================================== */
:root {
  --a11y-focus-ring: #0284c7;
  --a11y-focus-ring-dark: #ffffff;
  --a11y-brand-teal: #0B9CA4; /* Medicas brand teal header */
}

/* Topbar WCAG AA contrast fix */
.app-topbar {
  background-color: var(--a11y-brand-teal) !important;
}

/* Accessible text color updates (replacing low-contrast muted grays) */
.text-muted,
.muted,
.patient-sub,
.summary-label {
  color: #475569 !important; /* Contrast 5.9:1 on white (WCAG AA pass) */
}

/* Accessible link styling */
a:focus-visible {
  text-decoration: underline !important;
}

/* Accessible file dropzone focus */
.dropzone:focus-visible,
.dropzone:focus-within {
  outline: 3px solid #0284c7 !important;
  outline-offset: 3px !important;
  background: #f0f9ff !important;
}

/* ==========================================================================
   5. Reduced Motion Support (WCAG 2.3.3 Animation from Interactions)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body.a11y-reduced-motion *,
body.a11y-reduced-motion *::before,
body.a11y-reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* ==========================================================================
   6. Font Size Scaling (WCAG 1.4.4 Resize Text)
   ========================================================================== */
body.a11y-font-medium {
  font-size: 112% !important;
}
body.a11y-font-large {
  font-size: 125% !important;
}
body.a11y-font-medium .topbar-nav-link,
body.a11y-font-large .topbar-nav-link {
  font-size: 14px !important;
  padding: 8px 12px !important;
}
body.a11y-font-medium h1,
body.a11y-font-large h1 {
  font-size: 1.4em !important;
}
body.a11y-font-medium p,
body.a11y-font-large p,
body.a11y-font-medium td,
body.a11y-font-large td {
  line-height: 1.7 !important;
}

/* ==========================================================================
   7. Dyslexia-Friendly Typography
   ========================================================================== */
body.a11y-dyslexic-font {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Comic Sans MS", "Arial Rounded MT Bold", sans-serif !important;
  letter-spacing: 0.04em !important;
  word-spacing: 0.1em !important;
  line-height: 1.75 !important;
}
body.a11y-dyslexic-font p,
body.a11y-dyslexic-font span,
body.a11y-dyslexic-font div,
body.a11y-dyslexic-font a,
body.a11y-dyslexic-font button,
body.a11y-dyslexic-font input,
body.a11y-dyslexic-font select {
  letter-spacing: 0.035em !important;
}

/* ==========================================================================
   8. High Contrast Mode (WCAG 1.4.6 Contrast Enhanced AAA)
   ========================================================================== */
body.a11y-high-contrast {
  /* Comprehensive CSS variable inversion */
  --ink: #ffffff !important;
  --muted: #cbd5e1 !important;
  --line: #ffffff !important;
  --panel: #000000 !important;
  --soft: #111111 !important;
  --brand: #ffff00 !important;
  --brand-hover: #ffff33 !important;
  --teal: #38bdf8 !important;
  --warn: #fde047 !important;
  --danger: #f87171 !important;
  --good: #4ade80 !important;
  --oncoai-ink: #ffffff !important;
  --oncoai-muted: #cbd5e1 !important;
  --oncoai-line: #ffffff !important;
  --oncoai-surface: #000000 !important;
  --oncoai-canvas: #000000 !important;
  --oncoai-brand: #ffff00 !important;
  --oncoai-brand-2: #38bdf8 !important;
  background-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
}

/* Topbar in High Contrast */
body.a11y-high-contrast .app-topbar {
  background-color: #000000 !important;
  border-bottom: 3px solid #ffffff !important;
}
body.a11y-high-contrast .topbar-brand-img {
  filter: brightness(2) contrast(1.5) !important;
}
body.a11y-high-contrast .topbar-nav-link {
  color: #ffffff !important;
  border: 1px solid #ffffff !important;
  margin: 0 2px !important;
}
body.a11y-high-contrast .topbar-nav-link.active {
  background: #ffff00 !important;
  color: #000000 !important;
  font-weight: 800 !important;
}
body.a11y-high-contrast .topbar-btn,
body.a11y-high-contrast .topbar-profile-link,
body.a11y-high-contrast .topbar-logout-btn,
body.a11y-high-contrast .topbar-icon-btn,
body.a11y-high-contrast .topbar-org-badge {
  border: 2px solid #ffffff !important;
  background: #000000 !important;
  color: #ffffff !important;
}

/* Comprehensive Container, Panel, Card, and Surface Overrides */
body.a11y-high-contrast .app-main,
body.a11y-high-contrast .page-shell,
body.a11y-high-contrast .page-content,
body.a11y-high-contrast .page-title,
body.a11y-high-contrast .patient-context,
body.a11y-high-contrast .content-band,
body.a11y-high-contrast .patient-card,
body.a11y-high-contrast .worklist-card,
body.a11y-high-contrast .worklist,
body.a11y-high-contrast .clinical-summary-card,
body.a11y-high-contrast .info-panel,
body.a11y-high-contrast .table-panel,
body.a11y-high-contrast .chat-container,
body.a11y-high-contrast .modal-card,
body.a11y-high-contrast .modal-content,
body.a11y-high-contrast .modal-dialog,
body.a11y-high-contrast .modal-body,
body.a11y-high-contrast .modal-header,
body.a11y-high-contrast .modal-footer,
body.a11y-high-contrast .drawer-panel,
body.a11y-high-contrast .metric-grid article,
body.a11y-high-contrast .metric-card,
body.a11y-high-contrast .capacity-meter,
body.a11y-high-contrast .empty-state,
body.a11y-high-contrast .patient-hero,
body.a11y-high-contrast .document-toolbar,
body.a11y-high-contrast .clinical-alert,
body.a11y-high-contrast .assessment-banner,
body.a11y-high-contrast .overview-grid article,
body.a11y-high-contrast .summary-card,
body.a11y-high-contrast .tab-content,
body.a11y-high-contrast .tab-pane,
body.a11y-high-contrast .sidebar-org-box,
body.a11y-high-contrast .app-header,
body.a11y-high-contrast .timeline-item,
body.a11y-high-contrast .timeline-card-item,
body.a11y-high-contrast .recommendation-card,
body.a11y-high-contrast .action-card,
body.a11y-high-contrast .treatment-node,
body.a11y-high-contrast .recommendation-list article,
body.a11y-high-contrast .action-grid article,
body.a11y-high-contrast .treatment-course article,
body.a11y-high-contrast .evidence-drawer,
body.a11y-high-contrast .evidence-card,
body.a11y-high-contrast .chunk-card,
body.a11y-high-contrast .card,
body.a11y-high-contrast .oncoai-safety-notice,
body.a11y-high-contrast .oncoai-citation,
body.a11y-high-contrast .oncoai-disclaimer,
body.a11y-high-contrast .oncoai-no-evidence,
body.a11y-high-contrast .worklist-facts div,
body.a11y-high-contrast .detail-list div,
body.a11y-high-contrast .mini-grid div,
body.a11y-high-contrast .chat-msg,
body.a11y-high-contrast .chat-msg.ai,
body.a11y-high-contrast .chat-msg.user,
body.a11y-high-contrast #chat-loading-bubble,
body.a11y-high-contrast #chat-window > div,
body.a11y-high-contrast #notifDropdown,
body.a11y-high-contrast .notif-dropdown {
  background-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
  border-color: #ffffff !important;
}

body.a11y-high-contrast .page-title,
body.a11y-high-contrast .patient-context,
body.a11y-high-contrast .content-band,
body.a11y-high-contrast .patient-card,
body.a11y-high-contrast .worklist-card,
body.a11y-high-contrast .clinical-summary-card,
body.a11y-high-contrast .info-panel,
body.a11y-high-contrast .table-panel,
body.a11y-high-contrast .chat-container,
body.a11y-high-contrast .modal-card,
body.a11y-high-contrast .modal-content,
body.a11y-high-contrast .drawer-panel,
body.a11y-high-contrast .metric-grid article,
body.a11y-high-contrast .metric-card,
body.a11y-high-contrast .capacity-meter,
body.a11y-high-contrast .empty-state,
body.a11y-high-contrast .patient-hero,
body.a11y-high-contrast .document-toolbar,
body.a11y-high-contrast .clinical-alert,
body.a11y-high-contrast .assessment-banner,
body.a11y-high-contrast .evidence-drawer,
body.a11y-high-contrast .evidence-card,
body.a11y-high-contrast .chunk-card,
body.a11y-high-contrast .card,
body.a11y-high-contrast .timeline-card-item,
body.a11y-high-contrast .recommendation-card,
body.a11y-high-contrast .action-card,
body.a11y-high-contrast .treatment-node,
body.a11y-high-contrast .chat-msg,
body.a11y-high-contrast .chat-msg.ai,
body.a11y-high-contrast .chat-msg.user,
body.a11y-high-contrast #chat-loading-bubble,
body.a11y-high-contrast #chat-window > div,
body.a11y-high-contrast #notifDropdown,
body.a11y-high-contrast .notif-dropdown,
body.a11y-high-contrast .oncoai-safety-notice,
body.a11y-high-contrast .oncoai-citation {
  border: 2px solid #ffffff !important;
  box-shadow: none !important;
}

/* 1. Clinical Summary Grid (Patient Detail) */
body.a11y-high-contrast .summary-label,
body.a11y-high-contrast .clinical-summary-grid .summary-label {
  color: #38bdf8 !important;
  font-weight: 700 !important;
}
body.a11y-high-contrast .summary-value,
body.a11y-high-contrast .clinical-summary-grid .summary-value {
  color: #ffffff !important;
}
body.a11y-high-contrast .evidence-pill,
body.a11y-high-contrast .evidence-pill.pill-teal,
body.a11y-high-contrast .evidence-pill.pill-signed,
body.a11y-high-contrast .evidence-pill.pill-lab {
  background: #000000 !important;
  color: #ffffff !important;
  border: 1.5px solid #ffffff !important;
}
body.a11y-high-contrast .evidence-pill:hover,
body.a11y-high-contrast .evidence-pill.pill-teal:hover,
body.a11y-high-contrast .evidence-pill.pill-lab:hover {
  background: #ffff00 !important;
  color: #000000 !important;
  border-color: #ffffff !important;
}

/* 2. Longitudinal Timeline (Medical Events & Milestones) */
body.a11y-high-contrast .timeline-container {
  border-left: 2px solid #ffffff !important;
}
body.a11y-high-contrast .timeline-card-item strong {
  color: #ffff00 !important;
}
body.a11y-high-contrast .timeline-card-item p,
body.a11y-high-contrast .timeline-card-item span {
  color: #ffffff !important;
}
body.a11y-high-contrast .timeline-card-item > div[style*="padding: 10px 14px"],
body.a11y-high-contrast .timeline-card-item [style*="border-left: 3px solid"] {
  background-color: #000000 !important;
  background: #000000 !important;
  border: 1px solid #ffffff !important;
  border-left: 4px solid #ffff00 !important;
  color: #ffffff !important;
}
body.a11y-high-contrast .timeline-card-item [style*="border-left: 3px solid"] strong {
  color: #ffff00 !important;
}
body.a11y-high-contrast .timeline-card-item span[style*="border-radius: 4px"],
body.a11y-high-contrast .timeline-card-item span[style*="letter-spacing: 0.5px"] {
  background: #000000 !important;
  color: #38bdf8 !important;
  border: 1.5px solid #ffffff !important;
}
/* Source Record & Provenance Badges (Timeline Event Footers) */
body.a11y-high-contrast .timeline-card-item span[style*="background"],
body.a11y-high-contrast .timeline-card-item span[style*="border-radius: 3px"],
body.a11y-high-contrast .timeline-card-item div[style*="font-size: 0.76rem"] span,
body.a11y-high-contrast .biomarker-row span[style*="background"] {
  background-color: #000000 !important;
  background: #000000 !important;
  color: #38bdf8 !important;
  border: 1.5px solid #ffffff !important;
  font-weight: 600 !important;
}
body.a11y-high-contrast .tl-filter-btn {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .tl-filter-btn.active,
body.a11y-high-contrast .tl-filter-btn[aria-selected="true"] {
  background: #ffff00 !important;
  color: #000000 !important;
  border: 2px solid #ffffff !important;
  font-weight: 800 !important;
}
body.a11y-high-contrast section[style*="grid-template-columns: repeat(auto-fit"] > div {
  background: #000000 !important;
  border: 2px solid #ffffff !important;
  color: #ffffff !important;
}
body.a11y-high-contrast section[style*="grid-template-columns: repeat(auto-fit"] > div > span {
  color: #38bdf8 !important;
}
body.a11y-high-contrast section[style*="grid-template-columns: repeat(auto-fit"] > div > div {
  color: #ffff00 !important;
}

/* 3. AI Assessment & Treatment Options */
body.a11y-high-contrast .recommendation-card h3,
body.a11y-high-contrast .action-card h3,
body.a11y-high-contrast .treatment-node h3 {
  color: #ffff00 !important;
}
body.a11y-high-contrast .recommendation-card p,
body.a11y-high-contrast .action-card p,
body.a11y-high-contrast .treatment-node p {
  color: #ffffff !important;
}
body.a11y-high-contrast .source-badge,
body.a11y-high-contrast button.source-badge {
  background-color: #000000 !important;
  background: #000000 !important;
  color: #ffff00 !important;
  border: 2px solid #ffffff !important;
  font-weight: 700 !important;
  cursor: pointer !important;
}
body.a11y-high-contrast .source-badge:hover,
body.a11y-high-contrast button.source-badge:hover {
  background: #ffff00 !important;
  color: #000000 !important;
  border-color: #ffffff !important;
}

/* Caution Text, Empty-States, and Clinical Notices */
body.a11y-high-contrast .caution-text,
body.a11y-high-contrast p.caution-text,
body.a11y-high-contrast div.caution-text {
  background-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
  border-left: 6px solid #ffff00 !important;
}
body.a11y-high-contrast .empty-inline,
body.a11y-high-contrast p.empty-inline {
  background-color: #000000 !important;
  background: #000000 !important;
  color: #cbd5e1 !important;
  border: 1px dashed #ffffff !important;
}
body.a11y-high-contrast .notice,
body.a11y-high-contrast .flex-notice,
body.a11y-high-contrast .success-notice,
body.a11y-high-contrast .security-notice,
body.a11y-high-contrast .info-box {
  background-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .notice strong,
body.a11y-high-contrast .success-notice strong,
body.a11y-high-contrast .security-notice strong,
body.a11y-high-contrast .info-box strong {
  color: #ffff00 !important;
}

/* 4. Chat Assistant Window & Messages (Ask a Question) */
body.a11y-high-contrast #chat-window {
  background: #000000 !important;
}
body.a11y-high-contrast .chat-msg div,
body.a11y-high-contrast #chat-window div {
  color: #ffffff !important;
}
body.a11y-high-contrast .chat-msg strong,
body.a11y-high-contrast #chat-window strong {
  color: #ffff00 !important;
}
body.a11y-high-contrast .chat-msg.ai > div:first-child,
body.a11y-high-contrast #chat-window .chat-msg.ai > div:first-child {
  color: #ffff00 !important;
  font-weight: 800 !important;
}
body.a11y-high-contrast .chat-msg.user > div:first-child,
body.a11y-high-contrast #chat-window .chat-msg.user > div:first-child {
  color: #38bdf8 !important;
  font-weight: 800 !important;
}
body.a11y-high-contrast #question-input {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast #question-input::placeholder {
  color: #cbd5e1 !important;
}
body.a11y-high-contrast #send-button {
  background: #ffff00 !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border: 2px solid #ffffff !important;
}

/* 5. Evidence Drawer */
body.a11y-high-contrast .evidence-drawer {
  background: rgba(0, 0, 0, 0.88) !important;
}
body.a11y-high-contrast .evidence-drawer .drawer-panel,
body.a11y-high-contrast .evidence-drawer .tl-drawer-panel {
  background-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
  border-left: 3px solid #ffffff !important;
  box-shadow: -10px 0 30px rgba(255, 255, 255, 0.25) !important;
}
body.a11y-high-contrast .evidence-drawer .tl-drawer-header,
body.a11y-high-contrast .evidence-drawer .tl-drawer-footer {
  background: #000000 !important;
  border-color: #ffffff !important;
}
body.a11y-high-contrast .evidence-drawer .tl-drawer-meta {
  color: #38bdf8 !important;
}
body.a11y-high-contrast .evidence-drawer .tl-drawer-title {
  color: #ffff00 !important;
}
body.a11y-high-contrast .evidence-drawer .drawer-close,
body.a11y-high-contrast .evidence-drawer .tl-drawer-close {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .evidence-drawer .drawer-close:hover,
body.a11y-high-contrast .evidence-drawer .tl-drawer-close:hover {
  background: #ffffff !important;
  color: #000000 !important;
}
body.a11y-high-contrast [data-evidence-fact] {
  color: #ffff00 !important;
}
body.a11y-high-contrast [data-evidence-value] {
  color: #38bdf8 !important;
}
body.a11y-high-contrast [data-evidence-date],
body.a11y-high-contrast [data-evidence-source] {
  color: #ffffff !important;
}
body.a11y-high-contrast [data-evidence-original] {
  color: #ffffff !important;
}
body.a11y-high-contrast [data-evidence-usage],
body.a11y-high-contrast [data-evidence-conflict] {
  color: #ffffff !important;
}
body.a11y-high-contrast [data-evidence-link-title] {
  color: #ffffff !important;
}
body.a11y-high-contrast a[data-evidence-link] {
  background: #ffff00 !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border: 2px solid #ffffff !important;
  text-decoration: none !important;
}
body.a11y-high-contrast .evidence-drawer .tl-drawer-footer button {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .evidence-drawer .tl-drawer-footer button:hover {
  background: #ffffff !important;
  color: #000000 !important;
}

/* 6. Notifications Dropdown */
body.a11y-high-contrast #notifDropdown strong {
  color: #ffff00 !important;
}
body.a11y-high-contrast #notifDropdown p,
body.a11y-high-contrast #notifDropdown span {
  color: #ffffff !important;
}

/* Metric Grid High Contrast Numbers & Labels */
body.a11y-high-contrast .metric-grid article strong,
body.a11y-high-contrast .metric-card strong {
  color: #ffff00 !important;
}
body.a11y-high-contrast .metric-grid article span,
body.a11y-high-contrast .metric-card span {
  color: #ffffff !important;
}
body.a11y-high-contrast .worklist-facts dt,
body.a11y-high-contrast .detail-list dt,
body.a11y-high-contrast .mini-grid dt {
  color: #38bdf8 !important;
  font-weight: 700 !important;
}
body.a11y-high-contrast .worklist-facts dd,
body.a11y-high-contrast .detail-list dd,
body.a11y-high-contrast .mini-grid dd {
  color: #ffffff !important;
}

/* Typography Hierarchy (Yellow Headings on Black = 19.5:1, White Body = 21:1) */
body.a11y-high-contrast h1,
body.a11y-high-contrast h2,
body.a11y-high-contrast h3,
body.a11y-high-contrast h4,
body.a11y-high-contrast h5,
body.a11y-high-contrast h6,
body.a11y-high-contrast strong,
body.a11y-high-contrast b {
  color: #ffff00 !important;
}
body.a11y-high-contrast p,
body.a11y-high-contrast span,
body.a11y-high-contrast td,
body.a11y-high-contrast th,
body.a11y-high-contrast dt,
body.a11y-high-contrast dd,
body.a11y-high-contrast label,
body.a11y-high-contrast li {
  color: #ffffff !important;
}
body.a11y-high-contrast .muted,
body.a11y-high-contrast .muted-inline,
body.a11y-high-contrast [class*="muted"] {
  color: #cbd5e1 !important;
}

/* Links (Light Cyan on Black = 11.2:1 with mandatory underline) */
body.a11y-high-contrast a,
body.a11y-high-contrast .patient-link,
body.a11y-high-contrast a.patient-link {
  color: #38bdf8 !important;
  text-decoration: underline !important;
  font-weight: 700 !important;
}
body.a11y-high-contrast a:hover,
body.a11y-high-contrast .patient-link:hover {
  color: #ffff00 !important;
}

/* Action Buttons (Primary: Black on Yellow = 19.5:1; Secondary: White on Black = 21:1) */
body.a11y-high-contrast .primary-button,
body.a11y-high-contrast .btn-primary,
body.a11y-high-contrast button.primary-button,
body.a11y-high-contrast a.primary-button {
  background: #ffff00 !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border: 2px solid #ffffff !important;
  text-decoration: none !important;
}
body.a11y-high-contrast .primary-button:hover,
body.a11y-high-contrast .btn-primary:hover {
  background: #ffffff !important;
  color: #000000 !important;
}
body.a11y-high-contrast .secondary-button,
body.a11y-high-contrast .btn-secondary,
body.a11y-high-contrast .link-button,
body.a11y-high-contrast button.secondary-button,
body.a11y-high-contrast a.secondary-button,
body.a11y-high-contrast .btn-sm {
  background: #000000 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border: 2px solid #ffffff !important;
  text-decoration: none !important;
}
body.a11y-high-contrast .secondary-button:hover,
body.a11y-high-contrast .btn-secondary:hover,
body.a11y-high-contrast .link-button:hover {
  background: #222222 !important;
  color: #ffff00 !important;
  border-color: #ffff00 !important;
}

/* Filter Bar & Navigation Tabs */
body.a11y-high-contrast .filter-bar,
body.a11y-high-contrast .patient-tabs {
  background: transparent !important;
}
body.a11y-high-contrast .filter-bar a,
body.a11y-high-contrast .filter-bar button,
body.a11y-high-contrast .patient-tabs a {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
  text-decoration: none !important;
}
body.a11y-high-contrast .filter-bar .active,
body.a11y-high-contrast .filter-bar a.active,
body.a11y-high-contrast .patient-tabs a.active {
  background: #ffff00 !important;
  color: #000000 !important;
  border: 2px solid #ffffff !important;
  font-weight: 800 !important;
}

/* Inputs, Selects, and Textareas */
body.a11y-high-contrast input,
body.a11y-high-contrast select,
body.a11y-high-contrast textarea {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast input::placeholder,
body.a11y-high-contrast textarea::placeholder {
  color: #cbd5e1 !important;
}

/* Enhanced Focus Ring */
body.a11y-high-contrast :focus-visible {
  outline: 4px solid #ffff00 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px #000000 !important;
}

/* Chips, Tags, Badges, and Metadata Pills */
body.a11y-high-contrast .status-chip,
body.a11y-high-contrast .tag,
body.a11y-high-contrast .badge,
body.a11y-high-contrast .pill,
body.a11y-high-contrast .alert-pill,
body.a11y-high-contrast .profile-pill,
body.a11y-high-contrast .doc-chip,
body.a11y-high-contrast .suggestion-chip {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

/* Capacity Progress Bars */
body.a11y-high-contrast .capacity-meter,
body.a11y-high-contrast [role="progressbar"],
body.a11y-high-contrast .capacity-bar-container,
body.a11y-high-contrast .capacity-bar {
  background: #000000 !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .capacity-fill,
body.a11y-high-contrast [role="progressbar"] > div {
  background: #ffff00 !important;
}

/* Tables */
body.a11y-high-contrast table {
  border-collapse: collapse !important;
  border: 2px solid #ffffff !important;
  background-color: #000000 !important;
}
body.a11y-high-contrast th {
  background-color: #111111 !important;
  color: #ffff00 !important;
  border: 1px solid #ffffff !important;
  font-weight: 800 !important;
}
body.a11y-high-contrast td {
  background-color: #000000 !important;
  color: #ffffff !important;
  border: 1px solid #ffffff !important;
}

/* ==========================================================================
   9. Accessibility Control Modal & Trigger Pill
   ========================================================================== */
.a11y-trigger-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 12px !important;
  background: rgba(255, 255, 255, 0.2) !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
  color: #ffffff !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.18s ease !important;
}
.a11y-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.32) !important;
  color: #ffffff !important;
}

/* Modal Dialog */
.a11y-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(3px) !important;
  z-index: 100000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
}
.a11y-modal-backdrop[hidden] {
  display: none !important;
}
.a11y-modal-card {
  background: #ffffff !important;
  color: #0f172a !important;
  border-radius: 12px !important;
  max-width: 560px !important;
  width: 100% !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25) !important;
  border: 1px solid #cbd5e1 !important;
  padding: 24px !important;
  box-sizing: border-box !important;
  animation: a11yFadeIn 0.18s ease-out !important;
}
@keyframes a11yFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.a11y-modal-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding-bottom: 14px !important;
  margin-bottom: 20px !important;
}
.a11y-modal-header h2 {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.a11y-modal-close-btn {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  border-radius: 6px !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
}
.a11y-modal-close-btn:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}
.a11y-option-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 12px 0 !important;
  border-bottom: 1px solid #f1f5f9 !important;
}
.a11y-option-info {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
}
.a11y-option-title {
  font-weight: 700 !important;
  font-size: 14px !important;
  color: #0f172a !important;
}
.a11y-option-desc {
  font-size: 12px !important;
  color: #475569 !important;
}
.a11y-toggle-btn {
  display: inline-flex !important;
  align-items: center !important;
  padding: 6px 14px !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  border: 1px solid #cbd5e1 !important;
  background: #f8fafc !important;
  color: #334155 !important;
  transition: all 0.15s ease !important;
}
.a11y-toggle-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}
.a11y-font-group {
  display: flex !important;
  gap: 6px !important;
}
.a11y-shortcut-list {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 12px 16px !important;
  margin-top: 16px !important;
  font-size: 12.5px !important;
  color: #334155 !important;
}
.a11y-shortcut-header {
  display: block !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  margin-bottom: 8px !important;
}
.a11y-shortcut-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 6px 16px !important;
  color: #334155 !important;
}
.a11y-shortcut-list kbd {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 4px !important;
  padding: 2px 6px !important;
  font-family: monospace !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1) !important;
}

/* Modal in High Contrast Mode (WCAG AAA >= 7:1) */
body.a11y-high-contrast .a11y-modal-backdrop {
  background: rgba(0, 0, 0, 0.88) !important;
}
body.a11y-high-contrast .a11y-modal-card {
  background: #000000 !important;
  color: #ffffff !important;
  border: 3px solid #ffffff !important;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.25) !important;
}
body.a11y-high-contrast .a11y-modal-header {
  border-bottom: 2px solid #ffffff !important;
}
body.a11y-high-contrast .a11y-modal-header h2 {
  color: #ffff00 !important;
}
body.a11y-high-contrast .a11y-modal-close-btn {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .a11y-modal-close-btn:hover {
  background: #ffffff !important;
  color: #000000 !important;
}
body.a11y-high-contrast .a11y-option-row {
  border-bottom: 1px solid #333333 !important;
}
body.a11y-high-contrast .a11y-option-title {
  color: #ffffff !important;
  font-weight: 700 !important;
}
body.a11y-high-contrast .a11y-option-desc {
  color: #cbd5e1 !important;
}
body.a11y-high-contrast .a11y-toggle-btn {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .a11y-toggle-btn.active {
  background: #ffff00 !important;
  color: #000000 !important;
  border: 2px solid #ffffff !important;
  font-weight: 800 !important;
}
body.a11y-high-contrast .a11y-shortcut-list {
  background: #000000 !important;
  border: 2px solid #ffffff !important;
  color: #ffffff !important;
}
body.a11y-high-contrast .a11y-shortcut-header {
  color: #ffff00 !important;
}
body.a11y-high-contrast .a11y-shortcut-grid {
  color: #ffffff !important;
}
body.a11y-high-contrast .a11y-shortcut-grid div {
  color: #ffffff !important;
}
body.a11y-high-contrast .a11y-shortcut-list kbd {
  background: #000000 !important;
  color: #ffff00 !important;
  border: 1px solid #ffffff !important;
}

/* ==========================================================================
   Executive Longitudinal Journey Timeline (High Contrast Mode WCAG AAA)
   ========================================================================== */
body.a11y-high-contrast .clinical-journey-timeline {
  background: #000000 !important;
  border: 2px solid #ffffff !important;
  box-shadow: none !important;
}
body.a11y-high-contrast .tl-year-header {
  color: #ffff00 !important;
}
body.a11y-high-contrast .tl-track::before {
  background: #ffffff !important;
}
body.a11y-high-contrast .tl-dot {
  box-shadow: 0 0 0 2px #000000 !important;
}
body.a11y-high-contrast .tl-dot.dot-red {
  background: #ef4444 !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .tl-dot.dot-amber {
  background: #f59e0b !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .tl-dot.dot-teal {
  background: #22d3ee !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .tl-dot.dot-grey {
  background: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .tl-meta {
  color: #38bdf8 !important;
}
body.a11y-high-contrast .tl-body {
  color: #ffffff !important;
}
body.a11y-high-contrast .tl-body strong,
body.a11y-high-contrast .tl-body .tl-event-name {
  color: #ffff00 !important;
}
body.a11y-high-contrast .tl-citation {
  background: #000000 !important;
  color: #ffff00 !important;
  border: 1.5px solid #ffffff !important;
  box-shadow: none !important;
}
body.a11y-high-contrast .tl-citation:hover,
body.a11y-high-contrast .tl-citation:focus-visible {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #ffff00 !important;
  outline: 3px solid #ffff00 !important;
}
body.a11y-high-contrast .tl-subcallout {
  background: #000000 !important;
  border: 1px solid #ffffff !important;
  border-left: 4px solid #ffff00 !important;
  color: #ffffff !important;
}
body.a11y-high-contrast .tl-subcallout strong {
  color: #ffff00 !important;
}
body.a11y-high-contrast .tl-filter-btn {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .tl-filter-btn:hover {
  background: #222222 !important;
  color: #ffff00 !important;
}
body.a11y-high-contrast .tl-filter-btn.active {
  background: #000000 !important;
  color: #ffff00 !important;
  border: 2px solid #ffff00 !important;
  outline: 2px solid #ffff00 !important;
  font-weight: 800 !important;
}
body.a11y-high-contrast #tlNoMatchMessage {
  color: #ffffff !important;
}

/* Single-line timeline items in High Contrast Mode */
body.a11y-high-contrast .tl-meta-inline {
  color: #38bdf8 !important;
}
body.a11y-high-contrast .tl-sep {
  color: #ffffff !important;
}
body.a11y-high-contrast .tl-summary-inline {
  color: #ffffff !important;
}
body.a11y-high-contrast .tl-summary-inline strong,
body.a11y-high-contrast .tl-summary-inline .tl-event-name {
  color: #ffff00 !important;
}
body.a11y-high-contrast .tl-summary-inline:hover {
  color: #ffff00 !important;
}

/* Event Details Drawer in High Contrast Mode (WCAG AAA >= 7:1) */
body.a11y-high-contrast .timeline-drawer,
body.a11y-high-contrast .tl-modal-backdrop {
  background: rgba(0, 0, 0, 0.88) !important;
}
body.a11y-high-contrast .timeline-drawer .drawer-panel,
body.a11y-high-contrast .timeline-drawer .tl-drawer-panel,
body.a11y-high-contrast .tl-modal-card {
  background-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
  border-left: 3px solid #ffffff !important;
  box-shadow: -10px 0 30px rgba(255, 255, 255, 0.25) !important;
}
body.a11y-high-contrast .tl-drawer-header,
body.a11y-high-contrast .tl-drawer-footer,
body.a11y-high-contrast .tl-modal-header,
body.a11y-high-contrast .tl-modal-footer {
  background: #000000 !important;
  border-color: #ffffff !important;
}
body.a11y-high-contrast .tl-drawer-meta,
body.a11y-high-contrast .tl-modal-meta {
  color: #38bdf8 !important;
}
body.a11y-high-contrast .tl-drawer-title,
body.a11y-high-contrast .tl-modal-title {
  color: #ffff00 !important;
}
body.a11y-high-contrast .tl-drawer-close,
body.a11y-high-contrast .tl-modal-close {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .tl-drawer-close:hover,
body.a11y-high-contrast .tl-modal-close:hover {
  background: #ffffff !important;
  color: #000000 !important;
}
body.a11y-high-contrast .tl-drawer-section-label,
body.a11y-high-contrast .tl-modal-section-label {
  color: #38bdf8 !important;
}
body.a11y-high-contrast .tl-drawer-narrative-text,
body.a11y-high-contrast .tl-modal-narrative-text {
  color: #ffffff !important;
}
body.a11y-high-contrast #tlDrawerCiteSection,
body.a11y-high-contrast #tlModalCiteSection {
  border-color: #ffffff !important;
}
body.a11y-high-contrast .tl-drawer-provenance-row,
body.a11y-high-contrast .tl-modal-provenance-row {
  background: #000000 !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .tl-prov-filename {
  color: #ffffff !important;
}
body.a11y-high-contrast .tl-prov-pages {
  color: #38bdf8 !important;
}
body.a11y-high-contrast .tl-drawer-footer button,
body.a11y-high-contrast .tl-modal-footer button {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .tl-drawer-footer button:hover,
body.a11y-high-contrast .tl-modal-footer button:hover {
  background: #ffffff !important;
  color: #000000 !important;
}

/* Enhanced Biomarkers High Contrast Rules */
body.a11y-high-contrast .bm-panel,
body.a11y-high-contrast .bm-controls-bar {
  background: #000000 !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .bm-search-wrap input {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .bm-search-wrap input:focus {
  outline: 3px solid #ffff00 !important;
  border-color: #ffff00 !important;
}
body.a11y-high-contrast .bm-filter-group-label {
  color: #38bdf8 !important;
}
body.a11y-high-contrast .bm-counter-pill {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .bm-filter-chip {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .bm-filter-chip:hover {
  background: #333333 !important;
  color: #ffff00 !important;
  border-color: #ffff00 !important;
}
body.a11y-high-contrast .bm-filter-chip.active {
  background: #ffff00 !important;
  color: #000000 !important;
  border-color: #ffff00 !important;
  font-weight: 800 !important;
}
body.a11y-high-contrast .bm-badge {
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .bm-badge-pathogenic {
  background: #000000 !important;
  color: #ff4d4d !important;
  border-color: #ff4d4d !important;
}
body.a11y-high-contrast .bm-badge-vus {
  background: #000000 !important;
  color: #facc15 !important;
  border-color: #facc15 !important;
}
body.a11y-high-contrast .bm-badge-positive {
  background: #000000 !important;
  color: #4ade80 !important;
  border-color: #4ade80 !important;
}
body.a11y-high-contrast .bm-badge-negative,
body.a11y-high-contrast .bm-badge-neutral,
body.a11y-high-contrast .bm-badge-quant,
body.a11y-high-contrast .bm-badge-other {
  background: #000000 !important;
  color: #ffffff !important;
  border-color: #ffffff !important;
}
body.a11y-high-contrast .bm-method-badge {
  background: #000000 !important;
  color: #38bdf8 !important;
  border: 1px solid #38bdf8 !important;
}
body.a11y-high-contrast .bm-cite-btn {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .bm-cite-btn:hover {
  background: #ffff00 !important;
  color: #000000 !important;
  border-color: #ffffff !important;
}
body.a11y-high-contrast .bm-cite-name {
  color: inherit !important;
}
body.a11y-high-contrast .bm-cite-pages {
  color: #38bdf8 !important;
}
body.a11y-high-contrast .bm-cite-btn:hover .bm-cite-pages {
  color: #000000 !important;
}
body.a11y-high-contrast .bm-test-name {
  color: #ffffff !important;
}
body.a11y-high-contrast .bm-specimen-text {
  color: #cccccc !important;
}
body.a11y-high-contrast .bm-date-text {
  color: #ffffff !important;
}

/* Patient Tabs High Contrast Mode */
body.a11y-high-contrast .patient-tabs {
  background: #000000 !important;
  border-bottom: 2px solid #ffffff !important;
}
body.a11y-high-contrast .patient-tabs a {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
body.a11y-high-contrast .patient-tabs a:hover {
  background: #333333 !important;
  color: #ffff00 !important;
  border-color: #ffff00 !important;
}
body.a11y-high-contrast .patient-tabs a.active {
  background: #ffff00 !important;
  color: #000000 !important;
  border: 2px solid #ffffff !important;
  font-weight: 800 !important;
}
body.a11y-high-contrast .patient-tabs a:focus-visible {
  outline: 3px solid #38bdf8 !important;
  outline-offset: 2px !important;
}



