/* Legacy breadcrumb rules removed. Breadcrumb source of truth: /components/breadcrumb/breadcrumb.css?v=20260710-v6118-31-short-hero-all-devices */
:root {
  --portal-accent: #2563eb;
  --portal-accent-2: #1d4ed8;
  --portal-soft: #f6effa;
  --portal-border: #e7d7ef;
  --portal-card: #ffffff;
  --portal-text: #13203a;
  --portal-muted: #667085;
  --portal-page: #f7f9fc;
  --portal-shadow: 0 12px 32px rgba(25, 35, 60, 0.09);
}

html.dark-mode {
  --portal-soft: #20172a;
  --portal-border: #3c2a48;
  --portal-card: #161c28;
  --portal-text: #f4f7fb;
  --portal-muted: #b6bfce;
  --portal-page: #0f172a;
  --portal-shadow: 0 18px 38px rgba(0, 0, 0, 0.30);
}

.resource-portal-page {
  background: var(--portal-page);
}

.portal-content {
  min-width: 0;
  padding-bottom: 52px;
}

.portal-hero {
  position: relative;
  overflow: hidden;
  display: block;
  padding: 30px 34px;
  border: 1px solid var(--portal-border);
  border-radius: 24px;
  background: linear-gradient(135deg, var(--portal-card), var(--portal-soft));
  box-shadow: var(--portal-shadow);
  color: var(--portal-text);
}

.portal-hero::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--portal-accent) 13%, transparent);
  inset-inline-end: -70px;
  top: -85px;
}

.portal-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 100%;
}

.portal-eyebrow {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--portal-accent) 9%, var(--portal-card));
  color: var(--portal-accent-2);
  font-size: 0.83rem;
  font-weight: 850;
}

.portal-hero-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0 8px;
}

.portal-hero h1 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.55rem);
  line-height: 1.2;
}

.portal-hero p {
  margin: 0;
  color: var(--portal-muted);
  font-size: 1rem;
  line-height: 1.8;
}

.portal-hero-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--portal-accent), var(--portal-accent-2));
  color: #ffffff;
  font-size: 1.45rem;
  box-shadow: 0 13px 30px color-mix(in srgb, var(--portal-accent) 29%, transparent);
}

.portal-context {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
  padding: 13px;
  border: 1px solid var(--portal-border);
  border-radius: 19px;
  background: var(--portal-card);
  box-shadow: 0 8px 22px rgba(20, 30, 55, 0.06);
}

.portal-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 13px;
  background: var(--portal-accent);
  color: #ffffff;
  font-weight: 850;
  font-size: 0.86rem;
}

.portal-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 1px;
}

.portal-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid var(--portal-border);
  border-radius: 999px;
  color: var(--portal-muted);
  background: var(--portal-card);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
}

.portal-step b {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--portal-soft);
  color: var(--portal-accent);
  font-size: 0.76rem;
}

.portal-step.done {
  border-color: color-mix(in srgb, var(--portal-accent) 35%, var(--portal-border));
  color: var(--portal-text);
}

.portal-step.done b,
.portal-step.active b {
  background: var(--portal-accent);
  color: #ffffff;
}

.portal-step.active {
  border-color: var(--portal-accent);
  color: var(--portal-accent);
  background: color-mix(in srgb, var(--portal-accent) 7%, var(--portal-card));
}

.portal-step.locked {
  opacity: 0.55;
}

.portal-search-dock {
  position: relative;
  margin: 0 0 18px;
  padding: 10px;
  border: 1px solid var(--portal-border);
  border-radius: 17px;
  background: var(--portal-card);
  box-shadow: 0 11px 27px rgba(15, 23, 42, 0.11);
}

.portal-search-dock[hidden] {
  display: none;
}

.portal-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--portal-border);
  border-radius: 13px;
  background: var(--portal-card);
  color: var(--portal-muted);
}

.portal-search:focus-within {
  border-color: var(--portal-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-accent) 12%, transparent);
}

.portal-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--portal-text);
  font: inherit;
  padding: 12px 0;
}

.portal-result-count {
  white-space: nowrap;
  color: var(--portal-muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.portal-status:empty {
  display: none;
}

.portal-card-guide {
  display: grid;
  gap: 5px;
  margin: 18px 0 14px;
  padding-inline: 4px;
  color: var(--portal-text);
}

.portal-card-guide[hidden] {
  display: none;
}

.portal-card-guide strong {
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
  line-height: 1.35;
  font-weight: 900;
}

.portal-card-guide span {
  max-width: 920px;
  color: var(--portal-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 650;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.portal-choice-card {
  --choice-accent: var(--portal-accent);
  align-self: start;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--choice-accent) 24%, var(--portal-border));
  border-top: 5px solid var(--choice-accent);
  border-radius: 21px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--choice-accent) 5%, var(--portal-card)), var(--portal-card) 105px);
  box-shadow: 0 11px 27px rgba(25, 35, 60, 0.07);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.portal-choice-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--choice-accent) 50%, var(--portal-border));
  box-shadow: 0 17px 36px color-mix(in srgb, var(--choice-accent) 14%, rgba(20, 30, 55, 0.12));
}

.portal-choice-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 118px;
  padding: 18px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.portal-choice-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--choice-accent), color-mix(in srgb, var(--choice-accent) 72%, #111827));
  color: #ffffff;
  font-size: 1.35rem;
  box-shadow: 0 10px 23px color-mix(in srgb, var(--choice-accent) 25%, transparent);
}

.portal-choice-copy {
  display: block;
  min-width: 0;
}

.portal-choice-copy strong {
  display: block;
  color: var(--portal-text);
  font-size: 1.04rem;
  font-weight: 900;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.portal-choice-copy small {
  display: -webkit-box;
  margin-top: 5px;
  color: var(--portal-muted);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.portal-choice-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--choice-accent) 9%, var(--portal-card));
  color: var(--choice-accent);
}















.portal-choice-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.portal-choice-badges em {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--choice-accent) 10%, var(--portal-card));
  color: var(--choice-accent);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 850;
}

.portal-choice-badges .lang-fr { color: #1558b0; background: rgba(21, 88, 176, 0.10); }

.portal-choice-badges .lang-en { color: #8a3b12; background: rgba(138, 59, 18, 0.10); }

.portal-choice-badges .lang-es { color: #a11a1a; background: rgba(161, 26, 26, 0.10); }

.portal-section-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 0 0;
  padding: 12px 15px;
  border-inline-start: 5px solid var(--portal-accent);
  border-radius: 13px;
  background: var(--portal-card);
  color: var(--portal-text);
  box-shadow: 0 7px 20px rgba(20, 30, 55, 0.05);
  font-size: 1rem;
}

.portal-section-title i {
  color: var(--portal-accent);
}

.portal-card {
  align-self: start;
  min-width: 0;
  height: max-content;
  border: 1px solid var(--portal-border);
  border-top: 5px solid var(--portal-accent);
  border-radius: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--portal-accent) 4%, var(--portal-card)), var(--portal-card) 94px);
  box-shadow: 0 10px 26px rgba(25, 35, 60, 0.07);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.portal-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--portal-accent) 15%, rgba(20, 30, 55, 0.12));
  border-color: color-mix(in srgb, var(--portal-accent) 45%, var(--portal-border));
}

.portal-card.is-selected {
  border-color: var(--portal-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-accent) 11%, transparent), 0 15px 34px color-mix(in srgb, var(--portal-accent) 16%, rgba(20, 30, 55, 0.12));
}

.portal-card-head {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 17px 17px 10px;
}

.portal-card-icon {
  display: grid;
  place-items: center;
  flex: 0 0 50px;
  height: 50px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--portal-accent), var(--portal-accent-2));
  color: #ffffff;
  font-size: 1.18rem;
  box-shadow: 0 9px 20px color-mix(in srgb, var(--portal-accent) 24%, transparent);
}

.portal-card-copy {
  min-width: 0;
  flex: 1;
}

.portal-card-title {
  margin: 0;
  color: var(--portal-text);
  font-size: 1.02rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.portal-card-track {
  display: -webkit-box;
  margin: 4px 0 0;
  color: var(--portal-muted);
  font-size: 0.84rem;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}



.portal-card-actions {
  display: flex;
  gap: 9px;
  margin-top: auto;
  padding: 13px 17px 17px;
}

.portal-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  text-decoration: none;
  font: inherit;
  font-weight: 850;
  font-size: 0.86rem;
  cursor: pointer;
}

.portal-action.primary {
  border-color: var(--portal-accent);
  background: var(--portal-accent);
  color: #ffffff;
}

.portal-action.secondary {
  background: var(--portal-card);
  color: var(--portal-text);
}

.portal-detail {
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--portal-accent) 30%, var(--portal-border));
  border-top: 5px solid var(--portal-accent);
  border-radius: 22px;
  background: var(--portal-card);
  box-shadow: var(--portal-shadow);
  padding: 20px;
}

.portal-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.portal-detail-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--portal-accent);
  font-size: 0.78rem;
  font-weight: 850;
}

.portal-detail-title {
  margin: 0;
  color: var(--portal-text);
  font-size: 1.22rem;
  line-height: 1.45;
}

.portal-detail-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.portal-detail-source {
  flex: 0 0 auto;
}

.portal-close {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  background: var(--portal-soft);
  color: var(--portal-text);
  cursor: pointer;
}

.portal-resource-section {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid var(--portal-border);
  border-radius: 17px;
  background: color-mix(in srgb, var(--portal-card) 97%, var(--portal-soft));
}

.portal-resource-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--portal-text);
  font-size: 1rem;
}

.portal-resource-section-title i {
  color: var(--portal-accent);
}

.portal-semester {
  margin: 16px 0 8px;
  color: var(--portal-text);
  font-size: 0.98rem;
}

.portal-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.portal-item {
  align-self: start;
  border: 1px solid var(--portal-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--portal-card) 95%, var(--portal-soft));
  overflow: hidden;
}

.portal-item summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 14px;
  color: var(--portal-text);
  font-weight: 850;
  line-height: 1.45;
  list-style: none;
  cursor: pointer;
}

.portal-item summary::-webkit-details-marker {
  display: none;
}

.portal-item summary::before {
  content: "+";
  display: grid;
  place-items: center;
  flex: 0 0 27px;
  height: 27px;
  border-radius: 8px;
  background: var(--portal-soft);
  color: var(--portal-accent);
  font-size: 1rem;
}

.portal-item[open] summary::before {
  content: "−";
}

.portal-resource-kind {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 14px 7px;
  color: var(--portal-accent);
  font-size: 0.86rem;
  font-weight: 900;
}

.portal-resource-list {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.portal-resource-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border-radius: 10px;
  background: var(--portal-soft);
  color: var(--portal-text);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.45;
}

.portal-resource-link:hover,
.portal-resource-link:focus-visible {
  color: var(--portal-accent);
  outline: none;
}

.portal-resource-videos i {
  color: #e11d48;
}

.portal-empty-inline {
  margin: 0;
  padding: 0 14px 12px;
  color: var(--portal-muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.portal-message {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--portal-border);
  border-radius: 18px;
  background: var(--portal-card);
  color: var(--portal-muted);
  text-align: center;
}

.portal-message i {
  display: block;
  margin-bottom: 10px;
  color: var(--portal-accent);
  font-size: 1.7rem;
}

.portal-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.portal-skeleton-grid span {
  height: 176px;
  border-radius: 18px;
  background: linear-gradient(90deg, var(--portal-soft), var(--portal-card), var(--portal-soft));
  background-size: 200% 100%;
  animation: portal-shimmer 1.3s linear infinite;
}

@keyframes portal-shimmer {
to { background-position: -200% 0; }
}

.portal-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.portal-page-btn {
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--portal-border);
  border-radius: 11px;
  background: var(--portal-card);
  color: var(--portal-text);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.portal-page-btn.active {
  background: var(--portal-accent);
  border-color: var(--portal-accent);
  color: #ffffff;
}

.portal-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 1100px) {
.portal-grid,
  .portal-skeleton-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
.portal-content {
    padding-inline: 10px;
  }
.portal-hero {
    padding: 22px 18px;
    border-radius: 18px;
  }
.portal-hero-heading {
    gap: 10px;
  }
.portal-hero-icon {
    flex-basis: 48px;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    font-size: 1.2rem;
  }
.portal-context {
    align-items: stretch;
    border-radius: 16px;
    padding: 10px;
  }
.portal-type-chip {
    justify-content: center;
    width: 100%;
  }
.portal-stepper {
    width: 100%;
  }
.portal-search-dock {
    border-radius: 15px;
    padding: 8px;
  }
.portal-search-row {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }
.portal-result-count {
    padding-inline: 4px;
  }
.portal-grid,
  .portal-skeleton-grid,
  .portal-items {
    grid-template-columns: 1fr;
  }
.portal-choice-button {
    min-height: 104px;
    padding: 15px;
  }


.portal-choice-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
  }
.portal-card-actions {
    flex-direction: column;
  }
.portal-detail {
    padding: 14px;
  }
.portal-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }
.portal-detail-tools {
    width: 100%;
  }
.portal-detail-source {
    flex: 1;
  }
.portal-resource-section {
    padding: 10px;
  }
.portal-hero p {
    font-size: 0.92rem;
  }
}

@media (prefers-reduced-motion: reduce) {
.portal-card,
  .portal-choice-card,
  .portal-skeleton-grid span {
    transition: none;
    animation: none;
  }
}

.portal-context {
  display: none !important;
}

.portal-detail {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  align-self: start;
}

.portal-card.is-last-opened {
  position: relative;
  border-color: color-mix(in srgb, var(--portal-accent) 78%, var(--portal-border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--portal-accent) 10%, var(--portal-card)), var(--portal-card) 110px);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--portal-accent) 10%, transparent), 0 16px 36px color-mix(in srgb, var(--portal-accent) 19%, rgba(20, 30, 55, 0.14));
}

.portal-card.is-selected {
  position: relative;
  overflow: visible;
  z-index: 3;
}

.portal-card.is-selected::after {
  content: "";
  position: absolute;
  inset-inline-start: 50%;
  bottom: -15px;
  width: 26px;
  height: 16px;
  transform: translateX(-50%);
  background: var(--portal-accent);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 4px 4px color-mix(in srgb, var(--portal-accent) 30%, transparent));
  pointer-events: none;
}

[dir="rtl"] .portal-card.is-selected::after { transform: translateX(50%); }

.dark-mode .portal-card.is-last-opened,
html.dark-mode .portal-card.is-last-opened {
  background: linear-gradient(180deg, color-mix(in srgb, var(--portal-accent) 17%, var(--portal-card)), var(--portal-card) 110px);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--portal-accent) 16%, transparent), 0 18px 38px rgba(0, 0, 0, 0.34);
}

.subj-icon > .mdi-abjad-arabic,
.subj-icon > .mdi-head-dots-horizontal,
.portal-card-icon > .mdi-abjad-arabic,
.portal-card-icon > .mdi-head-dots-horizontal {
  font-size: 1.42em !important;
  line-height: 1 !important;
  transform: scale(1.06);
  transform-origin: center;
}

.portal-card {
  overflow: hidden;
}

.portal-card-open {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.portal-card-open:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--portal-accent) 28%, transparent);
  outline-offset: -3px;
}

.portal-card-head {
  align-items: center;
  padding: 15px 15px 8px;
}

.portal-card-icon {
  flex-basis: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 1.08rem;
}

.portal-card-copy {
  align-self: center;
}

.portal-card-title {
  font-size: 1rem;
  line-height: 1.38;
}

.portal-card-track {
  margin-top: 2px;
  font-size: .8rem;
  line-height: 1.35;
  -webkit-line-clamp: 1;
}

.portal-card-open-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--portal-accent) 24%, var(--portal-border));
  border-radius: 11px;
  background: color-mix(in srgb, var(--portal-accent) 8%, var(--portal-card));
  color: var(--portal-accent);
  font-size: .9rem;
  transition: transform .16s ease, background-color .16s ease, color .16s ease;
}

.portal-card:hover .portal-card-open-icon,
.portal-card-open:focus-visible .portal-card-open-icon {
  transform: translateY(-1px);
  background: var(--portal-accent);
  color: #fff;
}





.portal-card-actions {
  display: none !important;
}

.portal-detail {
  padding: 17px;
}

.portal-detail-head {
  align-items: center;
  margin-bottom: 12px;
}

.portal-detail-copy {
  min-width: 0;
}

.portal-detail-kicker {
  margin-bottom: 2px;
  font-size: .76rem;
  line-height: 1.3;
}

.portal-detail-title {
  font-size: clamp(1.05rem, 1.8vw, 1.28rem);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.portal-detail-tools {
  gap: 7px;
}

.portal-detail-source {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 11px;
  border-radius: 11px;
  font-size: .8rem;
}

.portal-close {
  flex-basis: 38px;
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.portal-terms-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.portal-term-card {
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--portal-accent) 24%, var(--portal-border));
  border-radius: 18px;
  background: var(--portal-card);
  box-shadow: 0 8px 22px rgba(20, 30, 55, .055);
  overflow: hidden;
}

.portal-term-card:only-child {
  grid-column: 1 / -1;
}

.portal-term-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--portal-accent) 18%, var(--portal-border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--portal-accent) 9%, var(--portal-card)), var(--portal-card));
  color: var(--portal-text);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.25;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.portal-term-head::-webkit-details-marker {
  display: none;
}

.portal-term-head i {
  color: var(--portal-accent);
  font-size: .9rem;
  transition: transform .18s ease;
}

.portal-term-card:not([open]) .portal-term-head i:first-child {
  transform: rotate(-90deg);
}

.portal-term-card:not([open]) .portal-term-head i:last-child {
  transform: rotate(90deg);
}

.portal-term-body {
  padding: 11px;
}

.portal-term-card .portal-items {
  grid-template-columns: 1fr;
  gap: 9px;
}

.portal-semester {
  display: none;
}

.portal-item {
  border-color: color-mix(in srgb, var(--portal-accent) 18%, var(--portal-border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--portal-card) 96%, var(--portal-soft));
  box-shadow: 0 4px 13px rgba(20, 30, 55, .035);
  transition: border-color .17s ease, box-shadow .17s ease, transform .17s ease;
}

.portal-item:hover,
.portal-item:focus-within {
  border-color: color-mix(in srgb, var(--portal-accent) 55%, var(--portal-border));
  box-shadow: 0 9px 22px color-mix(in srgb, var(--portal-accent) 10%, rgba(20, 30, 55, .08));
}

.portal-item[open] {
  border-color: var(--portal-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--portal-accent) 9%, transparent), 0 8px 20px rgba(20, 30, 55, .07);
}

.portal-item summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  min-height: 48px;
  padding: 9px 10px;
  line-height: 1.35;
}

.portal-item summary::before {
  display: none !important;
}

.portal-item-number {
  display: grid;
  place-items: center;
  min-width: 31px;
  height: 31px;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--portal-accent) 32%, var(--portal-border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--portal-accent) 8%, var(--portal-card));
  color: var(--portal-accent);
  font-size: .75rem;
  font-weight: 900;
  line-height: 1;
}

.portal-item-title {
  min-width: 0;
  color: var(--portal-text);
  font-size: .89rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.portal-item-toggle {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: var(--portal-soft);
  color: var(--portal-accent);
  font-size: 1rem;
  font-weight: 900;
}

.portal-item-toggle::before {
  content: "+";
}

.portal-item[open] .portal-item-toggle::before {
  content: "−";
}

.portal-item-body {
  padding: 0 10px 10px;
}

.portal-resource-group + .portal-resource-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--portal-border);
}

.portal-resource-kind {
  margin: 2px 2px 7px;
  font-size: .82rem;
}

.portal-resource-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
}

.portal-resource-count-1 {
  grid-template-columns: 1fr;
}

.portal-resource-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--portal-accent) 14%, var(--portal-border));
  border-radius: 11px;
  background: var(--portal-soft);
  color: var(--portal-text);
  font-size: .81rem;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 3px 9px rgba(20, 30, 55, .025);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.portal-resource-link:hover,
.portal-resource-link:focus-visible {
  transform: translateY(-1px);
  border-color: var(--portal-accent);
  background: color-mix(in srgb, var(--portal-accent) 8%, var(--portal-card));
  color: var(--portal-accent);
  box-shadow: 0 7px 16px color-mix(in srgb, var(--portal-accent) 10%, rgba(20, 30, 55, .06));
}

.portal-resource-link-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--portal-accent) 10%, var(--portal-card));
  color: var(--portal-accent);
  font-size: .85rem;
}

.portal-resource-link-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.portal-resource-videos .portal-resource-link-icon,
.portal-resource-link.portal-resource-videos .portal-resource-link-icon {
  color: #e11d48;
  background: color-mix(in srgb, #e11d48 9%, var(--portal-card));
}

.portal-resource-quizzes .portal-resource-link-icon,
.portal-resource-link.portal-resource-quizzes .portal-resource-link-icon {
  color: #2563eb;
  background: color-mix(in srgb, #2563eb 9%, var(--portal-card));
}

.portal-empty-inline {
  padding: 5px 2px 2px;
}

.portal-resource-section {
  padding: 12px;
}

.portal-resource-section-title {
  margin-bottom: 9px;
}

@media (max-width: 760px) {
.portal-terms-wrap {
    grid-template-columns: 1fr;
  }
.portal-term-card:only-child {
    grid-column: auto;
  }
.portal-detail-head {
    align-items: center;
    flex-direction: row;
  }
.portal-detail-tools {
    width: auto;
  }
.portal-detail-source {
    flex: 0 0 auto;
  }
}

@media (max-width: 520px) {
.portal-card-head {
    padding: 13px 13px 7px;
  }

.portal-detail {
    padding: 12px;
  }
.portal-detail-head {
    align-items: flex-start;
    gap: 8px;
  }
.portal-detail-source span {
    display: none;
  }
.portal-detail-source {
    width: 38px;
    padding: 0;
  }
.portal-resource-list {
    grid-template-columns: 1fr;
  }
.portal-term-body {
    padding: 9px;
  }
.portal-item-title {
    font-size: .84rem;
  }
}





















/* V43: long Secondary track titles wrap fully instead of clipping. */
.portal-track-grid .portal-choice-copy strong,
.portal-track-grid .portal-choice-copy small {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.portal-track-grid .portal-choice-copy small {
  display: block;
  -webkit-line-clamp: unset;
}

/* V37: opened-state parity for sidebar/footer resource portal. */
.portal-resource-link.is-opened,
.portal-resource-link[data-opened="1"] {
  border-color: var(--stage-color, #16a34a) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stage-color, #16a34a) 55%, transparent), 0 6px 18px color-mix(in srgb, var(--stage-color, #16a34a) 16%, transparent);
  background: color-mix(in srgb, var(--stage-color, #16a34a) 9%, #fff) !important;
}
.portal-resource-link.is-opened::after,
.portal-resource-link[data-opened="1"]::after {
  content: "✓";
  display: inline-grid;
  place-items: center;
  inline-size: 1.35rem;
  block-size: 1.35rem;
  border-radius: 999px;
  color: var(--stage-color, #16a34a);
  background: color-mix(in srgb, var(--stage-color, #16a34a) 14%, #fff);
  font-weight: 900;
  flex: 0 0 auto;
}

/* V40: compact opened badge — never changes portal resource button dimensions. */
.portal-resource-link {
  position: relative;
  padding-inline-end: 2.15rem;
}
.portal-resource-link.is-opened::after,
.portal-resource-link[data-opened="1"]::after {
  position: absolute;
  inset-inline-end: .48rem;
  inset-block-start: 50%;
  transform: translateY(-50%);
  inline-size: 1.08rem;
  block-size: 1.08rem;
  min-inline-size: 1.08rem;
  margin: 0;
  font-size: .68rem;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}
.portal-resource-link.is-opened:hover::after,
.portal-resource-link[data-opened="1"]:hover::after,
.portal-resource-link.is-opened:focus-visible::after,
.portal-resource-link[data-opened="1"]:focus-visible::after {
  transform: translateY(-50%);
}


/* V41: portal opened-state colors follow the active education stage. */
html[data-portal-stage="p"] { --stage-color: #168a55; }
html[data-portal-stage="m"] { --stage-color: #f08a24; }
html[data-portal-stage="s"] { --stage-color: #8e24aa; }

html[data-portal-stage="p"] .portal-resource-link.is-opened,
html[data-portal-stage="p"] .portal-resource-link[data-opened="1"] { color: #0d6e43; }
html[data-portal-stage="m"] .portal-resource-link.is-opened,
html[data-portal-stage="m"] .portal-resource-link[data-opened="1"] { color: #c96a10; }
html[data-portal-stage="s"] .portal-resource-link.is-opened,
html[data-portal-stage="s"] .portal-resource-link[data-opened="1"] { color: #6a1b9a; }



/* V44: professional pole tree and intrinsic metric widths. */
.portal-professional-pole{grid-column:span 1}
.portal-professional-pole-head{min-height:86px;cursor:default}
.portal-professional-pole-head .portal-choice-arrow{display:none}
.portal-professional-track-list{display:grid;gap:8px;padding:0 14px 15px}
.portal-professional-track-choice{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:9px;width:100%;min-height:52px;padding:8px 10px;border:1px solid var(--portal-border);border-radius:12px;background:var(--portal-card);color:var(--portal-text);font:inherit;text-align:start;cursor:pointer}
.portal-professional-track-choice:hover,.portal-professional-track-choice:focus-visible{border-color:var(--portal-accent);background:color-mix(in srgb,var(--portal-accent) 7%,var(--portal-card));outline:none}
.portal-professional-track-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:var(--portal-soft);color:var(--portal-accent)}
.portal-professional-track-copy{min-width:0}.portal-professional-track-copy strong{display:block;font-size:.86rem;line-height:1.35}.portal-professional-track-copy small{display:block;margin-top:2px;color:var(--portal-muted);font-size:.68rem;line-height:1.3;white-space:normal}
.portal-professional-track-arrow{color:var(--portal-accent)}


@media(max-width:700px){.portal-professional-pole{grid-column:1/-1}}

/* V52: identity badges are visually distinct from statistics in light/dark mode. */
.portal-choice-badges em {
  border: 1px solid color-mix(in srgb, var(--choice-accent, var(--portal-accent)) 42%, transparent);
  background: color-mix(in srgb, var(--choice-accent, var(--portal-accent)) 18%, var(--portal-card));
  color: color-mix(in srgb, var(--choice-accent, var(--portal-accent)) 88%, var(--portal-text));
  box-shadow: 0 3px 10px color-mix(in srgb, var(--choice-accent, var(--portal-accent)) 18%, transparent);
  letter-spacing: .01em;
}
.portal-choice-badges em.badge-general {
  background: color-mix(in srgb, #7b1fa2 18%, var(--portal-card));
  border-color: color-mix(in srgb, #ab47bc 52%, transparent);
  color: color-mix(in srgb, #8e24aa 82%, var(--portal-text));
}
.portal-choice-badges em.badge-biof {
  background: color-mix(in srgb, #1565c0 17%, var(--portal-card));
  border-color: color-mix(in srgb, #42a5f5 54%, transparent);
  color: color-mix(in srgb, #1565c0 82%, var(--portal-text));
}
.portal-choice-badges em.badge-english {
  background: color-mix(in srgb, #ef6c00 17%, var(--portal-card));
  border-color: color-mix(in srgb, #ff9800 55%, transparent);
  color: color-mix(in srgb, #e65100 84%, var(--portal-text));
}
.portal-choice-badges em.badge-spanish {
  background: color-mix(in srgb, #c62828 16%, var(--portal-card));
  border-color: color-mix(in srgb, #ef5350 55%, transparent);
  color: color-mix(in srgb, #b71c1c 84%, var(--portal-text));
}
.portal-choice-badges em.badge-vocational {
  background: color-mix(in srgb, #00897b 17%, var(--portal-card));
  border-color: color-mix(in srgb, #26a69a 55%, transparent);
  color: color-mix(in srgb, #00796b 84%, var(--portal-text));
}

html.dark-mode .portal-choice-badges em {
  color: #fff;
  box-shadow: 0 0 14px color-mix(in srgb, var(--choice-accent, var(--portal-accent)) 32%, transparent);
}
html.dark-mode .portal-choice-badges em.badge-general {
  background: linear-gradient(135deg, rgba(142,36,170,.72), rgba(106,27,154,.48));
  border-color: rgba(206,147,216,.72);
  box-shadow: 0 0 15px rgba(171,71,188,.34);
}
html.dark-mode .portal-choice-badges em.badge-biof {
  background: linear-gradient(135deg, rgba(21,101,192,.78), rgba(13,71,161,.52));
  border-color: rgba(100,181,246,.76);
  box-shadow: 0 0 15px rgba(66,165,245,.32);
}
html.dark-mode .portal-choice-badges em.badge-english {
  background: linear-gradient(135deg, rgba(239,108,0,.80), rgba(230,81,0,.54));
  border-color: rgba(255,183,77,.78);
  box-shadow: 0 0 15px rgba(255,152,0,.32);
}
html.dark-mode .portal-choice-badges em.badge-spanish {
  background: linear-gradient(135deg, rgba(198,40,40,.80), rgba(183,28,28,.54));
  border-color: rgba(239,83,80,.78);
  box-shadow: 0 0 15px rgba(239,83,80,.30);
}
html.dark-mode .portal-choice-badges em.badge-vocational {
  background: linear-gradient(135deg, rgba(0,137,123,.82), rgba(0,105,92,.56));
  border-color: rgba(77,208,225,.72);
  box-shadow: 0 0 15px rgba(38,166,154,.30);
}

/* Statistics remain neutral information chips, not glowing pathway badges. */






/* V57: semantic statistics, restrained open state, and clearer marked edge. */









/* Identity badges stay distinct, but avoid neon bloom. */
html.dark-mode .portal-choice-badges em,
html.dark-mode .portal-choice-badges em.badge-general,
html.dark-mode .portal-choice-badges em.badge-biof,
html.dark-mode .portal-choice-badges em.badge-english,
html.dark-mode .portal-choice-badges em.badge-spanish,
html.dark-mode .portal-choice-badges em.badge-vocational {
  box-shadow: 0 2px 7px rgba(0,0,0,.18) !important;
}

/* Opened resource: crisp stage edge, no luminous halo. */
.portal-resource-link.is-opened,
.portal-resource-link[data-opened="1"] {
  border-color: color-mix(in srgb, var(--stage-color, #16a34a) 76%, #9aa5b5) !important;
  background: color-mix(in srgb, var(--stage-color, #16a34a) 7%, var(--portal-card)) !important;
  box-shadow: inset 3px 0 0 var(--stage-color, #16a34a), 0 2px 8px rgba(15,23,42,.055) !important;
}
[dir="rtl"] .portal-resource-link.is-opened,
[dir="rtl"] .portal-resource-link[data-opened="1"] {
  box-shadow: inset -3px 0 0 var(--stage-color, #16a34a), 0 2px 8px rgba(15,23,42,.055) !important;
}
.portal-resource-link.is-opened::after,
.portal-resource-link[data-opened="1"]::after {
  color: var(--stage-color, #16a34a) !important;
  background: var(--portal-card) !important;
  border: 2px solid var(--stage-color, #16a34a) !important;
  box-shadow: 0 1px 3px rgba(15,23,42,.14) !important;
  box-sizing: border-box;
}
html.dark-mode .portal-resource-link.is-opened,
html.dark-mode .portal-resource-link[data-opened="1"] {
  background: color-mix(in srgb, var(--stage-color, #16a34a) 11%, #171f2c) !important;
  box-shadow: inset 3px 0 0 var(--stage-color, #16a34a), 0 2px 8px rgba(0,0,0,.18) !important;
}
html.dark-mode[dir="rtl"] .portal-resource-link.is-opened,
html.dark-mode[dir="rtl"] .portal-resource-link[data-opened="1"] {
  box-shadow: inset -3px 0 0 var(--stage-color, #16a34a), 0 2px 8px rgba(0,0,0,.18) !important;
}
html.dark-mode .portal-resource-link.is-opened::after,
html.dark-mode .portal-resource-link[data-opened="1"]::after {
  background: #17202d !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.28) !important;
}

.portal-card.is-last-opened,
.portal-card.is-selected {
  border-color: color-mix(in srgb, var(--portal-accent) 62%, var(--portal-border)) !important;
  box-shadow: 0 8px 22px rgba(15,23,42,.09) !important;
}
html.dark-mode .portal-card.is-last-opened,
html.dark-mode .portal-card.is-selected {
  box-shadow: 0 8px 22px rgba(0,0,0,.24) !important;
}
.portal-card.is-selected::after {
  filter: none !important;
}


/* V59: consistent semantic statistics and intentional dark opened-state glow. */





html.dark-mode .portal-resource-link.is-opened,
html.dark-mode .portal-resource-link[data-opened="1"] {
  color: color-mix(in srgb, var(--portal-stage-color, #a21caf) 68%, #ffffff) !important;
  text-shadow:
    0 0 5px color-mix(in srgb, var(--portal-stage-color, #a21caf) 70%, transparent),
    0 0 12px color-mix(in srgb, var(--portal-stage-color, #a21caf) 34%, transparent);
  border-color: color-mix(in srgb, var(--portal-stage-color, #a21caf) 72%, #ffffff 8%) !important;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--portal-stage-color, #a21caf) 28%, transparent),
    0 0 10px color-mix(in srgb, var(--portal-stage-color, #a21caf) 20%, transparent) !important;
}
html.dark-mode .portal-resource-link.is-opened::after,
html.dark-mode .portal-resource-link[data-opened="1"]::after {
  color: #ffffff !important;
  background: color-mix(in srgb, var(--portal-stage-color, #a21caf) 78%, #111827) !important;
  border: 2px solid color-mix(in srgb, var(--portal-stage-color, #a21caf) 70%, #ffffff) !important;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--portal-stage-color, #a21caf) 22%, transparent),
    0 0 10px color-mix(in srgb, var(--portal-stage-color, #a21caf) 48%, transparent) !important;
  text-shadow: 0 0 5px rgba(255,255,255,.75);
}


/* V60: definitive semantic statistics palette; no gray fallback. */









/* V62: unified five-blue statistics palette + strict P/M/S opened-state identity. */







html[data-portal-stage="p"] { --stage-color: #168a55; --stage-open-text: #0d6e43; --stage-open-dark-text: #72e6ad; }
html[data-portal-stage="m"] { --stage-color: #f08a24; --stage-open-text: #b85c08; --stage-open-dark-text: #ffbd73; }
html[data-portal-stage="s"] { --stage-color: #8e24aa; --stage-open-text: #6a1b9a; --stage-open-dark-text: #dda0ee; }
html[data-portal-stage] .portal-resource-link.is-opened,
html[data-portal-stage] .portal-resource-link[data-opened="1"] { color: var(--stage-open-text) !important; }
html.dark-mode[data-portal-stage] .portal-resource-link.is-opened,
html.dark-mode[data-portal-stage] .portal-resource-link[data-opened="1"] { color: var(--stage-open-dark-text) !important; }


/* V63: definitive all-blue statistics palette in every portal card and theme. */










/* V64: final statistics palette — dark blue in light mode, luminous blue-white in dark mode. */









/* V66 — canonical five-frequency statistics palette.
   Light mode: dark readable numbers. Dark mode: white numbers with controlled glow. */













/* V67 — definitive semantic statistics colors and contrast.
   The five requested frequencies are assigned by metric identity, so a lone
   Resources chip never inherits the first (purple) nth-child color. */







/* Light mode: icon, number and label use a darker version of their own frequency. */



/* Dark mode: the same frequency is retained, but all glyphs become luminous white. */



/* V67: professional S3 child cards must never visually collapse to one pole icon. */
.portal-professional-track-choice .portal-professional-track-icon i,
.portal-professional-track-choice .portal-professional-track-icon svg {
  width:1.05em;
  min-width:1.05em;
}


/* V68 — hard fallback colors: no black statistic values and no unsupported color-mix dependency. */









/* V71 — restrained dark-mode statistics glow.
   Statistics remain readable and color-coded, but stay visually secondary to the main cards. */




/* V72 — simple dark-mode statistics: no glow, no visual competition with cards. */




/* ========================================================================== 
   V103 — portal metric and title vertical alignment
   ======================================================================= */








.portal-choice-copy strong,
.portal-card-title {
  transform: translateY(2px);
}




/* ========================================================================== 
   V104 — mobile portal statistic badge alignment + centered opened checkmark
   ======================================================================= */


.portal-resource-link.is-opened::after,
.portal-resource-link[data-opened="1"]::after {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  place-items: center !important;
  text-align: center !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  padding: 0 !important;
  letter-spacing: 0 !important;
  vertical-align: middle !important;
  text-indent: 0 !important;
}

@media (max-width: 720px) {
  .portal-resource-link.is-opened::after,
  .portal-resource-link[data-opened="1"]::after {
    inline-size: 1.16rem !important;
    block-size: 1.16rem !important;
    min-inline-size: 1.16rem !important;
    font-size: .72rem !important;
    inset-inline-end: .54rem !important;
    transform: translateY(-50%) !important;
  }

  .portal-resource-link.is-opened:hover::after,
  .portal-resource-link[data-opened="1"]:hover::after,
  .portal-resource-link.is-opened:focus-visible::after,
  .portal-resource-link[data-opened="1"]:focus-visible::after {
    transform: translateY(-50%) !important;
  }
}

/* V105: mobile portal stage statistic badges must stay as one balanced row. */




/* V105: Mobile portal statistics must behave like compact real badges.
   Fixes the broken 2+1 wrapping on stage cards and aligns icon, number,
   and label on the same vertical center line. Desktop sizing is untouched. */





/* V106: single-source mobile portal stat badge alignment.
   One variable set controls height, icon size, gap, and text baseline for
   all stage/level/sidebar/footer resource-portal counters. */
:root {
  --portal-stat-mobile-h: 42px;
  --portal-stat-mobile-gap: 5px;
  --portal-stat-mobile-pad-x: 7px;
  --portal-stat-mobile-font: clamp(.76rem, 2.95vw, .88rem);
  --portal-stat-mobile-icon: clamp(.84rem, 3.15vw, .96rem);
}



@media (max-width: 370px) {
  :root {
    --portal-stat-mobile-h: 40px;
    --portal-stat-mobile-gap: 3px;
    --portal-stat-mobile-pad-x: 5px;
    --portal-stat-mobile-font: .72rem;
    --portal-stat-mobile-icon: .82rem;
  }
}

/* ========================================================================== 
   V117 — CANONICAL RESOURCE PORTAL STAT BADGES
   Single owner for sidebar/footer/resource portal metric badges.
   No legacy blue/purple statistic layers; no flex wrapping; no JS dependency.
   ======================================================================= */
:root {
  --portal-badge-main: var(--portal-accent, #8e24aa);
  --portal-badge-ink: var(--portal-accent-2, #6a1b9a);
  --portal-badge-bg: #faf5ff;
  --portal-badge-border: #d8b4fe;
  --portal-badge-height: 42px;
  --portal-badge-radius: 14px;
  --portal-badge-gap: 8px;
  --portal-badge-pad-x: 10px;
  --portal-badge-font: .76rem;
  --portal-badge-icon: .86rem;
}
html[data-portal-stage="p"], html[data-schoolep-cycle="p"] {
  --portal-badge-main: #16a34a;
  --portal-badge-ink: #08713a;
  --portal-badge-bg: #f0fdf4;
  --portal-badge-border: #86efac;
}
html[data-portal-stage="m"], html[data-schoolep-cycle="m"] {
  --portal-badge-main: #f59e0b;
  --portal-badge-ink: #b45309;
  --portal-badge-bg: #fff7ed;
  --portal-badge-border: #fed7aa;
}
html[data-portal-stage="s"], html[data-schoolep-cycle="s"] {
  --portal-badge-main: #9333ea;
  --portal-badge-ink: #6d28d9;
  --portal-badge-bg: #faf5ff;
  --portal-badge-border: #d8b4fe;
}
.portal-choice-card,
.portal-card,
.portal-subject-card {
  min-width: 0;
}
.portal-choice-stats,
.portal-card-stats,
.portal-subject-stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  align-items: center !important;
  justify-content: stretch !important;
  gap: var(--portal-badge-gap) !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  padding: 0 17px 16px !important;
  margin: 0 !important;
  overflow: hidden !important;
  direction: inherit !important;
  --portal-badge-local-main: var(--choice-accent, var(--portal-badge-main));
  --portal-badge-local-ink: color-mix(in srgb, var(--portal-badge-local-main) 76%, #0f172a);
  --portal-badge-local-bg: color-mix(in srgb, var(--portal-badge-local-main) 7%, #ffffff);
  --portal-badge-local-border: color-mix(in srgb, var(--portal-badge-local-main) 42%, #d8deea);
}
.portal-choice-stats > span,
.portal-card-stats > span,
.portal-subject-stats > span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: none !important;
  gap: 5px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: var(--portal-badge-height) !important;
  min-height: var(--portal-badge-height) !important;
  padding: 0 var(--portal-badge-pad-x) !important;
  border: 1.5px solid var(--portal-badge-local-border) !important;
  border-radius: var(--portal-badge-radius) !important;
  background: linear-gradient(180deg, #ffffff 0%, var(--portal-badge-local-bg) 100%) !important;
  color: var(--portal-badge-local-ink) !important;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--portal-badge-local-main) 12%, transparent) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  line-height: 1 !important;
  text-shadow: none !important;
  filter: none !important;
  transform: none !important;
  box-sizing: border-box !important;
}
.portal-choice-stats > span > i,
.portal-card-stats > span > i,
.portal-subject-stats > span > i,
.portal-choice-stats > span > .mdi,
.portal-card-stats > span > .mdi,
.portal-subject-stats > span > .mdi {
  display: inline-grid !important;
  place-items: center !important;
  flex: 0 0 auto !important;
  width: 1.1em !important;
  min-width: 1.1em !important;
  margin: 0 !important;
  padding: 0 !important;
  color: currentColor !important;
  -webkit-text-fill-color: currentColor !important;
  font-size: var(--portal-badge-icon) !important;
  line-height: 1 !important;
  position: static !important;
  transform: none !important;
  text-shadow: none !important;
  overflow: visible !important;
}
.portal-choice-stats > span > b,
.portal-card-stats > span > b,
.portal-subject-stats > span > b,
.portal-choice-stats > span > em,
.portal-card-stats > span > em,
.portal-subject-stats > span > em {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  color: currentColor !important;
  -webkit-text-fill-color: currentColor !important;
  font-style: normal !important;
  font-size: var(--portal-badge-font) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  text-shadow: none !important;
  position: static !important;
  transform: none !important;
}
.portal-choice-stats > span > b,
.portal-card-stats > span > b,
.portal-subject-stats > span > b {
  flex: 0 0 auto !important;
  font-weight: 950 !important;
  font-variant-numeric: tabular-nums !important;
}
.portal-choice-stats > span > em,
.portal-card-stats > span > em,
.portal-subject-stats > span > em {
  flex: 1 1 auto !important;
  max-width: 100% !important;
  font-weight: 900 !important;
  letter-spacing: -.01em !important;
}
html[lang="ar"] .portal-choice-stats > span,
html[lang="ar"] .portal-card-stats > span,
html[lang="ar"] .portal-subject-stats > span,
body[dir="rtl"] .portal-choice-stats > span,
body[dir="rtl"] .portal-card-stats > span,
body[dir="rtl"] .portal-subject-stats > span {
  direction: rtl !important;
}
html[lang="fr"] .portal-choice-stats > span,
html[lang="fr"] .portal-card-stats > span,
html[lang="fr"] .portal-subject-stats > span,
body[dir="ltr"] .portal-choice-stats > span,
body[dir="ltr"] .portal-card-stats > span,
body[dir="ltr"] .portal-subject-stats > span {
  direction: ltr !important;
}
html.dark-mode .portal-choice-stats > span,
html.dark-mode .portal-card-stats > span,
html.dark-mode .portal-subject-stats > span,
html[data-theme="dark"] .portal-choice-stats > span,
html[data-theme="dark"] .portal-card-stats > span,
html[data-theme="dark"] .portal-subject-stats > span,
body.dark-mode .portal-choice-stats > span,
body.dark-mode .portal-card-stats > span,
body.dark-mode .portal-subject-stats > span {
  background: color-mix(in srgb, var(--portal-badge-local-main) 14%, #0f172a) !important;
  border-color: color-mix(in srgb, var(--portal-badge-local-main) 56%, #334155) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}
@media (max-width: 700px) {
  :root {
    --portal-badge-height: 38px;
    --portal-badge-gap: 5px;
    --portal-badge-pad-x: 5px;
    --portal-badge-font: clamp(.56rem, 2.15vw, .66rem);
    --portal-badge-icon: .72rem;
  }
  .portal-choice-stats,
  .portal-card-stats,
  .portal-subject-stats {
    padding: 0 12px 14px !important;
  }
  .portal-choice-stats > span,
  .portal-card-stats > span,
  .portal-subject-stats > span {
    gap: 3px !important;
    border-radius: 12px !important;
  }
}
@media (max-width: 390px) {
  :root {
    --portal-badge-gap: 4px;
    --portal-badge-pad-x: 3px;
    --portal-badge-font: .55rem;
    --portal-badge-icon: .66rem;
  }
  .portal-choice-stats,
  .portal-card-stats,
  .portal-subject-stats {
    padding-inline: 8px !important;
  }
}



/* V133 — portal/sidebar/footer statistic badges: full labels, no clipping. */
.portal-choice-card,
.portal-card,
.portal-subject-card {
  height: auto !important;
  min-height: 0 !important;
}
.portal-choice-stats,
.portal-card-stats,
.portal-subject-stats {
  overflow: visible !important;
  align-items: stretch !important;
  padding-bottom: 17px !important;
}
.portal-choice-stats > span,
.portal-card-stats > span,
.portal-subject-stats > span {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  grid-template-areas: "metric-icon metric-number" "metric-icon metric-label" !important;
  align-content: center !important;
  align-items: center !important;
  justify-content: center !important;
  column-gap: 6px !important;
  row-gap: 2px !important;
  height: auto !important;
  min-height: 46px !important;
  padding: 6px 8px !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  line-height: 1.05 !important;
}
.portal-choice-stats > span > i,
.portal-card-stats > span > i,
.portal-subject-stats > span > i,
.portal-choice-stats > span > .mdi,
.portal-card-stats > span > .mdi,
.portal-subject-stats > span > .mdi {
  grid-area: metric-icon !important;
  align-self: center !important;
}
.portal-choice-stats > span > b,
.portal-card-stats > span > b,
.portal-subject-stats > span > b {
  grid-area: metric-number !important;
  display: block !important;
  width: 100% !important;
  text-align: center !important;
  overflow: visible !important;
  white-space: nowrap !important;
  font-size: clamp(.68rem, 1.2vw, .78rem) !important;
  line-height: 1 !important;
}
.portal-choice-stats > span > em,
.portal-card-stats > span > em,
.portal-subject-stats > span > em {
  grid-area: metric-label !important;
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  text-align: center !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  overflow-wrap: anywhere !important;
  font-size: clamp(.58rem, 1.05vw, .72rem) !important;
  line-height: 1.1 !important;
}
@media (max-width: 700px) {
  .portal-choice-stats > span,
  .portal-card-stats > span,
  .portal-subject-stats > span {
    min-height: 43px !important;
    padding: 5px 4px !important;
    column-gap: 3px !important;
  }
  .portal-choice-stats > span > b,
  .portal-card-stats > span > b,
  .portal-subject-stats > span > b { font-size: .66rem !important; }
  .portal-choice-stats > span > em,
  .portal-card-stats > span > em,
  .portal-subject-stats > span > em { font-size: .56rem !important; }
}


/* V229.14 — Resource breadcrumb uses the same interaction model as normal
   P/M/S breadcrumbs. Parent ancestors stay neutral. Only the final/current
   node is pinned to the active portal color; ancestors take that color on
   hover/focus/active. With no stage selected --portal-accent is neutral blue. */
.resource-portal-page .portal-breadcrumbs {
  color: #64748b !important;
}
.resource-portal-page .portal-breadcrumbs a,
.resource-portal-page .portal-breadcrumbs a .schoolep-breadcrumb-icon {
  color: #64748b !important;
}
.resource-portal-page .portal-breadcrumbs a:hover,
.resource-portal-page .portal-breadcrumbs a:hover .schoolep-breadcrumb-icon,
.resource-portal-page .portal-breadcrumbs a:focus-visible,
.resource-portal-page .portal-breadcrumbs a:focus-visible .schoolep-breadcrumb-icon,
.resource-portal-page .portal-breadcrumbs a:active,
.resource-portal-page .portal-breadcrumbs a:active .schoolep-breadcrumb-icon {
  color: var(--portal-accent) !important;
}
.resource-portal-page .portal-breadcrumbs strong.bc-current,
.resource-portal-page .portal-breadcrumbs strong.bc-current .schoolep-breadcrumb-icon {
  color: var(--portal-accent) !important;
}
.resource-portal-page .portal-breadcrumbs .sep {
  color: #94a3b8 !important;
}
html.dark-mode .resource-portal-page .portal-breadcrumbs,
html.dark-mode .resource-portal-page .portal-breadcrumbs a,
html.dark-mode .resource-portal-page .portal-breadcrumbs a .schoolep-breadcrumb-icon {
  color: #94a3b8 !important;
}
html.dark-mode .resource-portal-page .portal-breadcrumbs .sep {
  color: #64748b !important;
}
html.dark-mode .resource-portal-page .portal-breadcrumbs a:hover,
html.dark-mode .resource-portal-page .portal-breadcrumbs a:hover .schoolep-breadcrumb-icon,
html.dark-mode .resource-portal-page .portal-breadcrumbs a:focus-visible,
html.dark-mode .resource-portal-page .portal-breadcrumbs a:focus-visible .schoolep-breadcrumb-icon,
html.dark-mode .resource-portal-page .portal-breadcrumbs a:active,
html.dark-mode .resource-portal-page .portal-breadcrumbs a:active .schoolep-breadcrumb-icon,
html.dark-mode .resource-portal-page .portal-breadcrumbs strong.bc-current,
html.dark-mode .resource-portal-page .portal-breadcrumbs strong.bc-current .schoolep-breadcrumb-icon {
  color: var(--portal-accent) !important;
}
.resource-portal-page .portal-hero {
  border-color: color-mix(in srgb,var(--portal-accent) 42%,var(--portal-border)) !important;
  box-shadow: 0 10px 28px color-mix(in srgb,var(--portal-accent) 10%,transparent) !important;
}
.resource-portal-page .portal-hero h1,
.resource-portal-page .portal-hero .portal-eyebrow { color: var(--portal-accent-2) !important; }
.resource-portal-page .portal-hero-icon { background: linear-gradient(135deg,var(--portal-accent),var(--portal-accent-2)) !important; }

.portal-track-section {
  grid-column: 1 / -1;
  margin: 0 0 18px;
  border: 1px solid color-mix(in srgb,var(--portal-accent) 26%,var(--portal-border));
  border-radius: 18px;
  background: color-mix(in srgb,var(--portal-accent) 3%,var(--portal-card));
  overflow: clip;
}
.portal-track-section-head {
  list-style: none;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--portal-accent-2);
  font-weight: 900;
  border-bottom: 1px solid transparent;
}
.portal-track-section-head::-webkit-details-marker { display:none; }
.portal-track-section-head > i:first-child { width: 36px;height:36px;display:grid;place-items:center;border-radius:10px;background:color-mix(in srgb,var(--portal-accent) 12%,var(--portal-card));color:var(--portal-accent); }
.portal-track-section[open] > .portal-track-section-head { border-bottom-color: color-mix(in srgb,var(--portal-accent) 22%,var(--portal-border)); }
.portal-track-section-chevron { transition: transform .16s ease; }
.portal-track-section[open] .portal-track-section-chevron { transform: rotate(180deg); }
.portal-track-section-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;padding:16px; }
.portal-track-section-grid > .portal-choice-card { min-width:0; }
@media (max-width: 980px){ .portal-track-section-grid{grid-template-columns:repeat(2,minmax(0,1fr));} }
@media (max-width: 680px){ .portal-track-section-grid{grid-template-columns:1fr;padding:10px}.portal-track-section-head{min-height:52px;padding:9px 11px;font-size:.92rem;} }


/* V229.22.4 — Secondary track workspace: visible grouped panels, not long dropdowns. */
.resource-portal-page .portal-track-panels {
  grid-template-columns: 1fr !important;
  gap: 22px !important;
}
.resource-portal-page .portal-track-panel {
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--portal-accent) 28%, var(--portal-border));
  border-radius: 20px;
  background: color-mix(in srgb, var(--portal-accent) 3%, var(--portal-card));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--portal-accent) 7%, transparent);
}
.resource-portal-page .portal-track-panel::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--portal-accent), var(--portal-accent-2));
}
.resource-portal-page .portal-track-panel-head {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
  gap: 13px;
  min-height: 76px;
  padding: 14px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--portal-accent) 18%, var(--portal-border));
  background: color-mix(in srgb, var(--portal-accent) 5%, var(--portal-card));
}
.resource-portal-page .portal-track-panel-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--portal-accent);
  background: color-mix(in srgb, var(--portal-accent) 12%, var(--portal-card));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--portal-accent) 18%, transparent);
}
.resource-portal-page .portal-track-panel-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.resource-portal-page .portal-track-panel-copy > strong {
  color: var(--portal-text) !important;
  font-size: clamp(.96rem,1.5vw,1.12rem);
  font-weight: 900;
  line-height: 1.25;
}
.resource-portal-page .portal-track-language-legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.resource-portal-page .portal-track-language-legend > em {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 999px;
  font-style: normal;
  font-size: .76rem;
  font-weight: 800;
  color: var(--portal-text);
  background: var(--portal-card);
  border: 1px solid var(--portal-border);
}
.resource-portal-page .portal-track-language-legend > em > b {
  min-width: 24px;
  text-align: center;
  font-size: .68rem;
  letter-spacing: .04em;
}
.resource-portal-page .portal-track-language-legend .is-en > b { color: #b45309; }
.resource-portal-page .portal-track-language-legend .is-es > b { color: #dc2626; }
.resource-portal-page .portal-track-panel .portal-track-section-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 14px;
  padding: 16px;
}
.resource-portal-page .portal-track-panel .portal-choice-card {
  min-width: 0;
  border-top-width: 1px !important;
  border-inline-start: 4px solid var(--choice-accent);
  border-radius: 15px;
  box-shadow: none;
}
.resource-portal-page .portal-track-panel .portal-choice-button { min-height: 92px; }
.resource-portal-page .portal-track-panel .portal-choice-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px color-mix(in srgb,var(--portal-accent) 11%,transparent);
}

/* Dark mode: keep stage identity in borders/icons/glow; text stays high contrast. */
html.dark-mode .resource-portal-page .portal-hero {
  background: linear-gradient(135deg, color-mix(in srgb,var(--portal-accent) 8%,#111827), #171827) !important;
  border-color: color-mix(in srgb,var(--portal-accent) 52%,#334155) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--portal-accent) 10%,transparent), 0 16px 38px rgba(0,0,0,.24), 0 0 30px color-mix(in srgb,var(--portal-accent) 12%,transparent) !important;
}
html.dark-mode .resource-portal-page .portal-hero h1 {
  color: #f8fafc !important;
  text-shadow: 0 0 18px color-mix(in srgb,var(--portal-accent) 42%,transparent);
}
html.dark-mode .resource-portal-page .portal-hero .portal-eyebrow {
  color: #f8fafc !important;
  background: color-mix(in srgb,var(--portal-accent) 18%,#111827) !important;
  border: 1px solid color-mix(in srgb,var(--portal-accent) 32%,#334155);
  box-shadow: 0 0 18px color-mix(in srgb,var(--portal-accent) 13%,transparent);
}
html.dark-mode .resource-portal-page .portal-track-panel {
  background: linear-gradient(145deg, color-mix(in srgb,var(--portal-accent) 5%,#151a28), #171b28);
  border-color: color-mix(in srgb,var(--portal-accent) 44%,#334155);
  box-shadow: 0 12px 34px rgba(0,0,0,.28), 0 0 26px color-mix(in srgb,var(--portal-accent) 8%,transparent);
}
html.dark-mode .resource-portal-page .portal-track-panel-head {
  background: color-mix(in srgb,var(--portal-accent) 8%,#171b28);
  border-bottom-color: color-mix(in srgb,var(--portal-accent) 28%,#334155);
}
html.dark-mode .resource-portal-page .portal-track-panel-copy > strong { color: #f8fafc !important; }
html.dark-mode .resource-portal-page .portal-track-panel-icon {
  color: #f8fafc;
  background: linear-gradient(135deg,var(--portal-accent),var(--portal-accent-2));
  box-shadow: 0 0 20px color-mix(in srgb,var(--portal-accent) 30%,transparent);
}
html.dark-mode .resource-portal-page .portal-track-language-legend > em {
  color: #e5e7eb;
  background: rgba(15,23,42,.62);
  border-color: color-mix(in srgb,var(--portal-accent) 24%,#475569);
}
html.dark-mode .resource-portal-page .portal-track-language-legend .is-en > b { color: #fbbf24; }
html.dark-mode .resource-portal-page .portal-track-language-legend .is-es > b { color: #fb7185; }
html.dark-mode .resource-portal-page .portal-track-panel .portal-choice-card {
  background: rgba(20,25,38,.92) !important;
  border-color: color-mix(in srgb,var(--portal-accent) 28%,#334155) !important;
}
html.dark-mode .resource-portal-page .portal-track-panel .portal-choice-copy strong { color:#f8fafc !important; }
html.dark-mode .resource-portal-page .portal-track-panel .portal-choice-copy small { color:#cbd5e1 !important; }

/* Resource SPA current-route marker: persists while moving inside that section. */
.resource-portal-page #sidebar-slot .levels-sidebar .level-btn.is-current-route,
.resource-portal-page #sidebar-slot .levels-sidebar .level-btn[aria-current="page"] {
  position: relative;
  outline: 2px solid rgba(255,255,255,.78);
  outline-offset: 2px;
  filter: saturate(1.24) brightness(1.08) !important;
  transform: translateY(-1px) scale(1.035);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.72), 0 0 0 3px color-mix(in srgb,var(--portal-accent) 24%,transparent), 0 0 22px color-mix(in srgb,var(--portal-accent) 55%,transparent), 0 10px 24px rgba(15,23,42,.28) !important;
}
html.dark-mode .resource-portal-page #sidebar-slot .levels-sidebar .level-btn.is-current-route,
html.dark-mode .resource-portal-page #sidebar-slot .levels-sidebar .level-btn[aria-current="page"] {
  outline-color: rgba(255,255,255,.92);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.86), 0 0 0 3px color-mix(in srgb,var(--portal-accent) 34%,transparent), 0 0 28px color-mix(in srgb,var(--portal-accent) 68%,transparent), 0 12px 28px rgba(0,0,0,.35) !important;
}
.resource-portal-page #footer-slot a.is-current-route,
.resource-portal-page #footer-slot a.is-current-stage {
  color: var(--portal-accent) !important;
  font-weight: 900;
  text-shadow: 0 0 12px color-mix(in srgb,var(--portal-accent) 22%,transparent);
}
html.dark-mode .resource-portal-page #footer-slot a.is-current-route,
html.dark-mode .resource-portal-page #footer-slot a.is-current-stage {
  color: #f8fafc !important;
  text-shadow: 0 0 14px color-mix(in srgb,var(--portal-accent) 72%,transparent);
}

@media (max-width:980px){
  .resource-portal-page .portal-track-panel .portal-track-section-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:680px){
  .resource-portal-page .portal-track-panel-head { min-height:64px;padding:11px 12px; }
  .resource-portal-page .portal-track-panel-icon { width:38px;height:38px;border-radius:11px; }
  .resource-portal-page .portal-track-panel .portal-track-section-grid { grid-template-columns:1fr;padding:10px;gap:10px; }
  .resource-portal-page .portal-track-language-legend { width:100%; }
}


/* V229.82 — centered compact statistic cluster (matches “12 parcours”).
   Keep icon physically close to the number/label stack instead of pinning it
   to the far edge of a full-width second grid column. */
.portal-choice-stats > span,
.portal-card-stats > span,
.portal-subject-stats > span {
  grid-template-columns: auto auto !important;
  grid-template-rows: auto auto !important;
  grid-template-areas: "metric-icon metric-number" "metric-icon metric-label" !important;
  justify-content: center !important;
  justify-items: center !important;
  align-content: center !important;
  column-gap: 4px !important;
}
.portal-choice-stats > span > b,
.portal-card-stats > span > b,
.portal-subject-stats > span > b,
.portal-choice-stats > span > em,
.portal-card-stats > span > em,
.portal-subject-stats > span > em {
  width: auto !important;
  min-width: 0 !important;
  justify-self: center !important;
  text-align: center !important;
}
.portal-choice-stats > span > i,
.portal-card-stats > span > i,
.portal-subject-stats > span > i,
.portal-choice-stats > span > .mdi,
.portal-card-stats > span > .mdi,
.portal-subject-stats > span > .mdi {
  justify-self: center !important;
  margin-inline: 0 !important;
}

/* V230.12: stage identity owns every opened mark in light and dark mode.
   Never allow legacy purple fallbacks to recolor Primary or Middle resources. */
html[data-portal-stage="p"] {
  --portal-stage-color: #168a55;
  --portal-open-text: #0d6e43;
  --portal-open-dark-text: #72e6ad;
}
html[data-portal-stage="m"] {
  --portal-stage-color: #f08a24;
  --portal-open-text: #b85c08;
  --portal-open-dark-text: #ffbd73;
}
html[data-portal-stage="s"] {
  --portal-stage-color: #8e24aa;
  --portal-open-text: #6a1b9a;
  --portal-open-dark-text: #dda0ee;
}
html[data-portal-stage] .portal-resource-link.is-opened,
html[data-portal-stage] .portal-resource-link[data-opened="1"] {
  color: var(--portal-open-text) !important;
  border-color: var(--portal-stage-color) !important;
  background: color-mix(in srgb, var(--portal-stage-color) 8%, var(--portal-card)) !important;
  box-shadow: inset 3px 0 0 var(--portal-stage-color), 0 2px 8px rgba(15,23,42,.08) !important;
  text-shadow: none !important;
}
html[data-portal-stage][dir="rtl"] .portal-resource-link.is-opened,
html[data-portal-stage][dir="rtl"] .portal-resource-link[data-opened="1"] {
  box-shadow: inset -3px 0 0 var(--portal-stage-color), 0 2px 8px rgba(15,23,42,.08) !important;
}
html[data-portal-stage] .portal-resource-link.is-opened .portal-resource-link-icon,
html[data-portal-stage] .portal-resource-link.is-opened .portal-resource-link-label,
html[data-portal-stage] .portal-resource-link[data-opened="1"] .portal-resource-link-icon,
html[data-portal-stage] .portal-resource-link[data-opened="1"] .portal-resource-link-label {
  color: inherit !important;
}
html[data-portal-stage] .portal-resource-link.is-opened::after,
html[data-portal-stage] .portal-resource-link[data-opened="1"]::after {
  color: var(--portal-stage-color) !important;
  background: var(--portal-card) !important;
  border-color: var(--portal-stage-color) !important;
  box-shadow: 0 1px 3px rgba(15,23,42,.15) !important;
  text-shadow: none !important;
}
html.dark-mode[data-portal-stage] .portal-resource-link.is-opened,
html.dark-mode[data-portal-stage] .portal-resource-link[data-opened="1"] {
  color: var(--portal-open-dark-text) !important;
  border-color: var(--portal-stage-color) !important;
  background: color-mix(in srgb, var(--portal-stage-color) 12%, #171f2c) !important;
  box-shadow: inset 3px 0 0 var(--portal-stage-color), 0 2px 8px rgba(0,0,0,.20) !important;
}
html.dark-mode[data-portal-stage][dir="rtl"] .portal-resource-link.is-opened,
html.dark-mode[data-portal-stage][dir="rtl"] .portal-resource-link[data-opened="1"] {
  box-shadow: inset -3px 0 0 var(--portal-stage-color), 0 2px 8px rgba(0,0,0,.20) !important;
}
html.dark-mode[data-portal-stage] .portal-resource-link.is-opened::after,
html.dark-mode[data-portal-stage] .portal-resource-link[data-opened="1"]::after {
  color: var(--portal-open-dark-text) !important;
  background: #17202d !important;
  border-color: var(--portal-stage-color) !important;
}
html[data-portal-stage] .resource-portal-page #footer-slot a.is-current-route,
html[data-portal-stage] .resource-portal-page #footer-slot a.is-current-stage,
html.dark-mode[data-portal-stage] .resource-portal-page #footer-slot a.is-current-route,
html.dark-mode[data-portal-stage] .resource-portal-page #footer-slot a.is-current-stage {
  color: var(--portal-stage-color) !important;
}

/* V230.31 — exact Level-3 unit grouping parity for sidebar/footer Resource Portal. */
.portal-unit-heading{display:flex;align-items:center;gap:.65rem;margin:.8rem 0 .22rem;padding:.62rem .72rem;border:1px solid rgba(255,152,0,.32);border-inline-start:4px solid #ff9800;border-radius:13px;background:rgba(255,152,0,.07);font-weight:900;line-height:1.35}
.portal-unit-heading-index{display:inline-grid;place-items:center;min-width:2rem;height:2rem;padding:0 .3rem;border-radius:9px;background:#ff9800;color:#fff;font-size:.96rem;font-weight:900}
.portal-unit-heading-title{min-width:0;overflow-wrap:anywhere;font-size:1.08rem;font-weight:900}
@media (max-width:720px){.portal-unit-heading{padding:.55rem .62rem;margin:.65rem 0 .18rem}.portal-unit-heading-title{font-size:.92rem}}

/* V230.73 — Pioneer programme cards used by Sidebar/Footer resource entry. */
.portal-programme-choice-grid .portal-choice-card {
  min-height: 100%;
}
.portal-middle-pioneer-card {
  --choice-accent: #ffd003;
  border-color: color-mix(in srgb,#ffd003 58%,var(--portal-border,#d8dee8));
  background: linear-gradient(145deg,#fffef5,#fff8c8);
}
.portal-middle-pioneer-card .portal-card-icon {
  background: linear-gradient(135deg,#ffe66b,#ffd003);
  color:#3b3200;
}
.portal-middle-pioneer-card .portal-card-track {
  color:#7a6500;
}
html.dark-mode .portal-middle-pioneer-card,
body.dark-mode .portal-middle-pioneer-card {
  background: linear-gradient(145deg,#151709,#1d2008);
  border-color:#cad000;
}
html.dark-mode .portal-middle-pioneer-card .portal-card-title,
body.dark-mode .portal-middle-pioneer-card .portal-card-title {
  color:#f4f7ca;
}
html.dark-mode .portal-middle-pioneer-card .portal-card-track,
body.dark-mode .portal-middle-pioneer-card .portal-card-track {
  color:#f7ff06;
}
html.dark-mode .portal-middle-pioneer-card .portal-card-icon,
body.dark-mode .portal-middle-pioneer-card .portal-card-icon {
  background:linear-gradient(135deg,#cad000,#f7ff06);
  color:#242700;
}
