.pwa-topbar,
.pwa-bottom-nav {
  display: none;
}

@media (display-mode: standalone) {
  html,
  body {
    overscroll-behavior-x: none;
    -webkit-tap-highlight-color: transparent;
  }
}

html.app-shell {
  --pwa-topbar-height: 52px;
  --pwa-nav-height: 60px;
  --pwa-safe-top: env(safe-area-inset-top, 0px);
  --pwa-safe-bottom: env(safe-area-inset-bottom, 0px);
  --pwa-safe-left: env(safe-area-inset-left, 0px);
  --pwa-safe-right: env(safe-area-inset-right, 0px);
  overflow-x: clip;
  overscroll-behavior-x: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

html.app-shell body {
  overflow-x: clip;
  overscroll-behavior-x: none;
  overflow-wrap: break-word;
  padding-left: var(--pwa-safe-left);
  padding-right: var(--pwa-safe-right);
}

html.app-shell[data-page="do_quiz"],
html.app-shell[data-page="do_quiz"] body,
html.app-shell[data-page="quiz_preview"],
html.app-shell[data-page="quiz_preview"] body {
  overscroll-behavior: none;
}

html.app-shell img,
html.app-shell video,
html.app-shell iframe {
  max-width: 100%;
}

html.app-shell pre {
  white-space: pre-wrap;
}

html.app-shell .app-header,
html.app-shell footer.footer,
html.pwa-standalone #pwa-install-banner {
  display: none !important;
}

html.app-shell .pwa-topbar,
html.app-shell .pwa-bottom-nav,
html.app-shell .left-sidebar,
html.app-shell .btn,
html.app-shell .nav-link,
html.app-shell .sidebar-link,
html.app-shell .dropdown-item {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html.app-shell .pwa-topbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 997;
  box-sizing: border-box;
  height: calc(var(--pwa-topbar-height) + var(--pwa-safe-top));
  padding-top: var(--pwa-safe-top);
  padding-left: calc(0.25rem + var(--pwa-safe-left));
  padding-right: calc(0.25rem + var(--pwa-safe-right));
  background: #1565C0;
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}

.pwa-topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
}

.pwa-topbar-btn:active {
  background: rgba(255, 255, 255, 0.18);
}

[dir="rtl"] .pwa-back i {
  transform: scaleX(-1);
}

.pwa-topbar[data-root] .pwa-back {
  display: none;
}

.pwa-topbar[data-root] .pwa-topbar-logo {
  margin-inline-start: 0.5rem;
}

.pwa-topbar-logo {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin-inline: 0.25rem 0.5rem;
}

.pwa-topbar-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-topbar-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.pwa-topbar-actions .navbar-nav {
  flex-direction: row !important;
  align-items: center;
  gap: 0.25rem !important;
  margin: 0 !important;
}

.pwa-topbar-actions .btn,
.pwa-topbar-actions .btn-light {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
}

.pwa-topbar-actions .btn-light {
  background: transparent !important;
  border-color: transparent;
  box-shadow: none;
}

.pwa-topbar-actions form > .btn span {
  display: none;
}

.pwa-topbar-actions .dropdown-menu.show {
  position: fixed !important;
  inset: calc(var(--pwa-topbar-height) + var(--pwa-safe-top) + 0.25rem) 0.5rem auto 0.5rem !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  max-height: calc(100vh - var(--pwa-topbar-height) - var(--pwa-nav-height) - var(--pwa-safe-top) - var(--pwa-safe-bottom) - 1rem);
  overflow-y: auto;
  transform: none !important;
  margin: 0 !important;
  border-radius: 14px;
  z-index: 1001;
}

html.app-shell .pwa-bottom-nav {
  display: flex;
  position: fixed;
  inset-block-end: 0;
  inset-inline: 0;
  z-index: 997;
  box-sizing: border-box;
  height: calc(var(--pwa-nav-height) + var(--pwa-safe-bottom));
  padding-bottom: var(--pwa-safe-bottom);
  padding-left: var(--pwa-safe-left);
  padding-right: var(--pwa-safe-right);
  background: #fff;
  border-block-start: 1px solid #e2e8f0;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
}

.pwa-tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.25rem 0.125rem;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
}

.pwa-tab i {
  font-size: 1.15rem;
}

.pwa-tab span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-tab.active,
.pwa-tab:active {
  color: #1565C0;
}

html.app-shell .body-wrapper .body-wrapper-inner {
  margin-block: calc(var(--pwa-topbar-height) + var(--pwa-safe-top)) calc(var(--pwa-nav-height) + var(--pwa-safe-bottom));
  margin-inline: 0;
  min-height: auto;
  border-radius: 0 !important;
}

html.app-shell .body-wrapper-inner > .container-fluid {
  padding: 16px 12px !important;
}

html.app-shell[data-page="do_quiz"] .pwa-bottom-nav,
html.app-shell[data-page="quiz_preview"] .pwa-bottom-nav {
  display: none;
}

html.app-shell[data-page="do_quiz"] .body-wrapper .body-wrapper-inner,
html.app-shell[data-page="quiz_preview"] .body-wrapper .body-wrapper-inner {
  margin-block-end: var(--pwa-safe-bottom);
}

html.app-shell .left-sidebar {
  padding-top: var(--pwa-safe-top);
  padding-bottom: var(--pwa-safe-bottom);
}

html.app-shell #float-dock {
  inset-block-end: calc(var(--pwa-nav-height) + var(--pwa-safe-bottom) + 12px);
  max-height: calc(100vh - var(--pwa-nav-height) - var(--pwa-topbar-height) - var(--pwa-safe-top) - var(--pwa-safe-bottom) - 24px);
}

html.app-shell[data-page="do_quiz"] #float-dock,
html.app-shell[data-page="quiz_preview"] #float-dock {
  inset-block-end: calc(var(--pwa-safe-bottom) + 12px);
}

html.app-shell .toast-container.bottom-0 {
  bottom: calc(var(--pwa-nav-height) + var(--pwa-safe-bottom)) !important;
}

html.app-shell .public-body {
  padding-top: calc(var(--pwa-topbar-height) + var(--pwa-safe-top));
  padding-bottom: var(--pwa-safe-bottom);
}

html.app-shell .public-body > nav,
html.app-shell .public-body > header,
html.app-shell .public-body > footer {
  display: none !important;
}

html.app-shell .signin-body {
  padding-top: var(--pwa-safe-top);
  padding-bottom: var(--pwa-safe-bottom);
}

html.app-shell .table-responsive.has-table-cards {
  overflow: visible;
}

html.app-shell table.table-cards,
html.app-shell table.table-cards > tbody {
  display: block;
  width: 100%;
  min-width: 0 !important;
  margin: 0;
}

html.app-shell table.table-cards > thead {
  display: none;
}

html.app-shell table.table-cards > tbody > tr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

html.app-shell table.table-cards > tbody > tr > td {
  display: block;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-align: start !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

html.app-shell table.table-cards > tbody > tr > td[data-cell="index"],
html.app-shell table.table-cards > tbody > tr > td[data-cell="empty"] {
  display: none;
}

html.app-shell table.table-cards > tbody > tr > td[data-cell="title"] {
  order: 0;
  flex: 1 1 0;
  min-width: 55% !important;
  font-weight: 600;
}

html.app-shell table.table-cards > tbody > tr > td[data-cell="actions"] {
  order: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

html.app-shell table.table-cards > tbody > tr > td[data-cell="field"] {
  order: 2;
  flex: 1 1 calc(50% - 0.25rem);
  padding: 0.45rem 0.6rem !important;
  background: #f8fafc !important;
  border-radius: 10px;
  font-size: 0.85rem;
}

html.app-shell table.table-cards > tbody > tr > td[data-cell="field"]::before {
  content: attr(data-label);
  display: block;
  margin-block-end: 0.2rem;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 600;
}

html.app-shell table.table-cards > tbody > tr > td[colspan] {
  flex: 1 1 100%;
  text-align: center !important;
}

html.app-shell table.table-cards > tbody > tr > td .text-truncate,
html.app-shell table.table-cards > tbody > tr > td .badge {
  max-width: 100% !important;
  white-space: normal !important;
  overflow: visible;
}

html.app-shell[data-page="index"] .welcome-header {
  padding: 1rem;
  border-radius: 14px;
}

html.app-shell[data-page="index"] .welcome-header h4 {
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

html.app-shell[data-page="index"] .welcome-header .btn-section {
  width: 100%;
}

html.app-shell[data-page="index"] .welcome-header .btn-section > .btn {
  flex: 1 1 0;
  padding-inline: 0.5rem !important;
  font-size: 0.85rem;
  white-space: nowrap;
}

html.app-shell[data-page="index"] .row.g-4 {
  --bs-gutter-x: 0.75rem;
  --bs-gutter-y: 0.75rem;
}

html.app-shell[data-page="index"] .row.g-4 > .col-12.col-sm-6 {
  flex: 0 0 auto;
  width: 50%;
}

html.app-shell[data-page="index"] .stat-card-dashboard {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.875rem;
  border-radius: 14px;
}

html.app-shell[data-page="index"] .stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

html.app-shell[data-page="index"] .stat-card-number {
  font-size: 1.5rem;
}

html.app-shell[data-page="index"] .stat-card-label {
  font-size: 0.8rem;
}

html.app-shell[data-page="index"] .stat-card-sub {
  font-size: 0.7rem;
}

html.app-shell[data-page="index"] .welcome-header .btn-section {
  display: flex;
  gap: 0.5rem;
}

html.app-shell table.table-cards > tbody > tr > td[data-cell="field"] .text-center {
  text-align: start !important;
}

html.app-shell table.table-cards > tbody > tr > td[data-cell="field"] .justify-content-center,
html.app-shell table.table-cards > tbody > tr > td[data-cell="field"] .d-flex {
  justify-content: flex-start !important;
}

html.app-shell table.table-cards > tbody > tr > td[data-cell="field"] .mx-auto {
  margin-inline: 0 !important;
}

html.app-shell[data-page="show_student_answers"] .container-fluid.pt-4.px-4 {
  padding-inline: 0 !important;
  padding-top: 0 !important;
}

html.app-shell[data-page="show_student_answers"] .quiz-header .display-6 {
  font-size: 1.25rem;
  font-weight: 600;
}

html.app-shell .filter-btn-group {
  flex-wrap: wrap !important;
  gap: 0.375rem !important;
  overflow: visible !important;
}

html.app-shell .filter-btn-group .filter-btn {
  flex: 0 0 auto !important;
  padding: 0.3rem 0.875rem !important;
  font-size: 0.8rem;
  line-height: 1.4;
  border-radius: 50px !important;
  margin: 0 !important;
}

#pwa-legacy-banner {
  position: fixed;
  inset-inline: 0.75rem;
  inset-block-end: calc(var(--pwa-nav-height, 0px) + var(--pwa-safe-bottom, 0px) + 0.75rem);
  z-index: 2000;
  padding: 0.9rem 1rem;
  background: #fff;
  border-radius: 14px;
  border-inline-start: 4px solid #1565C0;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.18);
  font-size: 0.85rem;
}

#pwa-legacy-banner strong {
  display: block;
  margin-block-end: 0.25rem;
  color: #1565C0;
}

#pwa-legacy-banner p {
  margin: 0 0 0.6rem;
  color: #475569;
}

#pwa-legacy-banner button {
  padding: 0.35rem 1.1rem;
  border: 0;
  border-radius: 50px;
  background: #1565C0;
  color: #fff;
  font-weight: 600;
}
