body.u-portal-mode .u-student-mobile-strip,
body.u-portal-mode .u-student-mobile-bottom-nav {
  display: none;
}

body.u-portal-mode .u-content[data-u-page],
body.u-portal-mode .u-main[data-u-page] {
  min-width: 0;
}

body.u-portal-mode .u-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

body.u-portal-mode .u-topbar__title {
  min-width: 0;
}

body.u-portal-mode .u-topbar__title,
body.u-portal-mode .u-hero__title,
body.u-portal-mode .u-card__header,
body.u-portal-mode .u-section-title,
body.u-portal-mode .u-action-title,
body.u-portal-mode .u-panel__title {
  overflow-wrap: anywhere;
}

body.u-portal-mode .u-hero__actions,
body.u-portal-mode .u-action-bar__left,
body.u-portal-mode .u-action-bar__right {
  flex-wrap: wrap;
}

body.u-portal-mode .u-hero__actions .btn,
body.u-portal-mode .u-hero__actions a,
body.u-portal-mode .u-action-bar .btn,
body.u-portal-mode .u-action-bar a.btn {
  min-height: 44px;
}

body.u-portal-mode .u-card .table {
  margin-bottom: 0;
}

body.u-portal-mode .u-card .table td,
body.u-portal-mode .u-card .table th {
  vertical-align: middle;
}

body.u-portal-mode .u-mobile-card-list {
  display: none;
}

body.u-portal-mode .u-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

body.u-portal-mode .u-choice-card {
  position: relative;
}

body.u-portal-mode .u-choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.u-portal-mode .u-choice-card__label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--u-border);
  border-radius: 1rem;
  background: #ffffff;
  color: var(--u-text);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

body.u-portal-mode .u-choice-card input:checked + .u-choice-card__label {
  border-color: rgba(59, 130, 246, 0.35);
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.96) 0%, rgba(191, 219, 254, 0.86) 100%);
  color: var(--u-accent-ink);
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.12);
}

body.u-portal-mode .u-choice-card input:focus-visible + .u-choice-card__label {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px;
}

body.u-portal-mode .u-auto-upload-status {
  display: none;
  margin-top: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.85rem;
  font-size: 0.86rem;
  font-weight: 600;
}

body.u-portal-mode .u-auto-upload-status.is-visible {
  display: block;
}

body.u-portal-mode .u-auto-upload-status.is-loading {
  background: rgba(219, 234, 254, 0.7);
  color: var(--u-accent-ink);
}

body.u-portal-mode .u-auto-upload-status.is-success {
  background: rgba(220, 252, 231, 0.9);
  color: #166534;
}

body.u-portal-mode .u-auto-upload-status.is-error {
  background: rgba(254, 226, 226, 0.95);
  color: #991b1b;
}

body.u-portal-mode .u-auto-upload-form.is-uploading {
  opacity: 0.8;
}

@media (max-width: 992px) {
  body.u-portal-mode .u-sidebar {
    width: min(86vw, 340px);
    flex-basis: min(86vw, 340px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.22);
  }

  body.u-portal-mode .u-sidebar__header {
    padding: 1rem;
  }

  body.u-portal-mode .u-sidebar__nav {
    padding: 0.85rem 0.85rem 0;
  }

  body.u-portal-mode .u-sidebar__footer {
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  }

  body.u-portal-mode .u-sidebar__toggle {
    display: none;
  }

  body.u-portal-mode .u-sidebar__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    border-radius: 0.8rem;
  }

  body.u-portal-mode .u-topbar {
    padding: 0.85rem 1rem;
    gap: 0.75rem;
  }

  body.u-portal-mode.u-has-mobile-bottom-nav .u-topbar__menu {
    display: none !important;
  }

  body.u-portal-mode .u-topbar__menu-label {
    display: none;
  }

  body.u-portal-mode .u-topbar__title {
    font-size: 1rem;
    line-height: 1.2;
  }

  body.u-portal-mode .u-topbar__actions {
    gap: 0.4rem;
  }

  body.u-portal-mode .u-topbar__actions .btn,
  body.u-portal-mode .u-topbar__actions a.btn {
    padding: 0.55rem 0.8rem;
    min-height: 42px;
    font-size: 0.86rem;
    border-radius: 0.85rem;
  }

  body.u-portal-mode .u-content {
    padding: 1rem;
  }

  body.u-portal-mode .u-hero {
    border-radius: 1.05rem;
    margin-bottom: 0.9rem;
  }

  body.u-portal-mode .u-hero__row,
  body.u-portal-mode .u-hero__row--actions {
    flex-wrap: wrap;
  }

  body.u-portal-mode .u-hero__actions {
    width: 100%;
    margin-left: 0 !important;
    gap: 0.65rem;
  }

  body.u-portal-mode .u-hero__actions > a,
  body.u-portal-mode .u-hero__actions > button,
  body.u-portal-mode .u-hero__actions .u-hero-btn,
  body.u-portal-mode .u-hero__actions .btn {
    flex: 1 1 180px;
    justify-content: center;
  }

  body.u-portal-mode .u-card,
  body.u-portal-mode .u-section-card,
  body.u-portal-mode .u-kpi-card,
  body.u-portal-mode .u-stat-card,
  body.u-portal-mode .u-panel,
  body.u-portal-mode .u-action-card {
    border-radius: 1rem;
  }

  body.u-portal-mode .u-kpi-grid,
  body.u-portal-mode .u-chart-grid,
  body.u-portal-mode .u-chart-grid--secondary,
  body.u-portal-mode .u-action-grid {
    gap: 0.85rem;
  }

  body.u-portal-mode .u-student-mobile-strip {
    display: none;
  }

  body.u-portal-mode .u-student-mobile-strip__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 72px;
    padding: 0.7rem 0.45rem;
    border-radius: 1rem;
    border: 1px solid var(--u-border);
    background: rgba(255, 255, 255, 0.96);
    color: var(--u-text);
    text-decoration: none;
    box-shadow: var(--u-shadow-sm);
    font-weight: 700;
    text-align: center;
  }

  body.u-portal-mode .u-student-mobile-strip__item i {
    font-size: 1rem;
    color: var(--u-accent-ink);
  }

  body.u-portal-mode .u-student-mobile-strip__item span {
    font-size: 0.72rem;
    line-height: 1.15;
  }

  body.u-portal-mode .u-student-mobile-strip__item.is-active {
    border-color: rgba(59, 130, 246, 0.28);
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.95) 0%, rgba(191, 219, 254, 0.8) 100%);
    color: var(--u-accent-ink);
  }

  body.u-portal-mode .u-student-mobile-strip__item--menu {
    border: none;
    background: linear-gradient(135deg, var(--u-accent) 0%, var(--u-accent-2) 100%);
    color: #ffffff;
  }

  body.u-portal-mode .u-student-mobile-strip__item--menu i,
  body.u-portal-mode .u-student-mobile-strip__item--menu span {
    color: #ffffff;
  }

  body.u-portal-mode .u-student-mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1032;
    gap: 0;
    min-height: calc(62px + env(safe-area-inset-bottom));
    padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  }

  body.u-portal-mode .u-student-mobile-bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
    min-height: 52px;
    padding: 0.25rem 0.15rem;
    border-radius: 0.9rem;
    color: var(--u-muted);
    text-decoration: none;
    background: transparent;
    border: none;
    font-weight: 700;
  }

  body.u-portal-mode .u-student-mobile-bottom-nav__item i {
    font-size: 1.05rem;
  }

  body.u-portal-mode .u-student-mobile-bottom-nav__item span {
    font-size: 0.7rem;
    line-height: 1.1;
  }

  body.u-portal-mode .u-student-mobile-bottom-nav__item.is-active {
    color: var(--u-accent-ink);
    background: rgba(219, 234, 254, 0.75);
  }

  body.u-portal-mode.u-has-mobile-bottom-nav .u-main {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  body.u-portal-mode.u-has-mobile-bottom-nav .u-content,
  body.u-portal-mode.u-has-mobile-bottom-nav .u-content[data-u-page] {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  body.u-portal-mode.u-mobile-sidebar-open .u-student-mobile-bottom-nav {
    opacity: 0;
    pointer-events: none;
  }

  body.u-portal-mode .u-action-bar,
  body.u-portal-mode .u-action-bar__left,
  body.u-portal-mode .u-action-bar__right {
    gap: 0.65rem;
  }

  body.u-portal-mode .u-action-bar__left,
  body.u-portal-mode .u-action-bar__right {
    justify-content: stretch;
  }

  body.u-portal-mode .u-action-bar__left .btn,
  body.u-portal-mode .u-action-bar__left a.btn,
  body.u-portal-mode .u-action-bar__right .btn,
  body.u-portal-mode .u-action-bar__right a.btn {
    flex: 1 1 auto;
    text-align: center;
  }

  body.u-portal-mode .u-card .table-responsive {
    overflow: visible;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] thead {
    display: none;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"],
  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] tbody,
  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] tr,
  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] td {
    display: block;
    width: 100%;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] tbody {
    padding: 0.85rem;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] tr {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
    padding: 0.1rem 0;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] tr + tr {
    margin-top: 0.75rem;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] td {
    border: 0;
    padding: 0.75rem 0.9rem;
    text-align: left !important;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] td::before {
    content: attr(data-u-cell-label);
    display: block;
    margin-bottom: 0.3rem;
    color: var(--u-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] td[colspan]::before,
  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] td[data-u-cell-label=""]::before {
    display: none;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] .stretched-link {
    position: static;
  }

  body.u-portal-mode .u-card table.table[data-u-mobile-stack="1"] .stretched-link::after {
    display: none;
  }

  body.u-portal-mode .u-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  body.u-portal-mode .u-topbar {
    padding: 0.8rem 0.85rem;
  }

  body.u-portal-mode .u-topbar__actions {
    width: auto;
    justify-content: flex-end;
  }

  body.u-portal-mode .u-topbar__actions .btn,
  body.u-portal-mode .u-topbar__actions a.btn {
    min-width: 42px;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }

  body.u-portal-mode .u-hero {
    padding: 1rem;
  }

  body.u-portal-mode .u-hero__icon {
    width: 44px;
    height: 44px;
    border-radius: 0.9rem;
    font-size: 1rem;
  }

  body.u-portal-mode .u-hero__title {
    font-size: 1.1rem;
  }

  body.u-portal-mode .u-hero__subtitle {
    font-size: 0.9rem;
  }

  body.u-portal-mode .u-card__header,
  body.u-portal-mode .u-card__body,
  body.u-portal-mode .u-section-card,
  body.u-portal-mode .u-panel,
  body.u-portal-mode .u-kpi-card,
  body.u-portal-mode .u-stat-card {
    padding-left: 0.95rem;
    padding-right: 0.95rem;
  }

  body.u-portal-mode .u-programme-banner__inner,
  body.u-portal-mode .u-hero__row > .d-flex.align-items-start,
  body.u-portal-mode .u-hero__row--actions > .d-flex.align-items-start {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.8rem;
  }

  body.u-portal-mode .u-kpi-grid .u-kpi-card,
  body.u-portal-mode .u-stat-card,
  body.u-portal-mode .u-action-card,
  body.u-portal-mode .u-panel,
  body.u-portal-mode .u-card {
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  }

  body.u-portal-mode .u-choice-grid {
    grid-template-columns: 1fr;
  }

  body.u-portal-mode .u-choice-card__label {
    min-height: 50px;
    border-radius: 0.9rem;
  }
}

@media (max-width: 480px) {
  body.u-portal-mode .u-content {
    padding: 0.85rem 0.8rem;
  }

  body.u-portal-mode .u-topbar__title {
    font-size: 0.95rem;
  }

  body.u-portal-mode .u-student-mobile-bottom-nav__item span {
    font-size: 0.66rem;
  }

  body.u-portal-mode .u-hero__actions > a,
  body.u-portal-mode .u-hero__actions > button,
  body.u-portal-mode .u-hero__actions .u-hero-btn,
  body.u-portal-mode .u-hero__actions .btn {
    flex-basis: 100%;
  }
}
