/*
 * Mobile layer for Brand Dashboard and Master Admin (SPEC section 16).
 * Phones in portrait (360-430 px): slide-out menu, compact header, tables scroll inside their own box,
 * single-column forms, 44 px touch targets, no sideways scrolling of the page. Desktop is not touched (min-width 768 px).
 */

.mobile-burger { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 767.98px) {

    html, body { max-width: 100%; overflow-x: hidden; }

    /* ---- Slide-out menu ---- */
    .mobile-burger {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; flex: 0 0 auto;
        border: 0; border-radius: 10px; background: transparent; color: inherit; font-size: 28px; line-height: 1;
    }
    .sidebar-wrapper {
        position: fixed !important; top: 0; left: 0; bottom: 0;
        width: 280px !important; max-width: 85vw; height: 100% !important; min-height: 0 !important;
        overflow-y: auto; z-index: 1045;
        transform: translateX(-105%); transition: transform .22s ease;
    }
    body.sidebar-open .sidebar-wrapper { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .45); }
    body.sidebar-open { overflow: hidden; }
    .sidebar-backdrop {
        position: fixed; inset: 0; z-index: 1040; background: rgba(16, 26, 49, .55);
    }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .sidebar-wrapper .nav-link { min-height: 44px; }

    /* ---- Compact header: burger, title that wraps, bell / theme / profile stay ---- */
    .topbar, .header-topbar-bg { padding: 8px 12px !important; gap: 8px; flex-wrap: nowrap; }
    .topbar > div:first-child, .header-topbar-bg > div:first-child { min-width: 0; flex: 1 1 auto; white-space: normal; word-break: break-word; }
    .topbar .py-2, .header-topbar-bg .py-2 { padding-top: 0 !important; padding-bottom: 0 !important; }
    .topbar #profileDropdown > span[data-header-identity], .header-topbar-bg #profileDropdown > span[data-header-identity] { display: none; }
    .topbar #profileDropdown img, .header-topbar-bg #profileDropdown img { margin-right: 0 !important; }
    .header-topbar-bg .me-4, .topbar .me-4 { margin-right: .5rem !important; }
    .header-topbar-bg .gap-3 { gap: .5rem !important; }

    /* ---- Page area ---- */
    .flex-grow-1.p-4, .col-md-9 > .p-4, .col-lg-10 > .p-4 { padding: 14px !important; }
    h1, .page-title { font-size: 1.4rem; }
    .container, .container-fluid { max-width: 100%; }
    img, video, canvas, svg, iframe { max-width: 100%; }
    canvas { height: auto; }

    /* Columns that were written without a phone breakpoint */
    .row > [class*="col-2"]:not([class*="col-md"]):not([class*="col-lg"]):not([class*="col-sm"]),
    .row > .col-3:not([class*="col-md"]), .row > .col-4:not([class*="col-md"]), .row > .col-5:not([class*="col-md"]) {
        flex: 0 0 auto; width: 50%;
    }
    .row > .col-7, .row > .col-8, .row > .col-9, .row > .col-10, .row > .col-11 { flex: 0 0 auto; width: 100%; }
    /* a column with its own fixed percentage width must not squeeze on a phone */
    [class*="col-md"][style*="width"], [class*="col-lg"][style*="width"] { width: 100% !important; }

    /* ---- Tables scroll inside their own box ---- */
    .table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-scroll > table { margin-bottom: 0; }
    table.table-wide { min-width: 640px; }
    table.table-wide td, table.table-wide th { min-width: 96px; }
    table.table-wide td:not(.text-nowrap) { min-width: 180px; }
    table.table-fit { width: 100% !important; table-layout: auto; }
    table.table-fit td, table.table-fit th { overflow-wrap: break-word; }
    .table-responsive { -webkit-overflow-scrolling: touch; }

    /* ---- Forms: one column, full-width inputs and buttons, big touch targets ---- */
    form .row > [class*="col"] { flex: 0 0 auto; width: 100%; }
    .form-control, .form-select, .ts-control, .btn { min-height: 44px; }
    .form-control, .form-select, input, select, textarea { font-size: 16px; max-width: 100%; }
    form button[type="submit"], form .btn-primary-custom, form .btn-primary, form .btn-secondary, form .btn-outline-primary,
    .page-header .btn, .section-header-with-actions .btn { width: 100%; }
    .btn-sm { min-height: 40px; }
    .form-check-input { width: 1.4em; height: 1.4em; }
    .accordion-button, .nav-tabs .nav-link, .nav-pills .nav-link, .dropdown-item { min-height: 44px; }

    /* ---- Filters / action rows wrap instead of overflowing ---- */
    .d-flex.justify-content-between { flex-wrap: wrap; gap: 8px; }
    .nav-tabs, .nav-pills.flex-nowrap, .wallet-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .pagination { flex-wrap: wrap; }

    /* ---- Modals fit the screen ---- */
    .modal-dialog { margin: .5rem auto; max-width: calc(100vw - 1rem) !important; min-width: 0 !important; width: auto !important; }
    .modal-content { max-width: 100%; }
    .modal-body { overflow-x: auto; }
    [style*="min-width"] { min-width: 0 !important; }

    /* ---- Live Preview moves below the form (columns stack) and shrinks to the screen ---- */
    [style*="height: 500px"], [style*="height:534px"], [style*="height:515px"] { max-width: 100%; }

    /* ---- Charts and poll bars ---- */
    .chart-container, [id*="chart"], [class*="chart"] { max-width: 100%; }
    .answer-bars, .poll-bar, [class*="answer-bar"] { max-width: 100%; overflow: hidden; }
    .stats-container { grid-template-columns: repeat(2, 1fr); }

    /* ---- Login, sign up, verification pages ---- */
    .bb-login-card { width: 100% !important; max-width: 400px; padding: 18px; }
    .bb-login-wrapper { padding-left: 16px; padding-right: 16px; }
    .bb-input { font-size: 16px; min-height: 44px; }
}

@media (max-width: 479.98px) {
    .stats-container { grid-template-columns: 1fr; }
    .row > .col-6 { flex: 0 0 auto; width: 50%; }
}


/* ======================================================================
   Phone layout, round 2 (lists as cards, Welcome page, Campaigns, filters)
   ====================================================================== */
@media (max-width: 767.98px) {

    /* ---- Lists: one record = one card. Rows are marked `.bb-card-row` by mobile.js ---- */
    .bb-card-container { padding: 14px !important; border-radius: 16px !important; }
    .bb-card-row {
        display: grid !important; grid-template-columns: 1fr 1fr; gap: 12px 14px;
        margin: 0 !important; --bs-gutter-x: 0; align-items: start !important;
    }
    .bb-card-row > * {
        width: auto !important; max-width: none !important; min-width: 0 !important;
        flex: none !important; padding: 0 !important; margin: 0 !important;
        text-align: left !important; justify-content: flex-start !important; align-items: flex-start !important;
        word-break: break-word;
    }
    .bb-card-row > :first-child { grid-column: 1 / -1; gap: 12px !important; align-items: center !important; }   /* number + name */
    .bb-card-row > .bb-wide { grid-column: 1 / -1; }                                                              /* categories, long cells */
    .bb-card-row > .bb-actions {
        grid-column: 1 / -1; display: flex !important; flex-wrap: wrap; gap: 10px !important;
        padding-top: 10px !important; border-top: 1px solid rgba(0, 0, 0, .08);
    }
    .bb-card-row > .bb-actions .btn, .bb-card-row > .bb-actions a, .bb-card-row > .bb-actions button {
        min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
    }
    .bb-card-row .gap-5, .bb-card-row .gap-4 { gap: .75rem !important; }
    .bb-card-row .text-center { text-align: left !important; }
    .bb-card-row .banner-category, .bb-card-row .coupon-category > div { display: inline-block; margin: 2px 4px 2px 0 !important; }
    .bb-card-row .small.text-muted, .bb-card-row .text-muted.small { font-size: .78rem; }

    /* ---- Filters and search: one column, full width ---- */
    form[method="GET"].d-flex, form#filterForm, form[id$="FilterForm"], form[id$="filterForm"] {
        flex-wrap: wrap !important; width: 100%; gap: 10px !important;
    }
    form[method="GET"].d-flex > *, form#filterForm > *, form[id$="FilterForm"] > *, form[id$="filterForm"] > * {
        flex: 1 1 100% !important; width: 100% !important; max-width: none !important; min-width: 0 !important;
    }
    form[method="GET"].d-flex .form-select, form[method="GET"].d-flex .form-control { width: 100% !important; max-width: none !important; }
    .col-md-12.d-flex.justify-content-end, .col-lg-10.d-flex.justify-content-end { justify-content: stretch !important; }
    .clear-filter .btn, .clear-filter a { width: 100%; }

    /* ---- Page headers: title, then a full-width action button ---- */
    .row.align-items-center.justify-content-between.mb-4 > [class*="col-"] { width: 100%; text-align: left !important; margin-bottom: 8px; }
    .btn-primary-custom { width: 100%; display: block; text-align: center; }
    h2, h3, h4 { word-break: break-word; }
    h3.fw-semibold, h4.fw-bold { font-size: 1.3rem; }

    .bb-preview-col { order: 2; width: 100% !important; }
    .bb-preview-col .bbcp-phone, .bb-preview-col .live-preview { max-width: 100%; margin-left: auto; margin-right: auto; }

    /* ---- Statistic cards (Coupons, Banners, Rewards, Performance Snapshot): two per row, tighter ---- */
    .row.g-4 > .col, .row.g-3 > .col { flex: 0 0 auto; width: 50%; }
    .row > .col-md-3 > .card-gray-bg, .row > .col > .card-gray-bg, .card-gray-bg {
        min-height: 110px !important; padding: 14px !important;
    }
    .card-gray-bg .fs-4 { font-size: 1rem !important; margin-bottom: .5rem !important; }
    .stat-main-number { font-size: 1.8rem !important; }
    .card-gray-bg .grey-box, .card-gray-bg .green-box, .card-gray-bg [class$="-box"] { width: 44px !important; height: 44px !important; padding: 6px !important; }
    .card-gray-bg .grey-box img, .card-gray-bg [class$="-box"] img { width: 26px !important; height: 26px !important; }
    .row.g-3 > .col-md-3, .row.g-3 > .col-md-4, .row.g-4 > .col-md-3, .row.g-4 > .col-md-4 { width: 50%; }

    /* ---- Welcome page ---- */
    .welcome-message h2 { font-size: 1.5rem; }
    .welcome-message { width: 100%; }
    .active-card { width: 50% !important; min-height: 0 !important; padding: 0 6px !important; margin-bottom: 12px; }
    .active-card .card-body { padding: 14px 8px; gap: .5rem !important; }
    .active-card .card-body > .rounded-circle { width: 52px !important; height: 52px !important; }
    .active-card .card-body > .rounded-circle img { width: 28px; }
    .active-card .fs-5 { font-size: .95rem !important; }
    .active-card h1 { font-size: 1.8rem; }
    .active-card a.fs-5 { font-size: .9rem !important; }
    .rounded-4.p-4 { padding: 14px !important; }

    /* ---- Campaigns / Challenges tabs: stacked cards ---- */
    #challengeTabs { width: 100%; padding: 0 !important; }
    #challengeTabs > [class*="col-"] { width: 100% !important; padding: 0 !important; margin-bottom: 12px; }
    #challengeTabs .nav-item { padding: 0 !important; width: 100%; }
    .tab-card { padding: 16px !important; width: 100%; }
    .tab-card .tab-title { flex-wrap: wrap; gap: .5rem !important; }
    .tab-card .tab-title h5 { font-size: 1rem; margin: 0; }
    .tab-card .tab-description span { display: block; }
    .tab-content { padding-left: 0 !important; padding-right: 0 !important; }
    .tab-pane.p-4 { padding: 14px !important; }

    /* ---- Card lists inside tabs / other containers ---- */
    .px-4.py-4.rounded-4, .px-4.py-3.rounded-4 { padding-left: 14px !important; padding-right: 14px !important; }
    .px-5 { padding-left: 14px !important; padding-right: 14px !important; }

    /* ---- Detail pages: two-column blocks stack, long text wraps ---- */
    .row > [class*="col-md-6"], .row > [class*="col-md-4"], .row > [class*="col-md-8"], .row > [class*="col-lg-"] { max-width: 100%; }
    .card, .card-body { max-width: 100%; }
    pre, code { white-space: pre-wrap; word-break: break-word; }
    .breadcrumb { flex-wrap: wrap; }
    .dropdown-menu { max-width: calc(100vw - 24px); }
}

@media (max-width: 479.98px) {
    /* Live Campaigns tiles stay two per row (vertical tiles) */
    .row.g-4 > .col, .row.g-3 > .col, .row.g-3 > .col-md-3, .row.g-3 > .col-md-4, .row.g-4 > .col-md-3, .row.g-4 > .col-md-4 { width: 50%; }
    .bb-card-row { grid-template-columns: 1fr 1fr; }
}


/* ======================================================================
   Phone layout, round 3 (systematic): one rule per page type
   ====================================================================== */
@media (max-width: 767.98px) {

    /* -- Page type "View with two columns" (info + Live Preview / track / asset): brand.css fixes these widths with
          !important at every screen size, so they are reset here. Everything stacks, Live Preview goes last. -- */
    .coupon-logo, .coupon-details, .coupon, .details-logo, .details-info, .preview-card, .question-list, .preview,
    .banner-info, .seed-details, .quiz-coupon-details, .banner-track, .seed-preview, .quiz-live-preview,
    .brand-coupon, .coupon-action, .banner-image, .banner-duration, .banner-action, .ingame-info, .ingame-preview {
        width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; margin-left: 0 !important;
    }
    .banner-track, .seed-preview, .quiz-live-preview, .preview-card, .preview { order: 2; }
    .phone-wrapper { width: 237px !important; max-width: 100%; margin-left: auto !important; margin-right: auto !important; }
    .upload-box { max-width: 100%; }
    .progress-bar-track { width: 100% !important; max-width: 100%; }
    .pill-input { width: 100% !important; }
    .drp-calendar { max-width: 100%; }
    .metric { min-width: 0 !important; }

    /* -- Rows that were written with margins / offsets / gutters that only make sense on a wide screen -- */
    .row[class*="mx-"] { margin-left: 0 !important; margin-right: 0 !important; }
    [class*="offset-"] { margin-left: 0 !important; }
    .row > [class*="col-"].ps-0, .row > [class*="col-"].pe-0 { padding-left: calc(var(--bs-gutter-x, 1.5rem) * .5) !important; padding-right: calc(var(--bs-gutter-x, 1.5rem) * .5) !important; }

    /* -- Page type "metric cards" (View pages): two per row, readable titles -- */
    .row > .col:not(:only-child) { flex: 0 0 auto; width: 50%; }
    .row > .col:only-child { flex: 1 1 100%; }
    .challenges-card { padding: 14px !important; margin: 0 0 12px 0 !important; border-radius: 16px !important; }
    .challenges-card h4, .card-gray-bg p { font-size: 1rem !important; margin-bottom: .6rem !important; word-break: normal; overflow-wrap: break-word; hyphens: auto; }
    .card-gray-bg .d-flex.justify-content-between { flex-wrap: nowrap; align-items: center; gap: 8px; }
    .stat-main-number { word-break: normal; }

    /* -- Page type "info blocks" (label : value tables, detail rows) -- */
    table.coupon-info td { padding: 10px 6px !important; vertical-align: top; }
    table.coupon-info td:first-child { width: 42% !important; }
    table.coupon-info td.text-end { text-align: right; overflow-wrap: break-word; }
    .p-4.rounded-4 { padding: 14px !important; }
    .details-title h3 { font-size: 1.35rem; }

    /* -- Long texts, URLs, e-mail addresses never push the page wider -- */
    p, td, th, li, a, span, h1, h2, h3, h4, h5, h6, .small { overflow-wrap: break-word; }
    a.text-break, .text-truncate { max-width: 100%; }

    /* -- Page type "bar charts / poll bars / quiz answers" -- */
    .answer-bars, .answer-bars *, .bar-row, .vote-row { min-width: 0; max-width: 100%; }
    .answer-bars .row, .vote-row { flex-wrap: nowrap; gap: 8px; }

    /* -- Page type "forms": images and previews -- */
    .logo-preview, .banner-preview, .image-preview, [class*="preview"] img { max-width: 100%; height: auto; }
    input[type="file"] { max-width: 100%; }
    .tab-card, .nav-tabs { max-width: 100%; }
    .support-chat, .chat-box, .message-bubble { max-width: 100%; }
    .attachment-preview-img { max-width: 100%; height: auto; }

    /* -- Page type "sign-up wizard" -- */
    .bb-stepper-wrapper { width: 100% !important; max-width: 100%; }
    .bb-progress-line { width: 60% !important; }

    /* -- List cards also without JavaScript (the JS adds the extras): a list row has 4+ cells and labels -- */
    .row.align-items-center:has(> [class*="col-"]:nth-child(4)):has(.small.text-muted):not(.bb-card-row) {
        display: grid !important; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin: 0 !important; --bs-gutter-x: 0; align-items: start !important;
    }
    .row.align-items-center:has(> [class*="col-"]:nth-child(4)):has(.small.text-muted):not(.bb-card-row) > * {
        width: auto !important; max-width: none !important; min-width: 0 !important; flex: none !important; padding: 0 !important; margin: 0 !important;
        text-align: left !important; justify-content: flex-start !important; align-items: flex-start !important;
    }
    .row.align-items-center:has(> [class*="col-"]:nth-child(4)):has(.small.text-muted):not(.bb-card-row) > :first-child { grid-column: 1 / -1; }
    .row.align-items-center:has(> [class*="col-"]:nth-child(4)):has(.small.text-muted):not(.bb-card-row) > :has(.banner-category, .coupon-category),
    .row.align-items-center:has(> [class*="col-"]:nth-child(4)):has(.small.text-muted):not(.bb-card-row) > :last-child:not(:has(.small.text-muted)) { grid-column: 1 / -1; }
    .row.align-items-center:has(> [class*="col-"]:nth-child(4)):has(.small.text-muted) .text-center { text-align: left !important; }
    .bg-white.rounded-4.mb-3 { padding: 14px !important; }
    /* Players, Leaderboard, Player Submissions rows use plain muted labels */
    .row.align-items-center:has(> [class*="col-"]:nth-child(4)) .text-muted + .fw-semibold { margin-top: 2px; }
}


/* ======================================================================
   Phone layout, round 4 (found by the automatic 390 px audit)
   ====================================================================== */
@media (max-width: 767.98px) {
    /* header controls and breadcrumb links: 44 px touch targets */
    .topbar a, .topbar button, .header-topbar-bg a, .header-topbar-bg button,
    .topbar .dropdown-toggle, .header-topbar-bg .dropdown-toggle {
        min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
    }
    .breadcrumb a, .breadcrumb-item a { display: inline-flex; align-items: center; min-height: 44px; }
    .page-link { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
    /* player page: wallet tabs scroll inside their strip, action buttons wrap */
    .wallet-sub-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; gap: 8px; }
    .wallet-sub-tab { flex: 0 0 auto; min-height: 44px; }
    .player-actions-right { flex-wrap: wrap !important; width: 100%; justify-content: flex-start !important; gap: 10px; }
    .player-actions-right > * { flex: 1 1 140px; }
}


@media (max-width: 767.98px) {
    /* compact header: avatar only (name hidden), icons in one row with the title */
    [id$="rofileDropdown"] > span, [id$="rofileDropdown"]::after { display: none !important; }
    [id$="rofileDropdown"] img { margin-right: 0 !important; }
    .header-topbar-bg > div:last-child, .topbar > div:last-child { flex: 0 0 auto; flex-wrap: nowrap; gap: 2px !important; }
    .header-topbar-bg .position-relative.me-4 { margin-right: 0 !important; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }

    /* tables with a header row: one card per row, label on the left, value on the right */
    table.table-stack, table.table-stack tbody { display: block; width: 100% !important; }
    table.table-stack thead { display: none; }
    table.table-stack tr { display: block; background: rgba(255, 255, 255, .6); border: 1px solid rgba(0, 0, 0, .08); border-radius: 14px; padding: 6px 12px; margin-bottom: 12px; }
    table.table-stack td { display: block; padding: 8px 0 !important; border: 0 !important; text-align: left !important; white-space: normal !important; background: transparent !important; overflow-wrap: break-word; word-break: normal; }
    table.table-stack td::before { content: attr(data-label); display: block; font-weight: 600; font-size: .75rem; color: #6c757d; margin-bottom: 2px; }
    table.table-stack td:not([data-label])::before { content: none; }
    table.table-stack td:empty { display: none; }
    table.table-stack td + td { border-top: 1px dashed rgba(0, 0, 0, .08) !important; }
    table.table-stack .btn, table.table-stack a.btn { min-height: 44px; }
}

@media (max-width: 767.98px) {
    [data-bs-theme="dark"] table.table-stack tr { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .14); }
    [data-bs-theme="dark"] table.table-stack td::before { color: #9aa4b2; }
    [data-bs-theme="dark"] table.table-stack td + td { border-top-color: rgba(255, 255, 255, .12) !important; }
}

@media (max-width: 767.98px) {
    .header-topbar-bg.d-flex.justify-content-between, .topbar.d-flex.justify-content-between { flex-wrap: nowrap !important; }
    .header-topbar-bg > div:first-child, .topbar > div:first-child { min-width: 0; }
    .header-topbar-bg h4, .topbar h4 { font-size: 1.05rem !important; line-height: 1.2; }
}

/* ======================================================================
   Phone layout, round 5 (brand pages, found by the local 390 px run)
   ====================================================================== */
@media (max-width: 767.98px) {
    /* toast messages: centered, full width minus margins */
    .alert-toast-wrapper { left: 12px !important; right: 12px !important; transform: none !important; width: auto !important; max-width: none !important; top: 12px !important; }

    /* breadcrumb in the header: compact, wraps to two lines at most, never runs under the icons */
    .topbar > div:first-child, .header-topbar-bg > div:first-child { flex: 1 1 0 !important; min-width: 0 !important; }
    .topbar > div:first-child > div, .header-topbar-bg > div:first-child > div { min-width: 0; }
    .topbar .breadcrumb, .header-topbar-bg .breadcrumb { flex-wrap: wrap; font-size: .9rem !important; align-items: center; margin: 0; row-gap: 0; line-height: 1.25; }
    .topbar .breadcrumb .breadcrumb-item, .header-topbar-bg .breadcrumb .breadcrumb-item { display: inline-flex; align-items: center; min-width: 0; }
    .topbar .breadcrumb .breadcrumb-item h4, .header-topbar-bg .breadcrumb .breadcrumb-item h4 { font-size: .95rem !important; margin: 0; }
    .breadcrumb a, .breadcrumb-item a { min-height: 0; display: inline-block; padding: 12px 2px; margin: -12px 0; }
    .breadcrumb-item + .breadcrumb-item { padding-left: .3rem; }
    .breadcrumb-item + .breadcrumb-item::before { padding-right: .3rem; }

    /* action rows under View pages (Back / Pause / Edit): big full-width buttons */
    .row > [class*="col-md-5"] .btn, .row > [class*="col-md-5"] form, .form-close-btn, .model-btn-outline, .model-btn-custom { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; text-align: center; }
    .row > [class*="col-md-5"].d-flex { flex-direction: column; justify-content: stretch !important; gap: 10px !important; }
    .row > [class*="col-md-5"].text-end { text-align: center !important; }

    /* filter pills (Winners, tabs) wrap instead of running off the screen */
    .d-flex:has(> .winner-filter-btn), .d-flex:has(> .filter-btn) { flex-wrap: wrap !important; gap: 8px !important; }
    .winner-filter-btn, .filter-btn { min-height: 44px; padding-left: 16px !important; padding-right: 16px !important; }

    /* avatars / logos in the header keep their size */
    .topbar img.rounded-circle, .header-topbar-bg img.rounded-circle { width: 36px !important; height: 36px !important; flex: 0 0 auto; }
}

@media (max-width: 767.98px) {
    /* poll / quiz View: Total Impressions and Total Responses two per row like the other metric cards */
    .row > [class*="col-md-"]:has(> .challenges-card) { flex: 0 0 auto; width: 50%; padding-left: 6px; padding-right: 6px; }
    .row > [class*="col-md-"]:has(> .challenges-card) .challenges-card { height: 100%; }
}

@media (max-width: 767.98px) {
    /* quiz / sign-up step indicators: three steps share the width, labels small and centered */
    .d-flex:has(> .step-line) { width: 100%; align-items: flex-start !important; justify-content: space-between !important; }
    .d-flex:has(> .step-line) > .d-flex.flex-column { flex: 0 1 30%; min-width: 0; text-align: center; }
    .d-flex:has(> .step-line) h5 { font-size: .75rem !important; line-height: 1.2; text-align: center; word-break: normal; overflow-wrap: break-word; }
    .d-flex:has(> .step-line) > .step-line { flex: 1 1 12px; min-width: 12px; margin-top: 18px; }
}

@media (max-width: 767.98px) {
    /* label : value tables use a fixed layout so a long URL, code or hash can never widen the page */
    table.table-fit, table.coupon-info, table.bb-sign-table { table-layout: fixed; width: 100% !important; }
    table.table-fit td, table.table-fit th, table.coupon-info td, table.bb-sign-table td { word-break: break-word; overflow-wrap: break-word; }
    table.bb-sign-table td:last-child { word-break: normal; overflow-wrap: anywhere; }

    /* image + text rows (product cards): text may shrink and wrap, the picture stays in proportion */
    .d-flex.align-items-center.gap-3 > :not(img):not(i):not(svg):not(button):not(a.btn) { min-width: 0; overflow-wrap: break-word; }
    .d-flex.align-items-center.gap-3 > img { flex: 0 0 auto; max-width: 40%; height: auto; }

    /* action buttons at the bottom of View pages written with plain col-5 (Pause / Edit / Delete) */
    .row > .col-5.d-flex, .row > .col-5.text-end { flex: 0 0 100% !important; width: 100% !important; max-width: 100% !important; flex-direction: column; justify-content: stretch !important; gap: 10px !important; text-align: center !important; }
    .row > .col-5 form, .row > .col-5 .btn, .row > .col-5 a { width: 100%; }
    .row > .col-5 .btn, .row > .col-5 a.btn { min-height: 44px; display: flex; align-items: center; justify-content: center; }
}

@media (max-width: 767.98px) {
    /* login, sign up and password cards: full width minus a 16 px margin on each side */
    .bb-login-card, .forget-psw-card { width: calc(100vw - 32px) !important; max-width: 420px; margin-left: auto; margin-right: auto; box-sizing: border-box; }
    .bb-stepper-wrapper { padding-left: 0 !important; padding-right: 0 !important; }
}

@media (max-width: 767.98px) {
    /* fixed-width filter buttons and inputs written inline */
    [style*="width: 170px"], [style*="width:170px"], [style*="width: 180px"], [style*="width:180px"] { width: 100% !important; max-width: 100% !important; }
    /* Get Started list and other tap rows */
    .get-started-item { min-height: 48px; display: flex !important; align-items: center; padding-top: 8px; padding-bottom: 8px; }
    .form-control, .form-select, select, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) { min-height: 44px; }
    .btn, a.btn, button.btn { min-height: 44px; }
    .btn.p-0 { min-width: 44px; }
}

@media (max-width: 767.98px) {
    /* text links that were only 18-28 px high get a 44 px tap area */
    .alert-link, .active-card a, a[href^="mailto:"], .bb-support-ticket-btn, .coupon-info a, .p-4 > a:not(.btn), .card-body > a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; }
    .breadcrumb a, .breadcrumb-item a { padding: 13px 2px; margin: -13px 0; }
}


@media (max-width: 767.98px) {
    /* View In-Game Content and View Brand Quiz (brand and admin) */
    .ingame-info, .ingame-preview { width: 100% !important; flex: 0 0 100% !important; max-width: 100% !important; }
    .ingame-preview { order: 2; margin-top: 8px; }
    /* plain col-3 / col-4 / col-8 / col-9 that hold whole blocks (cards, previews) stack instead of sharing the row */
    .row > [class*="col-"]:not([class*="col-md"]):not([class*="col-lg"]):not([class*="col-sm"]):has(.rounded-4.p-4, [class*="preview"]),
    .row > .col-8:not([class*="col-md"]), .row > .col-9:not([class*="col-md"]), .row > .col-3:has(.rounded-4) { flex: 0 0 100% !important; width: 100% !important; max-width: 100% !important; }
    .row > .col-4:has(.rounded-4.p-4) { flex: 0 0 100% !important; width: 100% !important; max-width: 100% !important; }
    /* product card of a quiz: small picture, text takes the rest */
    .product-image { width: 72px !important; flex: 0 0 72px !important; max-width: 72px !important; }
    .product-image img { width: 72px !important; height: 72px !important; object-fit: cover; }
    .product-details { width: auto !important; flex: 1 1 0 !important; min-width: 0 !important; }
    .product-details .url { max-width: 100% !important; overflow-wrap: anywhere; display: block; }
    .product-details .d-flex.align-items-center.gap-2 { flex-wrap: wrap; }
    .live-preview-slider, .quiz-live-preview, .preview .phone-wrapper { max-width: 100%; }
    .question-list .row { margin-left: 0; margin-right: 0; }
}

@media (max-width: 767.98px) {
    img[height="300"], img[height="250"], img[height="200"] { height: auto !important; max-height: 240px; }
}

@media (max-width: 767.98px) {
    .row > [class*="col-md-"]:has(> .challenges-card) { padding-left: 6px !important; padding-right: 6px !important; }
    .row.mx-2:has(> [class*="col-md-"] > .challenges-card) { margin-left: -6px !important; margin-right: -6px !important; }
}

@media (max-width: 767.98px) {
    /* title block of View Quiz: logo keeps its size, chips wrap tidily */
    .brands-logo { flex: 0 0 56px !important; width: 56px !important; height: 56px !important; }
    .quiz-title { min-width: 0; flex: 1 1 0; }
    .quiz-title .quiz-info { margin: 3px 4px 3px 0 !important; max-width: 100%; white-space: normal; text-align: left; }
}
@media (max-width: 767.98px) { .coupon-info td { white-space: normal !important; overflow-wrap: anywhere; }
    .coupon-info th { white-space: normal !important; overflow-wrap: normal; }
    .coupon-info th, .coupon-info td, .table > :not(caption) > * > * { padding-left: .5rem !important; padding-right: .5rem !important; } }
