/* Shared responsive layer for every LMS surface. */
:root {
    --lms-page-gutter: clamp(14px, 2.2vw, 32px);
    --lms-touch-size: 44px;
}

/* Make every close/cross control clearly visible without changing its size or action. */
.modal-close,
.icon-close,
.review-search-clear {
    color: #dc2626 !important;
    border-color: #fecaca !important;
    background-color: #fef2f2 !important;
}

.modal-close:hover,
.modal-close:focus,
.icon-close:hover,
.icon-close:focus,
.review-search-clear:hover,
.review-search-clear:focus {
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
    background-color: #fee2e2 !important;
}

button .bi-x-lg,
a .bi-x-lg {
    color: #dc2626 !important;
}

.btn-close {
    --bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23dc2626'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") !important;
    background-color: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    border-radius: 8px !important;
    filter: none !important;
    opacity: 1 !important;
}

.btn-close:hover,
.btn-close:focus {
    background-color: #fee2e2 !important;
    border-color: #fca5a5 !important;
    opacity: 1 !important;
}

html {
    width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-width: 320px;
    max-width: 100%;
}

img,
video,
canvas {
    max-width: 100%;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

button,
a,
input,
select,
textarea,
summary {
    touch-action: manipulation;
}

.layout,
.main,
.content,
.page-shell,
.shell,
.panel,
.card,
.course-card,
.course-item,
.assignment,
.review-row,
.topbar-inner,
.lms-nav,
.nav-links,
.feature-item,
.summary-card,
.summary-course-card,
.modal-card,
.modal-body,
.form-grid,
.field-grid,
.grid,
.grid-2 {
    min-width: 0;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table {
    margin: 0;
}

.exam-frame,
iframe {
    max-width: 100%;
}

.modal-layer {
    overscroll-behavior: contain;
}

.modal-card {
    max-width: 100%;
}

.modal-body {
    overflow-wrap: anywhere;
}

.lms-nav-toggle {
    display: none;
    width: var(--lms-touch-size);
    height: var(--lms-touch-size);
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #fff;
    color: #0f4f9d;
    align-items: center;
    justify-content: center;
    font: inherit;
    cursor: pointer;
}

@media (max-width: 1199px) {
    .lms-nav,
    .page-shell,
    .topbar-inner,
    .shell,
    .footer-inner,
    .feature-strip {
        width: calc(100% - (var(--lms-page-gutter) * 2));
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    .home-hero {
        width: calc(100vw - (var(--lms-page-gutter) * 2));
        min-height: 460px;
        padding-left: clamp(22px, 5vw, 54px);
        padding-right: clamp(22px, 5vw, 54px);
    }

    .feature-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 10px 18px;
    }

    .feature-item {
        padding: 16px 18px;
    }

    .feature-item:nth-child(2n) {
        border-right: 0;
    }

    .feature-item:nth-child(-n + 2) {
        border-bottom: 1px solid #e5eaf2;
    }

    .feature-item strong,
    .feature-item span {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .course-grid,
    .announcement-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-course-grid,
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid,
    .grid-2,
    .content,
    .qr-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .top-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .rich-editor.active {
        inset: 14px;
    }
}

@media (max-width: 980px) {
    body:has(.layout) {
        overflow: auto !important;
    }

    .layout {
        width: 100%;
        min-height: 100dvh;
        height: auto !important;
        flex-direction: column;
    }

    .sidebar {
        width: 100% !important;
        max-width: none;
        position: sticky;
        top: 0;
        z-index: 90;
        flex: 0 0 auto;
        max-height: 100dvh;
    }

    .sidebar .brand {
        min-height: 72px;
        padding: 12px 16px;
    }

    .sidebar .brand div {
        display: block !important;
        min-width: 0;
    }

    .sidebar .brand strong,
    .sidebar .brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar-toggle {
        margin-left: auto !important;
        flex: 0 0 auto;
    }

    .sidebar .nav {
        max-height: calc(100dvh - 140px);
        overflow-y: auto;
        padding: 8px 0;
        overscroll-behavior: contain;
    }

    .sidebar .logout-area {
        flex: 0 0 auto;
    }

    body.nav-collapsed .sidebar .nav,
    body.nav-collapsed .sidebar .logout-area {
        display: none !important;
    }

    body.nav-collapsed .sidebar {
        width: 100% !important;
    }

    .main {
        width: 100%;
        height: auto !important;
        min-height: calc(100dvh - 72px);
        overflow: visible !important;
    }

    .main > .topbar {
        position: sticky;
        top: 0;
        z-index: 40;
    }

    .content,
    .content.exam-content {
        width: calc(100% - (var(--lms-page-gutter) * 2));
        max-width: none;
        padding: 16px 0;
    }

    .content.exam-content {
        width: 100%;
        padding: 0;
    }

    .exam-frame,
    .content.exam-content .exam-frame {
        height: calc(100dvh - 72px);
        min-height: 560px;
    }

    .scope-filter .form-grid,
    .form-grid[style*="grid-template-columns"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .course-item {
        grid-template-columns: 112px minmax(0, 1fr);
    }

    .course-item > .actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .lms-nav {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        gap: 8px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .lms-nav .brand {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    .lms-nav .brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .lms-nav-toggle {
        display: inline-flex;
        grid-column: 2;
        grid-row: 1;
    }

    .lms-nav .user-menu,
    .lms-nav > .user-pill {
        grid-column: 3;
        grid-row: 1;
        min-width: 0;
    }

    .lms-nav .user-pill {
        max-width: min(36vw, 220px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .lms-nav .nav-links {
        display: none;
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        margin: 0;
        padding: 8px 0 0;
        overflow: visible;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .lms-nav.is-open .nav-links {
        display: flex;
    }

    .lms-nav .nav-links a {
        width: 100%;
        padding: 11px 12px;
    }
}

@media (max-width: 767px) {
    :root {
        --lms-page-gutter: 14px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    button,
    .btn,
    .pill,
    .hero-button,
    .btn-course,
    .user-pill {
        min-height: var(--lms-touch-size);
    }

    .lms-nav {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        gap: 8px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .lms-nav .brand {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
        font-size: 1rem;
    }

    .lms-nav .brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .lms-nav-toggle {
        display: inline-flex;
        grid-column: 2;
        grid-row: 1;
    }

    .lms-nav .user-menu,
    .lms-nav > .user-pill {
        grid-column: 3;
        grid-row: 1;
        min-width: 0;
    }

    .lms-nav .user-pill {
        max-width: min(42vw, 190px);
        padding: 7px 10px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .lms-nav .user-dropdown {
        right: 0;
        width: min(260px, calc(100vw - 28px));
    }

    .lms-nav .nav-links {
        display: none;
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        margin: 0;
        padding: 8px 0 0;
        overflow: visible;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .lms-nav.is-open .nav-links {
        display: flex;
    }

    .lms-nav .nav-links a {
        width: 100%;
        padding: 11px 12px;
    }

    .page-shell {
        padding-top: 20px;
        padding-bottom: 40px;
    }

    .home-hero {
        min-height: min(660px, calc(100dvh - 80px));
        margin-top: -20px;
        padding: 44px 20px 88px;
        align-items: flex-end;
        background-position: 58% center;
    }

    .home-hero-content {
        max-width: 100%;
    }

    .home-hero-kicker {
        font-size: 1.08rem;
    }

    .home-hero-subtitle {
        margin-bottom: 18px;
        font-size: .9rem;
    }

    .home-hero h1 {
        margin-bottom: 16px;
        font-size: clamp(2.35rem, 13vw, 3.55rem);
        line-height: 1.02;
        overflow-wrap: anywhere;
    }

    .home-hero p {
        margin-bottom: 20px;
        font-size: 1rem;
        line-height: 1.55;
    }

    .hero-buttons {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-button {
        width: 100%;
        justify-content: center;
    }

    .feature-strip {
        grid-template-columns: minmax(0, 1fr);
        margin-top: -54px;
        padding: 8px 16px;
    }

    .feature-item,
    .feature-item:nth-child(2n),
    .feature-item:nth-child(-n + 2) {
        grid-template-columns: 46px minmax(0, 1fr);
        padding: 14px 4px;
        border-right: 0;
        border-bottom: 1px solid #e5eaf2;
    }

    .feature-item:last-child {
        border-bottom: 0;
    }

    .feature-item i {
        width: 46px;
        height: 46px;
    }

    .feature-item strong {
        font-size: .93rem;
    }

    .feature-item span {
        font-size: .8rem;
    }

    .section-head,
    .contact-band,
    .panel-head,
    .assignment-head,
    .page-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .section-title,
    .page-actions h2,
    .panel h2 {
        font-size: 1.15rem;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .search-form {
        width: 100%;
    }

    .course-grid,
    .announcement-grid,
    .summary-grid,
    .summary-course-grid,
    .footer-inner,
    .field-grid,
    .select-grid,
    .review-row,
    .grid,
    .grid-2,
    .qr-panel,
    .summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .course-card,
    .announcement,
    .summary-card,
    .summary-course-card {
        width: 100%;
    }

    .course-body p {
        min-height: 0;
    }

    .summary-course-card summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .summary-metrics {
        justify-content: flex-start;
    }

    .summary-course-body,
    .summary-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .summary-table {
        min-width: 620px;
    }

    .footer-inner {
        gap: 22px;
    }

    .topbar-inner {
        min-height: 0;
        padding-top: 12px;
        padding-bottom: 12px;
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-inner .brand {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .top-actions {
        width: 100%;
        margin-left: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .top-actions .pill {
        width: 100%;
        padding: 8px 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        overflow-wrap: anywhere;
    }

    .shell {
        margin-top: 18px;
        margin-bottom: 40px;
    }

    .course-hero,
    .cover {
        min-height: 210px;
        padding: 20px;
    }

    .course-hero .hero-content h1,
    .cover h1 {
        font-size: clamp(1.45rem, 8vw, 2rem);
        overflow-wrap: anywhere;
    }

    .panel,
    .summary-card,
    .summary-course-card,
    .contact-band {
        padding: 14px;
    }

    .assignment,
    .review-row,
    .exam-item,
    .student-item,
    .online-item,
    .compact-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .staff-actions,
    .score-form,
    .actions,
    .table-toolbar,
    .session-picker,
    .qr-link-tools {
        width: 100%;
        align-items: stretch;
    }

    .page-actions > .btn,
    .table-toolbar > .btn,
    .actions > .btn,
    .actions > form,
    .actions > form .btn,
    .form-grid > .btn,
    .qr-link-tools > .btn {
        width: 100%;
    }

    .course-item {
        grid-template-columns: minmax(0, 1fr);
    }

    .course-item .cover {
        width: 100%;
        min-height: 180px;
    }

    .course-item > .actions {
        grid-column: auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content .topbar,
    .main > .topbar {
        padding: 10px 14px;
    }

    .main > .topbar h1 {
        font-size: 1.05rem;
        line-height: 1.4;
    }

    .main > .topbar .user-pill {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .modal-layer {
        padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
        align-items: stretch;
    }

    .modal-card,
    .modal-card.narrow {
        width: 100%;
        max-height: calc(100dvh - 16px);
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .modal-head {
        flex: 0 0 auto;
        padding: 12px 14px;
    }

    .modal-head h2 {
        font-size: 1rem;
        line-height: 1.4;
    }

    .modal-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: 14px;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap table,
    .table-wrap > table {
        min-width: 720px;
    }

    .inline-score,
    .row-status-select {
        min-height: var(--lms-touch-size);
    }

    .rich-editor.active {
        inset: 0;
        border-radius: 0;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .rich-menubar,
    .rich-toolbar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .rich-menubar button,
    .rich-toolbar button {
        flex: 0 0 auto;
    }

    body:has(> main.card) {
        padding: 14px;
        place-items: start center;
    }

    body > main.card {
        width: 100%;
    }

    body > main.card .header {
        padding: 20px;
        align-items: flex-start;
    }

    body > main.card form {
        padding: 18px;
    }

    .article .body {
        padding: 18px;
    }

    .article .cover {
        width: 100%;
        min-height: 0;
        max-height: 320px;
        padding: 0;
    }

    .toast-stack {
        right: max(14px, env(safe-area-inset-right));
        bottom: max(14px, env(safe-area-inset-bottom));
        width: calc(100vw - 28px - env(safe-area-inset-left) - env(safe-area-inset-right));
    }
}

@media (max-width: 479px) {
    .lms-nav {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .lms-nav .user-menu,
    .lms-nav > .user-pill {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
    }

    .lms-nav .user-pill {
        width: 100%;
        max-width: none;
    }

    .lms-nav .nav-links {
        grid-row: 3;
    }

    .home-hero {
        padding-left: 16px;
        padding-right: 16px;
        background-position: 62% center;
    }

    .top-actions,
    .course-item > .actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .course-hero,
    .cover {
        min-height: 190px;
        padding: 16px;
    }

    .sidebar .brand img {
        width: 42px;
        height: 42px;
    }

    .main > .topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
    }

    .summary-table,
    .table-wrap table,
    .table-wrap > table {
        min-width: 680px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Shared classroom audience picker for assignments and course announcements. */
.audience-dropdown {
    position: relative;
    width: 100%;
}

.audience-dropdown > summary {
    min-height: 48px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f2f68;
    cursor: pointer;
    list-style: none;
}

.audience-dropdown > summary::-webkit-details-marker {
    display: none;
}

.audience-dropdown > summary strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

.audience-dropdown[open] > summary {
    border-color: #1d7fe2;
    box-shadow: 0 0 0 3px rgba(29, 127, 226, .12);
}

.audience-dropdown[open] > summary .bi-chevron-down {
    transform: rotate(180deg);
}

.audience-options {
    max-height: min(390px, 55vh);
    overflow: auto;
    margin-top: 6px;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 28px rgba(15, 23, 42, .14);
}

.audience-group-title {
    padding: 10px 10px 5px;
    color: #64748b;
    font-size: .8rem;
    font-weight: 800;
}

.audience-check {
    min-height: 42px;
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    padding: 8px 10px;
    border-radius: 6px;
    color: #1e293b !important;
    cursor: pointer;
}

.audience-check:hover {
    background: #eff6ff;
}

.audience-check input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: #1d7fe2;
}

.audience-all {
    border-bottom: 1px solid #e2e8f0;
    color: #0f2f68 !important;
    font-weight: 800 !important;
}

.room-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

.room-check {
    min-height: 42px;
    display: flex !important;
    align-items: center;
    gap: 9px;
    margin: 0 !important;
    padding: 8px 10px;
    border: 1px solid #dbe3ef;
    border-radius: 7px;
    background: #fff;
    color: #1e293b !important;
    cursor: pointer;
}

.room-check:has(input:checked) {
    border-color: #1d7fe2;
    background: #eff6ff;
    color: #0f4cbd !important;
}

.room-check input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: #1d7fe2;
}

.room-check.all {
    font-weight: 800 !important;
}

@media (max-width: 639px) {
    .audience-dropdown > summary {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .audience-dropdown > summary > span {
        display: none;
    }

    .audience-dropdown > summary strong {
        text-align: left;
    }

    .datetime-24 {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .room-check-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
