/* Homepage phone layout: content determines card heights. */
@media (max-width: 720px) {
  .portal-page .page-shell { width: calc(100% - 24px); margin: 10px auto 24px; padding: 0 0 64px; }
  .portal-page .portal-main { gap: 14px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .portal-page .portal-main > * { min-width: 0; }
  .portal-page .portal-header { gap: 8px; padding: 10px; height: auto; min-height: 58px; border-radius: 16px; }
  .portal-page .portal-brand { flex: 1; min-width: 0; gap: 7px; }
  .portal-page .portal-brand .topbar__home-icon { flex: 0 0 30px; width: 30px; height: 30px; }
  .portal-page .topbar__brand-copy { min-width: 0; }
  .portal-page .topbar__brand-copy strong { font-size: 14px; line-height: 1.4; }
  .portal-page .topbar__brand-copy > span { font-size: 11px; line-height: 1.4; }
  .portal-page .portal-header__actions { flex: 0 0 auto; gap: 6px; }
  .portal-page .portal-topbar-icon:disabled { display: none; }
  .portal-page .portal-user-chip { display: flex; gap: 5px; width: auto; min-width: 0; }
  .portal-page .portal-user-chip strong { max-width: 48px; font-size: 12px; }
  .portal-page .portal-user-chip small { display: none; }
  .portal-page .portal-hero__intro { width: 100%; max-width: 100%; box-sizing: border-box; height: auto; min-height: 140px; padding: 18px; overflow: hidden; }
  .portal-page .portal-hero__art { min-width: 0; max-width: 100%; }
  .portal-page .portal-hero__copy { width: 70%; max-width: 240px; }
  .portal-page .portal-hero__copy h1 { font-size: 21px; line-height: 1.3; }
  .portal-page .portal-hero__text { font-size: 12px; line-height: 1.6; margin-top: 8px; }
  .portal-page .portal-quick-grid { gap: 6px; }
  .portal-page .portal-quick-card,
  .portal-page .portal-quick-card:nth-child(n) {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; height: auto; min-height: 96px; padding: 11px 3px; aspect-ratio: auto; overflow: hidden;
  }
  .portal-page .portal-quick-card:nth-child(n) .portal-quick-card__icon {
    position: relative; z-index: 3; width: 36px; height: 36px; flex: 0 0 36px;
    margin: 0; border-radius: 11px; background: transparent; box-shadow: none;
  }
  .portal-page .portal-quick-card:nth-child(n) .portal-quick-card__visual { display: none !important; }
  .portal-page .portal-quick-card__label { position: static; font-size: 12px; line-height: 1.4; white-space: nowrap; }
  .portal-page .portal-quick-card::before { display: none; }
  .portal-page .portal-today-section { aspect-ratio: auto; height: auto; min-height: 0; }
  .portal-page .portal-today-card { height: auto; padding: 16px; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 16px 8px; }
  .portal-page .portal-today-card__intro h2 { font-size: 20px; line-height: 1.3; }
  .portal-page .portal-today-card__intro p:last-child { font-size: 12px; line-height: 1.5; }
  .portal-page .portal-today-card__date strong { font-size: 12px; line-height: 1.5; }
  .portal-page .portal-today-card__date span { display: none; }
  .portal-page .portal-today-card__stats { position: static; margin: 0; align-self: start; }
  .portal-page .portal-today-card__stats div { padding: 0 4px; gap: 5px; }
  .portal-page .portal-today-card__stats strong { font-size: 22px; line-height: 1.2; }
  .portal-page .portal-today-card__stats span { font-size: 11px; line-height: 1.4; white-space: normal; overflow: visible; }
  .portal-page .portal-message-card { padding: 14px; }
  .portal-page .portal-message-card__head strong { font-size: 14px; }
  .portal-page .portal-message-card__head span { font-size: 12px; }
  .portal-page .portal-message-item__body strong { font-size: 13px; }
  .portal-page .portal-message-item__body p { font-size: 12px; line-height: 1.6; }
  .portal-page .portal-message-item__time { font-size: 11px; }
  .portal-page .portal-track-section,
  .portal-page .portal-certification-section { padding: 14px 12px; }
  .portal-page .portal-section-heading { gap: 6px; margin-bottom: 12px; }
  .portal-page .portal-section-heading h2 { font-size: 14px; line-height: 1.4; }
  .portal-page .portal-section-heading .section-heading__link { flex-shrink: 0; font-size: 12px; white-space: nowrap; }
  .portal-page .portal-track-section .portal-module-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
  .portal-page .portal-track-section .portal-module-card {
    height: auto; min-height: 128px; padding: 0 4px 8px; align-items: center; overflow: hidden;
  }
  .portal-page .portal-track-section .portal-module-card__image { width: calc(100% + 8px); height: 52px; flex-basis: 52px; margin: 0 -4px 8px; }
  .portal-page .portal-track-section .portal-module-card h3 { font-size: 12px; line-height: 1.4; margin: 0 0 8px; }
  .portal-page .portal-track-section .portal-module-card p { display: none; }
  .portal-page .portal-track-section .portal-module-card__link { display: flex; align-items: center; justify-content: center; width: 100%; box-sizing: border-box; height: auto; min-height: 28px; margin-top: auto; padding: 5px 1px; font-size: 11px; line-height: 1.4; white-space: nowrap; }
  .portal-page .portal-certification-section .portal-module-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .portal-page .portal-certification-section .portal-module-card,
  .portal-page .portal-certification-section .portal-module-card--coming {
    display: grid; grid-template-columns: 26px minmax(0,1fr); grid-template-rows: 26px auto auto;
    gap: 5px 8px; height: auto; min-height: 106px; padding: 9px 10px; align-items: center;
  }
  .portal-page .portal-certification-section .portal-module-card__icon { position: static; grid-column: 1; grid-row: 1; width: 26px; height: 26px; transform: none; }
  .portal-page .portal-certification-section .portal-module-card h3 { position: static; grid-column: 2; grid-row: 1; margin: 0; font-size: 13px; line-height: 1.3; transform: none; }
  .portal-page .portal-certification-section .portal-module-card p { position: static; grid-column: 1/-1; grid-row: 2; margin: 0; font-size: 11px; line-height: 1.4; transform: none; white-space: normal; }
  .portal-page .portal-certification-section .portal-module-card__link {
    position: static; grid-column: 1/-1; grid-row: 3; justify-self: stretch; align-self: end;
    width: 100%; height: auto; min-height: 28px; padding: 4px; margin: 0; box-sizing: border-box;
    border-radius: 8px; font-size: 12px; line-height: 1.5; white-space: nowrap; transform: none;
  }
  .portal-page .portal-certification-section .portal-module-card__link::after { display: none; }
  .portal-page .portal-certification-section .portal-module-card__link span { display: none; }
  .portal-page .portal-bottom-promo { height: auto; min-height: 0; padding: 18px 14px; }
  .portal-page .portal-bottom-promo strong { font-size: 14px; line-height: 1.5; }
  .portal-page .portal-bottom-promo div > span { font-size: 12px; line-height: 1.6; }
  .portal-page .portal-bottom-promo ~ .portal-bottom-promo { display: none; }
}

/* Keep each quick-action glyph centered inside its colored icon tile on phones. */
@media (max-width: 720px) {
  .portal-page .portal-quick-card:nth-child(n) .portal-quick-card__icon {
    display: grid;
    place-items: center;
    place-content: center;
    background: #6658ef !important;
    box-shadow: 0 5px 10px rgba(85, 72, 216, .18) !important;
  }
  .portal-page .portal-quick-card:nth-child(2) .portal-quick-card__icon { background: #ff7950 !important; }
  .portal-page .portal-quick-card:nth-child(3) .portal-quick-card__icon { background: #22ba95 !important; }
  .portal-page .portal-quick-card:nth-child(4) .portal-quick-card__icon { background: #438fe9 !important; }
  .portal-page .portal-quick-card:nth-child(n) .portal-quick-card__glyph {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: 0;
    transform: translate(-50%, -50%) scale(.8);
    transform-origin: center;
  }
  /* Include the camera's raised top and the speech bubble's tail in visual centering. */
  .portal-page .portal-quick-card:nth-child(2) .portal-quick-card__glyph { top: calc(50% + 2.8px); }
  .portal-page .portal-quick-card:nth-child(4) .portal-quick-card__glyph { top: calc(50% - 2px); }
}
