/* ==========================================================================
   1. GLOBAL TYPOGRAPHIES & SITE OVERRIDES (WCAG AAA STANDARDS)
   ========================================================================== */
body { 
  background-color: #f8fafc; 
  color: #1e293b; 
  font-family: system-ui, -apple-system, sans-serif; 
}

.text-primary { color: #1e40af !important; }
.text-muted { color: #475569 !important; }
.text-danger { color: #b50000 !important; }
.text-success { color: #065f46 !important; }
.text-secondary { color: #1e293b !important; } 
.text-gold-aaa { color: #7a4304 !important; }

.bg-primary { background: #005446 !important; }
.bg-light { background: #f0faf6 !important; }
footer { padding-bottom: 100px; }

/* ==========================================================================
   2. UNIFIED AUDIT MATRIX RESULTS GRID TABLE
   ========================================================================== */
.grid-table { 
  display: grid; 
  width: 100%; 
  border: 1px solid #cbd5e1; 
  border-radius: 8px; 
  border-top-left-radius: 0; 
  border-top-right-radius: 0; 
  overflow: hidden; 
  background-color: #ffffff; 
  box-shadow: 0 1px 3px rgba(0,0,0,0.05); 
}

.grid-header, .grid-row {
  display: grid;
  grid-template-columns: 140px 110px 160px 1fr 340px 130px; 
  transition: background-color 0.15s ease-in-out;
}

.grid-cell-block { 
  padding: 18px 20px; 
  border-bottom: 1px solid #e2e8f0; 
  font-size: 13.5px; 
  line-height: 1.6; 
}

.grid-header .grid-cell-block { 
  background-color: #1e293b; 
  color: #ffffff; 
  font-weight: 700; 
  font-size: 12px; 
  text-transform: uppercase; 
  letter-spacing: 0.8px; 
  border-bottom: 2px solid #0f172a; 
  display: flex; 
  align-items: center; 
  border-radius: 0; 
}

.grid-row[data-palette="primary"]:nth-of-type(odd) { background-color: #ffffff; }
.grid-row[data-palette="primary"]:nth-of-type(even) { background-color: #f4f9ff; }
.grid-row[data-palette="primary"]:hover { background-color: #dbeafe; }

.grid-row[data-palette="secondary"]:nth-of-type(odd) { background-color: #ffffff; }
.grid-row[data-palette="secondary"]:nth-of-type(even) { background-color: #f0faf6; }
.grid-row[data-palette="secondary"]:hover { background-color: #ccfbf1; }

.grid-row[data-palette="tertiary"]:nth-of-type(odd) { background-color: #ffffff; }
.grid-row[data-palette="tertiary"]:nth-of-type(even) { background-color: #fbf7ff; }
.grid-row[data-palette="tertiary"]:hover { background-color: #f3e8ff; }

.criterion-text-id { font-weight: 700; color: #0f172a; font-size: 14px; letter-spacing: -0.2px; }
.meta-tag { display: block; font-size: 11px; color: #475569; font-weight: 700; margin-top: 2px; }
.meta-principle { font-weight: 700; color: #0f172a; }
.overlap-list { margin: 0; padding-left: 14px; font-size: 12px; color: #1e293b; list-style-type: square; }
.overlap-list li { margin-bottom: 4px; }

.src-tag { display: inline-flex; align-items: center; justify-content: center; padding: 4px 8px; font-weight: 800; font-size: 10px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.src-wcag { background-color: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.src-508 { background-color: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.src-en { background-color: #fcf5ff; color: #6b21a8; border: 1px solid #e9d5ff; }

.ref-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  color: #1346ce;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  white-space: nowrap; 
}
.ref-action-link:hover, .ref-action-link:focus {
  color: #ffffff; background-color: #1346ce; border-color: #1346ce; outline: 2px solid #2563eb; outline-offset: 1px;
}

.status-badge { display: inline-block; padding: 4px 8px; font-weight: 700; font-size: 11px; border-radius: 4px; text-transform: uppercase; margin-bottom: 6px; letter-spacing: 0.3px; }
.badge-supports { background-color: #dcfce7 !important; color: #0a5b34 !important; }
.badge-not-applicable { background-color: #f1f5f9 !important; color: #334155 !important; }
.badge-partially { background-color: #fef3c7 !important; color: #7a4304 !important; }
.badge-see { background-color: #e0f2fe !important; color: #000080 !important; }

.no-results { padding: 60px 20px; text-align: center; font-weight: 600; color: #475569; background-color: #fff; display: none; }
.mobile-hdr { display: none; font-weight: 700; text-transform: uppercase; font-size: 11px; color: #334155; margin-bottom: 4px; letter-spacing: 0.5px; }

.grid-action-container { display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; }
.overlap-header-en { font-weight: 700; font-size: 11px; color: #1e40af; margin-top: 2px; }
.overlap-header-sec { font-weight: 700; font-size: 11px; color: #065f46; }
.evaluation-remarks-text { margin: 4px 0 0 0; font-size: 12px; color: #1e293b; font-weight: 500; }
.overlap-list-container { margin-bottom: 4px; }

.fallback-instruction { font-size: 11px; color: #1e293b; margin-top: 6px; text-align: center; font-weight: 500; line-height: 1.3; }
.fallback-instruction strong { display: block; font-weight: 700; color: #0f172a; text-transform: uppercase; font-size: 10px; letter-spacing: 0.3px; margin-bottom: 2px; }
.fallback-instruction code { background-color: #f1f5f9; color: #750000; padding: 1px 5px; border-radius: 3px; font-weight: 700; font-family: monospace; border: 1px solid #cbd5e1; }

/* ==========================================================================
   3. GLOBAL SCOPING MASTER REGISTRY SCROLL CONTROL CARDS
   ========================================================================== */
.ep-matrix-scoping-card { background-color: #ffffff !important; border-radius: 8px; overflow: hidden; }
.ep-matrix-title-icon { width: 16px !important; height: 16px !important; margin-right: 8px !important; color: #1346ce !important; display: inline-block; }

.ep-matrix-pure-table { font-size: 12.5px !important; background-color: #ffffff !important; width: 100% !important; border-collapse: collapse !important; margin: 0 !important; }

.ep-matrix-pure-header, .ep-matrix-pure-header th {
  background-color: #1e293b !important; 
  color: #ffffff !important; 
  font-weight: 700 !important; 
  font-size: 11px !important; 
  text-transform: uppercase !important;
  border: 1px solid #cbd5e1 !important;
  text-align: center;
}
.ep-matrix-pure-header th:first-child { text-align: left; }
.ep-matrix-pure-table th, .ep-matrix-pure-table td { white-space: normal !important; word-wrap: break-word !important; vertical-align: middle !important; }

.ep-matrix-notes-memo-panel { background-color: #f8fafc !important; border: 1px solid #e2e8f0 !important; padding: 16px !important; border-radius: 6px !important; font-size: 12.5px !important; line-height: 1.6 !important; }
.ep-matrix-notes-alert-header { font-weight: 700 !important; color: #750000 !important; margin-bottom: 8px !important; text-transform: uppercase !important; font-size: 11px !important; letter-spacing: 0.3px !important; }
.ep-matrix-notes-list { list-style-type: square !important; }

.ep-matrix-principles-panel { background-color: #f8fafc !important; border: 1px solid #e2e8f0 !important; padding: 16px !important; border-radius: 6px !important; font-size: 12.5px !important; line-height: 1.6 !important; }
.ep-matrix-principles-header { font-weight: 700 !important; color: #0f172a !important; margin-bottom: 12px !important; text-transform: uppercase !important; font-size: 11px !important; letter-spacing: 0.3px !important; border-bottom: 1px solid #cbd5e1; padding-bottom: 4px; }
.ep-matrix-pour-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ep-matrix-pour-item { background-color: #ffffff; padding: 12px; border: 1px solid #e2e8f0; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.01); }
.ep-matrix-pour-item strong { display: block; margin-bottom: 2px; text-transform: uppercase; font-size: 11px; letter-spacing: 0.2px; }

.ep-matrix-flash-alert-box { background-color: #fef3c7 !important; border: 1px solid #f59e0b !important; padding: 18px !important; border-radius: 6px !important; color: #451a03 !important; font-size: 12.5px !important; line-height: 1.6 !important; }
.ep-matrix-flash-alert-title { color: #750000 !important; font-weight: 800 !important; text-transform: uppercase !important; font-size: 11px !important; letter-spacing: 0.5px !important; display: block; border-bottom: 1px solid #f59e0b; padding-bottom: 4px; margin-bottom: 8px; }

/* ==========================================================================
   4. SYSTEM MASTER SECTION ACCORDION PANEL DETAILS HOOK
   ========================================================================== */
details.ep-matrix-main-disclosure { user-select: none !important; display: block !important; width: 100% !important; border: none !important; }
.ep-matrix-main-disclosure summary { display: flex !important; align-items: center !important; cursor: pointer !important; list-style: none !important; width: 100% !important; box-sizing: border-box !important; }
.ep-matrix-main-disclosure summary::-webkit-details-marker { display: none !important; } 

.ep-matrix-main-btn {
  position: relative !important; padding: 16px 18px !important; background: #ffffff !important; color: #1e293b !important;
  font-size: 14px !important; margin: 0 !important; border-bottom: 1px solid #cbd5e1 !important;
  font-weight: 700 !important; text-transform: uppercase !important; letter-spacing: 0.5px !important; justify-content: space-between !important;
}
.ep-matrix-main-btn:hover, .ep-matrix-main-btn:focus { color: #475569 !important; background-color: #f8fafc !important; }

.ep-matrix-action-state-indicator { display: flex !important; align-items: center !important; font-size: 11px !important; font-weight: 800 !important; text-transform: uppercase !important; letter-spacing: 0.5px !important; color: #475569 !important; }
.ep-matrix-action-state-indicator::before { content: "[" attr(data-text-closed) "]" !important; margin-right: 8px !important; }
details[open].ep-matrix-main-disclosure > summary .ep-matrix-action-state-indicator::before { content: "[" attr(data-text-open) "]" !important; }

.ep-matrix-action-state-indicator::after {
  content: "" !important; display: inline-block !important; width: 16px !important; height: 16px !important; background-color: #1e293b !important; transition: transform 0.3s ease-in-out !important;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat center/contain;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat center/contain;
  transform: rotate(0deg) !important;
}
details[open].ep-matrix-main-disclosure > summary .ep-matrix-action-state-indicator::after { transform: rotate(180deg) !important; }

.ep-matrix-main-content-wrap { padding: 24px !important; border-left: 5px solid #005446 !important; display: block !important; height: auto !important; background-color: #ffffff !important; }

/* Display Toggling Presets */
.ep-matrix-desktop-view-only { display: block !important; }
.ep-matrix-mobile-view-only { display: none !important; }

/* ==========================================================================
   5. RESPONSIVE TRANSITION TRIGGERS (991PX COEXISTENCE SPLIT MONITOR BOUNDS)
   ========================================================================== */
@media screen and (max-width: 991px) {
  .ep-matrix-desktop-view-only { display: none !important; }
  .ep-matrix-mobile-view-only { display: block !important; }
  
  .ep-matrix-mobile-deck-wrapper { width: 100% !important; display: block !important; }
  .ep-matrix-mobile-card { margin-bottom: 14px !important; border: 1px solid #cbd5e1 !important; border-radius: 6px !important; overflow: hidden !important; width: 100% !important; box-shadow: 0 1px 2px rgba(0,0,0,0.01) !important; }
  
  .ep-matrix-mobile-card.ep-matrix-row-wcag2 { background-color: #ffffff !important; }
  .ep-matrix-mobile-card.ep-matrix-row-508 { background-color: #f8fafc !important; }
  .ep-matrix-mobile-card.ep-matrix-row-en { background-color: #ffffff !important; }
  .ep-matrix-mobile-card.ep-matrix-row-wcag3 { background-color: #fef3c7 !important; }

  .ep-matrix-mobile-toggle { display: block !important; width: 100% !important; }
  .ep-matrix-mobile-toggle summary { display: flex !important; align-items: center !important; justify-content: space-between !important; cursor: pointer !important; list-style: none !important; }
  .ep-matrix-mobile-toggle summary::-webkit-details-marker { display: none !important; }
  
  .ep-matrix-mobile-summary { display: flex !important; padding: 14px 16px !important; font-weight: 700 !important; font-size: 13.5px !important; color: #0f172a !important; width: 100% !important; box-sizing: border-box !important; border-bottom: 1px solid #cbd5e1 !important; background-color: #f8fafc !important; }
  .ep-matrix-mobile-summary span.ep-matrix-arrow-icon { display: inline-block !important; width: 18px !important; height: 18px !important; background-color: #334155 !important; margin-left: auto !important; }
  details[open].ep-matrix-mobile-toggle > .ep-matrix-mobile-summary span.ep-matrix-arrow-icon { transform: rotate(180deg) !important; }

  .ep-matrix-row-wcag3 .ep-matrix-mobile-summary { background-color: #fef3c7 !important; color: #451a03 !important; }
  .ep-matrix-row-wcag3 .ep-matrix-mobile-summary span.ep-matrix-arrow-icon { background-color: #451a03 !important; }

  .ep-matrix-mobile-fields { display: none !important; width: 100% !important; }
  details[open].ep-matrix-mobile-toggle > .ep-matrix-mobile-fields { display: block !important; }

  .ep-matrix-mobile-fields div { text-align: left !important; padding: 12px 16px !important; border-bottom: 1px dashed #cbd5e1 !important; position: relative !important; padding-left: 45% !important; display: block !important; width: 100% !important; box-sizing: border-box !important; }
  .ep-matrix-mobile-fields div:last-child { border-bottom: none !important; }
  
  .ep-matrix-mobile-fields div::before { content: attr(data-label) !important; position: absolute !important; left: 16px !important; width: 40% !important; font-weight: 700 !important; text-transform: uppercase !important; font-size: 10.5px !important; color: #334155 !important; white-space: nowrap !important; }
  .ep-matrix-row-wcag3 .ep-matrix-mobile-fields div::before { color: #451a03 !important; }
}

/* ==========================================================================
   6. DYNAMIC STATUTORY REGISTRY INTERFACES (CLEAN HIGH CONTRAST MATRICES)
   ========================================================================== */

/* FIXED CORE CHASSIS: Overrides the parent results table container grid whenever the statutory track is active */
#matrixTable:has(.ep-statutory-row) {
  display: block !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  background-color: #ffffff !important;
}

/* FIXED CELL SCORING: Direct class styling completely free of parent container scoping limits */
.ep-statutory-row {
  display: grid !important; 
  grid-template-columns: 140px 190px 260px 1fr 130px !important;
  width: 100% !important; 
  border-bottom: 1px solid #cbd5e1 !important;
  transition: background-color 0.15s ease-in-out !important; 
  box-sizing: border-box !important;
}
#matrixTable .ep-statutory-row:last-child { border-bottom: none !important; }

/* Desktop framework template header alignments */
.ep-matrix-grid-header.ep-statutory-row {
  background-color: #1e293b !important; 
  color: #ffffff !important; 
  font-weight: 700 !important; 
  border-bottom: 2px solid #0f172a !important;
}

/* Localized row template zebra alignments and text hovers */
.ep-matrix-grid-row.ep-statutory-row:nth-of-type(odd) { background-color: #ffffff !important; }
.ep-matrix-grid-row.ep-statutory-row:nth-of-type(even) { background-color: #f8fafc !important; }
.ep-matrix-grid-row.ep-statutory-row:hover { background-color: #f1f5f9 !important; }

.ep-statutory-row > div {
  padding: 16px 18px !important; 
  display: flex !important; 
  align-items: center !important;
  border-right: 1px solid #cbd5e1 !important; 
  font-size: 13px !important; 
  line-height: 1.6 !important; 
  box-sizing: border-box !important;
  background-color: transparent !important;
}
.ep-statutory-row > div:last-child { border-right: none !important; }

.ep-statutory-row .ep-matrix-cell-id { font-weight: 700 !important; color: #1e40af !important; justify-content: center !important; white-space: nowrap !important; }
.ep-statutory-row .ep-matrix-cell-jur { font-weight: 600 !important; color: #0f172a !important; }
.ep-statutory-row .ep-matrix-cell-law { font-weight: 700 !important; color: #1e293b !important; align-items: flex-start !important; flex-direction: column !important; justify-content: center !important; }
.ep-statutory-row .ep-matrix-cell-over { color: #334155 !important; text-align: left !important; justify-content: flex-start !important; }
.ep-statutory-row .ep-matrix-cell-ref { justify-content: center !important; }

/* ==========================================================================
   7. HARDENED MOBILE REFLOW RESETS (CLEANS UP OVERWRITTEN COLUMNS UNDER 991PX)
   ========================================================================== */
@media screen and (max-width: 991px) {
  #matrixTable:has(.ep-statutory-row) { 
    border: none !important; 
    background-color: transparent !important; 
  }

  /* FIXED TARGET: Unlocks rows directly from horizontal constraints, generating cards */
  #matrixTable .ep-matrix-grid-row.ep-statutory-row {
    display: block !important; 
    width: 100% !important; 
    border-bottom: none !important; 
    margin-bottom: 14px !important;
    border: 1px solid #cbd5e1 !important; 
    border-radius: 6px !important; 
    overflow: hidden !important; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.01) !important;
  }
  
  /* Discard desktop column table layout headers completely */
  #matrixTable .ep-matrix-grid-header.ep-statutory-row { 
    display: none !important; 
  }

  #matrixTable .ep-matrix-grid-row.ep-statutory-row:nth-of-type(odd) { background-color: #ffffff !important; }
  #matrixTable .ep-matrix-grid-row.ep-statutory-row:nth-of-type(even) { background-color: #f8fafc !important; }
  
  /* Stacks inner cells vertically inside the responsive card boundaries */
  #matrixTable .ep-statutory-row > div {
    display: block !important; 
    width: 100% !important; 
    text-align: left !important; 
    padding: 12px 16px !important;
    border: none !important; 
    border-bottom: 1px dashed #cbd5e1 !important; 
    position: relative !important;
    padding-left: 45% !important; 
    box-sizing: border-box !important; 
    min-height: 44px !important;
  }
  #matrixTable .ep-statutory-row > div:last-child { border-bottom: none !important; }
  
  /* Reflow and align pseudo label entries */
  #matrixTable .ep-statutory-row > div::before {
    content: attr(data-label) !important; 
    position: absolute !important; 
    left: 16px !important; 
    top: 12px !important;
    width: 40% !important; 
    font-weight: 700 !important; 
    text-transform: uppercase !important; 
    font-size: 10.5px !important;
    color: #475569 !important; 
    white-space: nowrap !important;
  }
  
  #matrixTable .ep-statutory-row .ep-matrix-cell-id { text-align: left !important; justify-content: flex-start !important; }
  #matrixTable .ep-statutory-row .ep-matrix-cell-ref { padding: 8px 16px !important; }
  #matrixTable .ep-statutory-row .ep-matrix-cell-ref .ref-action-link { display: flex !important; width: 100% !important; padding: 10px !important; font-size: 13px !important; text-align: center !important; }
}

/* ==========================================================================
   8. CORE LAYOUT GRID RESPONSIVE BREAKPOINTS (ALL SITE OVERRIDES)
   ========================================================================== */
@media (min-width: 768px) { .border-end-md { border-right: 1px solid #f59e0b !important; } }
@media screen and (max-width: 768px) { .ep-matrix-pour-grid { grid-template-columns: 1fr !important; } }

@media screen and (max-width: 1200px) {
  .grid-header { display: none !important; }
  .grid-row, .grid-row[data-palette="primary"], .grid-row[data-palette="secondary"], .grid-row[data-palette="tertiary"] {
    display: block !important; grid-template-columns: none !important; border-bottom: 4px solid #cbd5e1 !important; padding: 16px 0 !important; background-color: #ffffff !important; 
  }
  .grid-cell-block { display: block !important; width: 100% !important; border: none !important; padding: 8px 20px !important; box-sizing: border-box !important; }
  .grid-cell-block:first-child { padding-top: 4px !important; padding-bottom: 12px !important; border-bottom: 1px dashed #cbd5e1 !important; margin-bottom: 8px !important; }
  .mobile-hdr { display: block !important; }
  .ref-action-link { display: flex !important; width: 100% !important; padding: 12px !important; font-size: 13px !important; margin-top: 4px !important; box-shadow: none; box-sizing: border-box !important; }
}