/*
 * Manifest Life Church — Global Mobile-First Foundation
 * Phase 1: shared frontend/user/admin responsive utilities.
 * This file is intentionally utility-focused so later phases can convert pages safely.
 */
:root {
    --mlc-mf-bg: #f6f8fc;
    --mlc-mf-surface: #ffffff;
    --mlc-mf-surface-soft: #f8fafc;
    --mlc-mf-text: #0f172a;
    --mlc-mf-muted: #64748b;
    --mlc-mf-border: rgba(15, 23, 42, .10);
    --mlc-mf-shadow: 0 18px 48px rgba(15, 23, 42, .10);
    --mlc-mf-shadow-soft: 0 10px 28px rgba(15, 23, 42, .08);
    --mlc-mf-radius-xs: 10px;
    --mlc-mf-radius-sm: 14px;
    --mlc-mf-radius: 20px;
    --mlc-mf-radius-lg: 28px;
    --mlc-mf-tap: 44px;
    --mlc-mf-gap: 1rem;
    --mlc-mf-safe-top: env(safe-area-inset-top, 0px);
    --mlc-mf-safe-bottom: env(safe-area-inset-bottom, 0px);
    --mlc-mf-brand: var(--admin-primary, var(--up-accent-1, var(--fd-primary, var(--fm-primary, var(--mlc-brand-orange, #2563eb)))));
    --mlc-mf-brand-2: var(--admin-primary-2, var(--up-accent-2, var(--fd-secondary, var(--fm-secondary, var(--mlc-brand-green, #7c3aed)))));
    --mlc-mf-accent: var(--admin-accent, var(--up-accent-3, var(--fd-accent, var(--fm-accent, var(--mlc-brand-blue, #f97316)))));
}

html {
    max-width: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--mlc-mobile-header-height, 0px) + .9rem);
}

body.mlc-mobile-first {
    max-width: 100%;
    overflow-x: hidden;
    overflow-wrap: anywhere;
    -webkit-tap-highlight-color: rgba(37, 99, 235, .16);
}

body.mlc-mobile-first *,
body.mlc-mobile-first *::before,
body.mlc-mobile-first *::after {
    box-sizing: border-box;
}

body.mlc-mobile-first img,
body.mlc-mobile-first svg,
body.mlc-mobile-first video,
body.mlc-mobile-first canvas,
body.mlc-mobile-first audio,
body.mlc-mobile-first iframe,
body.mlc-mobile-first embed,
body.mlc-mobile-first object {
    max-width: 100%;
}

body.mlc-mobile-first img,
body.mlc-mobile-first video,
body.mlc-mobile-first iframe,
body.mlc-mobile-first embed,
body.mlc-mobile-first object {
    height: auto;
}

body.mlc-mobile-first iframe {
    border: 0;
}

body.mlc-mobile-first table {
    max-width: 100%;
}

body.mlc-mobile-first a,
body.mlc-mobile-first button,
body.mlc-mobile-first input,
body.mlc-mobile-first select,
body.mlc-mobile-first textarea,
body.mlc-mobile-first summary,
body.mlc-mobile-first [role="button"] {
    touch-action: manipulation;
}

body.mlc-mobile-first :target {
    scroll-margin-top: calc(var(--mlc-mobile-header-height, 0px) + 1rem);
}

body.mlc-mobile-first .mlc-page-shell,
body.mlc-mobile-first .mlc-app-page,
body.mlc-mobile-first .mlc-mobile-page {
    width: min(100%, 1180px);
    margin-inline: auto;
    padding: clamp(.85rem, 3vw, 1.5rem);
}

body.mlc-mobile-first .mlc-page-shell--wide,
body.mlc-mobile-first .mlc-app-page--wide {
    width: min(100%, 1480px);
}

body.mlc-mobile-first .mlc-page-header,
body.mlc-mobile-first .mlc-mobile-hero,
body.mlc-mobile-first .mlc-section-header {
    display: grid;
    gap: .55rem;
    margin-bottom: clamp(1rem, 4vw, 1.6rem);
}

body.mlc-mobile-first .mlc-page-header h1,
body.mlc-mobile-first .mlc-mobile-hero h1,
body.mlc-mobile-first .mlc-section-header h2 {
    margin: 0;
    color: var(--mlc-mf-text);
    font-weight: 900;
    letter-spacing: -.045em;
    line-height: 1.04;
    font-size: clamp(1.65rem, 7vw, 3.1rem);
}

body.mlc-mobile-first .mlc-page-header p,
body.mlc-mobile-first .mlc-mobile-hero p,
body.mlc-mobile-first .mlc-section-header p {
    margin: 0;
    color: var(--mlc-mf-muted);
    line-height: 1.65;
    max-width: 70ch;
}

body.mlc-mobile-first .mlc-section,
body.mlc-mobile-first .mlc-stack {
    display: grid;
    gap: var(--mlc-mf-gap);
}

body.mlc-mobile-first .mlc-stack-sm { gap: .65rem; }
body.mlc-mobile-first .mlc-stack-lg { gap: 1.35rem; }

body.mlc-mobile-first .mlc-card,
body.mlc-mobile-first .mlc-panel,
body.mlc-mobile-first .mlc-form-card,
body.mlc-mobile-first .mlc-list-card,
body.mlc-mobile-first .mlc-media-card,
body.mlc-mobile-first .mlc-upload-card,
body.mlc-mobile-first .mlc-empty-state,
body.mlc-mobile-first .mlc-error-state,
body.mlc-mobile-first .mlc-loading-state {
    border: 1px solid var(--mlc-mf-border);
    border-radius: var(--mlc-mf-radius);
    background: var(--mlc-mf-surface);
    box-shadow: var(--mlc-mf-shadow-soft);
    padding: clamp(1rem, 4vw, 1.35rem);
    min-width: 0;
}

body.mlc-mobile-first .mlc-card-soft,
body.mlc-mobile-first .mlc-panel-soft {
    background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(248,250,252,.92));
}

body.mlc-mobile-first .mlc-card-title,
body.mlc-mobile-first .mlc-panel-title {
    margin: 0 0 .35rem;
    color: var(--mlc-mf-text);
    font-weight: 900;
    line-height: 1.15;
}

body.mlc-mobile-first .mlc-card-text,
body.mlc-mobile-first .mlc-panel-text,
body.mlc-mobile-first .mlc-muted {
    color: var(--mlc-mf-muted);
    line-height: 1.6;
}

body.mlc-mobile-first .mlc-grid,
body.mlc-mobile-first .mlc-mobile-grid,
body.mlc-mobile-first .mlc-card-grid,
body.mlc-mobile-first .mlc-stat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mlc-mf-gap);
    min-width: 0;
}

body.mlc-mobile-first .mlc-grid-2,
body.mlc-mobile-first .mlc-grid-3,
body.mlc-mobile-first .mlc-grid-4 {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mlc-mf-gap);
}

body.mlc-mobile-first .mlc-stat-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--mlc-mf-radius);
    border: 1px solid rgba(148, 163, 184, .22);
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--mlc-mf-brand), transparent 86%), transparent 36%),
        #fff;
    padding: 1rem;
    box-shadow: var(--mlc-mf-shadow-soft);
    display: flex;
    align-items: center;
    gap: .9rem;
    min-width: 0;
}

body.mlc-mobile-first .mlc-stat-card__icon,
body.mlc-mobile-first .mlc-card-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--mlc-mf-brand), var(--mlc-mf-brand-2));
    color: #fff;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--mlc-mf-brand), transparent 72%);
}

body.mlc-mobile-first .mlc-stat-card strong {
    display: block;
    color: var(--mlc-mf-text);
    font-weight: 900;
    font-size: 1.25rem;
    line-height: 1.1;
}

body.mlc-mobile-first .mlc-stat-card span,
body.mlc-mobile-first .mlc-stat-card small {
    display: block;
    color: var(--mlc-mf-muted);
    line-height: 1.35;
}

body.mlc-mobile-first .mlc-actions,
body.mlc-mobile-first .mlc-action-row,
body.mlc-mobile-first .mlc-button-row,
body.mlc-mobile-first .mlc-chip-row,
body.mlc-mobile-first .mlc-toolbar,
body.mlc-mobile-first .mlc-filter-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
    min-width: 0;
}

body.mlc-mobile-first .mlc-actions .btn,
body.mlc-mobile-first .mlc-action-row .btn,
body.mlc-mobile-first .mlc-button-row .btn,
body.mlc-mobile-first .mlc-filter-actions .btn {
    min-height: var(--mlc-mf-tap);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    white-space: normal;
}

body.mlc-mobile-first .mlc-chip,
body.mlc-mobile-first .mlc-action-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 38px;
    padding: .45rem .8rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .26);
    background: rgba(255, 255, 255, .88);
    color: var(--mlc-mf-text);
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

body.mlc-mobile-first .mlc-scroll-tabs,
body.mlc-mobile-first .mlc-horizontal-scroll,
body.mlc-mobile-first .mlc-chip-scroller {
    display: flex;
    gap: .6rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding-bottom: .35rem;
    -webkit-overflow-scrolling: touch;
}

body.mlc-mobile-first .mlc-scroll-tabs > *,
body.mlc-mobile-first .mlc-horizontal-scroll > *,
body.mlc-mobile-first .mlc-chip-scroller > * {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

body.mlc-mobile-first .mlc-form-grid,
body.mlc-mobile-first .mlc-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .9rem;
}

body.mlc-mobile-first .mlc-form-row {
    display: grid;
    gap: .45rem;
    min-width: 0;
}

body.mlc-mobile-first .mlc-form-row label,
body.mlc-mobile-first .form-label {
    font-weight: 800;
    color: var(--mlc-mf-text);
}

body.mlc-mobile-first .mlc-form-help,
body.mlc-mobile-first .form-text {
    color: var(--mlc-mf-muted);
    line-height: 1.45;
}

body.mlc-mobile-first .mlc-upload-block,
body.mlc-mobile-first .mlc-media-preview {
    border: 1px dashed rgba(148, 163, 184, .45);
    border-radius: var(--mlc-mf-radius);
    background: linear-gradient(135deg, #fff, #f8fafc);
    padding: 1rem;
    display: grid;
    gap: .75rem;
}

body.mlc-mobile-first .mlc-media-preview img,
body.mlc-mobile-first .mlc-media-preview video,
body.mlc-mobile-first .mlc-upload-block img,
body.mlc-mobile-first .mlc-upload-block video {
    width: 100%;
    border-radius: 16px;
    object-fit: cover;
}

body.mlc-mobile-first .mlc-speaker-list,
body.mlc-mobile-first .mlc-profile-list,
body.mlc-mobile-first .mlc-repeatable-list {
    display: grid;
    gap: .8rem;
}

body.mlc-mobile-first .mlc-speaker-card,
body.mlc-mobile-first .mlc-profile-card,
body.mlc-mobile-first .mlc-repeatable-card {
    display: grid;
    gap: .8rem;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: var(--mlc-mf-radius);
    background: #fff;
    padding: 1rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .07);
}

body.mlc-mobile-first .mlc-speaker-card img,
body.mlc-mobile-first .mlc-profile-card img {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    object-fit: cover;
}

body.mlc-mobile-first .mlc-filter-shell,
body.mlc-mobile-first .mlc-filter-panel,
body.mlc-mobile-first [data-mlc-filter-panel] {
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: var(--mlc-mf-radius);
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--mlc-mf-shadow-soft);
    padding: 1rem;
}

body.mlc-mobile-first .mlc-filter-toggle,
body.mlc-mobile-first [data-mlc-filter-toggle] {
    min-height: var(--mlc-mf-tap);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}

body.mlc-mobile-first .mlc-empty-state,
body.mlc-mobile-first .mlc-error-state,
body.mlc-mobile-first .mlc-loading-state {
    text-align: center;
    place-items: center;
    color: var(--mlc-mf-muted);
    background:
        radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--mlc-mf-brand), transparent 88%), transparent 45%),
        #fff;
}

body.mlc-mobile-first .mlc-empty-state i,
body.mlc-mobile-first .mlc-error-state i,
body.mlc-mobile-first .mlc-loading-state i {
    font-size: 2rem;
    color: var(--mlc-mf-brand);
}

body.mlc-mobile-first .mlc-empty-state strong,
body.mlc-mobile-first .mlc-error-state strong,
body.mlc-mobile-first .mlc-loading-state strong {
    display: block;
    color: var(--mlc-mf-text);
    font-weight: 900;
}

body.mlc-mobile-first .mlc-alert,
body.mlc-mobile-first .alert {
    border-radius: var(--mlc-mf-radius-sm);
    overflow-wrap: anywhere;
}

body.mlc-mobile-first .mlc-sticky-actions,
body.mlc-mobile-first .mlc-bottom-actions,
body.mlc-mobile-first [data-mlc-sticky-actions] {
    position: sticky;
    bottom: calc(var(--mlc-mobile-footer-height, 0px) + var(--mlc-mf-safe-bottom) + .75rem);
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: center;
    justify-content: flex-end;
    padding: .75rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .16);
    backdrop-filter: blur(16px);
}

body.mlc-mobile-first .mlc-fab,
body.mlc-mobile-first [data-mlc-fab] {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right, 0px));
    bottom: calc(var(--mlc-mobile-footer-height, 0px) + var(--mlc-mf-safe-bottom) + 1rem);
    z-index: 60;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: linear-gradient(135deg, var(--mlc-mf-brand), var(--mlc-mf-brand-2));
    color: #fff;
    box-shadow: 0 18px 44px color-mix(in srgb, var(--mlc-mf-brand), transparent 60%);
}

body.mlc-mobile-first .table-responsive,
body.mlc-mobile-first .mlc-table-wrap {
    max-width: 100%;
    border-radius: var(--mlc-mf-radius);
}

body.mlc-mobile-first .mlc-responsive-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

body.mlc-mobile-first .mlc-responsive-table th,
body.mlc-mobile-first .mlc-responsive-table td {
    vertical-align: middle;
}

body.mlc-mobile-first .mlc-responsive-table [data-mlc-row-actions],
body.mlc-mobile-first .mlc-responsive-table .mlc-row-actions,
body.mlc-mobile-first .mlc-responsive-table .btn-group,
body.mlc-mobile-first .mlc-responsive-table .action-buttons {
    display: flex;
    gap: .45rem;
    flex-wrap: wrap;
    align-items: center;
}

body.mlc-mobile-first .mlc-pagination,
body.mlc-mobile-first .pagination {
    flex-wrap: wrap;
    gap: .3rem;
}

body.mlc-mobile-first .mlc-pagination .page-link,
body.mlc-mobile-first .pagination .page-link {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

@media (max-width: 767.98px) {
    body.mlc-mobile-first {
        --mlc-mf-gap: .85rem;
    }

    body.mlc-mobile-first .container,
    body.mlc-mobile-first .container-sm,
    body.mlc-mobile-first .container-md,
    body.mlc-mobile-first .container-lg,
    body.mlc-mobile-first .container-xl,
    body.mlc-mobile-first .container-xxl,
    body.mlc-mobile-first .container-fluid {
        max-width: 100%;
        padding-left: max(.85rem, env(safe-area-inset-left, 0px));
        padding-right: max(.85rem, env(safe-area-inset-right, 0px));
    }

    body.mlc-mobile-first .row {
        min-width: 0;
    }

    body.mlc-mobile-first .btn,
    body.mlc-mobile-first button,
    body.mlc-mobile-first input[type="button"],
    body.mlc-mobile-first input[type="submit"],
    body.mlc-mobile-first input[type="reset"] {
        min-height: var(--mlc-mf-tap);
    }

    body.mlc-mobile-first .form-control,
    body.mlc-mobile-first .form-select,
    body.mlc-mobile-first .input-group-text {
        min-height: var(--mlc-mf-tap);
        font-size: 16px;
    }

    body.mlc-mobile-first textarea.form-control {
        min-height: 112px;
    }

    body.mlc-mobile-first .input-group,
    body.mlc-mobile-first .btn-group,
    body.mlc-mobile-first .btn-toolbar {
        flex-wrap: wrap;
    }

    body.mlc-mobile-first .input-group > .form-control,
    body.mlc-mobile-first .input-group > .form-select {
        min-width: 0;
    }

    body.mlc-mobile-first .modal-dialog {
        width: auto;
        max-width: none;
        margin: .5rem;
    }

    body.mlc-mobile-first .modal-content {
        border-radius: 22px;
        max-height: calc(100dvh - 1rem);
        overflow: hidden;
    }

    body.mlc-mobile-first .modal-header,
    body.mlc-mobile-first .modal-footer {
        flex-wrap: wrap;
        gap: .55rem;
    }

    body.mlc-mobile-first .modal-body {
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    body.mlc-mobile-first .mlc-modal-fullscreen-mobile .modal-dialog,
    body.mlc-mobile-first .modal.mlc-modal-fullscreen-mobile .modal-dialog {
        margin: 0;
        width: 100%;
        min-height: 100dvh;
    }

    body.mlc-mobile-first .mlc-modal-fullscreen-mobile .modal-content,
    body.mlc-mobile-first .modal.mlc-modal-fullscreen-mobile .modal-content {
        min-height: 100dvh;
        border-radius: 0;
    }

    body.mlc-mobile-first .mlc-responsive-table,
    body.mlc-mobile-first .mlc-responsive-table thead,
    body.mlc-mobile-first .mlc-responsive-table tbody,
    body.mlc-mobile-first .mlc-responsive-table tfoot,
    body.mlc-mobile-first .mlc-responsive-table tr,
    body.mlc-mobile-first .mlc-responsive-table th,
    body.mlc-mobile-first .mlc-responsive-table td {
        display: block;
        width: 100%;
    }

    body.mlc-mobile-first .mlc-responsive-table {
        border: 0 !important;
        background: transparent !important;
    }

    body.mlc-mobile-first .mlc-responsive-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    body.mlc-mobile-first .mlc-responsive-table tbody,
    body.mlc-mobile-first .mlc-responsive-table tfoot {
        display: grid;
        gap: .85rem;
    }

    body.mlc-mobile-first .mlc-responsive-table tr {
        border: 1px solid rgba(148, 163, 184, .22) !important;
        border-radius: var(--mlc-mf-radius);
        background: #fff;
        box-shadow: var(--mlc-mf-shadow-soft);
        padding: .85rem;
        overflow: hidden;
    }

    body.mlc-mobile-first .mlc-responsive-table td,
    body.mlc-mobile-first .mlc-responsive-table th[scope="row"] {
        border: 0 !important;
        padding: .65rem 0 !important;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
        text-align: right;
        min-width: 0;
    }

    body.mlc-mobile-first .mlc-responsive-table td + td,
    body.mlc-mobile-first .mlc-responsive-table th[scope="row"] + td {
        border-top: 1px solid rgba(148, 163, 184, .14) !important;
    }

    body.mlc-mobile-first .mlc-responsive-table td::before,
    body.mlc-mobile-first .mlc-responsive-table th[scope="row"]::before {
        content: attr(data-label);
        flex: 0 0 42%;
        max-width: 48%;
        text-align: left;
        color: var(--mlc-mf-muted);
        font-size: .78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .045em;
        overflow-wrap: anywhere;
    }

    body.mlc-mobile-first .mlc-responsive-table td:empty,
    body.mlc-mobile-first .mlc-responsive-table th[scope="row"]:empty {
        display: none;
    }

    body.mlc-mobile-first .mlc-responsive-table td[data-label=""],
    body.mlc-mobile-first .mlc-responsive-table th[scope="row"][data-label=""] {
        display: block;
        text-align: left;
    }

    body.mlc-mobile-first .mlc-responsive-table td[data-label=""]::before,
    body.mlc-mobile-first .mlc-responsive-table th[scope="row"][data-label=""]::before {
        display: none;
    }

    body.mlc-mobile-first .mlc-responsive-table .btn,
    body.mlc-mobile-first .mlc-responsive-table button,
    body.mlc-mobile-first .mlc-responsive-table a.btn {
        min-height: 38px;
        white-space: normal;
    }

    body.mlc-mobile-first .mlc-responsive-table [data-mlc-row-actions],
    body.mlc-mobile-first .mlc-responsive-table .mlc-row-actions,
    body.mlc-mobile-first .mlc-responsive-table .btn-group,
    body.mlc-mobile-first .mlc-responsive-table .action-buttons {
        justify-content: flex-end;
    }

    body.mlc-mobile-first .mlc-sticky-actions,
    body.mlc-mobile-first .mlc-bottom-actions,
    body.mlc-mobile-first [data-mlc-sticky-actions] {
        border-radius: 22px;
        justify-content: stretch;
    }

    body.mlc-mobile-first .mlc-sticky-actions > *,
    body.mlc-mobile-first .mlc-bottom-actions > *,
    body.mlc-mobile-first [data-mlc-sticky-actions] > * {
        flex: 1 1 auto;
    }
}

@media (max-width: 575.98px) {
    body.mlc-mobile-first .mlc-actions,
    body.mlc-mobile-first .mlc-action-row,
    body.mlc-mobile-first .mlc-button-row,
    body.mlc-mobile-first .mlc-toolbar {
        align-items: stretch;
    }

    body.mlc-mobile-first .mlc-actions > .btn,
    body.mlc-mobile-first .mlc-action-row > .btn,
    body.mlc-mobile-first .mlc-button-row > .btn,
    body.mlc-mobile-first .mlc-toolbar > .btn {
        flex: 1 1 100%;
    }

    body.mlc-mobile-first .mlc-card,
    body.mlc-mobile-first .mlc-panel,
    body.mlc-mobile-first .mlc-form-card,
    body.mlc-mobile-first .mlc-list-card {
        border-radius: 18px;
    }
}

@media (min-width: 576px) {
    body.mlc-mobile-first .mlc-grid-2,
    body.mlc-mobile-first .mlc-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    body.mlc-mobile-first .mlc-grid,
    body.mlc-mobile-first .mlc-mobile-grid,
    body.mlc-mobile-first .mlc-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.mlc-mobile-first .mlc-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.mlc-mobile-first .mlc-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.mlc-mobile-first .mlc-form-grid,
    body.mlc-mobile-first .mlc-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.mlc-mobile-first .mlc-span-2 {
        grid-column: span 2;
    }
}

@media (min-width: 992px) {
    body.mlc-mobile-first .mlc-grid-3,
    body.mlc-mobile-first .mlc-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.mlc-mobile-first .mlc-grid-4,
    body.mlc-mobile-first .mlc-stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    body.mlc-mobile-first .mlc-form-grid--3,
    body.mlc-mobile-first .mlc-filter-grid--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

@supports not (backdrop-filter: blur(16px)) {
    body.mlc-mobile-first .mlc-sticky-actions,
    body.mlc-mobile-first .mlc-bottom-actions,
    body.mlc-mobile-first [data-mlc-sticky-actions] {
        background: #fff;
    }
}

/* Phase 5 final responsive QA layer: shared containment, media, form, modal and sticky fixes. */
body.mlc-mobile-first :where(main, section, article, aside, header, footer, nav, div, form, fieldset, .container, .container-fluid, .row, [class*="col-"], .card, .modal-content, .offcanvas, .dropdown-menu) {
    min-width: 0;
}

body.mlc-mobile-first :where(.container, .container-sm, .container-md, .container-lg, .container-xl, .container-xxl) {
    max-width: min(100%, var(--mlc-container-max, 1180px));
}

body.mlc-mobile-first :where(.table-responsive, .responsive-table, .table-wrap, .mlc-table-wrap, .mlc-admin-table-shell, .mlc-user-table-wrap, .mlc-frontend-table-wrapper) {
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

body.mlc-mobile-first :where(.ratio, .embed-responsive, .video-wrapper, .media-wrapper, .mlc-media-frame, .mlc-frontend-media-frame) {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

body.mlc-mobile-first :where(iframe[src*="youtube"], iframe[src*="youtu.be"], iframe[src*="vimeo"], iframe[src*="facebook"], iframe[src*="maps"], iframe[src*="google"]) {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
}

body.mlc-mobile-first :where(audio, video) {
    width: 100%;
}

body.mlc-mobile-first :where(pre, code, kbd, samp) {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

body.mlc-mobile-first :where(.btn, button, input[type="button"], input[type="submit"], input[type="reset"], .dropdown-item, .page-link) {
    white-space: normal;
    overflow-wrap: anywhere;
}

body.mlc-mobile-first :where(.dropdown-menu, .popover, .tooltip-inner) {
    max-width: calc(100vw - 1rem);
}

body.mlc-mobile-first :where(.modal-dialog) {
    max-width: min(100%, var(--mlc-modal-max, 720px));
}

body.mlc-mobile-first :where(.modal-content, .offcanvas) {
    max-height: calc(100dvh - max(1rem, var(--mlc-mf-safe-top)) - max(1rem, var(--mlc-mf-safe-bottom)));
}

body.mlc-mobile-first :where(.modal-body, .offcanvas-body) {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

body.mlc-mobile-first :where(.tox-tinymce, .tox, .ck-editor, .ck-editor__editable, .note-editor, .ql-container) {
    max-width: 100%;
}

body.mlc-mobile-first :where(.tox .tox-toolbar, .tox .tox-toolbar__primary, .tox .tox-toolbar__overflow, .tox .tox-menubar, .tox .tox-statusbar) {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

body.mlc-mobile-first :where(.mlc-sticky-actions, .mlc-bottom-actions, .mlc-user-sticky-actions, .admin-sticky-actions, .frontend-sticky-actions) {
    max-width: calc(100vw - 1rem);
}

body.mlc-mobile-first.mlc-has-sticky-actions {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

body.mlc-mobile-first :where(.mlc-empty-state, .empty-state, .no-records, .no-results, .notification-empty) {
    border-radius: var(--mlc-mf-radius, 20px);
    border: 1px dashed rgba(148, 163, 184, .42);
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,250,252,.94));
    padding: clamp(1rem, 4vw, 1.5rem);
    text-align: center;
}

@media (max-width: 767.98px) {
    body.mlc-mobile-first :where(.row) {
        margin-left: 0;
        margin-right: 0;
    }

    body.mlc-mobile-first :where(.row > *) {
        padding-left: 0;
        padding-right: 0;
    }

    body.mlc-mobile-first :where(.input-group):not(.mlc-preserve-inline):not([data-mlc-preserve-inline]) {
        flex-wrap: wrap;
        gap: .5rem;
    }

    body.mlc-mobile-first :where(.input-group):not(.mlc-preserve-inline):not([data-mlc-preserve-inline]) > :where(.form-control, .form-select, .btn, button, input, select) {
        flex: 1 1 100%;
        width: 100%;
        border-radius: .85rem !important;
    }

    body.mlc-mobile-first :where(.btn-toolbar, .btn-group):not(.mlc-preserve-inline):not([data-mlc-preserve-inline]) {
        flex-wrap: wrap;
        gap: .5rem;
    }

    body.mlc-mobile-first :where(.btn-toolbar, .btn-group):not(.mlc-preserve-inline):not([data-mlc-preserve-inline]) > :where(.btn, button, a.btn) {
        flex: 1 1 auto;
    }

    body.mlc-mobile-first :where(.modal) {
        padding: 0 !important;
    }

    body.mlc-mobile-first :where(.modal-dialog) {
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
        margin: .5rem auto;
    }

    body.mlc-mobile-first :where(.modal-content) {
        border-radius: 1.1rem;
        max-height: calc(100dvh - 1rem);
        overflow: hidden;
    }

    body.mlc-mobile-first :where(.modal-header, .modal-footer) {
        flex-wrap: wrap;
        gap: .55rem;
    }

    body.mlc-mobile-first :where(.modal-footer .btn, .modal-footer button) {
        flex: 1 1 auto;
    }

    body.mlc-mobile-first :where(.offcanvas) {
        max-width: min(94vw, 430px);
    }

    body.mlc-mobile-first :where(.nav-tabs, .nav-pills) {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    body.mlc-mobile-first :where(.nav-tabs .nav-link, .nav-pills .nav-link) {
        white-space: nowrap;
    }
}
