/* V65: one consistent, readable portal heading across all student and admin routes.
   Scope deliberately stays within .portal-header: public navigation, sidebar themes and
   custom page headings are left alone. */
.app .portal-header:not([hidden]) {
  box-sizing: border-box;
  height: auto;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 11px;
  gap: clamp(8px, 1.4vw, 18px);
}
/* The section label and academy/page title must never occupy the same coordinates.
   Grid makes the label the first line and the title the second, and accommodates
   either the desktop hidden toggle or the visible phone menu button. */
.app .portal-header:not([hidden]) > div:first-child {
  box-sizing: border-box;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  column-gap: 10px !important;
  row-gap: 0 !important;
  align-items: center !important;
  justify-items: start !important;
  justify-content: start !important;
  flex: 1 1 auto;
  min-width: 0 !important;
  max-width: 100%;
  width: auto !important;
  position: relative;
  background: transparent !important;
}
.app .portal-header:not([hidden]) > div:first-child > button {
  grid-column: 1 !important;
  grid-row: 1 / 3 !important;
  align-self: center;
  flex-shrink: 0;
  min-width: 0;
}
.app .portal-header:not([hidden]) > div:first-child > span,
.app .portal-header:not([hidden]) > div:first-child > b {
  box-sizing: border-box !important;
  grid-column: 2 !important;
  display: block !important;
  position: static !important;
  inset: auto !important;
  float: none !important;
  transform: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  text-overflow: clip !important;
  overflow: visible !important;
  text-align: start !important;
  letter-spacing: normal;
}
.app .portal-header:not([hidden]) > div:first-child > span {
  grid-row: 1 !important;
  align-self: end;
  font-size: clamp(11px, .85vw, 13px) !important;
  line-height: 1.45 !important;
  font-weight: 650 !important;
  color: var(--header-text, var(--muted)) !important;
  opacity: .76;
}
.app .portal-header:not([hidden]) > div:first-child > b {
  grid-row: 2 !important;
  align-self: start;
  color: var(--header-text, var(--ink)) !important;
  opacity: 1;
  font-size: clamp(15px, 1.2vw, 19px) !important;
  line-height: 1.55 !important;
  font-weight: 750 !important;
}
.app .portal-header:not([hidden]) > .header-user {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-width: 0;
  max-width: min(36%, 230px);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.app .portal-header:not([hidden]) > .header-user strong {
  min-width: 0;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app .portal-header:not([hidden]) > .header-user .avatar {
  flex: 0 0 auto;
}
@media (max-width: 700px) {
  .app .portal-header:not([hidden]) {
    min-height: 69px;
    padding-inline: 12px;
    padding-block: 10px;
    gap: 7px;
  }
  .app .portal-header:not([hidden]) > div:first-child {
    column-gap: 7px !important;
    flex: 1 1 0;
  }
  .app .portal-header:not([hidden]) > div:first-child > span {
    font-size: 10px !important;
  }
  .app .portal-header:not([hidden]) > div:first-child > b {
    font-size: clamp(12px, 3.25vw, 15px) !important;
    line-height: 1.45 !important;
  }
  .app .portal-header:not([hidden]) > .header-user {
    max-width: 46px;
  }
  .app .portal-header:not([hidden]) > .header-user strong {
    display: none !important;
  }
  .app .portal-header:not([hidden]) .avatar {
    width: 34px;
    height: 34px;
  }
}
@media (max-width: 360px) {
  .app .portal-header:not([hidden]) > div:first-child > b { font-size: 12px !important; }
  .app .portal-header:not([hidden]) > div:first-child > span { font-size: 10px !important; }
  .app .portal-header:not([hidden]) > div:first-child { column-gap: 5px !important; }
}
