/* Shared layout safeguards for the fixed-height application shell. */
#portal-app,
#portal-app > main {
  min-width: 0;
  min-height: 0;
}

#portal-app > main {
  overflow-x: hidden;
}

#portal-app > main > [id^="page-"] {
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
}

#portal-app > main > [id^="page-"]:not(.hidden) {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

#portal-app img,
#portal-app video,
#portal-app canvas,
#portal-app svg {
  max-width: 100%;
}

#portal-app input,
#portal-app select,
#portal-app textarea,
#portal-app button {
  max-width: 100%;
}

#portal-app > aside .mobile-missing-assignments-button {
  display: none;
}

.mobile-missing-assignments-page {
  overflow: hidden;
}

.mobile-missing-assignments-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: 58rem;
  margin: 0 auto;
}

.mobile-missing-assignments-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.mobile-missing-assignments-header > div {
  min-width: 0;
}

.mobile-missing-assignments-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 1.4rem;
  font-weight: 800;
}

.mobile-missing-assignments-header p {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.82rem;
}

.mobile-missing-assignments-panel {
  box-sizing: border-box;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  padding: 1.15rem;
  border-radius: 1.25rem;
}

.mobile-missing-assignments-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
  flex-direction: row !important;
}

.mobile-missing-assignments-controls .home-inbox-search {
  min-width: 0;
  flex: 1;
}

.mobile-missing-assignments-filter {
  width: 7rem;
}

.mobile-missing-assignments-panel .panel-content {
  box-sizing: border-box;
  gap: 0.6rem;
  padding: 0.1rem 0.15rem 0.15rem;
}

.mobile-missing-assignments-panel .missing-item {
  flex: 0 0 auto;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mobile-missing-assignments-empty {
  margin: 0;
  padding: 1.25rem 0.5rem;
  color: #64748b;
  font-size: 0.88rem;
  text-align: center;
}

.app-dark .mobile-missing-assignments-header {
  border-color: #123b65;
  background: #001a38;
}

.app-dark .mobile-missing-assignments-header h1 {
  color: #f1f5f9;
}

.app-dark .mobile-missing-assignments-header p,
.app-dark .mobile-missing-assignments-empty {
  color: #a8b6c8;
}

.app-dark .mobile-missing-assignments-panel .missing-item {
  border-color: #123b65;
  background: #002147;
}

.app-dark .mobile-missing-assignments-panel .missing-item-title {
  color: #f1f5f9;
}

.app-dark .mobile-missing-assignments-panel .missing-item-meta,
.app-dark .mobile-missing-assignments-panel .missing-item-due {
  color: #a8b6c8;
}

.app-dark .mobile-missing-assignments-panel .missing-item-badge {
  background: #fff;
  color: #002147;
}

@media (max-width: 1023px) {
  #portal-app > main > [id^="page-"] {
    padding: 1rem;
  }

  #page-home {
    height: 100% !important;
    min-height: 0;
  }

  #page-home .home-main-grid {
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    overflow: visible;
  }

  #page-home .home-left {
    min-height: 26rem;
  }

  #page-home .home-right {
    width: 100%;
    min-height: 26rem;
  }

  #page-home .home-right > div {
    min-height: 12rem;
  }

  #page-subjects > .h-full,
  #page-calendar > .h-full,
  #page-timetable > .h-full,
  #page-resources > .h-full,
  #page-subject-resources > .h-full,
  #page-assignments > .h-full,
  #page-assignment-detail > .h-full,
  #page-gradebook > .h-full,
  #page-lp > .h-full,
  #page-fc > .h-full,
  #page-et > .h-full,
  #page-ic > .h-full,
  #page-leaderboard > .h-full,
  #page-profile > .h-full {
    height: auto;
    min-height: 100%;
  }
}

@media (max-width: 700px) {
  #page-subjects .grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #page-subjects #subjects-page-detail {
    display: none !important;
  }

  #page-subjects #subjects-list {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #page-subjects .subject-button {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 1rem;
  }

  #page-subjects .subject-button-content {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  #page-subjects .subject-button .subject-button-icon {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
  }

  #page-subjects .subject-button-name {
    font-size: 1rem;
    text-align: left;
  }

  #page-subjects > .h-full {
    height: 100% !important;
    min-height: 0;
    overflow: hidden;
  }

  #page-subjects .subjects-page-header {
    flex-shrink: 0;
  }

  #page-subjects .subjects-list-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  #page-subjects #subjects-list {
    overflow-y: auto;
    overflow-x: hidden;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    grid-auto-rows: auto !important;
  }

  #page-subjects .subject-button {
    height: auto !important;
    min-height: 4rem !important;
  }

  #page-subjects .subjects-page-header .text-slate-500 {
    display: none !important;
  }

  #page-subjects .subjects-page-header > div {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  #page-subjects .subjects-page-header > div > div:first-child {
    flex: 1;
  }

  #page-subjects .subjects-page-header > div > div:last-child {
    width: auto;
    margin-top: 0;
    margin-left: auto;
  }

  #page-subjects .subjects-header-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    background: #002147;
    color: #fff;
    border: none;
    padding: 0;
    transition: background 0.2s;
    margin-top: -0.5rem;
  }

  #page-subjects .subjects-header-icon-button .button-text {
    display: none;
  }

  #page-subjects .subjects-header-icon-button .button-icon {
    display: inline-block;
    font-size: 1.1rem;
  }

  #page-subjects .subjects-header-icon-button::before {
    display: none;
  }

  #page-subjects .subjects-header-icon-button span {
    display: none;
  }

  #page-subjects .subjects-header-icon-button:hover {
    background: #003366;
  }

  #page-subjects .subjects-header-icon-button i {
    font-size: 1.1rem;
  }

  .app-dark #page-subjects .subjects-header-icon-button {
    background: #fff;
    color: #002147;
  }

  .app-dark #page-subjects .subjects-header-icon-button:hover {
    background: #e2e8f0;
  }

  #page-calendar .grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #page-calendar .calendar-missing-panel {
    display: none !important;
  }

  #page-calendar .calendar-page-header .text-slate-500 {
    display: none !important;
  }

  #page-calendar .calendar-page-header > div {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  #page-calendar .calendar-page-header > div > div:first-child {
    flex: 1;
  }

  #page-calendar .calendar-page-header > div > div:last-child {
    width: auto;
    margin-top: 0;
    margin-left: auto;
  }

  #page-calendar .calendar-header-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    background: #002147;
    color: #fff;
    border: none;
    padding: 0;
    transition: background 0.2s;
    margin-top: 0;
  }

  #page-calendar .calendar-header-icon-button .button-text {
    display: none;
  }

  #page-calendar .calendar-header-icon-button .button-icon {
    display: inline-block;
    font-size: 1.1rem;
  }

  #page-calendar .week-topics-section {
    display: block !important;
    margin: 0.1rem 0 0;
  }

  #page-calendar .week-topics-label {
    margin-bottom: 0.15rem;
    font-size: 0.62rem;
  }

  #page-calendar .week-topics {
    display: -webkit-box;
    overflow: hidden;
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #page-calendar .week-current-badge {
    display: inline-flex;
    flex-shrink: 0;
    padding: 0.16rem 0.45rem;
    font-size: 0.58rem;
  }

  #page-calendar .week-card {
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.9rem;
    border-radius: 1rem;
  }

  #page-calendar .week-card::before {
    display: none;
  }

  #page-calendar .week-number {
    position: static;
    flex: 0 0 2.8rem;
    width: 2.8rem;
    height: 2.8rem;
    font-size: 1.15rem;
  }

  #page-calendar .week-content {
    flex: 1 1 0;
    gap: 0.4rem;
    min-width: 0;
    padding-left: 0;
  }

  #page-calendar .week-header {
    align-items: flex-start;
    gap: 0.45rem;
  }

  #page-calendar .week-title {
    min-width: 0;
    font-size: 0.9rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  #page-calendar .week-meta {
    align-items: flex-start;
    margin-top: 0;
  }

  #page-calendar .week-meta i {
    display: none;
  }

  #page-calendar .week-date {
    display: flex;
    flex-wrap: wrap;
    font-size: 0.7rem;
    line-height: 1.35;
  }

  #page-calendar > .h-full {
    height: 100% !important;
    min-height: 0;
    overflow: hidden;
  }

  #page-calendar .calendar-page-header {
    flex-shrink: 0;
  }

  #page-calendar .calendar-weeks-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  #page-calendar #weeks-list {
    gap: 0.65rem;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding-right: 0.1rem;
    scrollbar-gutter: stable;
  }

  #page-calendar .current-week-card {
    position: relative;
    top: auto;
  }

  #page-content .week-page-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
  }

  #page-content .week-resources-panel {
    grid-column: 1 !important;
    grid-row: 3 !important;
    display: none !important;
  }

  #page-content .week-header-content > div:first-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  #page-content .week-status-badge {
    margin-left: auto;
  }

  #page-content .week-status-badge {
    display: none;
  }

  #page-content .week-summary-grid {
    grid-template-columns: 1fr !important;
  }

  #page-resources .resources-week-badge {
    display: none !important;
  }

  #page-resources .resources-tabs {
    flex-wrap: nowrap !important;
    gap: 0.3rem !important;
  }

  #page-resources .resources-tab {
    padding: 0.5rem 0.7rem !important;
    font-size: 0.7rem !important;
    white-space: nowrap !important;
  }

  #page-home .home-subject-actions-grid {
    grid-template-columns: auto 1fr !important;
  }

  #page-home .home-subject-icons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
  }

  #page-home .detail-button-icon {
    display: flex;
  }

  #page-home .home-subject-buttons-desktop {
    display: none;
  }

  #page-home .home-subject-actions-grid {
    display: none;
  }

  #page-home .home-subject-icons-row {
    display: flex !important;
  }

  #page-home .home-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: #002147;
    color: #fff;
    border: none;
    padding: 0;
    transition: background 0.2s;
  }

  #page-home .home-icon-button:hover {
    background: #003366;
  }

  #page-home .home-icon-button i {
    font-size: 1.1rem;
  }

  #page-home .home-subject-icons-row .detail-button-large {
    height: calc(3rem + 0.75rem + 3rem);
    padding: 0.75rem 1rem !important;
  }

  #page-home .home-subject-icons-row .detail-button-large .mt-4 {
    margin-top: 0.5rem !important;
  }

  #page-home .home-subject-icons-row .detail-button-large .mt-3 {
    margin-top: 0.25rem !important;
  }

  #page-home .home-subject-icons-row .detail-button-large .text-xs {
    font-size: 0.65rem !important;
  }

  #page-home .home-subject-icons-row .detail-button-large .text-lg {
    font-size: 1rem !important;
  }

  #page-home .home-subject-icons-row .detail-button-large .text-sm {
    font-size: 0.75rem !important;
  }

  #page-home .home-subject-header-info {
    display: none !important;
  }

  #page-home #welcome-last-name {
    display: none !important;
  }

  .app-dark #page-home .home-icon-button {
    background: #fff;
    color: #002147;
  }

  .app-dark #page-home .home-icon-button:hover {
    background: #e2e8f0;
  }

  #page-timetable .timetable-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  #page-timetable .timetable-page-header > div:first-child {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }

  #page-timetable .timetable-date-time {
    display: none;
  }

  #page-timetable .timetable-date-description {
    font-size: 0.85rem;
    color: #64748b;
    text-align: left !important;
    line-height: 1.4;
  }

  #page-timetable .timetable-header-tools {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    order: 1;
  }

  #page-timetable .timetable-badge {
    font-size: 0.95rem;
    padding: 0.4rem 0.85rem;
  }

  #page-timetable .timetable-zoom-controls {
    gap: 0.3rem;
  }

  #page-timetable .timetable-zoom-controls button {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }

  #page-timetable .timetable-date-description::after {
    content: none !important;
  }

  #page-timetable .timetable-date-description > span {
    display: block !important;
  }

  #portal-app {
    height: 100dvh;
    flex-direction: column-reverse;
  }

  #portal-app > aside {
    z-index: 50;
    width: 100%;
    min-width: 0;
    height: calc(4.25rem + env(safe-area-inset-bottom, 0px));
    min-height: calc(4.25rem + env(safe-area-inset-bottom, 0px));
    flex: 0 0 calc(4.25rem + env(safe-area-inset-bottom, 0px));
    flex-direction: row;
    justify-content: space-around;
    padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e2e8f0;
    border-right: 0;
  }

  #portal-app > aside .logo-btn,
  #portal-app > aside > .h-px,
  #portal-app > aside > .flex-1 {
    display: none;
  }

  #portal-app > aside .sidebar-btn {
    width: 2.8rem;
    height: 2.8rem;
    flex: 0 0 2.8rem;
    margin: 0;
  }

  #portal-app > aside .mobile-missing-assignments-button {
    display: inline-flex;
    border-radius: 0.75rem;
    background: transparent;
    color: #002147;
    font-size: 1.15rem;
  }

  #portal-app > aside .mobile-missing-assignments-button:hover,
  #portal-app > aside .mobile-missing-assignments-button:focus-visible {
    background: #d4d4d4;
  }

  #portal-app > aside .mobile-missing-assignments-button.active {
    background: #002147;
    color: #fff;
  }

  .app-dark #portal-app > aside .mobile-missing-assignments-button {
    color: #cbd5e1;
  }

  .app-dark #portal-app > aside .mobile-missing-assignments-button.active {
    background: #002147;
    color: #fff;
  }

  #portal-app > main {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 1 1 0;
  }

  #portal-app > main > [id^="page-"] {
    padding: 0.85rem;
  }

  #page-home {
    gap: 1rem;
    height: 100% !important;
    min-height: 0;
  }

  #page-home .home-left {
    min-height: 0;
  }

  #page-home .home-right {
    min-height: 0;
  }

  #home-missing-assignments-panel,
  .week-resources-panel {
    display: none !important;
  }

  #page-home .home-right .leaderboard-panel {
    display: none !important;
  }

  #page-home .home-right > div {
    min-height: 13rem;
  }

  #page-home .subject-detail .rounded-2xl > .grid:nth-child(2) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #page-home .subject-detail .rounded-2xl > .grid:nth-child(2) > .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #page-home .home-left > div:first-child > .flex {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  #welcome-text {
    font-size: clamp(1.25rem, 5vw, 1.5rem);
    overflow-wrap: anywhere;
  }

  #page-home .home-header-actions {
    flex-wrap: wrap;
  }

  #page-chat {
    height: 100%;
    min-height: 0;
    overflow: hidden !important;
  }

  #chat-page-root,
  .chat-layout {
    height: 100%;
    min-height: 0;
  }

  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(8.5rem, 0.32fr) minmax(0, 1fr);
    gap: 0.6rem;
  }

  .chat-sidebar {
    min-height: 0;
    padding: 0.65rem;
  }

  .chat-sidebar-heading {
    padding: 0 0.25rem 0.5rem;
  }

  .chat-sidebar-heading h1 {
    font-size: 1.1rem;
  }

  .chat-sidebar-heading p {
    display: none;
  }

  .chat-subject-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.25rem;
  }

  .chat-subject-button {
    width: min(13rem, 72vw);
    min-width: min(13rem, 72vw);
    padding: 0.55rem 0.65rem;
  }

  .chat-conversation-header {
    gap: 0.55rem;
    padding: 0.75rem;
  }

  .chat-messages {
    gap: 0.65rem;
    padding: 0.75rem;
  }

  .chat-message {
    max-width: 90%;
  }

  .chat-compose {
    gap: 0.4rem;
    padding: 0.65rem;
  }

  .chat-compose button {
    width: 2.55rem;
    height: 2.55rem;
  }
}

@media (max-width: 420px) {
  #portal-app > main > [id^="page-"] {
    padding: 0.7rem;
  }

  @media (max-width: 360px) {
    .mobile-missing-assignments-controls {
      align-items: center;
      flex-direction: row;
    }

    .mobile-missing-assignments-filter {
      align-self: flex-end;
    }
  }

  #page-home .home-right > div {
    padding: 1rem;
  }
}

@media (min-width: 1400px) {
  html {
    font-size: clamp(16px, calc(10.4px + 0.4vw), 20px);
  }

  #portal-app > main {
    max-width: none;
    padding: 0;
  }

  #page-home .home-right {
    width: clamp(360px, 25vw, 580px);
  }

  #page-home {
    gap: clamp(1rem, 1.25vw, 1.5rem);
    padding: clamp(1rem, 1.25vw, 1.5rem);
  }

  #page-home .home-left > div:first-child {
    padding: clamp(1.25rem, 1.4vw, 1.75rem);
  }

  #page-home #welcome-text {
    font-size: clamp(1.5rem, 1.75vw, 2rem);
    line-height: 1.15;
  }

  #page-home #date-text {
    font-size: clamp(0.9rem, 0.9vw, 1.1rem);
  }

  #page-home .home-header-action {
    width: clamp(2.75rem, 3.1vw, 3.5rem);
    height: clamp(2.75rem, 3.1vw, 3.5rem);
    font-size: clamp(1.25rem, 1.35vw, 1.6rem);
  }

  #page-home .subject-row {
    min-height: clamp(5rem, 6vw, 7.5rem);
    align-items: stretch;
  }

  #page-home .subject-row-container .subject-card {
    width: auto;
    min-width: clamp(76px, 5.5vw, 124px);
    max-width: none;
    min-height: 100%;
    flex: 1 1 0;
    padding: clamp(0.4rem, 0.65vw, 0.75rem);
  }

  #page-home .subject-row-container .subject-card .subject-icon {
    width: clamp(1.6rem, 2vw, 2.25rem);
    height: clamp(1.6rem, 2vw, 2.25rem);
  }

  #page-home .subject-row-container .subject-card span {
    font-size: clamp(0.62rem, 0.65vw, 0.82rem);
  }

  #page-home .subject-detail > div {
    height: 100%;
  }

  #page-home .subject-detail > div > .rounded-2xl {
    flex: 1 1 auto;
    min-height: 0;
    gap: clamp(0.75rem, 0.9vw, 1rem);
  }

  #page-home .home-subject-actions-grid {
    flex: 0 0 auto;
    align-items: stretch;
  }

  #page-home .subject-detail > div > .rounded-2xl > .grid:last-child {
    flex: 1 1 auto;
    min-height: clamp(4.5rem, 6vw, 6.5rem);
    max-height: clamp(6rem, 12vh, 12rem);
    align-items: stretch;
  }

  #page-home .subject-detail > div > .rounded-2xl > .grid:last-child .detail-button {
    padding: clamp(0.85rem, 1vw, 1.2rem);
    font-size: clamp(0.86rem, 0.8vw, 1rem);
  }

  #page-home .home-header {
    max-width: none;
  }

  #page-home .subject-row-container {
    max-width: none;
  }

  #page-profile .profile-page,
  #page-leaderboard .leaderboard-page-shell {
    max-width: none;
  }

  .assignments-eyebrow,
  .resources-eyebrow,
  .timetable-eyebrow {
    font-size: calc(0.68rem + 0.1vw);
  }

  .assignments-page-header h1,
  .resources-page-header h1,
  .timetable-page-header h1 {
    font-size: calc(1.35rem + 0.3vw);
  }

  .subject-button {
    padding: clamp(0.7rem, calc(0.5rem + 0.2vw), 1rem);
  }

  .subject-button-icon {
    width: clamp(3rem, calc(2.5rem + 0.2vw), 3.75rem);
    height: clamp(3rem, calc(2.5rem + 0.2vw), 3.75rem);
    font-size: clamp(1.1rem, calc(0.9rem + 0.1vw), 1.35rem);
  }

  .subject-button-name {
    font-size: clamp(0.88rem, calc(0.72rem + 0.12vw), 1.1rem);
  }

  .profile-page {
    gap: clamp(0.8rem, 0.9vw, 1rem);
  }

  .profile-settings-container,
  .profile-settings-grid {
    flex: 0 0 auto;
  }
}

@media (min-width: 701px) and (max-width: 1199px) and (min-height: 600px) and (orientation: landscape) {
  #portal-app > main > [id^="page-"] {
    padding: 1rem;
  }

  #portal-app > aside .mobile-missing-assignments-button {
    display: inline-flex;
    border-radius: 0.75rem;
    background: transparent;
    color: #002147;
    font-size: 1.15rem;
  }

  #portal-app > aside .mobile-missing-assignments-button:hover,
  #portal-app > aside .mobile-missing-assignments-button:focus-visible {
    background: #d4d4d4;
  }

  #portal-app > aside .mobile-missing-assignments-button.active {
    background: #002147;
    color: #fff;
  }

  .app-dark #portal-app > aside .mobile-missing-assignments-button {
    color: #cbd5e1;
  }

  .app-dark #portal-app > aside .mobile-missing-assignments-button.active {
    background: #002147;
    color: #fff;
  }

  #page-subjects > .h-full > .grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #page-subjects #subjects-page-detail {
    display: none !important;
  }

  #page-home {
    height: auto !important;
    min-height: 100%;
  }

  #page-home .home-main-grid {
    display: flex;
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 1rem;
    overflow: visible;
  }

  #page-home .home-left {
    width: 100%;
    min-width: 0;
    min-height: 0;
    flex: 0 0 auto;
    gap: 1rem;
  }

  #page-home .subject-row-container {
    height: auto;
    min-height: 25rem;
    flex: 0 0 auto;
  }

  #page-home .subject-row {
    align-items: stretch;
  }

  #page-home .subject-row-container .subject-card {
    width: auto;
    min-width: 76px;
    max-width: none;
    min-height: 100%;
    flex: 1 1 0;
  }

  #page-home .home-right {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(18rem, 20rem);
    gap: 1rem;
    flex: 0 0 auto;
  }

  #page-home .home-right > div {
    min-width: 0;
    height: 100%;
    min-height: 0;
    flex: 0 0 auto;
  }

  #page-profile {
    height: auto;
    min-height: 100%;
  }

  #settings-page-root {
    height: auto;
    min-height: 100%;
  }

  .profile-page {
    height: auto;
    min-height: 100%;
    justify-content: center;
  }

  .profile-settings-container,
  .profile-settings-grid {
    flex: 0 0 auto;
  }
}

@media (max-width: 700px) {
  #page-assignments .assignments-page-grid {
    grid-template-rows: minmax(18rem, 1fr) auto;
  }

  #page-assignments .assignments-summary-panel {
    min-height: 0;
    align-items: stretch;
  }

  #page-assignments .assignments-progress-ring {
    display: none;
  }

  #page-assignments .assignments-legend {
    padding-top: 0;
    border-top: 0;
  }
}
