/* Shared phone experience for the public site, authentication, trader portal and CRM. */
@media (max-width: 900px) {
    html,
    body {
        max-width: 100%;
        overflow-x: clip;
    }

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

    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Public website */
    .wf-public-home .wf-header__toggle,
    .wf-public-home .wf-header__actions .wf-button,
    .wf-public-home .wf-login {
        min-height: 44px;
    }

    .wf-public-home .wf-header__nav {
        max-height: calc(100dvh - 92px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .wf-public-home .wf-header__nav a {
        min-height: 48px;
        padding-inline: 14px;
        display: flex;
        align-items: center;
        border-radius: 10px;
    }

    .wf-public-home .wf-hero__actions .wf-button,
    .wf-public-home .wf-final-cta .wf-button,
    .wf-public-home .wf-order-summary > .wf-button {
        min-height: 50px;
    }

    .wf-public-home .wf-model-cards,
    .wf-public-home .wf-account-cards,
    .wf-public-home .wf-payout-wall,
    .wf-public-home .wf-testimonials-track {
        scroll-padding-inline: 14px;
        scroll-snap-type: x proximity;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .wf-public-home .wf-model-cards > *,
    .wf-public-home .wf-account-cards > *,
    .wf-public-home .wf-payout-wall > * {
        scroll-snap-align: start;
    }

    .wf-public-home .wf-rule-column dt button {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
    }

    .wf-public-home .wf-footer nav a {
        min-height: 40px;
        display: flex;
        align-items: center;
    }

    .wf-public-home .wf-mobile-cta {
        bottom: max(12px, env(safe-area-inset-bottom));
        min-height: 50px;
    }

    /* Trading rules and public legal experience */
    .wf-rules-page .wf-rules-button,
    .wf-rules-page .wf-rules-header a,
    .wf-rules-page .wf-rule-category-nav a,
    .wf-rules-page .wf-summary-card > a,
    .wf-rules-page .wf-downloads__grid a,
    .wf-rules-page .wf-downloads__grid button {
        min-height: 44px;
    }

    .wf-rules-page .wf-comparison {
        width: 100%;
        max-width: calc(100vw - 24px);
        margin-right: 0 !important;
        contain: inline-size;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .wf-rules-page .wf-comparison table {
        width: 760px;
        min-width: 760px;
    }

    .wf-rules-page .wf-comparison th,
    .wf-rules-page .wf-comparison td {
        min-width: 145px;
        height: 62px;
        padding: 12px 13px;
    }

    .wf-rules-page .wf-comparison th:first-child {
        width: 150px;
        min-width: 150px;
        position: sticky;
        left: 0;
        z-index: 2;
        box-shadow: 7px 0 15px rgba(24, 73, 126, .08);
    }

    .wf-rules-page .wf-comparison thead th:first-child {
        z-index: 3;
    }

    .wf-rules-page .wf-rule-card summary,
    .wf-rules-page .wf-rules-faq__list summary {
        min-height: 64px;
    }

    .wf-rules-page .wf-rules-footer nav a {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    /* Authentication */
    .trader-auth-page .auth-shell,
    .admin-auth-page .auth-shell {
        min-height: 100dvh;
        padding: max(58px, env(safe-area-inset-top)) 12px max(22px, env(safe-area-inset-bottom));
        display: block;
        overflow: visible;
    }

    .trader-auth-page .auth-panel,
    .admin-auth-page .auth-panel {
        width: 100%;
        min-height: 0;
        margin: 0 auto;
        border-radius: 20px;
    }

    .trader-auth-page .auth-form-wrap,
    .admin-auth-page .auth-form-wrap {
        padding: 30px 20px;
    }

    .trader-auth-page .auth-form-wrap > .brand,
    .admin-auth-page .auth-form-wrap > .brand {
        min-height: 44px;
    }

    .trader-auth-page .auth-heading,
    .admin-auth-page .auth-heading {
        margin: 30px 0 24px;
    }

    .trader-auth-page .auth-heading h1,
    .admin-auth-page .auth-heading h1 {
        font-size: clamp(30px, 9vw, 38px);
    }

    .trader-auth-page .auth-form,
    .admin-auth-page .auth-form {
        gap: 14px;
    }

    .trader-auth-page .auth-form input:not([type="checkbox"]),
    .admin-auth-page .auth-form input:not([type="checkbox"]) {
        height: 52px;
    }

    .trader-auth-page .auth-form .btn,
    .admin-auth-page .auth-form .btn {
        min-height: 52px;
    }

    .trader-auth-page .checkbox-label input,
    .admin-auth-page .checkbox-label input {
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
    }

    /* Trader portal */
    .trader-portal-page .dashboard-main,
    .trader-portal-page .dashboard-card,
    .trader-portal-page .module-card,
    .trader-portal-page .data-table-wrap {
        min-width: 0;
        max-width: 100%;
    }

    .trader-portal-page .icon-button,
    .trader-portal-page .sidebar-toggle {
        width: 44px;
        height: 44px;
        min-height: 44px;
    }

    .trader-portal-page .dashboard-card,
    .trader-portal-page .module-card {
        overflow: hidden;
    }

    .trader-portal-page .data-table-wrap {
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .trader-portal-page .quick-actions a,
    .trader-portal-page .method-grid button,
    .trader-portal-page .portal-form button,
    .trader-portal-page .portal-form input,
    .trader-portal-page .portal-form select {
        min-height: 48px;
    }

    .trader-portal-page .card-heading a,
    .trader-portal-page .dashboard-command-link,
    .trader-portal-page .dashboard-payout-network__summary a,
    .trader-portal-page .history-row--payout > a,
    .trader-portal-page .recent-payouts a[aria-label*="QR"] {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    /* CRM navigation and profile */
    .crm-portal-page {
        --crm-mobile-sidebar-width: min(86vw, 316px);
    }

    .crm-portal-page.sidebar-open {
        overflow: hidden;
    }

    .crm-portal-page .admin-shell {
        display: block;
    }

    .crm-portal-page .admin-main {
        min-width: 0;
        grid-column: auto;
    }

    .crm-portal-page .admin-sidebar {
        width: var(--crm-mobile-sidebar-width);
        height: 100dvh;
        z-index: 180;
        padding: 12px 11px;
        overflow: hidden;
        border-radius: 0 20px 20px 0;
        transform: translateX(-103%);
        transition: transform .24s cubic-bezier(.22, 1, .36, 1);
        box-shadow: 24px 0 75px rgba(0, 0, 0, .48);
    }

    .crm-portal-page .admin-sidebar.open {
        transform: translateX(0);
    }

    .crm-portal-page .admin-sidebar-backdrop {
        width: auto;
        height: 100%;
        position: fixed;
        inset: 0 0 0 var(--crm-mobile-sidebar-width);
        z-index: 170;
        display: block;
        visibility: hidden;
        opacity: 0;
        border: 0;
        background: rgba(1, 5, 11, .68);
        backdrop-filter: blur(3px);
        pointer-events: none;
        transition: opacity .2s ease, visibility .2s ease;
    }

    .crm-portal-page .admin-sidebar.open + .admin-sidebar-backdrop {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    .crm-portal-page .admin-sidebar .sidebar-brand {
        min-height: 58px;
        padding: 0 4px 9px;
        flex: 0 0 auto;
    }

    .crm-portal-page .admin-sidebar [data-sidebar-close] {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        display: grid;
        place-items: center;
        color: #dcecff;
        border: 1px solid rgba(111, 180, 242, .2);
        border-radius: 11px;
        background: rgba(255, 255, 255, .04);
        font-size: 25px;
        line-height: 1;
        cursor: pointer;
    }

    .crm-portal-page .admin-workspace {
        margin: 8px 2px 5px;
        padding: 9px 11px;
        flex: 0 0 auto;
    }

    .crm-portal-page .admin-navigation {
        flex: 1 1 auto;
        min-height: 0;
        padding: 3px 1px 8px;
        overscroll-behavior: contain;
    }

    .crm-portal-page .admin-navigation a,
    .crm-portal-page .admin-sidebar-footer a,
    .crm-portal-page .admin-sidebar-footer button {
        min-height: 44px;
        border-radius: 10px;
        font-size: 14px !important;
    }

    .crm-portal-page .admin-nav-label {
        margin: 12px 10px 4px;
        font-size: 10px !important;
    }

    .crm-portal-page .admin-sidebar-footer {
        padding-top: 6px;
        flex: 0 0 auto;
    }

    .crm-portal-page .admin-topbar {
        height: 66px;
        padding: 0 12px;
        z-index: 150;
    }

    .crm-portal-page .admin-topbar .sidebar-toggle {
        width: 44px;
        height: 44px;
        padding: 0;
        display: grid;
        place-items: center;
        color: #74d7ff;
        border: 1px solid rgba(94, 174, 240, .18);
        border-radius: 12px;
        background: rgba(255, 255, 255, .035);
        cursor: pointer;
    }

    .crm-portal-page .admin-topbar-title {
        min-width: 0;
        gap: 9px;
    }

    .crm-portal-page .admin-topbar-title > div {
        min-width: 0;
    }

    .crm-portal-page .admin-topbar-title strong {
        max-width: 150px;
        overflow: hidden;
        font-size: 13px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .crm-portal-page .admin-topbar .user-menu-shell {
        position: relative;
    }

    .crm-portal-page .admin-topbar .user-menu {
        min-width: 54px;
        padding: 5px 7px;
        grid-template-columns: 36px 10px;
        gap: 4px;
        appearance: none;
        color: #e8f4ff;
        text-align: left;
        cursor: pointer;
    }

    .crm-portal-page .admin-user-copy {
        display: none;
    }

    .crm-portal-page .admin-user-chevron {
        color: #8297aa;
        transition: transform .2s ease;
    }

    .crm-portal-page .user-menu-shell.open .admin-user-chevron {
        transform: rotate(180deg);
    }

    .crm-portal-page .admin-user-menu-dropdown {
        width: min(330px, calc(100vw - 24px));
        max-height: calc(100dvh - 84px);
        position: fixed;
        top: 74px;
        right: 12px;
        z-index: 210;
        overflow-y: auto;
        color: #dcecff;
        border: 1px solid rgba(97, 177, 242, .2);
        border-radius: 17px;
        background: rgba(6, 15, 27, .985);
        box-shadow: 0 25px 75px rgba(0, 0, 0, .52);
        backdrop-filter: blur(20px);
    }

    .crm-portal-page .admin-user-menu-dropdown[hidden] {
        display: none;
    }

    .crm-portal-page .admin-user-menu-identity {
        padding: 17px;
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        border-bottom: 1px solid rgba(97, 177, 242, .14);
        background: rgba(18, 53, 83, .34);
    }

    .crm-portal-page .admin-user-menu-identity > span:last-child,
    .crm-portal-page .admin-user-menu-dropdown nav a > span {
        min-width: 0;
        display: flex;
        flex-direction: column;
    }

    .crm-portal-page .admin-user-menu-identity strong,
    .crm-portal-page .admin-user-menu-identity small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .crm-portal-page .admin-user-menu-identity strong {
        font-size: 14px;
    }

    .crm-portal-page .admin-user-menu-identity small {
        color: #8196aa;
        font-size: 11px !important;
    }

    .crm-portal-page .admin-user-menu-dropdown nav {
        padding: 8px;
    }

    .crm-portal-page .admin-user-menu-dropdown nav a {
        min-height: 58px;
        padding: 8px 10px;
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr) 12px;
        align-items: center;
        gap: 10px;
        color: #d9e8f5;
        border-radius: 10px;
    }

    .crm-portal-page .admin-user-menu-dropdown nav a:hover,
    .crm-portal-page .admin-user-menu-dropdown nav a:focus-visible {
        color: #74d7ff;
        background: rgba(53, 207, 250, .07);
    }

    .crm-portal-page .admin-user-menu-dropdown nav a > i {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        color: #6bd4ff;
        border-radius: 9px;
        background: rgba(53, 207, 250, .08);
        font-style: normal;
    }

    .crm-portal-page .admin-user-menu-dropdown nav a strong {
        font-size: 13px;
    }

    .crm-portal-page .admin-user-menu-dropdown nav a small {
        color: #7e94a8;
        font-size: 11px !important;
    }

    .crm-portal-page .admin-user-menu-dropdown nav a b {
        color: #6f8497;
        font-size: 18px;
    }

    .crm-portal-page .admin-user-menu-dropdown > form {
        padding: 9px;
        border-top: 1px solid rgba(97, 177, 242, .14);
    }

    .crm-portal-page .admin-user-menu-dropdown > form button {
        width: 100%;
        min-height: 44px;
        padding: 0 11px;
        display: flex;
        align-items: center;
        gap: 9px;
        color: #ff9aa7;
        border: 0;
        border-radius: 9px;
        background: transparent;
        font-weight: 700;
    }

    /* CRM content containment */
    .crm-portal-page .admin-content,
    .crm-portal-page .admin-dashboard-grid,
    .crm-portal-page .admin-dashboard-lower,
    .crm-portal-page .admin-panel,
    .crm-portal-page .dashboard-card,
    .crm-portal-page .admin-table-card,
    .crm-portal-page .data-table-wrap {
        min-width: 0;
        max-width: 100%;
    }

    .crm-portal-page .admin-dashboard-grid,
    .crm-portal-page .admin-dashboard-lower {
        grid-template-columns: minmax(0, 1fr);
    }

    .crm-portal-page .admin-dashboard-grid > *,
    .crm-portal-page .admin-dashboard-lower > * {
        min-width: 0;
        width: 100%;
    }

    .crm-portal-page .admin-panel,
    .crm-portal-page .admin-table-card {
        overflow: hidden;
    }

    .crm-portal-page .data-table-wrap,
    .crm-portal-page .admin-performance-chart,
    .crm-portal-page .report-chart-scroll {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .crm-portal-page .admin-table {
        width: max-content;
        max-width: none;
    }

    .crm-portal-page .admin-content input,
    .crm-portal-page .admin-content select,
    .crm-portal-page .admin-content textarea {
        min-height: 48px;
    }

    .crm-portal-page .admin-content .btn,
    .crm-portal-page .admin-content button:not(.dots):not([type="checkbox"]) {
        min-height: 44px;
    }

    .crm-portal-page .queue-link,
    .crm-portal-page .quick-action,
    .crm-portal-page .admin-activity-list > div {
        min-height: 52px;
    }
}

@media (max-width: 620px) {
    .wf-public-home .wf-container,
    .wf-rules-page .wf-rules-container {
        width: calc(100% - 24px);
    }

    .wf-public-home .wf-section {
        padding-block: 64px;
    }

    .wf-public-home .wf-header .brand {
        min-height: 44px;
    }

    .wf-public-home .wf-hero {
        min-height: 0;
        padding: 44px 0 38px;
    }

    .wf-public-home .wf-hero__layout {
        min-height: 0;
        gap: 28px;
    }

    .wf-public-home .wf-hero__copy h1 {
        font-size: clamp(40px, 12vw, 54px);
    }

    .wf-public-home .wf-hero__copy > p {
        margin-top: 18px;
        line-height: 1.65;
    }

    .wf-public-home .wf-hero__actions {
        width: 100%;
        margin-top: 24px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .wf-public-home .wf-hero__actions .wf-button {
        width: 100%;
        min-width: 0;
        padding-inline: 10px;
    }

    .wf-public-home .wf-hero__benefits {
        margin-top: 20px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 12px;
        text-align: left;
    }

    .wf-public-home .wf-hero__benefits li {
        min-width: 0;
        align-items: flex-start;
    }

    .wf-public-home .wf-hero-visual,
    .wf-public-home .wf-hero-visual__scene {
        height: 380px;
        min-height: 380px;
    }

    .wf-public-home .wf-hero-visual__orb {
        inset: 8% -6% 3%;
    }

    .wf-public-home .wf-hero-visual__mark {
        width: 220px;
        right: 0;
        top: 22%;
    }

    .wf-public-home .wf-visual-card--balance {
        width: 86%;
        top: 8%;
        padding: 15px;
    }

    .wf-public-home .wf-visual-card--balance svg {
        height: 60px;
    }

    .wf-public-home .wf-visual-card--payout {
        top: 48%;
        padding: 14px;
    }

    .wf-public-home .wf-visual-card--funded {
        width: 190px;
        bottom: 3%;
        padding: 15px;
    }

    .wf-public-home .wf-text-link,
    .wf-public-home .wf-payout-wall article > a {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .wf-public-home .wf-selector {
        border-radius: 19px;
    }

    .wf-public-home .wf-selector-toolbar {
        padding: 14px;
        gap: 12px;
    }

    .wf-public-home .wf-selector-utilities {
        width: 100%;
        padding-bottom: 3px;
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .wf-public-home .wf-selector-utilities > * {
        width: auto !important;
        min-width: max-content;
        flex: 0 0 auto;
    }

    .wf-public-home .wf-selector-detail__header {
        gap: 16px;
    }

    .wf-public-home .wf-rule-column dl > div {
        min-height: 54px;
        padding: 8px 0;
        align-items: center;
        flex-direction: row;
        gap: 10px;
    }

    .wf-public-home .wf-rule-column dt {
        min-width: 0;
        flex: 1 1 46%;
        overflow-wrap: anywhere;
    }

    .wf-public-home .wf-rule-column dd {
        min-width: 0;
        max-width: 54%;
        flex: 1 1 54%;
        overflow-wrap: anywhere;
        text-align: right;
    }

    .wf-rules-page .wf-rules-section {
        padding-block: 64px;
    }

    .wf-rules-page .wf-rules-hero {
        padding: 58px 0 64px;
    }

    .wf-rules-page .wf-rules-hero h1 {
        font-size: clamp(48px, 14vw, 60px);
    }

    .wf-rules-page .wf-rules-heading {
        margin-bottom: 32px;
    }

    .wf-rules-page .wf-rules-heading h2 {
        font-size: clamp(34px, 10vw, 42px);
    }

    .wf-rules-page .wf-summary-card {
        min-height: 205px;
    }

    .trader-portal-page .dashboard-command-hero {
        margin: 10px 12px 14px;
        padding: 22px 16px 18px;
    }

    .trader-portal-page .dashboard-command-copy h1 {
        font-size: clamp(29px, 9vw, 34px);
    }

    .trader-portal-page .dashboard-command-actions {
        margin-top: 17px;
    }

    .trader-portal-page .dashboard-command-actions .btn {
        min-height: 48px;
    }

    .trader-portal-page .dashboard-market-stage {
        min-height: 205px;
        margin-top: 8px;
    }

    .trader-portal-page .metric-grid,
    .trader-portal-page .dashboard-grid-main,
    .trader-portal-page .dashboard-lower-grid,
    .trader-portal-page .module-grid {
        padding-right: 12px;
        padding-left: 12px;
    }

    .trader-portal-page .metric-grid {
        gap: 9px;
    }

    .trader-portal-page .metric-card {
        min-height: 126px;
        padding: 14px;
    }

    .trader-portal-page .metric-card > strong {
        font-size: clamp(21px, 6.5vw, 27px);
    }

    .trader-portal-page .dashboard-card,
    .trader-portal-page .module-card {
        padding: 15px;
    }

    .trader-portal-page .dashboard-payout-network {
        margin-inline: 12px;
    }

    .crm-portal-page .admin-content {
        padding: 16px 12px 22px;
    }

    .crm-portal-page .admin-heading {
        margin-bottom: 18px;
        gap: 13px;
    }

    .crm-portal-page .admin-heading h1 {
        font-size: clamp(26px, 8vw, 32px);
    }

    .crm-portal-page .admin-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .crm-portal-page .admin-stats article {
        min-height: 126px;
        padding: 14px;
    }

    .crm-portal-page .admin-panel,
    .crm-portal-page .admin-table-card {
        padding: 14px;
    }

    .crm-portal-page .card-heading {
        align-items: flex-start;
        gap: 10px;
    }

    .crm-portal-page form[class*="-filter"],
    .crm-portal-page .admin-filter,
    .crm-portal-page .report-crm-filter,
    .crm-portal-page .wallet-crm-filter,
    .crm-portal-page .transaction-crm-filter {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .crm-portal-page form[class*="-filter"] .btn,
    .crm-portal-page .admin-filter .btn,
    .crm-portal-page .report-crm-filter .btn,
    .crm-portal-page .wallet-crm-filter .btn,
    .crm-portal-page .transaction-crm-filter .btn {
        width: 100%;
    }

    .crm-portal-page .row-editor,
    .crm-portal-page [class*="-edit-panel"] {
        width: calc(100vw - 24px) !important;
        inset: 12px 12px auto !important;
        max-height: calc(100dvh - 24px) !important;
    }
}

@media (max-width: 430px) {
    .trader-auth-page .auth-form-wrap,
    .admin-auth-page .auth-form-wrap {
        padding: 26px 17px;
    }

    .trader-portal-page .mobile-page-name {
        max-width: 76px;
    }

    .crm-portal-page {
        --crm-mobile-sidebar-width: min(88vw, 304px);
    }

    .crm-portal-page .admin-topbar-title span {
        display: none;
    }

    .crm-portal-page .admin-topbar-title strong {
        max-width: 118px;
    }
}

@media (max-width: 360px) {
    .wf-public-home .wf-hero__actions,
    .wf-public-home .wf-hero__benefits {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .crm-portal-page .admin-sidebar,
    .crm-portal-page .admin-sidebar-backdrop,
    .crm-portal-page .admin-user-chevron {
        transition: none;
    }
}
