/* Shared sizing safeguards; keep wide tables scrollable, not clipped. */
.image-preview-open,.image-preview-open body{overflow:hidden}
dialog.image-preview-dialog{box-sizing:border-box;width:min(1100px,calc(100% - 24px));max-width:calc(100% - 24px);max-height:calc(100dvh - 24px);padding:0;margin:auto;border:1px solid #d5b36c;border-radius:16px;background:#0b192b;color:#fff;box-shadow:0 20px 70px #0008;overflow:auto}
.image-preview-dialog::backdrop{background:#020914dc}
.image-preview-header{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;background:#0b192b;border-bottom:1px solid #ffffff26}
.image-preview-header>span{font-size:.9rem;color:#e0e9f5}
.image-preview-dialog .image-preview-close{flex-shrink:0;min-width:100px;min-height:44px;padding:8px 16px;border:1px solid #f3cc81;border-radius:9px;background:#f3cc81;color:#14243b;font:700 1rem system-ui;cursor:pointer}
.image-preview-close:focus-visible{outline:3px solid #fff;outline-offset:3px}
.image-preview-frame{display:flex;justify-content:center;padding:12px;min-width:0}
.image-preview-dialog .image-preview-frame img{display:block;width:auto;height:auto;max-width:100%;max-height:calc(100dvh - 114px);object-fit:contain;border-radius:6px}
@media(max-width:575px){dialog.image-preview-dialog{width:calc(100% - 16px);max-width:calc(100% - 16px);max-height:calc(100dvh - 16px)}.image-preview-header{padding:8px 10px}.image-preview-frame{padding:8px}}
@media screen {
    body > :where(main, section, article, div, footer),
    :where(.admin-shell, .admin-main, .admin-content, .instructor-main),
    :where(.row, .d-flex, .input-group) > *,
    :where(form, fieldset, .card-body, .panel, .chat-panel) {
        min-width: 0;
    }

    body > :where(main, section, article, div, footer) {
        max-width: 100%;
    }

    :where(input, select, textarea) {
        max-width: 100%;
    }

    :where(h1, h2, h3, p, label, legend, .alert, .card-body, .panel) {
        overflow-wrap: anywhere;
    }

    :where(.table-responsive, .mobile-table-scroll, .admin-scroll-table, .table-wrap, .dcl-scroll) {
        min-width: 0;
        max-width: 100%;
        overscroll-behavior-x: contain;
    }

    :where(.table-responsive, .mobile-table-scroll, .admin-scroll-table, .table-wrap, .dcl-scroll):focus-visible {
        outline: 3px solid #578fd6;
        outline-offset: 2px;
    }

    /* Match the larger footer grid gutters instead of clipping their edges. */
    .site-footer > .container {
        padding-inline: clamp(1rem, 2.5vw, 2.5rem);
    }
}

@media screen and (max-width: 767.98px) {
    :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) {
        font-size: 16px;
        min-width: 0;
    }

    :where(.btn, .admin-btn) {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        min-height: 44px;
    }

    :where(.admin-topbar__actions, .admin-toolbar, .instructor-page-head) {
        flex-wrap: wrap;
    }

    .modal-dialog {
        max-width: calc(100% - 1rem);
        margin: .5rem auto;
    }

    .modal-content {
        max-height: calc(100dvh - 1rem);
        overflow-y: auto;
    }

    .instructor-main :where(.stats-grid, .lesson-card, .chat-layout, .compose) > * {
        min-width: 0;
    }

    .instructor-main .exercise-athletes {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    }

    .instructor-main .bubble {
        overflow-wrap: anywhere;
    }
}
