/* Native safe area is outside the WebView; browsers retain their own safe inset. */
:root { --mt-ui-safe-bottom: env(safe-area-inset-bottom, 0px); }
html.mt-native-webview { --mt-ui-safe-bottom: 0px; }

@media (max-width: 991px) {
    /* Desktop tables become cards: reset intrinsic table-cell minimum widths. */
    .freelancer-follow-page .freelancer-follow-table,
    .freelancer-follow-page .freelancer-follow-table tbody,
    .freelancer-follow-page .freelancer-follow-table tr,
    .freelancer-follow-page .freelancer-follow-table td,
    .my-project #freelancer-project-proposal,
    .my-project #freelancer-project-proposal tbody,
    .my-project #freelancer-project-proposal tr,
    .my-project #freelancer-project-proposal td,
    .my-project #project-my-wishlist,
    .my-project #project-my-wishlist tbody,
    .my-project #project-my-wishlist tr,
    .my-project #project-my-wishlist td {
        min-width: 0 !important;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
    .freelancer-follow-page .follow-company-main-wrap,
    .freelancer-follow-page .follow-company-details,
    .my-project .proposal-main-wrap, .my-project .proposal-main-content,
    .my-project .wishlist-main-wrap, .my-project .wishlist-main-content {
        min-width: 0 !important;
        max-width: 100%;
        flex: 1 1 0%;
    }
    .freelancer-follow-page .follow-company-meta { min-width: 0; max-width: 100%; flex-wrap: wrap !important; }
    .freelancer-follow-page .follow-company-pill,
    .freelancer-follow-page .follow-company-title,
    .my-project .proposal-title, .my-project .proposal-title a,
    .my-project .wishlist-title, .my-project .wishlist-title a,
    .my-project .proposal-meta-pill, .my-project .wishlist-meta-pill {
        min-width: 0 !important;
        max-width: 100%;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: normal;
    }
    .freelancer-follow-page .follow-company-pill { padding: 6px 10px; box-sizing: border-box; }
    .freelancer-follow-page .follow-actions { grid-template-columns: minmax(0, 1fr) !important; }
    .freelancer-follow-page .follow-actions .follow-action {
        min-width: 0;
        height: auto;
        min-height: 44px;
        padding: 10px 12px;
        white-space: normal !important;
        overflow-wrap: anywhere;
        line-height: 1.4;
        text-align: center;
    }
    .freelancer-follow-page .follow-action > span { min-width: 0; }
    .freelancer-follow-page .follow-action > i { flex-shrink: 0; }
    .freelancer-follow-page .follow-tabs-dashboard .tab-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 14px;
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: 6px;
    }
    .freelancer-follow-page .follow-tabs-dashboard .tab-list .tab-item {
        flex: 0 0 auto;
        width: auto;
        margin: 0 !important;
    }
    .freelancer-follow-page .follow-tabs-dashboard .tab-list .tab-item a {
        white-space: nowrap;
        gap: 4px;
        font-size: 13px;
    }
    .freelancer-follow-page .follow-tabs-dashboard .tab-count { flex-shrink: 0; }
}

@media (max-width: 767px) {
    /* Each mobile screen has one height owner, rather than nested 100vh blocks. */
    html body.messages-mobile-content .entry-my-page.messages-dashboard {
        top: var(--mt-visible-top, 0px) !important;
        bottom: auto !important;
        height: var(--mt-visible-height, 100dvh) !important;
        min-height: 0 !important;
    }
    html body.messages-mobile-content .messages-dashboard .table-dashboard-wapper.ricetheme-messages,
    html body.messages-mobile-content .messages-dashboard .ricetheme-messages .mess-content {
        height: 100% !important;
        min-height: 0 !important;
    }
    html body .messages-dashboard .ricetheme-messages .mess-content {
        min-width: 0;
        flex-direction: column;
        overflow: hidden;
    }
    html body .messages-dashboard .ricetheme-messages .mess-content__body {
        flex: 1 1 0;
        min-height: 0;
        height: auto !important;
        overflow-y: auto;
    }
    html body .messages-dashboard .ricetheme-messages .mess-content__head,
    html body .messages-dashboard .ricetheme-messages .mess-content__action { flex: 0 0 auto; }
    html body .messages-dashboard .ricetheme-messages .mess-content__action {
        padding-bottom: var(--mt-ui-safe-bottom) !important;
        margin-bottom: 0 !important;
    }
    html body .messages-dashboard .ricetheme-messages .message-composer textarea {
        display: block;
        margin-bottom: 0;
        resize: none;
    }
    html body .messages-dashboard .ricetheme-messages .mess-list {
        top: var(--mt-message-list-top, 0px) !important;
        bottom: auto !important;
        height: var(--mt-message-list-height, 100dvh) !important;
        min-height: 0 !important;
        min-width: 0 !important;
        max-width: 100%;
        margin: 0 !important;
        background: #fff;
        /* Theme transition:all otherwise animates header/keyboard height changes. */
        transition-property: transform !important;
    }
    html body .messages-dashboard .ricetheme-messages.is-mobile-list .mess-content { display: none !important; }
    html body .messages-dashboard .ricetheme-messages .mess-list .tab-mess {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        margin: 0;
    }
    html body .messages-dashboard .ricetheme-messages .mess-list .mess-tab-head {
        display: block !important;
        position: relative;
        top: auto;
        flex: 0 0 auto;
        margin: 0 !important;
    }
    html body .messages-dashboard .ricetheme-messages .mess-list .tab-content {
        flex: 1 1 0;
        min-height: 0;
        height: auto;
        overflow-y: auto;
    }
    html body #freelancer-profile.freelancer-profile--refresh .profile-action-bar {
        bottom: 0 !important;
        padding-bottom: calc(10px + var(--mt-ui-safe-bottom)) !important;
    }
}

@media (max-width: 768px) {
    /* Bank account fields are rows on phones, so the IBAN gets the full width. */
    body .woocommerce .woocommerce-bacs-bank-details .wc-bacs-bank-details {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }
    body .woocommerce .woocommerce-bacs-bank-details .wc-bacs-bank-details li {
        float: none !important;
        width: 100% !important;
        min-width: 0;
        max-width: 100%;
        margin: 0 !important;
        padding: 14px 16px !important;
        border-right: 0;
        border-left: 0;
        flex: 0 0 auto;
        box-sizing: border-box;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    body .woocommerce .woocommerce-bacs-bank-details .wc-bacs-bank-details strong {
        display: block;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        font-size: 16px;
        line-height: 1.5;
    }
    body .woocommerce .woocommerce-bacs-bank-details .iban strong { direction: ltr; unicode-bidi: isolate; }
    body .woocommerce .woocommerce-bacs-bank-details h2,
    body .woocommerce .woocommerce-bacs-bank-details h3 { overflow-wrap: anywhere; }
}
