/* E-School mobile refinements shared by the public and authenticated shells. */
@media (max-width: 991.98px) {
    .app-sidebar { width: min(19rem, 88vw); flex-basis: min(19rem, 88vw); }
    .app-sidebar.sidebar-compact { width: min(19rem, 88vw); flex-basis: min(19rem, 88vw); }
    .app-sidebar.sidebar-compact .sidebar-brand { flex-direction: row; gap: .75rem; padding: 1.15rem 1.25rem; }
    .app-sidebar.sidebar-compact .sidebar-brand-identity > div,
    .app-sidebar.sidebar-compact .nav-item > span,
    .app-sidebar.sidebar-compact .nav-item > em { display: initial; }
    .app-sidebar.sidebar-compact .sidebar-collapse-toggle { display: none; }
    .app-sidebar.sidebar-compact .nav-group-toggle { display: flex; }
    .app-layout, .app-main { min-width: 0; }
    body.sidebar-open { overflow: hidden; }
}

@media (max-width: 767.98px) {
    .app-content, .public-shell main { padding: 1rem .75rem; }
    .app-topbar { min-height: 58px; gap: .4rem; padding: .45rem .75rem; }
    .app-topbar .sidebar-toggle { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; }
    .topbar-heading { gap: .45rem; flex: 1 1 auto; }
    .topbar-title { max-width: 58vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .topbar-actions { gap: .25rem; }
    .topbar-icon-btn { width: 42px; height: 42px; }
    .topbar-account { min-height: 42px; padding: .2rem; }
    .app-footer { flex-wrap: wrap; gap: .2rem .5rem; padding: .8rem 1rem; }
    .page-head { align-items: flex-start; gap: .7rem; }
    .page-head > :first-child { min-width: 0; }
    .page-title { font-size: clamp(1.2rem, 5.5vw, 1.55rem); line-height: 1.2; }
    .page-subtitle { font-size: .84rem; }
    .page-head-actions { display: flex; width: 100%; flex-wrap: wrap; gap: .45rem; }
    .page-head-actions .btn { flex: 1 1 auto; }
    .card-body { padding: 1rem; }
    .table-responsive, .table-wrap, .overflow-x-auto, pre { max-width: 100%; -webkit-overflow-scrolling: touch; }
    .table-responsive { overflow-x: auto; }
    .form-control, .form-select, input, select, textarea { max-width: 100%; font-size: 16px; }
    .btn, button { min-height: 42px; }
    .modal-dialog { margin: .5rem; }
    .notification-menu { max-width: calc(100vw - 1rem); }
    .site-nav-inner { gap: .5rem; }
    .site-brand { min-width: 0; }
    .site-brand-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .site-nav-links { max-height: calc(100dvh - 5rem); overflow-y: auto; overscroll-behavior: contain; }
    .public-app-content { width: 100%; }
    .public-app-tabs { padding-left: .75rem; padding-right: .75rem; }
    .desktop-app-menu { max-width: calc(100vw - 1.5rem); }
    .portal-welcome { padding: 1rem; }
    .portal-welcome h1 { font-size: clamp(1.35rem, 6vw, 1.8rem); line-height: 1.18; }
    .portal-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: thin; }
    .portal-tabs .nav-link { min-height: 42px; white-space: nowrap; }
    .portal-panel { min-width: 0; }
    .portal-panel-heading { align-items: flex-start; }
    .portal-profile-grid > div { min-width: 0; overflow-wrap: anywhere; }
    .portal-class-card { gap: .75rem; }
}

@media (max-width: 575.98px) {
    .app-content { padding: .8rem .6rem; }
    .app-topbar { padding-inline: .55rem; }
    .topbar-logo, .topbar-logo-fallback { display: none; }
    .topbar-heading-text { max-width: 52vw; }
    .topbar-title { max-width: 52vw; font-size: .9rem; }
    .topbar-account-avatar { font-size: 1.35rem; }
    .dropdown-menu { max-width: calc(100vw - .75rem); }
    .page-head-actions .btn { flex-basis: 100%; }
    .public-shell main { padding: .85rem .65rem; }
    .public-shell .card { border-radius: 14px; }
    .public-shell .card-body { padding: .9rem; }
    .site-footer .row > [class*="col-"] { width: 100%; }
    .portal-assignment-row { gap: .55rem; }
    .portal-assignment-row span { min-width: 0; }
    .portal-assignment-row strong { overflow-wrap: anywhere; }
    .portal-welcome-actions { align-items: flex-start !important; }
    .portal-id-line { gap: .3rem; }
}

@media (max-width: 360px) {
    .topbar-actions .dropdown > .topbar-account { padding: 0; }
    .topbar-icon-btn { width: 38px; }
    .portal-assignment-row { grid-template-columns: minmax(0, 1fr); }
    .portal-assignment-row span:last-child { grid-column: auto; }
}
