/* EduSimp - responsive admin & tables (mobile-first) */

.admin-mobile-full-btn {
  width: 100%;
}

@media (min-width: 600px) {
  .admin-mobile-full-btn {
    width: auto;
  }
}

.admin-main-content {
  min-height: calc(100vh - 64px);
}

/* Podgląd odpowiedzi po egzaminie: krótka treść (np. pusty filtr) - bez sztucznego „długiego” pustego scrolla */
.admin-main-content:has(.exam-sim-ended-review-session) {
  min-height: 0;
}

.admin-page-title {
  font-size: clamp(1.25rem, 4vw, 2.125rem);
  line-height: 1.25;
  word-break: break-word;
}

.admin-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--mud-default-borderradius);
}

.admin-mud-table .mud-table-cell,
.admin-mud-table .mud-table-row .mud-table-cell {
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

/* Pytania egzaminu: uchwyt przeciągania */
.admin-questions-col-drag {
  width: 3rem;
  max-width: 3rem;
  vertical-align: middle;
}

.admin-questions-col-filter {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 10rem;
}

.admin-questions-filter-bar {
  border-radius: 12px;
  background: color-mix(in srgb, var(--mud-palette-surface) 92%, var(--mud-palette-primary) 8%);
}

.admin-questions-filter-bar__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: end;
}

@media (min-width: 768px) {
  .admin-questions-filter-bar__grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(6rem, 8rem) minmax(10rem, 220px) auto;
    gap: 1rem 1.25rem;
  }
}

.admin-questions-filter-bar__label {
  display: block;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.72;
  margin-bottom: 0.35rem;
}

.admin-questions-filter-input {
  width: 100%;
}

.admin-questions-filter-input .mud-input-root-outlined {
  border-radius: 10px;
  background: var(--mud-palette-surface);
}

.admin-questions-filter-input .mud-input-outlined-border {
  border-radius: 10px;
}

.admin-questions-filter-bar__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  justify-content: flex-start;
}

@media (min-width: 768px) {
  .admin-questions-filter-bar__meta {
    justify-content: flex-end;
    min-height: 40px;
  }
}

.admin-table-filter-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.admin-col-filter {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 7.5rem;
  padding: 0.15rem 0;
}

.admin-col-filter__title {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--mud-palette-text-secondary);
  line-height: 1.2;
  white-space: nowrap;
}

.admin-col-filter__control {
  width: 100%;
  min-width: 0;
}

.admin-col-filter__control .mud-input-control,
.admin-col-filter__control .mud-input-control-input-container,
.admin-col-filter__control .mud-select {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.admin-col-filter__control .mud-input {
  font-size: 0.8125rem;
}

.admin-col-filter__control .mud-input-root-outlined,
.admin-col-filter__control .mud-input-outlined-border {
  border-radius: 8px;
}

.admin-users-table .mud-table-head .mud-table-cell,
.admin-groups-table .mud-table-head .mud-table-cell {
  vertical-align: bottom;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

@media (max-width: 960px) {
  .admin-col-filter {
    min-width: 6.5rem;
  }
}

.admin-questions-filter-count {
  font-weight: 600;
}

.admin-questions-filter-clear {
  text-transform: none;
  font-weight: 600;
}

.admin-questions-filter-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-questions-table .mud-table-head .mud-table-cell {
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.admin-questions-table .admin-questions-row--dragging {
  opacity: 0.55;
}

.admin-questions-table .admin-questions-row--drag-over {
  box-shadow: inset 0 3px 0 0 var(--mud-palette-primary);
}

/* Pytania egzaminu - mobile: bez reorder przez drag (PC bez zmian) */
@media (max-width: 599.98px) {
  .admin-mobile-cards.admin-questions-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-questions-col-drag[data-label],
  .admin-mobile-cards.admin-questions-table .mud-table-head .mud-table-cell.admin-questions-col-drag,
  .admin-questions-table .admin-questions-col-drag,
  .admin-questions-table .mud-table-head .admin-questions-col-drag {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    max-width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
  }

  .admin-mobile-cards.admin-questions-table .admin-material-drag-handle,
  .admin-questions-table .admin-material-drag-handle {
    display: none !important;
    pointer-events: none !important;
  }

  .admin-mobile-cards.admin-questions-table .admin-questions-col-text[data-label] {
    padding-right: 14px !important;
  }
}

/* Egzaminy: nie dziel nagłówków ani krótkich komórek na pojedyncze litery (np. „ID”) */
.admin-exams-table .mud-table-body .mud-table-cell:not(.admin-table-actions) {
  overflow-wrap: break-word;
  word-break: normal;
}

/* Pytania egzaminu (/admin/exams/.../questions) - stała wysokość wierszy na desktopie */
@media (min-width: 960px) {
  .admin-questions-table .mud-table-body .mud-table-row {
    height: 72px;
  }

  .admin-questions-table .mud-table-body .mud-table-row .mud-table-cell {
    max-height: 72px;
    overflow: hidden;
    word-break: normal;
    vertical-align: middle;
  }

  .admin-questions-table .admin-questions-col-text {
    overflow-wrap: anywhere;
  }

  .admin-questions-text-clip {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    max-height: calc(1.35em * 2);
    word-break: break-word;
  }

  .admin-questions-number {
    margin-right: 0.35em;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
  }

  .admin-questions-table .admin-questions-col-image .mud-image,
  .admin-questions-table .admin-questions-col-image img {
    max-height: 48px;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
  }

  .admin-questions-table .admin-questions-col-correct {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.admin-table-scroll .mud-table-container {
  -webkit-overflow-scrolling: touch;
}

/* /admin/communication - filtr daty: kalendarz nie może być obcięty przy pustej historii */
.communication-history-filters {
  overflow: visible !important;
  position: relative;
  z-index: 2;
}

.communication-history-table-wrap {
  overflow: visible;
  min-height: 6rem;
}

.communication-history-table-wrap .mud-table,
.communication-history-table-wrap .mud-table-root {
  width: 100%;
  max-width: 100%;
}

.communication-history-table-wrap .mud-table-container {
  overflow: visible !important;
}

.communication-history-date-range.mud-picker {
  width: 100%;
}

@media (max-width: 599.98px) {
  .communication-history-table-wrap {
    overflow-x: visible;
    overflow-y: visible;
  }

  .communication-history-table-wrap .mud-table-container {
    overflow-x: auto !important;
    overflow-y: visible;
    max-width: 100%;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .communication-history-table-wrap .communication-history-table table {
    width: max-content;
    min-width: 100%;
    table-layout: auto !important;
  }

  .communication-history-table-wrap .communication-history-table .mud-table-head .mud-table-cell,
  .communication-history-table-wrap .communication-history-table .mud-table-body .mud-table-cell {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    vertical-align: middle;
  }

  .communication-history-table-wrap .communication-history-table .mud-chip {
    max-width: none;
    white-space: nowrap;
  }

  .communication-history-table-wrap .communication-history-table .exam-perm-actions-row {
    flex-wrap: nowrap !important;
  }

  .communication-history-table table {
    min-width: 36rem;
  }

  .communication-history-table-wrap .mud-table-root,
  .communication-history-table-wrap .mud-table {
    overflow: hidden;
    border-radius: var(--mud-default-borderradius, 8px);
    max-width: 100%;
  }

  .communication-history-table-wrap .mud-table-pagination {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-table-lines);
    border-radius: 0 0 var(--mud-default-borderradius, 8px) var(--mud-default-borderradius, 8px);
    box-sizing: border-box;
  }

  .communication-history-table-wrap .mud-table-pagination-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px 4px !important;
    padding: 8px 10px 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0 !important;
  }

  .communication-history-table-wrap .mud-table-pagination-spacer {
    display: none !important;
  }

  .communication-history-table-wrap .mud-table-pagination-caption {
    flex: 1 1 100% !important;
    width: 100% !important;
    text-align: center !important;
    order: -2;
    margin: 0 !important;
    padding: 0 4px !important;
  }

  .communication-history-table-wrap .mud-table-pagination-toolbar .mud-select {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    order: -1;
    justify-content: center;
    margin: 0 !important;
  }

  .communication-history-table-wrap .mud-table-pagination .mud-icon-button,
  .communication-history-table-wrap .mud-table-pagination .mud-tooltip-root .mud-icon-button {
    flex: 0 0 auto;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 6px !important;
    margin: 0 !important;
  }
}

/* Analityka - klasyczna tabela (desktop bez zmian od 960px) */
@media (min-width: 960px) {
  .admin-analytics-table table {
    min-width: max(100%, 36rem);
  }
}

.analytics-users-table .analytics-user-row {
  cursor: pointer;
}

.admin-analytics-table .admin-user-col-group .mud-chip {
  max-width: 12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Analityka - tabela pytań: nagłówki statystyk w jednej linii */
.analytics-exam-questions-detail .analytics-questions-table table,
.analytics-user-detail .analytics-questions-table table {
  min-width: 52rem;
  table-layout: auto;
}

.analytics-questions-table .mud-table-head .mud-table-cell {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
  vertical-align: middle;
}

.analytics-questions-table .analytics-question-col-stat {
  width: auto !important;
  text-align: center;
}

.analytics-questions-table .analytics-question-col-wrong {
  min-width: 9.75rem;
}

.analytics-questions-table .analytics-question-col-correct-count {
  min-width: 10.75rem;
}

.analytics-questions-table .analytics-question-col-appearances {
  min-width: 12rem;
}

.analytics-questions-table .analytics-question-col-percent {
  min-width: 6.75rem;
}

.analytics-questions-table .analytics-question-col-action {
  width: 3.25rem;
  min-width: 3.25rem;
}

.analytics-questions-table .analytics-question-number {
  margin-right: 0.35em;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.analytics-questions-table .mud-table-body .analytics-question-col-stat,
.analytics-questions-table .mud-table-body .analytics-question-col-percent {
  white-space: nowrap !important;
  text-align: center;
}

.admin-table-scroll.analytics-exam-questions-detail,
.admin-table-scroll.analytics-user-detail {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Analityka - mobile: ta sama tabela co na PC, przewijanie poziome w kontenerze */
@media (max-width: 599.98px) {
  .admin-table-scroll.admin-analytics-table-wrap {
    overflow-x: visible;
    overflow-y: visible;
  }

  .admin-analytics-table-wrap .mud-table-root,
  .admin-analytics-table-wrap .mud-table {
    overflow: hidden;
    border-radius: var(--mud-default-borderradius, 8px);
    max-width: 100%;
  }

  .admin-analytics-table-wrap .mud-table-container {
    overflow-x: auto !important;
    overflow-y: visible;
    max-width: 100%;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .admin-analytics-table-wrap .admin-analytics-table table {
    min-width: 36rem;
  }

  .admin-analytics-table-wrap .analytics-questions-table table {
    min-width: 42rem;
  }

  .admin-analytics-table-wrap .mud-table-pagination {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-table-lines);
    border-radius: 0 0 var(--mud-default-borderradius, 8px) var(--mud-default-borderradius, 8px);
    box-sizing: border-box;
  }

  .admin-analytics-table-wrap .mud-table-pagination-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px 4px !important;
    padding: 8px 10px 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0 !important;
  }

  .admin-analytics-table-wrap .mud-table-pagination-spacer {
    display: none !important;
  }

  .admin-analytics-table-wrap .mud-table-pagination-caption {
    flex: 1 1 100% !important;
    width: 100% !important;
    text-align: center !important;
    order: -2;
    margin: 0 !important;
  }

  .admin-analytics-table-wrap .mud-table-pagination-toolbar .mud-select {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    order: -1;
    justify-content: center;
    margin: 0 !important;
  }

  .admin-analytics-table-wrap .mud-table-pagination .mud-icon-button,
  .admin-analytics-table-wrap .mud-table-pagination .mud-tooltip-root .mud-icon-button {
    flex: 0 0 auto;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 6px !important;
    margin: 0 !important;
  }

  /* Analityka - tabela pytań (egzamin ogólny + użytkownik): bez zawijania, pełna szerokość kolumn */
  .analytics-exam-questions-detail .admin-analytics-table table,
  .analytics-user-detail .admin-analytics-table table {
    width: max-content;
    min-width: 100%;
    table-layout: auto !important;
  }

  .analytics-exam-questions-detail .admin-analytics-table .mud-table-head .mud-table-cell,
  .analytics-exam-questions-detail .admin-analytics-table .mud-table-body .mud-table-cell,
  .analytics-user-detail .admin-analytics-table .mud-table-head .mud-table-cell,
  .analytics-user-detail .admin-analytics-table .mud-table-body .mud-table-cell {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    vertical-align: middle;
  }

  .analytics-exam-questions-detail .analytics-questions-table table,
  .analytics-user-detail .analytics-questions-table table {
    min-width: 42rem;
  }

  .analytics-user-detail .analytics-user-attempts-table table {
    min-width: 34rem;
  }
}

/* -------------------------------------------------------------------------
   Mobile: czytelne kafelki (MudTable Breakpoint Sm/Md - bez „label |     | wartość”)
   Etykieta nad treścią, wyraźna karta, pasek akcji na dole.
   ------------------------------------------------------------------------- */
@media (max-width: 959.98px) {
  .admin-table-scroll:has(.admin-mobile-cards) {
    overflow-x: visible;
  }

  .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-row,
  .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-row,
  .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-row {
    display: block !important;
    margin-bottom: 16px;
    padding: 0 !important;
    border-radius: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    background-color: var(--mud-palette-surface);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
  }

  .mud-theme-dark .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-row,
  .mud-theme-dark .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-row,
  .mud-theme-dark .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-row {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
  }

  /* Pole: etykieta nad wartością (pełna szerokość, bez przerwy pośrodku) */
  .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-cell[data-label],
  .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-cell[data-label],
  .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-cell[data-label] {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    text-align: left !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--mud-palette-table-lines) !important;
  }

  .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-cell[data-label]:last-child,
  .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-cell[data-label]:last-child,
  .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-cell[data-label]:last-child {
    border-bottom: none !important;
  }

  .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-cell[data-label]::before,
  .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-cell[data-label]::before,
  .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-cell[data-label]::before {
    padding-right: 0 !important;
    padding-inline-end: 0 !important;
    width: 100%;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary) !important;
    line-height: 1.35;
    opacity: 0.95;
  }

  /* Pierwsze pole (np. ID) - wyróżnienie „nagłówka” karty */
  .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child,
  .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child,
  .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child {
    padding-top: 14px !important;
    padding-bottom: 12px !important;
    background: linear-gradient(
      105deg,
      rgba(247, 148, 29, 0.14) 0%,
      rgba(247, 148, 29, 0.04) 55%,
      transparent 100%
    );
    border-bottom: 1px solid var(--mud-palette-table-lines) !important;
  }

  .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child::before,
  .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child::before,
  .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child::before {
    color: #f7941d !important;
    opacity: 1;
  }

  .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child,
  .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child,
  .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child {
    font-size: 1.05rem;
    font-weight: 600;
  }

  /* Treść wartości - normalna, czytelna */
  .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-cell[data-label]:not(:first-child),
  .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-cell[data-label]:not(:first-child),
  .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-cell[data-label]:not(:first-child) {
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.45;
  }

  /* Akcje: osobny pas na dole, przyciski w jednym rzędzie */
  .admin-mobile-cards.mud-xs-table .mud-table-body .mud-table-cell.admin-table-actions[data-label],
  .admin-mobile-cards.mud-sm-table .mud-table-body .mud-table-cell.admin-table-actions[data-label],
  .admin-mobile-cards.mud-md-table .mud-table-body .mud-table-cell.admin-table-actions[data-label] {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px !important;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    margin-top: 2px;
    background-color: rgba(127, 127, 127, 0.07);
    border-top: 1px solid var(--mud-palette-table-lines) !important;
    border-bottom: none !important;
  }

  .admin-mobile-cards .mud-table-body .mud-table-cell.admin-table-actions[data-label]::before {
    flex: 1 0 100%;
    margin-bottom: 2px;
  }

  .admin-mobile-cards .mud-table-body .mud-table-cell.admin-table-actions[data-label] .mud-tooltip-root {
    display: inline-flex;
  }

  /* -------------------------------------------------------------------------
     /admin/exams - mobile: tytuł i akcje w jednej linii (bez etykiet nad polami)
     Jedna obwódka/cień na całej liście - bez szarego tła między rekordami
     ------------------------------------------------------------------------- */
  .admin-mobile-cards.admin-exams-table .mud-table-body {
    display: block;
    width: 100%;
    border: 1px solid var(--mud-palette-lines-default);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    overflow: visible;
    background-color: var(--mud-palette-surface);
    box-shadow: none;
  }

  .mud-theme-dark .admin-mobile-cards.admin-exams-table .mud-table-body {
    box-shadow: none;
  }

  /* Jedna „karta”: lista + pager - bez szczelin w rogach pod zaokrąglonym tbody */
  .admin-table-scroll:has(table.admin-mobile-cards.admin-exams-table) .mud-table-pagination {
    display: block;
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-top: 1px solid var(--mud-palette-table-lines);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: visible;
    margin-top: 0;
    position: relative;
    z-index: 1;
  }

  .mud-theme-dark .admin-table-scroll:has(table.admin-mobile-cards.admin-exams-table) .mud-table-pagination {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
  }

  .admin-table-scroll:has(table.admin-mobile-cards.admin-exams-table) .mud-table-pagination-toolbar {
    border-top: none;
  }

  /* Mud „rounded-lg” na <table> nie psuje układu kart + stopki */
  table.admin-mobile-cards.admin-exams-table.rounded-lg {
    border-radius: 0 !important;
  }

  .admin-mobile-cards.admin-exams-table.mud-xs-table .mud-table-body .mud-table-row,
  .admin-mobile-cards.admin-exams-table.mud-sm-table .mud-table-body .mud-table-row,
  .admin-mobile-cards.admin-exams-table.mud-md-table .mud-table-body .mud-table-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding: 12px 14px !important;
    margin-bottom: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background-color: transparent !important;
    overflow: visible !important;
  }

  .admin-mobile-cards.admin-exams-table.mud-xs-table .mud-table-body .mud-table-row:not(:last-child),
  .admin-mobile-cards.admin-exams-table.mud-sm-table .mud-table-body .mud-table-row:not(:last-child),
  .admin-mobile-cards.admin-exams-table.mud-md-table .mud-table-body .mud-table-row:not(:last-child) {
    border-bottom: 1px solid var(--mud-palette-table-lines) !important;
  }

  .admin-mobile-cards.admin-exams-table.mud-xs-table .mud-table-body .mud-table-cell[data-label],
  .admin-mobile-cards.admin-exams-table.mud-sm-table .mud-table-body .mud-table-cell[data-label],
  .admin-mobile-cards.admin-exams-table.mud-md-table .mud-table-body .mud-table-cell[data-label] {
    display: block !important;
    flex-direction: unset !important;
    align-items: stretch !important;
    gap: 0 !important;
    border-bottom: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .admin-mobile-cards.admin-exams-table .mud-table-body .mud-table-cell[data-label]::before {
    display: none !important;
    content: none !important;
  }

  .admin-mobile-cards.admin-exams-table .mud-table-body .mud-table-cell.admin-exam-col-title[data-label] {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    background: transparent !important;
  }

  .admin-mobile-cards.admin-exams-table .mud-table-body .mud-table-cell.admin-table-actions.admin-exam-col-actions[data-label] {
    flex: 0 0 auto !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 0 !important;
    margin-top: 0 !important;
    margin-left: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    background-color: transparent !important;
    border-top: none !important;
    overflow: visible !important;
    -webkit-overflow-scrolling: auto !important;
  }

  .admin-mobile-cards.admin-exams-table .mud-table-body .mud-table-cell.admin-table-actions[data-label]::before {
    display: none !important;
    flex: unset !important;
    margin-bottom: 0 !important;
  }

  .admin-mobile-cards.admin-exams-table .admin-exam-actions-desktop {
    display: none !important;
  }

  .admin-mobile-cards.admin-exams-table .admin-exam-actions-mobile {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
  }

  .admin-exam-actions-mobile-wrap {
    position: relative;
    z-index: 2;
  }

  .admin-mobile-cards.admin-exams-table .mud-table-body .mud-table-row:has(.admin-exam-actions-sheet) {
    position: relative;
    z-index: 30;
  }

  .admin-exams-table-wrap:has(.admin-exam-actions-sheet),
  .admin-exams-table-wrap:has(.admin-exam-actions-sheet) .mud-table-container {
    overflow: visible !important;
  }

  .admin-exam-actions-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1590;
    background: rgba(0, 0, 0, 0.45);
    animation: admin-exam-backdrop-in 0.2s ease-out;
  }

  @keyframes admin-exam-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes admin-exam-sheet-in {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .admin-exam-actions-sheet {
    position: absolute;
    top: calc(100% + 4px);
    bottom: auto;
    right: 0;
    z-index: 1510;
    min-width: min(17.5rem, 92vw);
    padding: 4px 0;
    border-radius: 10px;
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  }

  .admin-exam-actions-sheet--portal {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 1600;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    max-height: min(85dvh, 26rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
    border: none;
    border-top: 1px solid var(--mud-palette-lines-default);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.28);
    animation: admin-exam-sheet-in 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .admin-exam-actions-sheet__handle {
    flex: 0 0 auto;
    width: 40px;
    height: 4px;
    margin: 10px auto 6px;
    border-radius: 999px;
    background-color: var(--mud-palette-lines-default);
    opacity: 0.9;
  }

  .admin-exam-actions-sheet__header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 4px 10px 16px;
    border-bottom: 1px solid var(--mud-palette-table-lines);
  }

  .admin-exam-actions-sheet__title {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-exam-actions-sheet__close {
    flex-shrink: 0;
  }

  .admin-exam-actions-sheet__body {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .admin-exam-actions-sheet__danger {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--mud-palette-table-lines);
  }

  .mud-theme-dark .admin-exam-actions-sheet,
  .mud-theme-dark .admin-exam-actions-sheet--portal {
    box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.55);
  }

  .admin-exam-action-btn.mud-button-root {
    min-height: 50px;
    padding: 0 16px !important;
    justify-content: flex-start !important;
    text-transform: none !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    border-radius: 0 !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .admin-exam-action-btn.mud-button-root .mud-button-label {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }

  .admin-exam-action-btn.mud-button-root .mud-button-icon-start {
    margin-right: 12px;
    margin-inline-end: 12px;
  }

  .admin-exam-action-btn--danger.mud-button-root {
    font-weight: 600 !important;
  }

  .admin-mobile-cards.admin-exams-table .admin-exam-actions-menu .mud-icon-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  /* Ukryj nagłówek tabeli egzaminów na mobile - wiersze to karty tytuł + menu */
  .admin-mobile-cards.admin-exams-table.mud-xs-table .mud-table-head,
  .admin-mobile-cards.admin-exams-table.mud-sm-table .mud-table-head,
  .admin-mobile-cards.admin-exams-table.mud-md-table .mud-table-head {
    display: none !important;
  }

  .admin-mobile-cards.admin-training-materials-table .mud-table-body .mud-table-cell.admin-table-actions.admin-exam-col-actions[data-label] {
    justify-content: center !important;
  }

  .admin-mobile-cards.admin-training-materials-table .admin-exam-actions-row {
    justify-content: center;
    min-width: 0;
  }

  /* Bez wewnętrznych linii pod tytułem / nad akcjami (nadpisanie :first-child i .admin-table-actions) */
  .admin-mobile-cards.admin-exams-table.mud-xs-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child,
  .admin-mobile-cards.admin-exams-table.mud-sm-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child,
  .admin-mobile-cards.admin-exams-table.mud-md-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:first-child {
    border-bottom: none !important;
    border-top: none !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    background: none !important;
    background-image: none !important;
  }

  .admin-mobile-cards.admin-exams-table.mud-xs-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:last-child,
  .admin-mobile-cards.admin-exams-table.mud-sm-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:last-child,
  .admin-mobile-cards.admin-exams-table.mud-md-table .mud-table-body .mud-table-row .mud-table-cell[data-label]:last-child {
    border-top: none !important;
    border-bottom: none !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  /* Zebra w trybie kart - jednolite tło karty */
  .admin-mobile-cards.mud-table-striped.mud-xs-table .mud-table-body .mud-table-row:nth-of-type(odd),
  .admin-mobile-cards.mud-table-striped.mud-sm-table .mud-table-body .mud-table-row:nth-of-type(odd),
  .admin-mobile-cards.mud-table-striped.mud-md-table .mud-table-body .mud-table-row:nth-of-type(odd) {
    background-color: var(--mud-palette-surface);
  }

  .admin-mobile-cards.mud-table-hover.mud-xs-table .mud-table-body .mud-table-row:hover,
  .admin-mobile-cards.mud-table-hover.mud-sm-table .mud-table-body .mud-table-row:hover,
  .admin-mobile-cards.mud-table-hover.mud-md-table .mud-table-body .mud-table-row:hover {
    background-color: var(--mud-palette-table-hover);
  }

  /* Egzaminy: zebra/hover na wierszu - tło listy zostaje na tbody */
  .admin-mobile-cards.admin-exams-table.mud-table-striped.mud-xs-table .mud-table-body .mud-table-row:nth-of-type(odd),
  .admin-mobile-cards.admin-exams-table.mud-table-striped.mud-sm-table .mud-table-body .mud-table-row:nth-of-type(odd),
  .admin-mobile-cards.admin-exams-table.mud-table-striped.mud-md-table .mud-table-body .mud-table-row:nth-of-type(odd) {
    background-color: transparent !important;
  }

  .admin-mobile-cards.admin-exams-table.mud-table-hover.mud-xs-table .mud-table-body .mud-table-row:hover,
  .admin-mobile-cards.admin-exams-table.mud-table-hover.mud-sm-table .mud-table-body .mud-table-row:hover,
  .admin-mobile-cards.admin-exams-table.mud-table-hover.mud-md-table .mud-table-body .mud-table-row:hover {
    background-color: rgba(127, 127, 127, 0.08) !important;
  }

  /* -------------------------------------------------------------------------
     Tabele admina - karty tylko na telefonach (<600px); tablet/PC = klasyczna tabela
     ------------------------------------------------------------------------- */
  @media (max-width: 599.98px) {
  /* /admin/users - e-mail ukryty tylko w starym układzie kart */
  .admin-mobile-cards.admin-users-table .admin-user-col-email {
    display: none !important;
  }

  /* -------------------------------------------------------------------------
     /admin/groups - mobile: karty grupy z etykietami pól
     ------------------------------------------------------------------------- */
  .admin-mobile-cards.admin-groups-table .mud-table-head {
    display: none !important;
  }

  .admin-mobile-cards.admin-groups-table .mud-table-container {
    overflow-x: visible !important;
  }

  .admin-table-scroll:has(table.admin-mobile-cards.admin-groups-table) {
    overflow-x: visible;
  }

  .admin-mobile-cards.admin-groups-table .mud-table-body {
    display: block !important;
    width: 100%;
    border: none;
    border-radius: 0;
    overflow: visible;
    background-color: transparent;
    box-shadow: none;
  }

  .admin-table-scroll:has(table.admin-mobile-cards.admin-groups-table) .mud-table-pagination {
    display: block;
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-top: 0.75rem;
  }

  .mud-theme-dark .admin-table-scroll:has(table.admin-mobile-cards.admin-groups-table) .mud-table-pagination {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
  }

  table.admin-mobile-cards.admin-groups-table.rounded-lg {
    border-radius: 0 !important;
  }

  .admin-mobile-cards.admin-groups-table .mud-table-body tr.mud-table-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "name name"
      "description description"
      "exam reminders"
      "training training"
      "actions actions";
    gap: 0;
    padding: 14px !important;
    margin-bottom: 14px !important;
    border: 1px solid var(--mud-palette-lines-default) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
    background-color: var(--mud-palette-surface) !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .mud-theme-dark .admin-mobile-cards.admin-groups-table .mud-table-body tr.mud-table-row {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35) !important;
  }

  .admin-mobile-cards.admin-groups-table .mud-table-body tr.mud-table-row > .mud-table-cell[data-label] {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    border: none !important;
    padding: 10px 12px !important;
    margin: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    background: transparent !important;
    box-sizing: border-box !important;
  }

  .admin-mobile-cards.admin-groups-table .mud-table-body .mud-table-cell[data-label]::before {
    display: block !important;
    content: attr(data-label) !important;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary) !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-name[data-label] {
    grid-area: name;
    font-size: 1rem !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    background: linear-gradient(
      105deg,
      rgba(247, 148, 29, 0.12) 0%,
      rgba(247, 148, 29, 0.03) 55%,
      transparent 100%
    ) !important;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-name[data-label]::before {
    color: #f7941d !important;
    text-transform: none !important;
    font-size: 0.75rem !important;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-description[data-label] {
    grid-area: description;
    border-top: 1px solid var(--mud-palette-table-lines) !important;
    font-size: 0.9375rem !important;
    line-height: 1.45 !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-description[data-label]:empty,
  .admin-mobile-cards.admin-groups-table .admin-group-col-description[data-label]:has(:empty) {
    display: none !important;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-exam[data-label] {
    grid-area: exam;
    border-top: 1px solid var(--mud-palette-table-lines) !important;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-reminders[data-label] {
    grid-area: reminders;
    border-top: 1px solid var(--mud-palette-table-lines) !important;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-training[data-label] {
    grid-area: training;
    border-top: 1px solid var(--mud-palette-table-lines) !important;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-actions[data-label] {
    grid-area: actions;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 4px !important;
    border-top: 1px solid var(--mud-palette-table-lines) !important;
    background-color: rgba(127, 127, 127, 0.07) !important;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-actions[data-label]::before {
    flex: 1 0 100%;
    margin-bottom: 2px;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-actions-row {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-actions-row .mud-icon-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .admin-mobile-cards.admin-groups-table .admin-group-col-reminders .mud-chip,
  .admin-mobile-cards.admin-groups-table .admin-group-col-training .mud-chip,
  .admin-mobile-cards.admin-groups-table .admin-groups-exam-chip.mud-chip {
    max-width: 100%;
    height: auto;
    min-height: 26px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .admin-mobile-cards.admin-groups-table.mud-table-striped .mud-table-body tr.mud-table-row:nth-of-type(odd) {
    background-color: var(--mud-palette-surface) !important;
  }

  .admin-mobile-cards.admin-groups-table.mud-table-hover .mud-table-body tr.mud-table-row:hover {
    background-color: var(--mud-palette-surface) !important;
    border-color: var(--mud-palette-primary) !important;
  }

  /* -------------------------------------------------------------------------
     /admin/users - mobile: karty użytkownika (imię, rola, grupa, akcje)
     E-mail ukryty na liście (widać w oknie edycji).
     ------------------------------------------------------------------------- */
  .admin-mobile-cards.admin-users-table .mud-table-body {
    display: block !important;
    width: 100%;
    border: none;
    border-radius: 0;
    overflow: visible;
    background-color: transparent;
    box-shadow: none;
  }

  .admin-mobile-cards.admin-users-table .mud-table-container {
    overflow-x: visible !important;
    -webkit-overflow-scrolling: auto;
  }

  table.admin-mobile-cards.admin-users-table,
  table.mud-table.admin-users-table.admin-mobile-cards,
  .admin-mobile-cards.admin-users-table.mud-table,
  .admin-mobile-cards.admin-users-table table.mud-table {
    display: block !important;
    width: 100% !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-head {
    display: none !important;
  }

  .admin-table-scroll:has(table.admin-mobile-cards.admin-users-table) {
    overflow-x: visible;
  }

  .admin-table-scroll:has(table.admin-mobile-cards.admin-users-table) .mud-table-pagination {
    display: block;
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-top: 0.75rem;
  }

  .mud-theme-dark .admin-table-scroll:has(table.admin-mobile-cards.admin-users-table) .mud-table-pagination {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
  }

  .admin-table-scroll:has(table.admin-mobile-cards.admin-users-table) .mud-table-pagination-toolbar {
    border-top: none;
  }

  table.admin-mobile-cards.admin-users-table.rounded-lg {
    border-radius: 0 !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "first last"
      "role group"
      "headadmin headadmin"
      "actions actions";
    gap: 0;
    padding: 14px !important;
    margin-bottom: 14px !important;
    border: 1px solid var(--mud-palette-lines-default) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
    background-color: var(--mud-palette-surface) !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .mud-theme-dark .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35) !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row:not(:last-child) {
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell[data-label] {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    border: none !important;
    padding: 10px 12px !important;
    margin: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    background: transparent !important;
    box-sizing: border-box !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-user-col-email[data-label],
  .admin-mobile-cards.admin-users-table .mud-table-body td.mud-table-cell.admin-user-col-email {
    display: none !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body .mud-table-cell[data-label]::before {
    display: block !important;
    content: attr(data-label) !important;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary) !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-user-col-first[data-label] {
    grid-area: first;
    font-size: 1rem !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    background: linear-gradient(
      105deg,
      rgba(247, 148, 29, 0.12) 0%,
      rgba(247, 148, 29, 0.03) 55%,
      transparent 100%
    ) !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-user-col-first[data-label]::before {
    color: #f7941d !important;
    text-transform: none !important;
    font-size: 0.75rem !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-user-col-last[data-label] {
    grid-area: last;
    font-size: 1rem !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    background: linear-gradient(
      105deg,
      rgba(247, 148, 29, 0.12) 0%,
      rgba(247, 148, 29, 0.03) 55%,
      transparent 100%
    ) !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-user-col-last[data-label]::before {
    color: #f7941d !important;
    text-transform: none !important;
    font-size: 0.75rem !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-user-col-role[data-label] {
    grid-area: role;
    border-top: 1px solid var(--mud-palette-table-lines) !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-user-col-group[data-label] {
    grid-area: group;
    border-top: 1px solid var(--mud-palette-table-lines) !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-user-col-headadmin[data-label] {
    grid-area: headadmin;
    border-top: 1px solid var(--mud-palette-table-lines) !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-table-actions.admin-user-col-actions[data-label] {
    grid-area: actions;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 4px !important;
    border-top: 1px solid var(--mud-palette-table-lines) !important;
    background-color: rgba(127, 127, 127, 0.07) !important;
  }

  .admin-mobile-cards.admin-users-table .mud-table-body .mud-table-cell.admin-table-actions[data-label]::before {
    flex: 1 0 100%;
    margin-bottom: 2px;
  }

  .admin-mobile-cards.admin-users-table .admin-user-actions-row {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
  }

  .admin-mobile-cards.admin-users-table .admin-user-actions-row .mud-icon-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 4px;
  }

  .admin-mobile-cards.admin-users-table .admin-user-col-role .mud-chip,
  .admin-mobile-cards.admin-users-table .admin-user-col-group .mud-chip,
  .admin-mobile-cards.admin-users-table .admin-user-col-headadmin .mud-chip,
  .admin-mobile-cards.analytics-users-table .admin-user-col-group .mud-chip {
    max-width: 100%;
    box-sizing: border-box;
    height: auto;
    min-height: 26px;
    font-size: 0.75rem;
    padding-left: 8px;
    padding-right: 8px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .admin-mobile-cards.admin-users-table.mud-table-striped .mud-table-body tr.mud-table-row:nth-of-type(odd) {
    background-color: var(--mud-palette-surface) !important;
  }

  .admin-mobile-cards.admin-users-table.mud-table-hover .mud-table-body tr.mud-table-row:hover {
    background-color: var(--mud-palette-surface) !important;
    border-color: var(--mud-palette-primary) !important;
  }

  /* Pytania egzaminu - karty na mobile (uchwyt drag bez długiej etykiety) */
  .admin-mobile-cards.admin-questions-table .mud-table-head {
    display: none !important;
  }

  .admin-table-scroll:has(table.admin-mobile-cards.admin-questions-table) {
    overflow-x: visible;
  }

  .admin-mobile-cards.admin-questions-table .mud-table-container {
    overflow: visible !important;
  }

  table.admin-mobile-cards.admin-questions-table.rounded-lg {
    border: none !important;
    background: transparent !important;
  }

  .admin-mobile-cards.admin-questions-table .mud-table-body tr.mud-table-row {
    display: block !important;
    position: relative;
    margin-bottom: 14px !important;
    padding: 0 !important;
    border-radius: 12px !important;
    border: 1px solid var(--mud-palette-lines-default) !important;
    background-color: var(--mud-palette-surface) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }

  .mud-theme-dark .admin-mobile-cards.admin-questions-table .mud-table-body tr.mud-table-row {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  }

  .admin-mobile-cards.admin-questions-table .mud-table-body tr.mud-table-row > .mud-table-cell[data-label] {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--mud-palette-table-lines) !important;
    font-size: 0.9375rem !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
    background: transparent !important;
  }

  .admin-mobile-cards.admin-questions-table .mud-table-body .mud-table-cell[data-label]::before {
    content: attr(data-label) !important;
    display: block !important;
    width: 100%;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary) !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere;
    opacity: 0.95;
  }

  .admin-mobile-cards.admin-questions-table .admin-questions-col-drag[data-label] {
    position: absolute !important;
    top: 6px;
    right: 4px;
    z-index: 2;
    width: auto !important;
    max-width: none !important;
    padding: 4px !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: inherit !important;
    font-weight: inherit !important;
  }

  .admin-mobile-cards.admin-questions-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-questions-col-drag[data-label]:first-child {
    padding: 4px !important;
    background: transparent !important;
    border-bottom: none !important;
    font-size: inherit !important;
    font-weight: inherit !important;
  }

  .admin-mobile-cards.admin-questions-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-questions-col-drag[data-label]:first-child::before {
    display: none !important;
    content: none !important;
    color: inherit !important;
  }

  .admin-mobile-cards.admin-questions-table .admin-questions-col-text[data-label] {
    padding: 14px 48px 12px 14px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    line-height: 1.45 !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    border-bottom: 1px solid var(--mud-palette-table-lines) !important;
    background: linear-gradient(
      105deg,
      rgba(247, 148, 29, 0.12) 0%,
      rgba(247, 148, 29, 0.03) 55%,
      transparent 100%
    ) !important;
  }

  .admin-mobile-cards.admin-questions-table .admin-questions-col-text[data-label]::before {
    color: #f7941d !important;
    text-transform: none !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    letter-spacing: 0;
  }

  .admin-mobile-cards.admin-questions-table .admin-questions-text-clip {
    display: block;
    -webkit-line-clamp: unset;
    max-height: none;
    overflow: visible;
    font-weight: 600;
  }

  .admin-mobile-cards.admin-questions-table .admin-questions-col-image[data-label] .mud-image,
  .admin-mobile-cards.admin-questions-table .admin-questions-col-image[data-label] img {
    max-height: 72px;
    width: auto;
    object-fit: contain;
  }

  .admin-mobile-cards.admin-questions-table .admin-questions-col-correct[data-label] {
    white-space: normal;
    word-break: break-word;
  }

  .admin-mobile-cards.admin-questions-table .mud-table-body tr.mud-table-row > .mud-table-cell.admin-table-actions[data-label] {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px !important;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    margin-top: 0;
    background-color: rgba(127, 127, 127, 0.07);
    border-top: 1px solid var(--mud-palette-table-lines) !important;
    border-bottom: none !important;
  }

  .admin-mobile-cards.admin-questions-table .mud-table-body .mud-table-cell.admin-table-actions[data-label]::before {
    flex: 1 0 100%;
    margin-bottom: 2px;
  }

  .admin-mobile-cards.admin-questions-table.mud-table-striped .mud-table-body tr.mud-table-row:nth-of-type(odd) {
    background-color: var(--mud-palette-surface) !important;
  }

  .admin-mobile-cards.admin-questions-table.mud-table-hover .mud-table-body tr.mud-table-row:hover {
    background-color: var(--mud-palette-surface) !important;
    border-color: var(--mud-palette-primary) !important;
  }

  .admin-mobile-cards.admin-questions-table .admin-questions-row--drag-over {
    box-shadow: inset 0 3px 0 0 var(--mud-palette-primary);
  }

  /* Analityka - zakładka Pytania: karty zamiast ściśniętej tabeli */
  .admin-mobile-cards.analytics-questions-table.mud-xs-table .mud-table-head,
  .admin-mobile-cards.analytics-questions-table.mud-sm-table .mud-table-head,
  .admin-mobile-cards.analytics-questions-table.mud-md-table .mud-table-head {
    display: none !important;
  }

  .admin-mobile-cards.analytics-questions-table.mud-xs-table .mud-table-body .mud-table-row,
  .admin-mobile-cards.analytics-questions-table.mud-sm-table .mud-table-body .mud-table-row,
  .admin-mobile-cards.analytics-questions-table.mud-md-table .mud-table-body .mud-table-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    position: relative;
    padding: 14px 14px 12px !important;
    margin-bottom: 14px !important;
    border-radius: 12px !important;
    border: 1px solid var(--mud-palette-lines-default) !important;
    background-color: var(--mud-palette-surface) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }

  .mud-theme-dark .admin-mobile-cards.analytics-questions-table .mud-table-body .mud-table-row {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  }

  .admin-mobile-cards.analytics-questions-table .mud-table-body .mud-table-cell[data-label] {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
    border: none !important;
    padding: 10px 12px !important;
    margin: 0 !important;
    min-width: 0 !important;
    background: transparent !important;
  }

  .admin-mobile-cards.analytics-questions-table .mud-table-body .mud-table-cell[data-label]::before {
    content: attr(data-label) !important;
    display: block !important;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary) !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere;
  }

  .admin-mobile-cards.analytics-questions-table .analytics-question-col-text[data-label] {
    grid-column: 1 / -1;
    padding: 0 44px 12px 0 !important;
    border-bottom: 1px solid var(--mud-palette-table-lines) !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    line-height: 1.45 !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    background: linear-gradient(
      105deg,
      rgba(247, 148, 29, 0.12) 0%,
      rgba(247, 148, 29, 0.03) 55%,
      transparent 100%
    ) !important;
  }

  .admin-mobile-cards.analytics-questions-table .analytics-question-col-text[data-label]::before {
    color: #f7941d !important;
    text-transform: none !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    letter-spacing: 0;
  }

  .admin-mobile-cards.analytics-questions-table .analytics-question-col-stat[data-label] {
    font-size: 1rem !important;
    font-weight: 600 !important;
    font-variant-numeric: tabular-nums;
    line-height: 1.3 !important;
  }

  .admin-mobile-cards.analytics-questions-table .analytics-question-col-percent[data-label] {
    font-weight: 700 !important;
  }

  .admin-mobile-cards.analytics-questions-table .analytics-question-col-action[data-label] {
    position: absolute !important;
    top: 8px;
    right: 4px;
    width: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
  }

  .admin-mobile-cards.analytics-questions-table .analytics-question-col-action[data-label]::before {
    display: none !important;
    content: none !important;
  }

  .admin-table-scroll:has(.analytics-questions-table) {
    overflow-x: visible;
  }
  }

}

/* Action columns: wrap icon buttons on narrow screens */
.admin-table-actions .mud-button-root,
.admin-table-actions .mud-icon-button {
  flex-shrink: 0;
}

.admin-table-actions {
  white-space: normal;
}

/* Wiersz ikon w komórce - flex TYLKO wewnątrz diva (nie na <td>, bo psuje kolumny tabeli) */
.admin-exams-table .admin-exam-actions-row {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  vertical-align: middle;
}

.admin-exams-table .admin-exam-actions-row .mud-tooltip-root {
  display: inline-flex;
  flex-shrink: 0;
}

.admin-users-table .admin-user-actions-row {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  vertical-align: middle;
}

.admin-users-table .admin-user-actions-row .mud-tooltip-root {
  display: inline-flex;
  flex-shrink: 0;
}

.admin-groups-table .admin-group-actions-row {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  vertical-align: middle;
}

.admin-groups-table .admin-group-actions-row .mud-tooltip-root {
  display: inline-flex;
  flex-shrink: 0;
}

/* -------------------------------------------------------------------------
   /admin/groups - data egzaminu w kolorze marki (chip)
   ------------------------------------------------------------------------- */
.admin-groups-table .admin-groups-exam-chip.mud-chip {
  color: #f7941d !important;
  border-color: rgba(247, 148, 29, 0.55) !important;
  background-color: rgba(247, 148, 29, 0.1) !important;
}

.admin-groups-table .admin-groups-exam-chip .mud-icon-root {
  color: #f7941d !important;
}

.admin-groups-table .admin-groups-none-label {
  color: #ffffff !important;
}

@media (min-width: 960px) {
  .admin-groups-table table {
    width: 100%;
    table-layout: fixed;
  }

  .admin-groups-table .mud-table-head .admin-group-col-exam,
  .admin-groups-table .admin-groups-exam-date {
    white-space: nowrap;
    width: 9.5rem;
  }
}

/* -------------------------------------------------------------------------
   /admin/exams - klasyczna tabela na każdej szerokości (przewijanie poziome na wąskich ekranach)
   ------------------------------------------------------------------------- */
.admin-table-scroll.admin-exams-table-wrap {
  overflow-x: visible;
  overflow-y: visible;
}

.admin-exams-table-wrap {
  overflow-x: visible;
  max-width: 100%;
}

.admin-exams-table-wrap--busy {
  pointer-events: none;
  opacity: 0.72;
  transition: opacity 0.15s ease;
}

.admin-exam-duplicate-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  max-width: min(22rem, 90vw);
}

.admin-exam-duplicate-overlay .mud-progress-circular,
.admin-exam-duplicate-overlay .custom-loader {
  color: #fff;
}

.admin-exam-duplicate-overlay .mud-typography {
  color: #fff !important;
}

.admin-exams-table-wrap .mud-table,
.admin-exams-table-wrap .mud-table-root {
  width: 100%;
  max-width: 100%;
}

.admin-exams-table-wrap .mud-table-container {
  overflow-x: auto !important;
  overflow-y: visible;
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 599.98px) {
  .admin-exams-table:not(.admin-training-materials-table) table {
    min-width: 36rem;
  }

  .admin-exams-table-wrap .mud-table-root,
  .admin-exams-table-wrap .mud-table {
    overflow: hidden;
    border-radius: var(--mud-default-borderradius, 8px);
    max-width: 100%;
  }

  .admin-exams-table-wrap .mud-table-pagination {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    position: relative;
    z-index: 1;
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-table-lines);
    border-radius: 0 0 var(--mud-default-borderradius, 8px) var(--mud-default-borderradius, 8px);
    box-sizing: border-box;
  }

  .admin-exams-table-wrap .mud-table-pagination-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px 4px !important;
    padding: 8px 10px 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0 !important;
  }

  .admin-exams-table-wrap .mud-table-pagination-spacer {
    display: none !important;
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
  }

  .admin-exams-table-wrap .mud-table-pagination-caption {
    flex: 1 1 100% !important;
    width: 100% !important;
    text-align: center !important;
    order: -2;
    margin: 0 !important;
    padding: 0 4px !important;
  }

  .admin-exams-table-wrap .mud-table-pagination-toolbar .mud-select {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    order: -1;
    justify-content: center;
    margin: 0 !important;
  }

  .admin-exams-table-wrap .mud-table-pagination-toolbar .mud-input-control,
  .admin-exams-table-wrap .mud-table-pagination-toolbar .mud-input-control-input-container {
    max-width: 100%;
  }

  .admin-exams-table-wrap .mud-table-pagination-toolbar .mud-select .mud-input-slot {
    font-size: 0.8125rem;
  }

  .admin-exams-table-wrap .mud-table-pagination .mud-icon-button,
  .admin-exams-table-wrap .mud-table-pagination .mud-tooltip-root .mud-icon-button {
    flex: 0 0 auto;
    flex-shrink: 0;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 6px !important;
    margin: 0 !important;
  }
}

.admin-users-table .admin-user-col-group .mud-chip {
  height: auto !important;
  min-height: 24px;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal !important;
  padding-top: 4px;
  padding-bottom: 4px;
}

.admin-users-table .admin-user-col-group .mud-chip .mud-chip-content {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

/* -------------------------------------------------------------------------
   /admin/users - klasyczna tabela na każdej szerokości (przewijanie poziome na wąskich ekranach)
   ------------------------------------------------------------------------- */
.admin-table-scroll.admin-users-table-wrap {
  overflow-x: visible;
  overflow-y: visible;
}

.admin-users-table-wrap {
  overflow-x: visible;
  max-width: 100%;
}

.admin-users-table-wrap .mud-table,
.admin-users-table-wrap .mud-table-root {
  width: 100%;
  max-width: 100%;
}

.admin-users-table-wrap .mud-table-container {
  overflow-x: auto !important;
  overflow-y: visible;
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 599.98px) {
  .admin-users-table-wrap .admin-users-table table {
    width: max-content;
    min-width: 100%;
    table-layout: auto !important;
  }

  .admin-users-table-wrap .admin-users-table .mud-table-head .mud-table-cell,
  .admin-users-table-wrap .admin-users-table .mud-table-body .mud-table-cell {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    vertical-align: middle;
  }

  .admin-users-table-wrap .admin-users-table .admin-user-col-role .mud-chip,
  .admin-users-table-wrap .admin-users-table .admin-user-col-group .mud-chip,
  .admin-users-table-wrap .admin-users-table .admin-user-col-headadmin .mud-chip {
    max-width: none;
    white-space: normal;
    height: auto;
  }

  .admin-users-table-wrap .admin-users-table .admin-user-actions-row {
    flex-wrap: nowrap !important;
  }

  .admin-users-table table {
    min-width: 48rem;
  }

  .admin-users-table-wrap .mud-table-root,
  .admin-users-table-wrap .mud-table {
    overflow: hidden;
    border-radius: var(--mud-default-borderradius, 8px);
    max-width: 100%;
  }

  .admin-users-table-wrap .mud-table-pagination {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    position: relative;
    z-index: 1;
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-table-lines);
    border-radius: 0 0 var(--mud-default-borderradius, 8px) var(--mud-default-borderradius, 8px);
    box-sizing: border-box;
  }

  .admin-users-table-wrap .mud-table-pagination-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px 4px !important;
    padding: 8px 10px 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0 !important;
  }

  .admin-users-table-wrap .mud-table-pagination-spacer {
    display: none !important;
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
  }

  .admin-users-table-wrap .mud-table-pagination-caption {
    flex: 1 1 100% !important;
    width: 100% !important;
    text-align: center !important;
    order: -2;
    margin: 0 !important;
    padding: 0 4px !important;
  }

  .admin-users-table-wrap .mud-table-pagination-toolbar .mud-select {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    order: -1;
    justify-content: center;
    margin: 0 !important;
  }

  .admin-users-table-wrap .mud-table-pagination-toolbar .mud-input-control,
  .admin-users-table-wrap .mud-table-pagination-toolbar .mud-input-control-input-container {
    max-width: 100%;
  }

  .admin-users-table-wrap .mud-table-pagination .mud-icon-button,
  .admin-users-table-wrap .mud-table-pagination .mud-tooltip-root .mud-icon-button {
    flex: 0 0 auto;
    flex-shrink: 0;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 6px !important;
    margin: 0 !important;
  }
}

/* -------------------------------------------------------------------------
   /admin/groups - klasyczna tabela na każdej szerokości (przewijanie poziome na wąskich ekranach)
   ------------------------------------------------------------------------- */
.admin-table-scroll.admin-groups-table-wrap {
  overflow-x: visible;
  overflow-y: visible;
}

.admin-groups-table-wrap {
  overflow-x: visible;
  max-width: 100%;
}

.admin-groups-table-wrap .mud-table,
.admin-groups-table-wrap .mud-table-root {
  width: 100%;
  max-width: 100%;
}

.admin-groups-table-wrap .mud-table-container {
  overflow-x: auto !important;
  overflow-y: visible;
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 599.98px) {
  .admin-groups-table-wrap .admin-groups-table table {
    width: max-content;
    min-width: 100%;
    table-layout: auto !important;
  }

  .admin-groups-table-wrap .admin-groups-table .mud-table-head .mud-table-cell,
  .admin-groups-table-wrap .admin-groups-table .mud-table-body .mud-table-cell {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    vertical-align: middle;
  }

  .admin-groups-table-wrap .admin-groups-table .admin-group-col-reminders .mud-chip,
  .admin-groups-table-wrap .admin-groups-table .admin-group-col-training .mud-chip,
  .admin-groups-table-wrap .admin-groups-table .admin-groups-exam-chip.mud-chip {
    max-width: none;
    white-space: nowrap;
  }

  .admin-groups-table-wrap .admin-groups-table .admin-group-actions-row {
    flex-wrap: nowrap !important;
  }

  .admin-groups-table table {
    min-width: 54rem;
  }

  .admin-groups-table-wrap .mud-table-root,
  .admin-groups-table-wrap .mud-table {
    overflow: hidden;
    border-radius: var(--mud-default-borderradius, 8px);
    max-width: 100%;
  }

  .admin-groups-table-wrap .mud-table-pagination {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    position: relative;
    z-index: 1;
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-table-lines);
    border-radius: 0 0 var(--mud-default-borderradius, 8px) var(--mud-default-borderradius, 8px);
    box-sizing: border-box;
  }

  .admin-groups-table-wrap .mud-table-pagination-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px 4px !important;
    padding: 8px 10px 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0 !important;
  }

  .admin-groups-table-wrap .mud-table-pagination-spacer {
    display: none !important;
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
  }

  .admin-groups-table-wrap .mud-table-pagination-caption {
    flex: 1 1 100% !important;
    width: 100% !important;
    text-align: center !important;
    order: -2;
    margin: 0 !important;
    padding: 0 4px !important;
  }

  .admin-groups-table-wrap .mud-table-pagination-toolbar .mud-select {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    order: -1;
    justify-content: center;
    margin: 0 !important;
  }

  .admin-groups-table-wrap .mud-table-pagination-toolbar .mud-input-control,
  .admin-groups-table-wrap .mud-table-pagination-toolbar .mud-input-control-input-container {
    max-width: 100%;
  }

  .admin-groups-table-wrap .mud-table-pagination .mud-icon-button,
  .admin-groups-table-wrap .mud-table-pagination .mud-tooltip-root .mud-icon-button {
    flex: 0 0 auto;
    flex-shrink: 0;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 6px !important;
    margin: 0 !important;
  }
}

.admin-exam-actions-mobile {
  display: none !important;
}

.admin-exam-actions-desktop {
  display: block;
}

/* -------------------------------------------------------------------------
   /admin/exams - pełna tabela (≥960px): nagłówki bez łamania liter, sensowne szerokości
   ------------------------------------------------------------------------- */
@media (min-width: 960px) {
  table.admin-exams-table,
  .admin-exams-table table {
    width: 100% !important;
    max-width: 100%;
    table-layout: fixed;
  }

  .admin-exams-table .mud-table-head .mud-table-cell {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }

  .admin-exams-table:not(.admin-training-materials-table) .admin-exam-col-actions.admin-table-actions,
  .admin-exams-table:not(.admin-training-materials-table) .mud-table-head .admin-exam-col-actions {
    width: 16.75rem;
    min-width: 16.75rem;
    max-width: 16.75rem;
    white-space: nowrap;
    vertical-align: middle;
    text-align: right;
    overflow: visible;
  }

  .admin-exams-table .admin-exam-col-actions.admin-table-actions,
  .admin-exams-table .mud-table-head .admin-exam-col-actions {
    white-space: nowrap;
    vertical-align: middle;
    text-align: right;
  }

  .admin-exams-table .admin-exam-actions-row {
    min-width: 0;
    max-width: 100%;
    justify-content: flex-end;
  }

  .analytics-users-table .analytics-user-row {
    cursor: pointer;
  }

  .admin-exams-table .admin-exam-actions-row .mud-icon-button {
    flex-shrink: 0;
  }

  .admin-exams-table .admin-exam-col-title {
    min-width: 0;
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .admin-exams-table .admin-materials-col-count,
  .admin-exams-table .mud-table-head .admin-materials-col-count {
    width: 5.5rem;
    text-align: left;
    white-space: nowrap;
  }

  /* /admin/training-materials - jedna ikona w kolumnie Akcje, wyśrodkowana pod nagłówkiem */
  .admin-training-materials-table .admin-exam-col-actions.admin-table-actions,
  .admin-training-materials-table .mud-table-head .admin-exam-col-actions {
    width: 5.5rem;
    min-width: 5.5rem;
    text-align: center;
  }

  .admin-training-materials-table .admin-exam-actions-row {
    display: flex;
    justify-content: center;
    min-width: 0;
    width: 100%;
  }

  /*
   * Pełna tabela (PC): ikony z Color=Warning/Info/… dają kolorowe tła przy hover -
   * na prążkowanym wierszu wygląda to jak losowe plamy. Neutralne tło jak przy zwykłym przycisku.
   */
  .admin-mud-table .admin-table-actions .mud-icon-button:hover,
  .admin-mud-table .admin-table-actions .mud-tooltip-root .mud-icon-button:hover {
    background-color: rgba(0, 0, 0, 0.07) !important;
  }

  .mud-theme-dark .admin-mud-table .admin-table-actions .mud-icon-button:hover,
  .mud-theme-dark .admin-mud-table .admin-table-actions .mud-tooltip-root .mud-icon-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
  }
}

/* -------------------------------------------------------------------------
   /admin/users - pełna tabela (≥960px)
   ------------------------------------------------------------------------- */
@media (min-width: 960px) {
  .admin-users-table table {
    width: 100%;
    table-layout: fixed;
  }

  .admin-users-table .mud-table-head .mud-table-cell {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }

  .admin-users-table .admin-user-col-actions.admin-table-actions {
    width: 7.5rem;
    white-space: nowrap;
    vertical-align: middle;
    text-align: right;
  }

  .admin-users-table .admin-user-col-first {
    width: 10%;
    min-width: 6rem;
  }

  .admin-users-table .admin-user-col-last {
    width: 10%;
    min-width: 6rem;
  }

  .admin-users-table .admin-user-col-email {
    width: 22%;
    min-width: 10rem;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .admin-users-table .admin-user-col-role {
    width: 14%;
    min-width: 11.5rem;
    overflow: visible;
    vertical-align: middle;
  }

  .admin-users-table .admin-user-col-group {
    width: 20%;
    min-width: 10rem;
    overflow: visible;
    vertical-align: middle;
  }

  .admin-users-table .admin-user-col-role .mud-chip,
  .admin-users-table .admin-user-col-group .mud-chip {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Długie nazwy grup: tło chipa obejmuje cały tekst (zawijanie zamiast wychodzenia poza tło) */
  .admin-users-table .admin-user-col-group .mud-chip {
    height: auto !important;
    min-height: 24px;
    white-space: normal !important;
    align-items: center;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .admin-users-table .admin-user-col-group .mud-chip .mud-chip-content {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    max-width: 100%;
  }
}

/* Table pager: stack nicely on phones */
@media (max-width: 599px) {
  .admin-table-scroll .mud-table-pagination-toolbar {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px;
    padding: 8px 4px !important;
  }

  .admin-table-scroll .mud-table-pagination-caption {
    flex: 1 1 100%;
    text-align: center;
    order: -1;
  }
}

/* Dialogs: use full width on small viewports */
@media (max-width: 600px) {
  .mud-dialog-container {
    margin: 8px !important;
    max-width: calc(100vw - 16px) !important;
    width: calc(100vw - 16px) !important;
  }

  .mud-dialog-content {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
  }
}

/* App bar - mobile: logo left, compact icon tools right (no overlap) */
.edusimp-appbar.mud-appbar {
  z-index: 1300 !important;
}

.edusimp-appbar .mud-toolbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding-left: 10px;
  padding-right: 2px;
  overflow: visible !important;
}

/* Drawer overlay must stay below the app bar so header controls stay tappable */
.mud-overlay-drawer {
  z-index: 1200 !important;
}

.edusimp-appbar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
}

.edusimp-appbar-menu-btn {
  flex-shrink: 0;
  margin-right: 0;
}

.edusimp-appbar-logo {
  height: 28px;
  width: auto;
  max-width: min(128px, 34vw);
  object-fit: contain;
  object-position: left center;
  cursor: pointer;
  flex-shrink: 1;
  display: block;
}

.edusimp-appbar-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.edusimp-appbar-tools {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.edusimp-appbar-tool-btn,
.edusimp-appbar-login-btn,
.edusimp-lang-select-wrap {
  flex-shrink: 0;
}

/* Native select styled like the old MudMenu text activator (PL/EN/UK + arrow) */
.edusimp-lang-select-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
  margin-right: 2px;
}

.edusimp-lang-select-wrap::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 50%;
  width: 1.125rem;
  height: 1.125rem;
  transform: translateY(-50%);
  pointer-events: none;
  background-color: var(--mud-palette-primary);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.edusimp-lang-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  outline: none;
  background-color: transparent;
  color: var(--mud-palette-primary);
  font-weight: 700;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1;
  min-width: 3rem;
  min-height: 44px;
  padding: 8px 1.25rem 8px 4px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  color-scheme: light;
}

.mud-theme-dark .edusimp-lang-select {
  color-scheme: dark;
}

.edusimp-lang-select option {
  background-color: var(--mud-palette-surface);
  color: var(--mud-palette-text-primary);
}

.edusimp-lang-select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--mud-palette-primary) 55%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

.edusimp-appbar-tool-btn.mud-icon-button-root {
  width: 44px;
  height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Menu konta - większy obszar dotyku na mobile (Wyloguj / Zaloguj) */
.edusimp-account-menu-popover.mud-popover {
  z-index: 1400 !important;
}

.edusimp-account-menu-popover .mud-list-item.mud-menu-item {
  min-height: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.edusimp-account-menu-popover .mud-list-item.mud-menu-item a,
.edusimp-account-menu-popover .mud-list-item.mud-menu-item .mud-menu-item-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
}

.edusimp-appbar-login-btn.mud-icon-button-root {
  width: 44px;
  height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 599.98px) {
  .edusimp-appbar-logo {
    height: 24px;
    max-width: min(104px, 30vw);
  }
}

/* -------------------------------------------------------------------------
   Student home (/) - exam list (Safari-safe: bez MudCard flex / height:100%)
   ------------------------------------------------------------------------- */
.student-exams-status {
  min-height: 120px;
  text-align: center;
}

.student-exam-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

@media (min-width: 960px) {
  .student-exam-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 1280px) {
  .student-exam-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.student-exam-card-simple {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 280px;
  border-radius: 12px;
  border: 1px solid var(--mud-palette-lines-default);
  background: var(--mud-palette-surface);
  overflow: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.student-exam-card-simple__img {
  display: block;
  width: 100%;
  height: 160px;
  min-height: 160px;
  object-fit: cover;
  background: var(--mud-palette-background-grey);
}

.student-exam-card-simple__img--empty {
  background-image: linear-gradient(
    135deg,
    rgba(247, 148, 29, 0.28) 0%,
    var(--mud-palette-surface) 100%
  );
}

.student-exam-card-simple__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1rem 1.25rem;
  flex: 1 1 auto;
}

.student-exam-card-simple__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--mud-palette-text-primary);
}

.student-exam-card-simple__desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--mud-palette-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.student-exam-card-simple__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
  width: 100%;
}

.student-unread-banner {
  position: relative;
  z-index: 2;
}

/* Legacy Mud grid cards (Learning.razor etc.) */
.student-exam-grid.mud-grid {
  align-items: flex-start;
}

.student-exam-grid .mud-grid-item,
.student-exam-grid-item {
  display: block !important;
  width: 100%;
}

.student-exam-card.mud-card {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: auto !important;
  min-height: 280px;
  margin-bottom: 1rem;
  border-radius: 12px !important;
  border-color: var(--mud-palette-lines-default) !important;
  background: var(--mud-palette-surface) !important;
  overflow: visible !important;
}

.student-exam-desc {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Stała wysokość pasu grafiki - wszystkie kafelki wyrównane */
.student-exam-tile-media {
  height: 160px;
  min-height: 160px;
  max-height: 160px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  display: block;
}

.student-exam-tile-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.student-exam-tile-cover--visible {
  opacity: 1;
}

.student-exam-tile-media--empty {
  background-color: var(--mud-palette-background-grey);
  background-image: linear-gradient(
    135deg,
    rgba(247, 148, 29, 0.28) 0%,
    var(--mud-palette-surface) 100%
  ) !important;
}

.student-exam-tile-overlay {
  min-height: 100%;
  height: 100%;
  padding: 16px;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.2) 55%, transparent 100%);
  box-sizing: border-box;
}

/* Blok opisu zajmuje resztę wysokości; krótsze opisy nie skracają karty */
.student-exam-card-body.mud-card-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 6.25rem;
}

.student-exam-tile-title {
  color: var(--mud-palette-text-primary) !important;
  line-height: 1.35;
}

/* Grafiki w egzaminie - utrudnienie „Otwórz w nowej karcie” / przeciągnięcia pliku */
.edusimp-protected-exam-image {
  user-select: none;
  -webkit-user-select: none;
}

.edusimp-protected-exam-image img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

.edusimp-question-image-frame {
  position: relative;
  display: block;
  width: 100%;
  min-height: 120px;
  background: var(--mud-palette-background-grey);
  border-radius: 8px;
  overflow: hidden;
}

.edusimp-question-image-loader {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--mud-palette-background-grey);
  pointer-events: none;
}

.edusimp-question-image-loader__spinner {
  width: 2.25rem;
  height: 2.25rem;
  display: block;
  border: 3px solid rgba(15, 23, 42, 0.15);
  border-top-color: var(--mud-palette-primary, #1976d2);
  border-radius: 50%;
  animation: edusimp-question-image-spin 0.7s linear infinite;
}

@keyframes edusimp-question-image-spin {
  to { transform: rotate(360deg); }
}

.edusimp-question-image-loader__text {
  font-size: 0.8rem;
  color: var(--mud-palette-text-secondary);
}

.exam-question-img-simple--loading {
  opacity: 0 !important;
}

.exam-question-img-simple--ready {
  opacity: 1 !important;
  transition: opacity 0.25s ease;
}

.edusimp-question-image-zoom-btn {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff !important;
  background: rgba(15, 23, 42, 0.82) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  -webkit-appearance: none;
  appearance: none;
}

.edusimp-question-image-zoom-btn__icon {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.edusimp-question-image-frame:hover .edusimp-question-image-zoom-btn,
.edusimp-question-image-zoom-btn:focus-visible {
  opacity: 1 !important;
  background: rgba(15, 23, 42, 0.92) !important;
}

.edusimp-question-image-zoom-btn:hover,
.edusimp-question-image-zoom-btn:focus-visible {
  background: rgba(15, 23, 42, 0.95) !important;
}

.edusimp-question-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  background: rgba(0, 0, 0, 0.96);
  overscroll-behavior: none;
  isolation: isolate;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

html.edusimp-lightbox-open {
  overflow: hidden;
  overscroll-behavior: none;
}

html.edusimp-lightbox-open .exam-practice-next-bar,
html.edusimp-lightbox-open .exam-sim-running-sticky-wrap,
html.edusimp-lightbox-open .exam-session-sticky-back,
html.edusimp-lightbox-open .exam-sim-ended-review-sticky-top {
  visibility: hidden !important;
  pointer-events: none !important;
}

.edusimp-question-image-lightbox__stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y pinch-zoom;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.75rem 0.75rem max(1rem, env(safe-area-inset-bottom, 0px));
  padding-top: max(3.75rem, calc(env(safe-area-inset-top, 0px) + 3rem));
  box-sizing: border-box;
}

.edusimp-question-image-lightbox__close {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  -webkit-tap-highlight-color: transparent;
}

.edusimp-question-image-lightbox__close:hover,
.edusimp-question-image-lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.24);
}

.edusimp-question-image-lightbox__img {
  display: block;
  max-width: min(100%, calc(100vw - 1.5rem));
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: pan-x pan-y pinch-zoom;
}

@media (min-width: 960px) {
  .edusimp-question-image-zoom-btn {
    width: 2.5rem;
    height: 2.5rem;
  }

  .edusimp-question-image-lightbox__stage {
    padding: 4rem 1.5rem 1.5rem;
  }

  .edusimp-question-image-lightbox__img {
    max-width: min(100%, calc(100vw - 3rem));
    max-height: calc(100vh - 5rem);
    cursor: zoom-out;
  }
}

.edusimp-loading-image {
  position: relative;
  display: block;
  width: 100%;
}

.edusimp-loading-image__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  background: var(--mud-palette-background-grey, #f5f5f5);
}

.edusimp-loading-image__placeholder--tile {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 0;
}

.edusimp-loading-image__placeholder--overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 0;
  pointer-events: none;
  background: var(--mud-palette-background-grey, #f5f5f5);
}

.edusimp-loading-image__placeholder--inline {
  min-height: 120px;
  border-radius: 8px;
}

.edusimp-loading-image__spinner {
  display: block;
}

.edusimp-loading-image__img,
.exam-learning-inline-img,
.exam-learning-inline-video {
  display: block;
  width: 100%;
  opacity: 1;
}

.edusimp-loading-image__img--visible,
.exam-learning-inline-media--visible {
  opacity: 1;
}

.edusimp-loading-image__img--failed {
  opacity: 0.35;
}

.edusimp-loading-inline-media--video .edusimp-loading-image__placeholder--inline {
  min-height: 180px;
}

.mud-card-actions.student-exam-card-actions {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  margin-top: auto;
}

.student-exam-card-actions .mud-stack {
  width: 100%;
}

.student-exam-card-actions .mud-button-root {
  width: 100%;
  justify-content: center;
}

.student-exam-card:hover {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08) !important;
}

.mud-theme-dark .student-exam-card:hover {
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.35) !important;
}

.student-mode-card {
  border-radius: 12px !important;
  border-top: 3px solid var(--mud-palette-primary) !important;
  background: var(--mud-palette-surface);
}

.student-home-empty-exams {
  border-radius: 12px;
  border: 1px dashed var(--mud-palette-lines-default);
  background: var(--mud-palette-background-grey);
}

.student-guest-hero {
  border-radius: 12px;
  border-top: 3px solid var(--mud-palette-primary);
}

.student-guest-actions {
  width: 100%;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* Pliki kursu - pas nad spisem treści (nauka) */
.exam-learning-files-rail,
.exam-learning-links-rail {
  border-radius: 20px;
  background: var(--mud-palette-surface);
  border: 1px solid var(--mud-palette-lines-default);
}

.exam-learning-link-tile {
  border-radius: 16px;
  flex: 1 1 280px;
  max-width: min(100%, 520px);
}

.exam-learning-files-rail-inner {
  width: 100%;
}

.exam-learning-file-tile {
  border-radius: 16px;
  flex: 1 1 240px;
  max-width: min(100%, 520px);
}

@media (max-width: 599.98px) {
  .exam-learning-file-tile {
    max-width: 100%;
  }
}

/* Materiały do nauki - czytelna treść, spójne karty, mobile: karuzela + pasek na dole */
.exam-learning-page {
  width: 100%;
  max-width: min(100vw, 1280px);
}

@media (max-width: 959.98px) {
  .exam-learning-page.exam-learning-page--with-bottom-nav {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (max-width: 959.98px) {
  .exam-learning-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1090;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) 12px;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.07);
  }
}

.exam-learning-mobile-nav-inner {
  width: 100%;
  max-width: min(100vw, 1280px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.exam-learning-mobile-nav-meta {
  min-height: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.exam-learning-nav-btn {
  flex-shrink: 0;
}

.exam-learning-viewer-title {
  line-height: 1.25;
  word-break: break-word;
  letter-spacing: -0.02em;
}

.exam-learning-hero,
.exam-learning-library {
  border-radius: 20px;
}

.exam-learning-viewer {
  border-radius: 20px;
  overflow: hidden;
}

.exam-learning-hero {
  overflow: hidden;
  border: 1px solid var(--mud-palette-lines-default);
  background: var(--mud-palette-surface);
  background: radial-gradient(
      120% 80% at 100% 0%,
      color-mix(in srgb, var(--mud-palette-primary) 14%, transparent),
      transparent 55%
    ),
    var(--mud-palette-surface);
}

.exam-learning-library {
  background: var(--mud-palette-surface);
}

.exam-learning-viewer {
  background: var(--mud-palette-surface);
  border: 1px solid var(--mud-palette-lines-default);
}

.exam-learning-layout {
  align-items: stretch;
}

@media (min-width: 960px) {
  .exam-learning-layout {
    align-items: flex-start;
  }
}

.exam-learning-card {
  border-radius: 16px;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    background-color 180ms ease;
  min-height: 52px;
}

@media (max-width: 959.98px) {
  .exam-learning-library {
    position: relative;
    margin-bottom: 14px !important;
    border-radius: 20px !important;
  }

  .exam-learning-mat-stack {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 12px !important;
    padding: 4px 2px 10px;
    margin-inline: -2px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--mud-palette-primary) 35%, transparent) transparent;
  }

  .exam-learning-mat-stack > .mud-paper {
    flex: 0 0 min(82vw, 280px);
    max-width: min(82vw, 280px);
    scroll-snap-align: start;
  }

  .exam-learning-mat-stack .exam-learning-card {
    padding: 14px !important;
  }

  .exam-learning-viewer {
    border-radius: 20px !important;
  }

  .exam-learning-empty-preview {
    min-height: 200px;
  }

  .exam-learning-frame {
    min-height: 48vh;
  }

  .exam-learning-frame--file {
    min-height: 70vh;
  }
}

.exam-learning-desktop-nav {
  gap: 4px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--mud-palette-background-grey);
  border: 1px solid var(--mud-palette-lines-default);
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.exam-learning-desktop-nav-btn.mud-icon-button {
  border-radius: 999px !important;
}

@media (min-width: 960px) {
  .exam-learning-desktop-nav {
    max-width: 360px;
  }
}

.exam-learning-embed {
  border-radius: 16px;
  overflow: hidden;
  line-height: 0;
  border: 1px solid var(--mud-palette-lines-default);
  background: var(--mud-palette-background-grey);
}

.exam-learning-card:hover {
  transform: translateY(-2px);
  border-color: var(--mud-palette-primary);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.exam-learning-card--active {
  border-color: var(--mud-palette-primary) !important;
  background: rgba(25, 118, 210, 0.07);
  box-shadow: 0 0 0 1px rgba(25, 118, 210, 0.22);
}

.exam-learning-card-title {
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
}

.exam-learning-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.exam-learning-icon--video {
  color: #c62828;
  background: rgba(198, 40, 40, 0.12);
}

.exam-learning-icon--link {
  color: var(--mud-palette-primary);
  background: rgba(25, 118, 210, 0.12);
}

.exam-learning-icon--pdf {
  color: #b71c1c;
  background: rgba(183, 28, 28, 0.12);
}

.exam-learning-icon--image {
  color: #2e7d32;
  background: rgba(46, 125, 50, 0.12);
}

.exam-learning-icon--file {
  color: #455a64;
  background: rgba(69, 90, 100, 0.12);
}

.exam-learning-icon--inline {
  color: #5e35b1;
  background: rgba(94, 53, 177, 0.12);
}

.exam-learning-inline-body {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: none;
  overflow-y: visible;
  padding: 6px 4px;
  font-size: clamp(1rem, 0.35vw + 0.95rem, 1.125rem);
  line-height: 1.65;
  letter-spacing: 0.01em;
  color: var(--mud-palette-text-primary);
}

@media (min-width: 960px) {
  .exam-learning-inline-body {
    font-size: 1.0625rem;
    line-height: 1.7;
    padding: 8px 6px;
  }
}

.exam-learning-inline-body-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 960px) {
  .exam-learning-inline-body-root {
    gap: 1.25rem;
  }
}

.exam-learning-inline-img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

.exam-learning-inline-video {
  width: 100%;
  max-height: min(78vh, 720px);
  border-radius: 12px;
  background: #000;
}

.exam-learning-empty-preview {
  min-height: 280px;
  border: 1px dashed var(--mud-palette-lines-default);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--mud-palette-background-grey);
}

@media (min-width: 960px) {
  .exam-learning-empty-preview {
    min-height: 360px;
  }
}

.exam-learning-frame {
  width: 100%;
  min-height: min(68vh, 760px);
  border: 0;
  border-radius: 14px;
  background: var(--mud-palette-background-grey);
}

.exam-learning-frame--file {
  min-height: min(82vh, 920px);
}

.exam-learning-file-embed {
  user-select: none;
}

.exam-learning-file-img {
  margin: 0 auto;
}

.exam-learning-file-preview-loading {
  min-height: min(60vh, 480px);
  border: 1px dashed var(--mud-palette-lines-default);
  border-radius: 16px;
  background: var(--mud-palette-background-grey);
}

.exam-answer-button {
  justify-content: flex-start !important;
  padding: 0 !important;
  overflow: hidden;
  height: auto !important;
  min-height: 52px;
  width: 100% !important;
  max-width: 100% !important;
  white-space: normal !important;
}

.exam-answer-button.mud-button-root {
  white-space: normal !important;
}

.exam-answer-button .mud-button-label {
  width: 100%;
  display: grid !important;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
  white-space: normal !important;
  text-align: left;
}

.exam-answer-option {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  align-items: stretch;
  text-align: left;
}

.exam-answer-letter {
  flex: 0 0 56px;
  width: 56px;
  min-width: 56px;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--mud-palette-text-primary);
  background-color: rgba(127, 127, 127, 0.14);
  border-right: 2px solid var(--mud-palette-lines-default);
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  line-height: 1.1;
}

.exam-answer-letter--user-correct {
  background-color: var(--mud-palette-success) !important;
  color: var(--mud-palette-success-text, #fff) !important;
  border-right-color: rgba(0, 0, 0, 0.12) !important;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.exam-answer-letter--user-wrong {
  background-color: var(--mud-palette-error) !important;
  color: var(--mud-palette-error-text, #fff) !important;
  border-right-color: rgba(0, 0, 0, 0.12) !important;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.exam-result-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  height: 2.35rem;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 12px;
  flex-shrink: 0;
  background-color: rgba(127, 127, 127, 0.14);
  border: 1px solid var(--mud-palette-lines-default);
}

.exam-result-letter--user-correct {
  background-color: var(--mud-palette-success);
  color: var(--mud-palette-success-text, #fff);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.38);
}

.exam-result-letter--user-wrong {
  background-color: var(--mud-palette-error);
  color: var(--mud-palette-error-text, #fff);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.38);
}

.exam-answer-text {
  display: block;
  padding: 10px 14px;
  min-height: 52px;
  min-width: 0;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  overflow: hidden;
}

/* Safari-safe answer buttons (plain HTML - bez MudButton grid) */
.exam-answer-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.exam-answer-btn-simple {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 8px;
  background: var(--mud-palette-surface);
  color: var(--mud-palette-text-primary);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.exam-answer-btn-simple:disabled {
  cursor: default;
  opacity: 1;
}

.exam-answer-btn-simple--selected {
  border-color: #F7941D;
  background: rgba(247, 148, 29, 0.18);
  box-shadow: inset 0 0 0 1px #F7941D;
}

.exam-answer-btn-simple--reveal-correct {
  background-color: rgba(46, 125, 50, 0.22);
  border: 2px solid #2e7d32;
}

.exam-answer-btn-simple--reveal-wrong {
  background-color: rgba(211, 47, 47, 0.2);
  border: 2px solid #c62828;
}

.exam-answer-btn-simple__letter {
  flex: 0 0 56px;
  width: 56px;
  min-width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--mud-palette-text-primary);
  background-color: rgba(127, 127, 127, 0.14);
  border-right: 2px solid var(--mud-palette-lines-default);
}

.exam-answer-btn-simple__letter--correct {
  background-color: var(--mud-palette-success) !important;
  color: #fff !important;
}

.exam-answer-btn-simple__letter--wrong {
  background-color: var(--mud-palette-error) !important;
  color: #fff !important;
}

.exam-answer-btn-simple__text {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  color: var(--mud-palette-text-primary);
  /* Redmi/Chrome: unikaj „zlepku” starego + nowego tekstu przy patchu DOM */
  contain: content;
}

.exam-question-img-wrap {
  width: 100%;
}

.exam-question-img-simple {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 120px;
  max-height: 50vh;
  object-fit: contain !important;
  border-radius: 8px;
  background: var(--mud-palette-background-grey);
  visibility: visible !important;
}

.exam-question-img-simple.exam-question-img-simple--loading {
  opacity: 0 !important;
}

.exam-question-img-simple.exam-question-img-simple--ready {
  opacity: 1 !important;
}

/* Symulacja egzaminu - pełna szerokość kolumny (fixed HUD nie może „zwinąć” rodzica) */
.exam-sim-root {
  width: 100%;
  max-width: 520px;
  box-sizing: border-box;
}

.exam-sim-running-session {
  width: 100%;
  max-width: 100%;
}

.exam-sim-running-hud-spacer {
  display: none;
  width: 100%;
}

.exam-sim-running-scroll {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.admin-main-content:has(.exam-sim-running-session) > .mud-container {
  width: 100%;
  max-width: 100%;
}

.exam-sim-question-text {
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

.exam-sim-timer-value {
  font-size: clamp(1.45rem, 5vw, 2.75rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: var(--mud-palette-text-primary);
}

/* Podgląd wyników egzaminu: filtry jako jeden segmentowany przełącznik */
.exam-sim-ended-review-filter-row {
  width: 100%;
}

.exam-sim-review-filter-segmented {
  display: flex;
  width: 100%;
  align-items: stretch;
  border-radius: 14px;
  border: 1px solid var(--mud-palette-lines-default);
  background-color: var(--mud-palette-background-grey);
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.exam-sim-review-filter-segmented .mud-tooltip-root {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.mud-theme-dark .exam-sim-review-filter-segmented {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.exam-sim-review-filter-seg {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
  transition: background-color 0.15s ease;
}

.exam-sim-review-filter-seg:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 12%;
  bottom: 12%;
  width: 1px;
  background-color: var(--mud-palette-table-lines);
  pointer-events: none;
}

.exam-sim-review-filter-seg--active.exam-sim-review-filter-seg--all {
  background-color: color-mix(in srgb, var(--mud-palette-primary) 20%, var(--mud-palette-surface));
}

.exam-sim-review-filter-seg--active.exam-sim-review-filter-seg--correct {
  background-color: color-mix(in srgb, var(--mud-palette-success) 22%, var(--mud-palette-surface));
}

.exam-sim-review-filter-seg--active.exam-sim-review-filter-seg--wrong {
  background-color: color-mix(in srgb, var(--mud-palette-error) 20%, var(--mud-palette-surface));
}

.exam-sim-review-filter-segmented .exam-sim-review-filter-hit.mud-icon-button {
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
  flex: 1;
}

.exam-sim-review-filter-segmented .exam-sim-review-filter-hit .mud-icon-root {
  font-size: 1.4rem;
}

/* Exam simulation (running): desktop - zwykły układ, bez sticky wrappera */
@media (min-width: 960px) {
  .exam-sim-running-sticky-wrap {
    position: static;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .exam-sim-running-sticky-home {
    margin-bottom: 8px;
    padding-left: 0;
  }

  .exam-sim-running-hud {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .exam-sim-hud-timer-block {
    width: 100%;
  }
}

@media (max-width: 959.98px) {
  .exam-sim-root:has(.exam-sim-running-session) {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/*
  Telefon: HUD (wróć + timer + licznik) - position: fixed zamiast sticky,
  żeby uniknąć przesunięć o ~1 px przy scrollu (subpiksele / przeliczenia sticky).
*/
@media (max-width: 959.98px) {
  .exam-sim-running-sticky-wrap {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(64px + env(safe-area-inset-top, 0px));
    z-index: 13;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 6px 12px 8px;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    background-color: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  }

  .exam-sim-running-sticky-wrap > .exam-sim-running-sticky-home,
  .exam-sim-running-sticky-wrap > .exam-sim-running-hud {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }

  .mud-theme-dark .exam-sim-running-sticky-wrap {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
  }

  .exam-sim-running-sticky-home {
    margin-bottom: 2px;
    padding-left: 2px;
  }

  .exam-sim-running-sticky-home .exam-sim-sticky-home-btn {
    margin: 0 !important;
    padding-left: 4px !important;
    padding-right: 10px !important;
    min-height: 38px !important;
    font-weight: 600;
    text-transform: none;
  }

  .exam-sim-running-hud {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding-bottom: 4px;
  }

  .exam-sim-hud-timer-block {
    grid-column: 2;
    justify-self: center;
    width: 100%;
    max-width: 160px;
    min-width: 0;
  }

  .exam-sim-hud-timer-block .exam-timer-wrap {
    margin-bottom: 0 !important;
    padding: 4px 8px !important;
    border-radius: 10px !important;
    box-shadow: none !important;
  }

  .exam-sim-running-hud .exam-sim-timer-label {
    font-size: 0.6rem !important;
    line-height: 1.15;
    margin-bottom: 0 !important;
  }

  .exam-sim-running-hud .exam-sim-timer-value {
    font-size: 1.45rem !important;
    line-height: 1.1 !important;
  }

  .exam-sim-running-hud .exam-sim-q-progress {
    grid-column: 3;
    justify-self: end;
    font-size: 0.76rem !important;
    font-weight: 700;
    margin: 0 !important;
    white-space: nowrap;
    text-align: right;
    line-height: 1.2;
  }

  .exam-sim-running-back {
    margin-top: 2px;
    margin-bottom: 0;
  }

  .exam-sim-running-back .mud-button-root {
    min-height: 40px;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }

  .exam-sim-running-hud-spacer {
    display: block;
    width: 100%;
    height: 6.875rem;
    flex-shrink: 0;
    pointer-events: none;
    visibility: hidden;
  }

  .exam-sim-running-session > .exam-sim-running-scroll.exam-practice-scroll {
    padding-top: 0;
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px) + 16px);
  }

  .exam-sim-running-session .exam-practice-next-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 14;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 0 max(10px, env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12);
  }

  .exam-sim-running-session .exam-practice-next-bar-inner {
    max-width: 520px;
    margin: 0 auto;
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* „Wstecz” w sesji ćwiczeń / egzaminu: przyklejone pod MudAppBar przy przewijaniu (mobile; na desktopie pełny sticky tam, gdzie ma sens) */
.exam-session-sticky-back {
  position: sticky;
  top: calc(64px + env(safe-area-inset-top, 0px) + 4px);
  z-index: 13;
  margin-left: -12px;
  margin-right: -12px;
  margin-bottom: 12px;
  padding: 6px 12px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  background-color: var(--mud-palette-surface);
  border-bottom: 1px solid var(--mud-palette-lines-default);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.mud-theme-dark .exam-session-sticky-back {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.exam-session-sticky-back .exam-session-back-btn {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.exam-practice-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.exam-practice-topbar .exam-session-back-btn {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
}

.exam-practice-shuffle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.exam-practice-shuffle__check {
  margin: 0 !important;
}

.exam-practice-shuffle__check .mud-typography {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Wynik egzaminu: ramka wokół przycisku powrotu na stronę główną */
.exam-sim-results-home-btn.mud-button-root {
  border: 2px solid var(--mud-palette-lines-default) !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  font-weight: 600 !important;
  text-transform: none !important;
  background-color: var(--mud-palette-surface) !important;
}

.mud-theme-dark .exam-sim-results-home-btn.mud-button-root {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

@media (min-width: 600px) {
  .exam-session-sticky-back--flat-md {
    position: static;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 12px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }
}

.exam-practice-q-number {
  margin-right: 0.35em;
  font-variant-numeric: tabular-nums;
}

.exam-practice-jump {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.exam-practice-jump__input {
  flex: 1 1 auto;
  min-width: 0;
}

.exam-practice-jump__btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Szukajka: środkowy przycisk (PC + mobile) + panel z prawej */
.exam-practice-jump--desktop {
  display: none !important;
}

.exam-practice-jump-nav-btn {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  width: 52px !important;
  min-width: 52px !important;
  max-width: 52px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.exam-practice-jump-drawer {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.exam-practice-jump-drawer--open {
  pointer-events: auto;
}

.exam-practice-jump-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.exam-practice-jump-drawer--open .exam-practice-jump-drawer__backdrop {
  opacity: 1;
}

.exam-practice-jump-drawer__panel {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top, 0px));
  right: 0;
  bottom: 0;
  width: min(86vw, 320px);
  box-sizing: border-box;
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--mud-palette-surface);
  border-left: 1px solid var(--mud-palette-lines-default);
  border-top: 1px solid var(--mud-palette-lines-default);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.exam-practice-jump-drawer--open .exam-practice-jump-drawer__panel {
  transform: translateX(0);
}

.exam-practice-jump-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.exam-practice-jump--drawer {
  align-items: stretch;
  flex-direction: column;
}

.exam-practice-jump--drawer .exam-practice-jump__btn {
  width: 100%;
}

/* Mobile: środkowy przycisk Szukaj + panel z prawej (style wspólne powyżej) */
@media (max-width: 599.98px) {
  .exam-practice-jump--desktop {
    display: none !important;
  }
}

/* Tryb ćwiczeń: na telefonie przycisk „Następne pytanie” przyklejony do dołu ekranu (nie ucieka przy przewijaniu) */
@media (max-width: 599.98px) {
  .exam-practice-scroll {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 16px);
  }

  /* Podgląd po egzaminie: tylko filtry - fixed pod app barem; Powrót / Ponownie w dolnym pasku */
  .exam-sim-ended-review-sticky-top {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(64px + env(safe-area-inset-top, 0px));
    z-index: 13;
    box-sizing: border-box;
    padding: 6px 12px 8px;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    background-color: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  .mud-theme-dark .exam-sim-ended-review-sticky-top {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  }

  .exam-sim-ended-review-sticky-top .exam-sim-ended-review-sticky-inner {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }

  .exam-sim-ended-review-session > .exam-sim-ended-review-scroll.exam-practice-scroll {
    padding-top: 4.5rem;
    /* Dwa przyciski nawigacji jeden pod drugim - więcej miejsca nad dolnym paskiem */
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px) + 14px);
  }

  .exam-sim-ended-review-nav-stack {
    width: 100%;
    align-items: stretch;
  }

  .exam-sim-ended-review-nav-stack .exam-sim-ended-review-nav-btn {
    width: 100%;
  }

  .exam-practice-next-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 14;
    padding: 10px 0 max(10px, env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12);
  }

  .mud-theme-dark .exam-practice-next-bar {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
  }

  .exam-practice-next-bar-inner {
    max-width: 520px;
    margin: 0 auto;
    padding-left: 12px;
    padding-right: 12px;
  }

  .exam-practice-next-bar.exam-sim-ended-review-nav-bar {
    padding: 8px 0 max(10px, env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .exam-practice-next-bar.exam-sim-ended-review-nav-bar .exam-sim-ended-review-nav-btn.mud-button-root {
    min-height: 46px !important;
    font-size: 0.9375rem !important;
    line-height: 1.25 !important;
    font-weight: 600 !important;
    text-transform: none !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }
}

@media (min-width: 960px) {
  .exam-sim-running-session > .exam-sim-running-scroll.exam-practice-scroll {
    padding-top: 0;
    padding-bottom: 0;
  }

  .exam-sim-running-session .exam-practice-next-bar {
    position: static;
    width: auto;
    max-width: none;
    padding: 0;
    margin: 0;
    margin-top: 1.5rem;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .exam-sim-running-session .exam-practice-next-bar-inner {
    padding: 0;
    max-width: none;
  }
}

@media (min-width: 600px) {
  .exam-practice-next-bar {
    position: static;
    padding: 0;
    margin: 0;
    margin-top: 1.5rem;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .exam-practice-next-bar-inner {
    padding: 0;
    max-width: none;
  }

  .exam-practice-scroll {
    padding-bottom: 0;
  }

  .exam-sim-ended-review-session > .exam-sim-ended-review-scroll.exam-practice-scroll {
    padding-top: 0;
    padding-bottom: 0;
  }

  .exam-sim-ended-review-sticky-top {
    position: static;
    margin: 0 0 12px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
  }

  .exam-practice-next-bar.exam-sim-ended-review-nav-bar .exam-sim-ended-review-nav-btn.mud-button-root {
    min-height: 46px !important;
    font-size: 0.9375rem !important;
    line-height: 1.25 !important;
    font-weight: 600 !important;
    text-transform: none !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }
}

/* Dialog: dodawanie / edycja pytania / egzaminu (admin) - przewijana treść, stałe Anuluj/Zapisz */
.admin-question-dialog,
.admin-exam-dialog {
  width: calc(100vw - 1.5rem) !important;
  max-width: calc(100vw - 1.5rem) !important;
  max-height: calc(100dvh - 1.5rem) !important;
  margin: 0.75rem !important;
  display: flex !important;
  flex-direction: column !important;
}

.admin-question-dialog .mud-dialog-title,
.admin-exam-dialog .mud-dialog-title {
  flex: 0 0 auto;
}

.admin-question-dialog .mud-dialog-content,
.admin-exam-dialog .mud-dialog-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100dvh - 11rem);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-exam-dialog-body,
.admin-question-dialog-body {
  width: 100%;
}

.admin-exam-dialog .mud-dialog-actions,
.admin-question-dialog .mud-dialog-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 !important;
  background-color: var(--mud-palette-surface);
  border-top: 1px solid var(--mud-palette-lines-default);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

.admin-exam-dialog-actions,
.admin-question-dialog-actions {
  padding: 12px 24px 18px !important;
}

.mud-theme-dark .admin-exam-dialog .mud-dialog-actions,
.mud-theme-dark .admin-question-dialog .mud-dialog-actions {
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.32);
}

@media (max-width: 599.98px) {
  .admin-question-dialog .mud-dialog-content {
    max-height: calc(100dvh - 9.5rem);
  }

  .admin-question-dialog-body {
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: 12px !important;
  }

  .admin-question-main-toggle {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 10px;
    border: 1px solid var(--mud-palette-lines-default);
    background: color-mix(in srgb, var(--mud-palette-surface) 92%, var(--mud-palette-primary) 8%);
  }

  .admin-question-main-toggle .mud-checkbox {
    align-items: flex-start;
  }

  .admin-question-main-toggle .mud-typography-caption {
    margin-bottom: 0 !important;
  }

  .admin-question-lang-tabs .mud-tabs-tabbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .admin-question-lang-tabs .mud-tabs-tabbar::-webkit-scrollbar {
    display: none;
  }

  .admin-question-lang-tabs .mud-tab {
    flex: 0 0 auto;
    min-width: max-content;
    font-size: 0.8125rem;
    padding-left: 10px;
    padding-right: 10px;
  }

  .admin-question-lang-panel {
    padding: 12px !important;
  }

  .admin-question-dialog-body .mud-tab-panel > .d-flex.justify-end {
    justify-content: stretch !important;
    margin-bottom: 8px !important;
  }

  .admin-question-dialog-body .mud-tab-panel > .d-flex.justify-end .mud-button-root {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .admin-question-answers-grid .admin-question-answer-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    background: var(--mud-palette-background);
  }

  .admin-question-answers-grid .admin-question-answer-row .mud-checkbox {
    align-self: flex-start;
    margin: 0;
    min-height: 44px;
  }

  .admin-question-answers-grid .admin-question-answer-row .mud-input-control,
  .admin-question-answers-grid .admin-question-answer-row .mud-input-root {
    width: 100%;
  }

  .admin-question-image-section {
    margin-top: 1.25rem !important;
  }

  .admin-question-image-dropzone {
    min-height: 108px !important;
    height: auto !important;
  }

  .admin-question-image-dropzone .mud-typography-body2 {
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  .admin-question-image-preview {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }

  .admin-question-image-preview .mud-image,
  .admin-question-image-preview img {
    display: block;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    max-height: 220px;
    margin-right: 0 !important;
    object-fit: contain;
  }

  .admin-question-image-preview .mud-button-root {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .admin-question-dialog-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 10px !important;
  }

  .admin-question-dialog-actions .admin-question-dialog-action-btn.mud-button-root {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    margin: 0 !important;
  }
}

/* Dialog: dodawanie / edycja użytkownika (admin) */
.admin-user-dialog {
  width: calc(100vw - 1.5rem) !important;
  max-width: calc(100vw - 1.5rem) !important;
  max-height: calc(100dvh - 1.5rem) !important;
  margin: 0.75rem !important;
  display: flex !important;
  flex-direction: column !important;
}

.admin-user-dialog .mud-dialog-title {
  flex: 0 0 auto;
}

.admin-user-dialog .mud-dialog-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 !important;
}

.admin-user-dialog-body {
  width: 100%;
}

.admin-user-dialog .mud-dialog-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 !important;
  background-color: var(--mud-palette-surface);
  border-top: 1px solid var(--mud-palette-lines-default);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

.admin-user-dialog-actions {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  width: 100%;
  box-sizing: border-box;
}

.mud-theme-dark .admin-user-dialog .mud-dialog-actions {
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.32);
}

@media (max-width: 599.98px) {
  .admin-user-dialog-actions .admin-user-dialog-action-btn.mud-button-root {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
}

/* Dialog: dodawanie / edycja grupy (admin) */
.admin-group-dialog {
  width: calc(100vw - 1.5rem) !important;
  max-width: calc(100vw - 1.5rem) !important;
  max-height: calc(100dvh - 1.5rem) !important;
  margin: 0.75rem !important;
  display: flex !important;
  flex-direction: column !important;
}

.admin-group-dialog .mud-dialog-title {
  flex: 0 0 auto;
}

.admin-group-dialog .mud-dialog-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 !important;
}

.admin-group-dialog-body {
  width: 100%;
}

.admin-group-dialog .mud-dialog-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 !important;
  background-color: var(--mud-palette-surface);
  border-top: 1px solid var(--mud-palette-lines-default);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

.admin-group-dialog-actions {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  width: 100%;
  box-sizing: border-box;
}

.mud-theme-dark .admin-group-dialog .mud-dialog-actions {
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.32);
}

@media (max-width: 599.98px) {
  .admin-group-dialog-actions .admin-group-dialog-action-btn.mud-button-root {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
}

/* Dialog: przypisanie dostępu do egzaminu (admin) */
.exam-permissions-mud-dialog .mud-dialog-content {
  overflow-x: hidden;
}

.exam-permissions-dialog-inner {
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.exam-permissions-dialog-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}

.exam-permissions-search-field {
  width: 100%;
  max-width: 280px;
}

.exam-permissions-table-wrap {
  border: 1px solid var(--mud-palette-lines-default);
  background: var(--mud-palette-surface);
}

.exam-permissions-table .exam-perm-col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.exam-perm-actions-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.exam-permissions-add-panel {
  background: var(--mud-palette-surface);
}

.exam-permissions-add-submit {
  min-height: 44px;
  text-transform: none;
  font-weight: 600;
}

.exam-permissions-pick-search,
.exam-permissions-group-search {
  width: 100%;
}

.exam-permissions-pick-list,
.exam-permissions-group-pick-list {
  max-height: min(42vh, 360px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 8px;
  background: var(--mud-palette-background);
}

.exam-permissions-pick-row,
.exam-permissions-group-pick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--mud-palette-lines-default);
}

.exam-permissions-pick-row:last-child,
.exam-permissions-group-pick-row:last-child {
  border-bottom: none;
}

.exam-permissions-pick-info,
.exam-permissions-group-pick-info {
  flex: 1 1 auto;
  min-width: 0;
}

.user-group-pick-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.user-group-pick-row:hover {
  background-color: rgba(127, 127, 127, 0.08);
}

.user-group-pick-row-selected {
  background-color: rgba(247, 148, 29, 0.1);
}

.user-group-pick-row-selected:hover {
  background-color: rgba(247, 148, 29, 0.14);
}

@media (max-width: 599.98px) {
  .exam-permissions-search-field {
    max-width: none;
  }

  /* Dialog dostępu - paginacja w kafelku, strzałki nie wystają (PC bez zmian) */
  .exam-permissions-table-wrap .mud-table-pagination {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-table-lines);
    border-radius: 0 0 var(--mud-default-borderradius, 8px) var(--mud-default-borderradius, 8px);
    box-sizing: border-box;
  }

  .exam-permissions-table-wrap .mud-table-pagination-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px 4px !important;
    padding: 8px 10px 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0 !important;
  }

  .exam-permissions-table-wrap .mud-table-pagination-spacer {
    display: none !important;
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
  }

  .exam-permissions-table-wrap .mud-table-pagination-caption {
    flex: 1 1 100% !important;
    width: 100% !important;
    text-align: center !important;
    order: -2;
    margin: 0 !important;
    padding: 0 4px !important;
  }

  .exam-permissions-table-wrap .mud-table-pagination-toolbar .mud-select {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    order: -1;
    justify-content: center;
    margin: 0 !important;
  }

  .exam-permissions-table-wrap .mud-table-pagination-toolbar .mud-input-control,
  .exam-permissions-table-wrap .mud-table-pagination-toolbar .mud-input-control-input-container {
    max-width: 100%;
  }

  .exam-permissions-table-wrap .mud-table-pagination .mud-icon-button,
  .exam-permissions-table-wrap .mud-table-pagination .mud-tooltip-root .mud-icon-button {
    flex: 0 0 auto;
    flex-shrink: 0;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 6px !important;
    margin: 0 !important;
  }
}

@media (max-width: 959.98px) {
  /* Dialog dostępu do egzaminu - mobile/tablet: klasyczne tabele z wierszami (PC bez zmian) */
  .exam-permissions-table-wrap,
  .exam-permissions-pick-table-wrap {
    overflow-x: visible;
    overflow-y: visible;
  }

  .exam-permissions-table-wrap .mud-table-root,
  .exam-permissions-table-wrap .mud-table,
  .exam-permissions-pick-table-wrap .mud-table-root,
  .exam-permissions-pick-table-wrap .mud-table {
    overflow: hidden;
    border-radius: var(--mud-default-borderradius, 8px);
    max-width: 100%;
  }

  .exam-permissions-table-wrap .mud-table-container,
  .exam-permissions-pick-table-wrap .mud-table-container {
    overflow-x: auto !important;
    overflow-y: auto;
    max-width: 100%;
    width: 100%;
    max-height: min(42vh, 360px);
    -webkit-overflow-scrolling: touch;
  }

  .exam-permissions-table-wrap .exam-permissions-table table {
    min-width: 28rem;
  }

  .exam-permissions-pick-table-wrap .exam-permissions-user-pick-table table {
    min-width: 34rem;
  }

  .exam-permissions-pick-table-wrap .exam-permissions-group-pick-table table {
    min-width: 30rem;
  }

  .exam-permissions-pick-table-wrap {
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background);
  }
}

/* Kolumna e-mail na wąsko: ukrywana w Users.razor (IBreakpointService), nie przez nth-child - inaczej po usunięciu e-mail z DOM nth-child(3) trafia w „Rolę”. */

/* Admin - materiały do nauki */
.admin-materials-exam-card {
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.admin-materials-exam-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.admin-materials-section {
  border-radius: 16px;
  overflow: hidden;
}

.admin-materials-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.admin-materials-main {
  min-width: 0;
}

.admin-materials-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.admin-materials-sidebar-block {
  background: var(--mud-palette-background-grey);
}

.admin-materials-pages-scroll {
  max-height: none;
  overflow: visible;
}

@media (min-width: 992px) {
  .admin-materials-layout {
    grid-template-columns: minmax(0, 1fr) min(360px, 34%);
    gap: 1.25rem;
  }

  .admin-materials-main {
    grid-column: 1;
    grid-row: 1;
  }

  .admin-materials-sidebar {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 72px;
    max-height: calc(100dvh - 88px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .admin-materials-pages-scroll {
    max-height: calc(100dvh - 240px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.25rem;
  }
}

@media (max-width: 991.98px) {
  .admin-materials-sidebar {
    order: -1;
  }

  .admin-materials-main {
    order: 1;
  }
}

.admin-materials-page-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: stretch;
}

.admin-materials-page-actions--header {
  width: auto;
  min-width: 360px;
  margin-left: auto;
  flex-shrink: 0;
}

@media (max-width: 599.98px) {
  .admin-materials-page-actions--header {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }
}

.admin-pdf-import-progress {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.admin-pdf-import-progress .mud-progress-linear {
  width: 100% !important;
  max-width: 100% !important;
}

.admin-pdf-import-progress .mud-progress-linear .mud-progress-bar {
  max-width: 100%;
}

.admin-materials-page-actions--centered {
  width: 100%;
  max-width: 100%;
}

.admin-materials-page-actions .admin-materials-action-btn.mud-button-root,
.admin-materials-page-actions a.admin-materials-action-btn {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
}

.admin-pdf-import-upload--hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-materials-files-section,
.admin-materials-links-section {
  background: var(--mud-palette-background-grey);
}

.admin-materials-files-grid .admin-material-file-tile {
  flex: 1 1 280px;
  max-width: min(100%, 520px);
  border-radius: 12px;
}

.admin-file-drop-upload {
  min-height: 140px;
}

.admin-file-drop-upload input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.admin-materials-toolbar {
  border-radius: 12px;
}

.admin-materials-search {
  min-width: min(100%, 280px);
  max-width: 420px;
}

.admin-materials-empty {
  border-radius: 16px;
  border-style: dashed;
}

.admin-material-card {
  border-radius: 12px;
  transition: border-color 0.15s ease;
}

.admin-material-card:hover {
  border-color: var(--mud-palette-primary);
}

.admin-material-type-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-material-type-icon--link {
  background: rgba(3, 169, 244, 0.12);
  color: #03a9f4;
}

.admin-material-type-icon--file {
  background: rgba(247, 148, 29, 0.15);
  color: #f7941d;
}

.admin-material-type-icon--inline {
  background: rgba(247, 148, 29, 0.08);
  color: var(--mud-palette-primary);
}

.admin-material-preview {
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-material-drag-col {
  display: flex;
  align-items: flex-start;
  padding-top: 0.15rem;
}

.admin-material-page-order {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  margin-top: 0.15rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
  color: var(--mud-palette-primary);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1;
  user-select: none;
}

.admin-material-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--mud-palette-primary);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.admin-material-drag-handle .mud-icon-root {
  pointer-events: none;
}

.admin-material-drag-handle--disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.admin-material-drag-handle[draggable="true"] {
  cursor: grab;
  -webkit-user-drag: element;
}

.admin-material-drag-handle[draggable="true"]:active {
  cursor: grabbing;
}

.admin-material-page-card--dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.admin-material-page-card--drag-over {
  outline: 2px dashed var(--mud-palette-primary);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent);
}

.admin-material-actions {
  margin-left: auto;
  flex-shrink: 0;
}

.admin-material-attachment-row {
  min-width: 0;
  width: 100%;
}

@media (max-width: 599.98px) {
  .admin-materials-search {
    max-width: none;
  }

  .admin-material-attachment-card {
    overflow: hidden;
  }

  .admin-material-attachment-card .admin-material-attachment-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0;
  }

  .admin-material-attachment-card .admin-material-type-icon {
    grid-column: 1;
    grid-row: 1;
  }

  .admin-material-attachment-card .admin-material-attachment-row > .min-width-0 {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .admin-material-attachment-card .admin-material-actions {
    grid-column: 3;
    grid-row: 1;
    width: auto;
    margin-left: 0;
    justify-content: flex-end;
  }

  .admin-material-page-card .admin-material-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Materiały do nauki - uproszczony widok (seniorzy), pełna szerokość */
.learning-simple-page {
  width: 100%;
  max-width: min(100vw, 1280px);
  margin-left: auto;
  margin-right: auto;
  font-size: 1.0625rem;
  line-height: 1.55;
}

.learning-simple-topbar {
  display: flex;
  align-items: stretch;
}

.learning-simple-back.mud-button-root {
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 600;
  width: 100%;
}

@media (min-width: 600px) {
  .learning-simple-back.mud-button-root {
    width: auto;
    min-width: 280px;
  }
}

.learning-simple-header {
  border-radius: 16px;
  border-top: 4px solid var(--mud-palette-primary);
}

.learning-simple-exam-title {
  font-weight: 800 !important;
  font-size: clamp(1.35rem, 4vw, 1.75rem) !important;
  line-height: 1.25;
}

.learning-simple-kicker {
  font-weight: 700;
  letter-spacing: 0.06em;
}

.learning-simple-intro {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--mud-palette-text-primary);
}

.learning-simple-section-head {
  border-radius: 14px;
  background: var(--mud-palette-background-grey);
}

.learning-simple-section-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--mud-palette-primary);
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.learning-simple-section-title {
  font-weight: 800 !important;
  font-size: 1.2rem !important;
}

.learning-simple-section-hint {
  font-size: 1rem !important;
  line-height: 1.5;
}

.learning-simple-section {
  width: 100%;
}

.learning-simple-articles-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

@media (min-width: 960px) {
  .learning-simple-articles-layout {
    flex-direction: row;
    align-items: stretch;
    gap: 1.25rem;
  }

  .learning-simple-articles-list {
    flex: 0 0 min(100%, 340px);
    max-width: 380px;
  }

  .learning-simple-articles-main {
    flex: 1 1 auto;
    min-width: 0;
  }
}

.learning-simple-reader-placeholder {
  border-radius: 16px;
  border: 2px dashed var(--mud-palette-lines-default);
  background: var(--mud-palette-background-grey);
  min-height: 280px;
}

.learning-simple-placeholder-text {
  font-size: 1.1rem !important;
  font-weight: 600;
  max-width: 28rem;
}

.learning-simple-cards-grid {
  width: 100%;
}

.learning-simple-cards-grid .mud-grid-item {
  display: flex;
}

.learning-simple-action-card {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.learning-simple-action-card .mud-stack {
  margin-top: auto;
}

.learning-simple-pick-btn.mud-button-root {
  min-height: 56px;
  text-transform: none;
  justify-content: flex-start;
  padding: 12px 16px;
}

.learning-simple-pick-btn-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
}

.learning-simple-pick-label {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  flex: 1;
}

.learning-simple-reader {
  border-radius: 16px;
  border: 2px solid var(--mud-palette-primary);
}

.learning-simple-reader-title {
  font-weight: 800 !important;
  font-size: 1.35rem !important;
}

.learning-simple-reader .exam-learning-inline-body {
  font-size: 1.125rem;
  line-height: 1.75;
  max-width: 72rem;
}

.learning-simple-action-card {
  border-radius: 16px;
  height: 100%;
}

.learning-simple-card-title {
  font-weight: 700 !important;
  font-size: 1.15rem !important;
  line-height: 1.35;
}

.learning-simple-action-card .mud-button-root {
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: none;
}

.learning-simple-footer {
  border-radius: 14px;
}

.learning-simple-alert {
  font-size: 1.05rem;
}

.learning-simple-footer .mud-button-root {
  min-height: 52px;
  font-weight: 600;
}

/* Tryb nauki - pełna strona, wąski nagłówek, animowane strony */
.learning-article-page {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  font-size: 1.0625rem;
  line-height: 1.55;
}

.learning-article-page--immersive {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 6.5rem);
  margin-top: -0.5rem;
}

.learning-article-page--immersive.learning-article-page--with-pager {
  height: calc(100dvh - 6.5rem);
  max-height: calc(100dvh - 6.5rem);
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

@media (min-width: 600px) {
  .learning-article-page--immersive {
    min-height: calc(100dvh - 8rem);
    margin-top: -1rem;
  }

  .learning-article-page--immersive.learning-article-page--with-pager {
    height: calc(100dvh - 8rem);
    max-height: calc(100dvh - 8rem);
  }
}

.learning-article-topbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  padding: 0.25rem 0 0.5rem;
  border-bottom: 1px solid var(--mud-palette-lines-default);
  margin-bottom: 0.75rem;
}

.learning-article-back-btn.mud-icon-button-root {
  flex-shrink: 0;
}

.learning-article-topbar-title {
  flex: 1;
  min-width: 0;
  font-weight: 700 !important;
  font-size: clamp(0.875rem, 2.2vw, 1rem) !important;
  line-height: 1.3 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.learning-article-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}

.learning-article-attachments-toggle.mud-button-root,
.learning-article-notes-toggle.mud-button-root {
  text-transform: none;
  font-weight: 600;
  max-width: 100%;
  padding-left: 0.625rem;
  padding-right: 0.625rem;
}

.learning-article-attachments-toggle-content {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
}

.learning-article-attachments-toggle-icon {
  flex-shrink: 0;
  font-size: 1.125rem !important;
  width: 1.125rem;
  height: 1.125rem;
}

.learning-article-attachments-toggle-label {
  white-space: nowrap;
}

.learning-article-attachments-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  background: var(--mud-palette-secondary);
  color: var(--mud-palette-secondary-text, #fff);
}

@media (max-width: 479px) {
  .learning-article-attachments-toggle-label {
    display: none;
  }

  .learning-article-attachments-toggle.mud-button-root,
  .learning-article-notes-toggle.mud-button-root {
    min-width: 2.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

.learning-article-attachments-backdrop,
.learning-article-notes-backdrop {
  display: none;
}

.learning-article-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.learning-article-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.75rem;
}

.learning-article-shell--with-rail {
  --learning-files-rail-width: clamp(280px, 34vw, 420px);
}

.learning-article-shell--with-notes {
  --learning-notes-rail-width: clamp(280px, 30vw, 380px);
}

/* Desktop: notes permanently on the right when space allows */
@media (min-width: 1100px) {
  .learning-article-shell--with-notes {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
  }

  .learning-article-shell--with-notes .learning-article-main {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 0.75rem;
  }

  .learning-article-shell--with-notes .learning-article-notes-rail {
    order: 2;
    display: flex;
    flex: 0 0 var(--learning-notes-rail-width);
    width: var(--learning-notes-rail-width);
    max-width: var(--learning-notes-rail-width);
    align-self: stretch;
    min-height: 0;
    max-height: none;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    margin: 0 0 0 0.5rem;
    padding: 0;
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    box-shadow: none;
    background: var(--mud-palette-surface);
  }

  /* Keep notes above the page pager (pager lives in .learning-article-main) */
  .learning-article-page--with-notes.learning-article-page--with-pager .learning-article-shell--with-notes .learning-article-notes-rail {
    align-self: flex-start;
    height: calc(100% - 3.5rem);
    max-height: calc(100% - 3.5rem);
    margin-bottom: 3.5rem;
  }

  .learning-article-notes-toggle,
  .learning-article-notes-rail-close,
  .learning-article-notes-backdrop {
    display: none !important;
  }

  /* With notes rail present, attachments replace the notes column (no overlapping overlay) */
  .learning-article-page--with-notes.learning-article-page--with-rail .learning-article-notes-rail {
    display: none !important;
  }

  .learning-article-page--with-notes.learning-article-page--with-rail .learning-article-attachments-backdrop {
    display: none !important;
  }

  .learning-article-page--with-notes.learning-article-page--with-rail .learning-article-shell--with-notes.learning-article-shell--with-rail {
    flex-direction: row;
  }

  .learning-article-page--with-notes.learning-article-page--with-rail .learning-article-files-rail {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    order: 2;
    z-index: 1;
    display: flex;
    flex: 0 0 var(--learning-files-rail-width, clamp(280px, 34vw, 420px));
    width: var(--learning-files-rail-width, clamp(280px, 34vw, 420px));
    max-width: var(--learning-files-rail-width, clamp(280px, 34vw, 420px));
    align-self: flex-start;
    height: calc(100% - 3.5rem);
    max-height: calc(100% - 3.5rem);
    margin: 0 0 3.5rem 0.5rem;
    padding: 0;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    border-left: 1px solid var(--mud-palette-lines-default);
    box-shadow: none;
    background: var(--mud-palette-surface);
  }

  .learning-article-page--with-notes.learning-article-page--with-rail:not(.learning-article-page--with-pager) .learning-article-files-rail {
    align-self: stretch;
    height: auto;
    max-height: none;
    margin-bottom: 0;
  }
}

@media (min-width: 1024px) {
  .learning-article-shell--with-rail:not(.learning-article-shell--with-notes) {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
  }

  .learning-article-shell--with-rail:not(.learning-article-shell--with-notes) .learning-article-main {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 0.75rem;
  }

  .learning-article-shell--with-rail:not(.learning-article-shell--with-notes) .learning-article-files-rail {
    order: 2;
    flex: 0 0 var(--learning-files-rail-width);
    width: var(--learning-files-rail-width);
    max-width: var(--learning-files-rail-width);
    align-self: stretch;
    min-height: 0;
    max-height: none;
    border-left: 1px solid var(--mud-palette-lines-default);
    border-radius: 0;
    margin: 0;
    padding-left: 0.75rem;
  }
}

.learning-article-files-rail {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 12px;
  background: var(--mud-palette-surface);
  overflow: hidden;
  z-index: 30;
}

@media (max-width: 1023.98px) {
  .learning-article-page--with-rail .learning-article-attachments-backdrop {
    display: block;
    position: fixed;
    top: calc(64px + env(safe-area-inset-top, 0px));
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.42);
  }

  .learning-article-page--with-rail .learning-article-files-rail {
    position: fixed;
    top: calc(64px + env(safe-area-inset-top, 0px));
    right: 0;
    bottom: 0;
    width: min(100vw, var(--learning-files-rail-width, 360px));
    max-width: min(100vw, var(--learning-files-rail-width, 360px));
    max-height: none;
    border-radius: 0;
    border-top: 1px solid var(--mud-palette-lines-default);
    border-right: 0;
    border-bottom: 0;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
  }
}

/* Hidden by default — desktop shows permanently, phone only via topbar button */
.learning-article-notes-rail {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 12px;
  background: var(--mud-palette-background);
  overflow: hidden;
  z-index: 30;
}

/* Phone / narrow: notes open as drawer via topbar button only — under MudAppBar */
@media (max-width: 1099.98px) {
  .learning-article-page--with-notes-open .learning-article-notes-backdrop {
    display: block;
    position: fixed;
    top: calc(64px + env(safe-area-inset-top, 0px));
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.42);
  }

  .learning-article-page--with-notes-open .learning-article-notes-rail--open {
    display: flex;
    position: fixed;
    top: calc(64px + env(safe-area-inset-top, 0px));
    right: 0;
    bottom: 0;
    z-index: 30;
    width: min(100vw, var(--learning-notes-rail-width, 360px));
    max-width: min(100vw, var(--learning-notes-rail-width, 360px));
    border-radius: 0;
    border-top: 1px solid var(--mud-palette-lines-default);
    border-right: 0;
    border-bottom: 0;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
  }
}

.learning-article-notes-rail .learning-article-files-rail-header {
  padding: 0.75rem 0.875rem;
  background: transparent;
}

.learning-article-notes-rail-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.learning-article-notes-edit-btn {
  flex-shrink: 0;
}

.learning-page-notes__readonly {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 10px;
  background: var(--mud-palette-surface);
  line-height: 1.45;
  font-size: 0.9375rem;
}

.learning-page-notes__empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
  border: 1px dashed var(--mud-palette-lines-default);
  border-radius: 10px;
}

.learning-article-notes-rail-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
  padding: 0.75rem 0.875rem 0.875rem;
}

.learning-page-notes__editor {
  flex: 1 1 auto;
  min-height: 12rem;
  position: relative;
}

.learning-page-notes__editor > .mud-input-control,
.learning-page-notes__field.mud-input-control {
  position: absolute !important;
  inset: 0;
  margin: 0 !important;
  height: auto !important;
  width: auto !important;
}

.learning-page-notes__field {
  width: 100%;
}

.learning-page-notes__editor .mud-input-control-input-container,
.learning-page-notes__editor .mud-input,
.learning-page-notes__editor .mud-input-outlined {
  height: 100% !important;
  background: var(--mud-palette-surface);
}

.learning-page-notes__editor .mud-input-outlined-border {
  border-radius: 10px !important;
}

.learning-page-notes__editor textarea.mud-input-slot,
.learning-page-notes__editor .mud-input-slot {
  height: 100% !important;
  min-height: 100% !important;
  max-height: none !important;
  resize: none !important;
  overflow-y: auto !important;
  padding: 0.75rem 0.875rem !important;
  line-height: 1.45;
  box-sizing: border-box;
}

.learning-page-notes__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  flex-shrink: 0;
  margin: 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--mud-palette-lines-default);
}

.learning-page-notes__save.mud-button-root {
  width: 100%;
  text-transform: none !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  min-height: 2.5rem;
}

.learning-page-notes__status {
  text-align: center;
  min-height: 1rem;
}

.learning-article-attachments-count--notes {
  min-width: 0.75rem;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

@media (min-width: 1024px) {
  .learning-article-files-rail {
    max-height: none;
    height: auto;
  }
}

.learning-article-page--with-rail.learning-article-page--immersive,
.learning-article-page--with-notes.learning-article-page--immersive {
  min-height: calc(100dvh - 6.5rem);
}

.learning-article-page--with-rail.learning-article-page--immersive.learning-article-page--with-pager,
.learning-article-page--with-notes.learning-article-page--immersive.learning-article-page--with-pager {
  height: calc(100dvh - 6.5rem);
  max-height: calc(100dvh - 6.5rem);
}

@media (min-width: 600px) {
  .learning-article-page--with-rail.learning-article-page--immersive,
  .learning-article-page--with-notes.learning-article-page--immersive {
    min-height: calc(100dvh - 8rem);
  }

  .learning-article-page--with-rail.learning-article-page--immersive.learning-article-page--with-pager,
  .learning-article-page--with-notes.learning-article-page--immersive.learning-article-page--with-pager {
    height: calc(100dvh - 8rem);
    max-height: calc(100dvh - 8rem);
  }
}

@media (min-width: 1024px) {
  .learning-article-page--with-rail .learning-article-shell--with-rail:not(.learning-article-shell--with-notes) {
    flex: 1;
    min-height: 0;
  }

  .learning-article-page--with-rail .learning-article-shell--with-rail:not(.learning-article-shell--with-notes) .learning-article-files-rail {
    max-height: none;
    height: auto;
  }
}

@media (min-width: 1100px) {
  .learning-article-page--with-notes .learning-article-shell--with-notes {
    flex: 1;
    min-height: 0;
  }
}

.learning-article-files-rail-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.875rem 0.75rem 0.875rem 1rem;
  border-bottom: 1px solid var(--mud-palette-lines-default);
  background: var(--mud-palette-background);
}

.learning-article-files-rail-title {
  font-weight: 700 !important;
  line-height: 1.3 !important;
  flex: 1;
  min-width: 0;
}

.learning-article-files-rail-close {
  flex-shrink: 0;
}

.learning-article-files-rail-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.learning-article-files-rail-section {
  display: block;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.learning-article-files-rail-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  max-width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 10px;
  background: var(--mud-palette-background);
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

a.learning-article-files-rail-item {
  text-decoration: none;
}

.learning-article-files-rail-item:hover {
  border-color: var(--mud-palette-primary);
  background: var(--mud-palette-action-default-hover);
}

.learning-article-files-rail-item:focus-visible {
  outline: 2px solid var(--mud-palette-primary);
  outline-offset: 2px;
}

.learning-article-files-rail-item-icon {
  flex-shrink: 0;
  color: var(--mud-palette-secondary);
}

.learning-article-files-rail-item-icon--link {
  color: var(--mud-palette-info);
}

.learning-article-files-rail-item-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  overflow: hidden;
}

.learning-article-files-rail-item-title {
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-article-files-rail-item-meta {
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--mud-palette-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-article-files-rail-item-action {
  flex-shrink: 0;
}

.learning-article-content-viewport--attachments-only {
  display: flex;
  align-items: center;
  justify-content: center;
}

.learning-article-content-viewport--attachments-main {
  overflow-y: auto;
  padding: 0.25rem 0 1rem;
}

.learning-article-attachments-main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.learning-article-attachments-main .learning-article-files-rail-item {
  width: 100%;
}

.learning-article-page--with-rail.learning-article-page--with-pager .learning-article-pager,
.learning-article-page--with-notes.learning-article-page--with-pager .learning-article-pager {
  position: sticky;
  left: auto;
  right: auto;
  bottom: 0;
  box-shadow: none;
  margin-top: auto;
}

@media (min-width: 1024px) {
  .learning-article-page--with-rail.learning-article-page--with-pager .learning-article-pager,
  .learning-article-page--with-notes.learning-article-page--with-pager .learning-article-pager {
    position: sticky;
  }
}

.learning-article-page--with-pager:not(.learning-article-page--with-rail):not(.learning-article-page--with-notes) .learning-article-pager {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.06);
}

.mud-theme-dark .learning-article-page--with-pager:not(.learning-article-page--with-rail):not(.learning-article-page--with-notes) .learning-article-pager {
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.35);
}

.learning-article-content-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.learning-article-body {
  height: 100%;
  overflow-y: auto;
  padding: 0.25rem 0 1rem;
  will-change: transform, opacity;
  -webkit-overflow-scrolling: touch;
}

.learning-article-page--with-pager .learning-article-body {
  padding-bottom: 3.5rem;
}

.learning-article-body .exam-learning-inline-body {
  font-size: 1.0625rem;
  line-height: 1.7;
  max-width: none;
}

.learning-page-enter-initial {
  animation: learningPageFadeIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.learning-page-enter-forward {
  animation: learningPageSlideForward 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.learning-page-enter-back {
  animation: learningPageSlideBack 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes learningPageFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes learningPageSlideForward {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes learningPageSlideBack {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.learning-article-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.625rem 0;
  padding-bottom: calc(0.625rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--mud-palette-lines-default);
  background: var(--mud-palette-background);
  z-index: 20;
}

.learning-article-pager-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  max-width: 100%;
}

.learning-article-page-jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.learning-article-page-input {
  width: 4.5rem;
  flex: 0 0 auto;
  margin: 0;
}

.learning-article-page-input .mud-input-control {
  margin-top: 0;
  margin-bottom: 0;
}

.learning-article-page-input input {
  text-align: center;
  font-weight: 700;
}

.learning-article-page-input .mud-input-root-outlined .mud-input-outlined-border {
  border-radius: 10px;
}

.learning-article-page-jump-total {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--mud-palette-text-secondary);
  white-space: nowrap;
}

.learning-article-pager-label {
  min-width: 4.5rem;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/*
 * Phone landscape ONLY for learning materials.
 * Does not affect PC (min-width 1100+) or phone portrait (orientation: portrait / taller screens).
 */
@media (max-width: 1099.98px) and (orientation: landscape) and (max-height: 560px) {
  .learning-article-page--immersive {
    min-height: calc(100dvh - 3.5rem);
    margin-top: 0;
  }

  .learning-article-page--immersive.learning-article-page--with-pager,
  .learning-article-page--with-notes.learning-article-page--immersive.learning-article-page--with-pager,
  .learning-article-page--with-rail.learning-article-page--immersive.learning-article-page--with-pager {
    height: calc(100dvh - 4.5rem);
    max-height: calc(100dvh - 4.5rem);
    min-height: 0;
  }

  .learning-article-topbar {
    padding: 0.05rem 0 0.2rem;
    margin-bottom: 0.3rem;
    gap: 0.15rem;
  }

  .learning-article-topbar-title {
    font-size: 0.8125rem !important;
  }

  .learning-article-attachments-toggle-label {
    display: none;
  }

  .learning-article-attachments-toggle.mud-button-root,
  .learning-article-notes-toggle.mud-button-root {
    min-width: 2.35rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .learning-article-page-title {
    font-size: 0.95rem !important;
    margin-bottom: 0.35rem !important;
    line-height: 1.25 !important;
  }

  .learning-article-body {
    padding: 0.1rem 0 0.35rem;
  }

  .learning-article-page--with-pager .learning-article-body {
    padding-bottom: 0.35rem;
  }

  .learning-article-body .exam-learning-inline-body {
    font-size: 0.9375rem;
    line-height: 1.45;
  }

  .learning-article-pager {
    padding: 0.3rem 0 0.45rem;
    padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
    margin-bottom: 0.35rem;
  }

  .learning-article-page--with-notes.learning-article-page--with-pager .learning-article-pager,
  .learning-article-page--with-rail.learning-article-page--with-pager .learning-article-pager {
    bottom: 0.45rem;
    margin-bottom: 0.45rem;
  }

  .learning-article-page-input {
    width: 3.75rem;
  }

  .learning-article-page-jump-total {
    font-size: 0.8125rem;
  }

  .learning-article-page--with-pager:not(.learning-article-page--with-rail):not(.learning-article-page--with-notes) .learning-article-pager {
    bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    padding-top: 0.3rem;
    padding-bottom: 0.45rem;
  }

  /* Drawers under compact app bar in landscape */
  .learning-article-page--with-notes-open .learning-article-notes-backdrop,
  .learning-article-page--with-notes-open .learning-article-notes-rail--open,
  .learning-article-page--with-rail .learning-article-attachments-backdrop,
  .learning-article-page--with-rail .learning-article-files-rail {
    top: calc(56px + env(safe-area-inset-top, 0px));
  }

  .learning-article-notes-rail .learning-article-files-rail-header,
  .learning-article-files-rail-header {
    padding: 0.45rem 0.65rem;
  }

  .learning-article-notes-rail-body,
  .learning-article-files-rail-list {
    padding: 0.5rem 0.65rem 0.65rem;
  }

  .learning-page-notes__editor {
    min-height: 6rem;
  }

  .learning-category-picker {
    padding: 0.75rem 1rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .learning-page-enter-initial,
  .learning-page-enter-forward,
  .learning-page-enter-back {
    animation: none;
  }
}

.admin-material-attachment-card {
  border-left: 3px solid var(--mud-palette-secondary);
}

.admin-material-page-card {
  border-left: 3px solid var(--mud-palette-primary);
}

/* Strona edycji materiałów - pełna szerokość, duże pole treści */
.training-material-edit-page {
  width: 100%;
  max-width: none;
}

.training-material-edit-panel {
  width: 100%;
  border-radius: 16px;
}

.training-material-edit-back.mud-button-root {
  min-height: auto;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: none;
}

.training-inline-editor-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  align-items: stretch;
}

@media (min-width: 1024px) {
  .training-inline-editor-layout {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .training-inline-editor-main {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
  }

  .training-inline-media-rail {
    order: 2;
    flex: 0 0 220px;
    width: 220px;
    max-width: 220px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: min(62vh, 680px);
    overflow: hidden;
    padding-left: 0.75rem;
    border-left: 1px solid var(--mud-palette-lines-default);
    box-sizing: border-box;
  }

  .training-inline-media-rail-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

.training-inline-editor-panel,
.training-inline-editor-main {
  width: 100%;
}

.training-inline-media-rail-upload {
  display: block;
}

.training-inline-media-rail-dropzone {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent);
}

.training-inline-media-rail-dropzone--active {
  background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mud-palette-primary) 35%, transparent);
}

.training-inline-media-rail-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 112px;
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.training-inline-media-rail-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.training-inline-media-rail-item {
  position: relative;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: 10px;
  padding: 0.5rem;
  padding-top: 1.75rem;
  cursor: grab;
  background: var(--mud-palette-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.training-inline-media-rail-delete-wrap {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 2;
}

.training-inline-media-rail-delete {
  margin: 0 !important;
}

.training-inline-media-rail-item:hover {
  border-color: var(--mud-palette-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.training-inline-media-rail-item--used {
  border-color: var(--mud-palette-success);
}

.training-inline-media-rail-item:active {
  cursor: grabbing;
}

.training-inline-media-rail-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 6px;
  background: var(--mud-palette-background-grey);
  display: flex;
  align-items: center;
  justify-content: center;
}

.training-inline-media-rail-thumb .exam-learning-inline-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.training-inline-media-rail-thumb .edusimp-loading-image {
  width: 100%;
  height: 100%;
}

.training-inline-media-rail-thumb .edusimp-loading-image__placeholder {
  min-height: 100%;
  height: 100%;
  background: transparent;
}

.training-inline-media-rail-video-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.training-inline-media-rail-label {
  display: block;
  text-align: center;
  margin-top: 0.35rem;
  font-weight: 600;
}

.training-inline-media-rail-used-icon {
  position: absolute;
  top: 6px;
  right: 6px;
}

.training-inline-body-highlight-stack {
  display: grid;
  grid-template-areas: "editor";
  width: 100%;
  min-width: 0;
}

.training-inline-body-highlight-stack > * {
  grid-area: editor;
  min-width: 0;
}

.training-inline-body-field .training-inline-body-highlight-stack .mud-input-slot,
.training-inline-body-field .mud-input-slot:has(.training-inline-body-highlight-stack) {
  background: transparent !important;
}

.training-inline-body-highlight-back {
  overflow: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  pointer-events: none;
  color: var(--mud-palette-text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  line-height: 1.65;
  z-index: 0;
  resize: none;
}

.training-inline-body-field textarea.training-inline-body-highlight-input,
.training-inline-body-field .mud-input-slot textarea.training-inline-body-highlight-input,
.training-inline-body-field.mud-input-control textarea.training-inline-body-highlight-input {
  position: relative;
  z-index: 1;
  background: transparent !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: var(--mud-palette-text-primary);
}

.training-inline-body-field textarea.training-inline-body-highlight-input::selection,
.training-inline-body-field .mud-input-slot textarea.training-inline-body-highlight-input::selection {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  background: color-mix(in srgb, var(--mud-palette-primary) 35%, transparent);
}

.training-inline-body-highlight-back .training-inline-body-media-token,
.training-inline-body-media-token {
  color: #f7941d !important;
  background: color-mix(in srgb, #f7941d 22%, transparent);
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-weight: 600;
}

.training-inline-body-field textarea,
.training-inline-body-field .mud-input-slot textarea {
  min-height: min(62vh, 680px) !important;
  max-height: min(62vh, 680px) !important;
  font-size: 1rem !important;
  line-height: 1.65 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
  overflow-y: auto !important;
}

.training-inline-body-field textarea.training-inline-body-dragover,
.training-inline-body-field .mud-input-slot textarea.training-inline-body-dragover {
  outline: 2px dashed var(--mud-palette-primary);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent) !important;
}

.training-material-preview-body {
  max-height: min(62vh, 680px);
  overflow-y: auto;
}

.training-material-preview-dialog .mud-dialog-content {
  padding-top: 8px;
}

.training-material-lang-tabs {
  width: 100%;
}

.training-material-dialog-actions {
  border-top: 1px solid var(--mud-palette-lines-default);
}

.server-disk-usage-card {
  border-radius: 12px;
}

.server-disk-usage-bar {
  height: 14px;
}

.server-disk-breakdown__item + .server-disk-breakdown__item {
  border-top: 1px solid var(--mud-palette-lines-default);
}

.server-disk-breakdown .mud-progress-linear {
  height: 8px;
}
