/* EDUHUNT R431 — Principal Downloads / Academic Library compact layout.
   Scope: Principal Portal only. No data, permission, download or upload logic changes. */

/* MATERIALS + SOLUTIONS
   Remove explanatory copy, hide Clear Filters defensively, and keep Class + Subject
   beside one another. Filtering remains automatic through the existing change events. */
body[data-portal-role="PRINCIPAL"][data-portal-module="library-materials"] .eduhunt-library-page-head > div > p:not(.eyebrow),
body[data-portal-role="PRINCIPAL"][data-portal-module="library-solutions"] .eduhunt-library-page-head > div > p:not(.eyebrow){
  display:none!important;
}
body[data-portal-role="PRINCIPAL"][data-portal-module="library-materials"] #eduhuntLibraryRoleClear,
body[data-portal-role="PRINCIPAL"][data-portal-module="library-solutions"] #eduhuntLibraryRoleClear{
  display:none!important;
}
body[data-portal-role="PRINCIPAL"][data-portal-module="library-materials"] .eduhunt-library-role-filter-flow,
body[data-portal-role="PRINCIPAL"][data-portal-module="library-solutions"] .eduhunt-library-role-filter-flow{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:10px!important;
  align-items:end!important;
  width:100%!important;
}
body[data-portal-role="PRINCIPAL"][data-portal-module="library-materials"] .eduhunt-library-role-filter-flow--programme-select > .form-field:first-of-type,
body[data-portal-role="PRINCIPAL"][data-portal-module="library-solutions"] .eduhunt-library-role-filter-flow--programme-select > .form-field:first-of-type{
  grid-column:1 / -1!important;
}
body[data-portal-role="PRINCIPAL"][data-portal-module="library-materials"] .eduhunt-library-role-filter-flow > .form-field,
body[data-portal-role="PRINCIPAL"][data-portal-module="library-solutions"] .eduhunt-library-role-filter-flow > .form-field{
  min-width:0!important;
  width:auto!important;
  margin:0!important;
}
body[data-portal-role="PRINCIPAL"][data-portal-module="library-materials"] .eduhunt-library-role-filter-flow select,
body[data-portal-role="PRINCIPAL"][data-portal-module="library-solutions"] .eduhunt-library-role-filter-flow select{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
}
body[data-portal-role="PRINCIPAL"][data-portal-module="library-materials"] .eduhunt-library-role-filter-actions,
body[data-portal-role="PRINCIPAL"][data-portal-module="library-solutions"] .eduhunt-library-role-filter-actions{
  justify-content:flex-end!important;
  margin-top:7px!important;
}

/* ASSIGNMENTS RESULTS
   One assignment = one horizontal line on desktop, tablet and mobile:
   Assignment title | Class / Subject | View / Download / Forward. */
body[data-portal-role="PRINCIPAL"] .principal-assignment-results{
  display:grid!important;
  gap:8px!important;
}
body[data-portal-role="PRINCIPAL"] .principal-assignment-card[hidden]{display:none!important}
body[data-portal-role="PRINCIPAL"] .principal-assignment-card:not([hidden]){
  display:grid!important;
  grid-template-columns:minmax(0,1.55fr) minmax(105px,.78fr) auto!important;
  align-items:center!important;
  gap:8px!important;
  width:100%!important;
  min-width:0!important;
  min-height:50px!important;
  margin:0!important;
  padding:8px 10px!important;
  border:1px solid var(--border,#2b506b)!important;
  border-radius:10px!important;
  background:var(--panel,#0a243b)!important;
  box-sizing:border-box!important;
}
body[data-portal-role="PRINCIPAL"] .principal-assignment-title{
  min-width:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-size:13px!important;
  font-weight:900!important;
  line-height:1.2!important;
}
body[data-portal-role="PRINCIPAL"] .principal-assignment-meta{
  display:flex!important;
  align-items:center!important;
  gap:5px!important;
  min-width:0!important;
  overflow:hidden!important;
  white-space:nowrap!important;
  font-size:11.5px!important;
  line-height:1.15!important;
}
body[data-portal-role="PRINCIPAL"] .principal-assignment-meta > span{
  min-width:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
body[data-portal-role="PRINCIPAL"] .principal-assignment-meta > span + span::before{
  content:"·";
  margin-right:5px;
  opacity:.7;
}
body[data-portal-role="PRINCIPAL"] .principal-assignment-actions,
body[data-portal-role="PRINCIPAL"] .principal-assignment-actions .row-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  flex-wrap:nowrap!important;
  gap:5px!important;
  min-width:max-content!important;
  margin:0!important;
}
body[data-portal-role="PRINCIPAL"] .principal-assignment-actions :is(.row-action,.button){
  flex:0 0 auto!important;
}

/* MICRO SCHEDULES
   Keep Class and every action button on the same single line. */
body[data-portal-role="PRINCIPAL"] .principal-micro-grid{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:9px!important;
}
body[data-portal-role="PRINCIPAL"] .principal-micro-card{
  display:block!important;
  width:100%!important;
  min-height:50px!important;
  margin:0!important;
  padding:8px 11px!important;
  box-sizing:border-box!important;
}
body[data-portal-role="PRINCIPAL"] .principal-micro-card-copy{
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:10px!important;
  width:100%!important;
  min-width:0!important;
}
body[data-portal-role="PRINCIPAL"] .principal-micro-card-copy > strong{
  flex:1 1 auto!important;
  min-width:0!important;
  margin:0!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
body[data-portal-role="PRINCIPAL"] .principal-micro-card-copy > .row-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  flex-wrap:nowrap!important;
  gap:6px!important;
  flex:0 0 auto!important;
  margin:0!important;
}

@media(max-width:1024px){
  /* Assignments: exactly four selectors in two rows (2 x 2).
     If Programme must be chosen, it occupies its own full row above them. */
  body[data-portal-role="PRINCIPAL"] .principal-assignment-filter-card .assignment-role-filter-flow{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    align-items:end!important;
  }
  body[data-portal-role="PRINCIPAL"] .principal-assignment-filter-card .assignment-programme-field{
    grid-column:1 / -1!important;
  }
  body[data-portal-role="PRINCIPAL"] .principal-assignment-filter-card .form-field{
    min-width:0!important;
    width:auto!important;
    margin:0!important;
  }
  body[data-portal-role="PRINCIPAL"] .principal-assignment-filter-card select{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }

  /* Do not let old responsive rules stack assignment rows. */
  body[data-portal-role="PRINCIPAL"] .principal-assignment-card:not([hidden]){
    grid-template-columns:minmax(0,1.35fr) minmax(88px,.72fr) auto!important;
    gap:6px!important;
    min-height:48px!important;
    padding:7px 8px!important;
  }
  body[data-portal-role="PRINCIPAL"] .principal-assignment-title{font-size:12px!important}
  body[data-portal-role="PRINCIPAL"] .principal-assignment-meta{font-size:10.5px!important;gap:3px!important}

  body[data-portal-role="PRINCIPAL"] .principal-micro-card{
    min-height:48px!important;
    padding:7px 9px!important;
  }
}

@media(max-width:520px){
  body[data-portal-role="PRINCIPAL"][data-portal-module="library-materials"] .eduhunt-library-role-filter-flow,
  body[data-portal-role="PRINCIPAL"][data-portal-module="library-solutions"] .eduhunt-library-role-filter-flow{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="library-materials"] .eduhunt-library-role-filter-flow select,
  body[data-portal-role="PRINCIPAL"][data-portal-module="library-solutions"] .eduhunt-library-role-filter-flow select,
  body[data-portal-role="PRINCIPAL"] .principal-assignment-filter-card select{
    min-height:40px!important;
    padding-left:7px!important;
    padding-right:23px!important;
    font-size:11px!important;
  }
  body[data-portal-role="PRINCIPAL"] .principal-assignment-card:not([hidden]){
    grid-template-columns:minmax(0,1.15fr) minmax(78px,.65fr) auto!important;
    gap:4px!important;
    padding:6px!important;
  }
  body[data-portal-role="PRINCIPAL"] .principal-assignment-title{font-size:10.5px!important}
  body[data-portal-role="PRINCIPAL"] .principal-assignment-meta{font-size:9px!important}
  body[data-portal-role="PRINCIPAL"] .principal-assignment-actions,
  body[data-portal-role="PRINCIPAL"] .principal-assignment-actions .row-actions{gap:3px!important}
  body[data-portal-role="PRINCIPAL"] .principal-assignment-actions :is(.row-action,.button){
    width:30px!important;
    min-width:30px!important;
    height:30px!important;
    min-height:30px!important;
    padding:0!important;
  }
  body[data-portal-role="PRINCIPAL"] .principal-micro-card-copy{gap:6px!important}
  body[data-portal-role="PRINCIPAL"] .principal-micro-card-copy > .row-actions{gap:4px!important}
  body[data-portal-role="PRINCIPAL"] .principal-micro-card-copy > .row-actions .row-action{
    width:32px!important;
    min-width:32px!important;
    height:32px!important;
    min-height:32px!important;
  }
}

/* EDUHUNT R433 — Principal Micro Schedule single-line row + utility control spacing.
   This block is inside the complete replacement R431 stylesheet so no extra patch file is needed. */
@media(max-width:1024px){
  body[data-portal-role="PRINCIPAL"] .principal-micro-grid{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
  }

  body[data-portal-role="PRINCIPAL"] .principal-micro-card.principal-micro-inline-row{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) repeat(3,34px)!important;
    align-items:center!important;
    column-gap:6px!important;
    width:100%!important;
    min-width:0!important;
    min-height:48px!important;
    margin:0!important;
    padding:7px 9px!important;
    box-sizing:border-box!important;
  }

  body[data-portal-role="PRINCIPAL"] .principal-micro-inline-class{
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:14px!important;
    line-height:1.2!important;
    font-weight:900!important;
    align-self:center!important;
  }

  body[data-portal-role="PRINCIPAL"] .principal-micro-inline-action{
    position:static!important;
    inset:auto!important;
    transform:none!important;
    width:34px!important;
    min-width:34px!important;
    max-width:34px!important;
    height:34px!important;
    min-height:34px!important;
    max-height:34px!important;
    margin:0!important;
    padding:0!important;
    display:grid!important;
    place-items:center!important;
    flex:0 0 34px!important;
    box-sizing:border-box!important;
  }

  body[data-portal-role="PRINCIPAL"] .principal-micro-inline-action svg{
    width:17px!important;
    height:17px!important;
  }

  /* Keep the three utility controls visually separate. The Theme switch is one
     control containing two choices, so it gets enough width for both icons. */
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock.principal-mobile-utility-dock{
    display:grid!important;
    grid-template-columns:60px 42px 42px!important;
    align-items:center!important;
    justify-content:end!important;
    gap:7px!important;
    width:auto!important;
    min-width:165px!important;
    height:50px!important;
    min-height:50px!important;
    padding:4px 5px!important;
    box-sizing:border-box!important;
    overflow:visible!important;
  }

  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock #desktopThemeSwitcher{
    width:60px!important;
    min-width:60px!important;
    max-width:60px!important;
    height:42px!important;
    min-height:42px!important;
    max-height:42px!important;
    display:grid!important;
    grid-template-columns:repeat(2,26px)!important;
    justify-content:center!important;
    align-items:center!important;
    gap:2px!important;
    margin:0!important;
    padding:2px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }

  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock .desktop-theme-choice{
    width:26px!important;
    min-width:26px!important;
    max-width:26px!important;
    height:36px!important;
    min-height:36px!important;
    max-height:36px!important;
    margin:0!important;
    padding:0!important;
    display:grid!important;
    place-items:center!important;
    box-sizing:border-box!important;
  }

  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock #accountButton,
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock #principalCoordinatorWhatsappButton{
    position:relative!important;
    inset:auto!important;
    transform:none!important;
    width:42px!important;
    min-width:42px!important;
    max-width:42px!important;
    height:42px!important;
    min-height:42px!important;
    max-height:42px!important;
    margin:0!important;
    padding:2px!important;
    box-sizing:border-box!important;
  }
}

@media(max-width:420px){
  body[data-portal-role="PRINCIPAL"] .principal-micro-card.principal-micro-inline-row{
    grid-template-columns:minmax(0,1fr) repeat(3,32px)!important;
    column-gap:5px!important;
    padding:6px 7px!important;
  }
  body[data-portal-role="PRINCIPAL"] .principal-micro-inline-action{
    width:32px!important;min-width:32px!important;max-width:32px!important;
    height:32px!important;min-height:32px!important;max-height:32px!important;
  }
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock.principal-mobile-utility-dock{
    grid-template-columns:56px 40px 40px!important;
    gap:6px!important;
    min-width:152px!important;
  }
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock #desktopThemeSwitcher{
    width:56px!important;min-width:56px!important;max-width:56px!important;
    grid-template-columns:repeat(2,24px)!important;
  }
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock .desktop-theme-choice{
    width:24px!important;min-width:24px!important;max-width:24px!important;
  }
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock #accountButton,
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock #principalCoordinatorWhatsappButton{
    width:40px!important;min-width:40px!important;max-width:40px!important;
  }
}

/* ========================================================================
   EDUHUNT R434 — Principal dashboard / Final Key / utility dock repair
   Scope: Principal Portal only. Desktop remains unchanged unless a rule is
   explicitly for the Principal Test Keys card.
   ======================================================================== */

/* 1) Dashboard upcoming exam: stronger date line, smaller exam text, and one
      clean CDF information row on mobile/tablet. */
@media (max-width:1024px){
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam{
    padding:10px!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam>.eyebrow{
    margin:0 0 7px!important;
    font-size:15px!important;
    line-height:1.2!important;
    font-weight:950!important;
    letter-spacing:.045em!important;
    white-space:nowrap!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped{
    display:grid!important;
    gap:6px!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf{
    display:grid!important;
    grid-template-columns:max-content max-content max-content minmax(0,1fr)!important;
    align-items:center!important;
    column-gap:8px!important;
    row-gap:0!important;
    min-height:48px!important;
    padding:8px 10px!important;
    overflow:hidden!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf>h3{
    grid-column:auto!important;
    margin:0!important;
    font-size:16px!important;
    line-height:1.15!important;
    font-weight:950!important;
    white-space:nowrap!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf>.principal-next-exam-classes{
    margin:0!important;
    font-size:12px!important;
    line-height:1.15!important;
    font-weight:900!important;
    white-space:nowrap!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf>.principal-next-exam-programme{
    display:none!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf>.principal-next-exam-subject{
    margin:0!important;
    font-size:12px!important;
    line-height:1.15!important;
    font-weight:850!important;
    white-space:nowrap!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf>.principal-next-exam-chapter{
    display:block!important;
    min-width:0!important;
    margin:0!important;
    font-size:12px!important;
    line-height:1.15!important;
    font-weight:650!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
}

@media (max-width:430px){
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam>.eyebrow{
    font-size:14px!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf{
    grid-template-columns:max-content max-content max-content minmax(0,1fr)!important;
    column-gap:5px!important;
    padding:7px 8px!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf>h3{
    font-size:14px!important;
  }
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf>.principal-next-exam-classes,
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf>.principal-next-exam-subject,
  body[data-portal-role="PRINCIPAL"][data-portal-module="dashboard"] .principal-next-exam-list--grouped>article.is-cdf>.principal-next-exam-chapter{
    font-size:10.5px!important;
  }
}

/* 2) Principal Test Keys: Class + FINAL KEY + download action in ONE ROW. */
body[data-portal-role="PRINCIPAL"] .r862-key-grid{
  grid-template-columns:1fr!important;
}
body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final{
  display:grid!important;
  grid-template-columns:minmax(78px,1fr) max-content minmax(165px,max-content)!important;
  align-items:center!important;
  gap:10px!important;
  padding:10px 12px!important;
}
body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final>.r862-key-top{
  display:contents!important;
}
body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final .r862-key-class{
  margin:0!important;
  font-size:17px!important;
  line-height:1.15!important;
  white-space:nowrap!important;
}
body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final .r862-key-stage{
  justify-self:center!important;
  margin:0!important;
  padding:5px 9px!important;
  white-space:nowrap!important;
}
body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final>.r862-key-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:6px!important;
  margin:0!important;
  min-width:0!important;
}
body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final>.r862-key-actions .button{
  width:auto!important;
  min-width:0!important;
  min-height:36px!important;
  margin:0!important;
  padding:7px 11px!important;
  white-space:nowrap!important;
  line-height:1!important;
  font-size:12px!important;
}

@media (max-width:620px){
  body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final{
    grid-template-columns:minmax(58px,.8fr) max-content minmax(0,1.7fr)!important;
    gap:6px!important;
    padding:8px!important;
  }
  body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final .r862-key-class{
    font-size:14px!important;
  }
  body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final .r862-key-stage{
    padding:4px 7px!important;
    font-size:10px!important;
  }
  body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final>.r862-key-actions .button{
    width:100%!important;
    min-height:34px!important;
    padding:6px 7px!important;
    font-size:10.5px!important;
  }
  body[data-portal-role="PRINCIPAL"] .r862-key-card.is-final>.r862-key-actions .button svg{
    width:15px!important;
    height:15px!important;
  }
}

/* 3) Final visual hardening for Theme + Profile + WhatsApp. Their geometry is
      also set inline by R434 JS so older mobile rules cannot overlap them. */
@media (max-width:1024px){
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock.principal-mobile-utility-dock{
    isolation:isolate!important;
    align-content:center!important;
    border-radius:14px!important;
  }
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock>*{
    float:none!important;
    flex:none!important;
    margin-left:0!important;
    margin-right:0!important;
  }
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock #desktopThemeSwitcher{
    overflow:hidden!important;
  }
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock #accountButton,
  body[data-portal-role="PRINCIPAL"] #principalMobileUtilityDock #principalCoordinatorWhatsappButton{
    border-radius:10px!important;
    overflow:hidden!important;
  }
}
