/* EDUHUNT R319: Super Admin dashboard / Result & Analysis UI.
 * Complete cumulative ERP frontend supplies dynamic values and permission checks.
 * Load after R317 stylesheet. Does not affect other portal roles. */

/* Consistent left and right content gutters across desktop, tablet and mobile. */
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content {
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  margin-inline:0!important;
  padding-inline:16px!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content > .r319-dashboard-module,
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content > .r317-dashboard-shortcuts {
  width:100%!important;
  max-width:100%!important;
  margin-inline:0!important;
  box-sizing:border-box!important;
  min-width:0!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content > .r319-dashboard-schools:first-child {
  margin-top:0!important;
}
/* Three primary dashboard modules, same readable title size, collapsed initially. */
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-accordion-toggle {
  appearance:none!important;
  width:100%!important;
  min-height:35px!important;
  margin:0!important;
  padding:4px 2px!important;
  display:flex!important;
  justify-content:space-between!important;
  align-items:center!important;
  gap:10px!important;
  border:0!important;
  background:transparent!important;
  color:inherit!important;
  text-align:left!important;
  font-size:16px!important;
  font-weight:900!important;
  line-height:1.25!important;
  letter-spacing:.01em!important;
  cursor:pointer!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-accordion-toggle:focus-visible {
  outline:2px solid #81d4fa!important;
  outline-offset:2px!important;
  border-radius:6px;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-chevron {
  display:grid;
  place-items:center;
  box-sizing:border-box;
  flex:0 0 30px;
  height:28px;
  border:1px solid #39718f;
  border-radius:7px;
  font-size:21px;
  line-height:1;
  color:#98e4ff;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-accordion-body {
  padding-top:8px!important;
  width:100%;
  min-width:0;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-accordion-body[hidden] {
  display:none!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content > .r319-dashboard-module {
  padding-block:9px!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-services .r319-dashboard-accordion-body small,
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r317-dashboard-students .r319-dashboard-accordion-body small {
  line-height:1.3!important;
}

/* Seven visible Services & Results statuses, including Inactive Schools. */
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-services .r315-services-grid {
  display:grid!important;
  grid-template-columns:repeat(7,minmax(0,1fr))!important;
  gap:7px!important;
}
/* Last three dashboard navigation modules always stay on ONE line. */
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions {
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:8px!important;
  width:100%!important;
  min-width:0!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions > .quick-card {
  min-width:0!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:8px!important;
  min-height:56px!important;
  height:auto!important;
  padding:8px 7px!important;
  text-align:center!important;
  box-sizing:border-box!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions > .quick-card > span:not(.kpi-icon) {
  min-width:0!important;
  flex:0 1 auto!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions > .quick-card strong {
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  text-align:center!important;
  font-size:clamp(11px,1.2vw,14px)!important;
  line-height:1.2!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions .kpi-icon {
  flex:0 0 30px!important;
  width:30px!important;
  height:30px!important;
  min-width:30px!important;
}
/* New Key Stage control uses the same native select appearance as its neighbours. */
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r319-key-stage-filter select,
body[data-portal-role="ACADEMIC_COORDINATOR"][data-portal-module="result-analysis"] #content .r319-key-stage-filter select {
  width:100%!important;
  min-height:41px!important;
  box-sizing:border-box!important;
}
@media(max-width:1050px) {
  body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-services .r315-services-grid {
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
  }
}
@media(max-width:800px) {
  body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content {
    padding-inline:10px!important;
  }
  body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-accordion-toggle {
    font-size:14px!important;
    min-height:32px!important;
  }
  body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-chevron {
    flex-basis:27px;height:26px;font-size:18px;
  }
  body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions {
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:5px!important;
  }
  body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions > .quick-card {
    min-height:49px!important;
    padding:8px 3px!important;
  }
  body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions .kpi-icon {
    display:none!important;
  }
  body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions > .quick-card strong {
    font-size:10px!important;
  }
  body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-services .r315-services-grid {
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:5px!important;
  }
}
/* The ERP supports compact mobile mode even on a wide browser viewport. */
html.eh-force-mobile body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content {padding-inline:10px!important}
html.eh-force-mobile body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-accordion-toggle {font-size:14px!important}
html.eh-force-mobile body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions {grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:5px!important}
html.eh-force-mobile body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions > .quick-card {min-height:49px!important;padding:8px 3px!important}
html.eh-force-mobile body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions .kpi-icon {display:none!important}
html.eh-force-mobile body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-actions > .quick-card strong {font-size:10px!important}
html.eh-force-mobile body[data-portal-role="SUPER_ADMIN"][data-portal-module="dashboard"] #content .r319-dashboard-services .r315-services-grid {grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:5px!important}

/* EDUHUNT R320 · Super Admin Result & Analysis: compact, accessible, role-scoped. */
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-history-filters {
  display:grid!important;
  grid-template-columns:minmax(190px,2fr) repeat(3,minmax(130px,1.25fr)) minmax(96px,.7fr)!important;
  align-items:end!important;
  gap:8px!important;
  width:100%!important;
  min-width:0!important;
}
/* Keep filter names accessible to screen readers without wasting a visible row. */
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-history-filters .form-field>label:not(.r320-visually-hidden),
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-history-filters label.form-field>span,
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-history-filters .r320-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;
  clip-path:inset(50%)!important;white-space:nowrap!important;
  border:0!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-history-filters :is(input,select){
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r317-matrix-slices {
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  width:100%!important;
  min-width:0!important;
  gap:7px!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r317-matrix-slice {
  min-width:0!important;
  white-space:normal!important;
  overflow-wrap:normal!important;
  word-break:normal!important;
  text-align:center!important;
  line-height:1.15!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-matrix-scroll {
  box-sizing:border-box!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow:auto!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-result-matrix {
  box-sizing:border-box!important;
  width:100%!important;
  table-layout:fixed!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-result-matrix :is(th,td) {
  box-sizing:border-box!important;
  overflow-wrap:anywhere!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-result-matrix td:nth-child(3) {
  min-width:0!important;
  max-width:none!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
}
/* Compact six-column Key Approval table. Coordinator retains the existing nine-column workflow. */
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-sa-key-table {
  table-layout:fixed!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-sa-key-table th:nth-child(1){width:5%!important}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-sa-key-table th:nth-child(2){width:16%!important}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-sa-key-table th:nth-child(3){width:12%!important}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-sa-key-table th:nth-child(4){width:20%!important}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-sa-key-table th:nth-child(5){width:27%!important}
body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-sa-key-table th:nth-child(6){width:20%!important}
@media(max-width:900px) {
 body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-history-filters {
   grid-template-columns:repeat(2,minmax(0,1fr))!important;
 }
 body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-sa-key-table td:nth-child(6) {
   grid-column:auto!important;
 }
}
@media(max-width:480px) {
 body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r317-matrix-slices {
   grid-template-columns:repeat(4,minmax(0,1fr))!important;
   gap:4px!important;
 }
 body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r317-matrix-slice {
   min-height:39px!important;
   padding:7px 2px!important;
   font-size:10px!important;
 }
 body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-history-filters {
   grid-template-columns:repeat(2,minmax(0,1fr))!important;
 }
}
/* Compact mobile mode on landscape devices using EduHunt's forced-mobile marker. */
html.eh-force-mobile body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r317-matrix-slices {
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:4px!important;
}
html.eh-force-mobile body[data-portal-role="SUPER_ADMIN"][data-portal-module="result-analysis"] #content .r320-history-filters {
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
}
