/* Mobile/tablet only. Keep every rule inside this gate: desktop is unchanged.
   Loaded last by _ResponsiveStyles so individual page styles stay intact. */
@media screen and (max-width: 1199.98px) {
    /* A consistent off-canvas navigation on phones and tablets. */
    .fd-dashboard { display: block; }
    .fd-dashboard .fd-header-menu { display: inline-flex; flex: 0 0 44px; width: 44px; height: 44px; }
    .fd-dashboard .fd-sidebar,
    :is(.fd-dashboard.is-sidebar-expanded, html[data-wt-sidebar-expanded="true"] .fd-dashboard) .fd-sidebar,
    .fd-dashboard.is-sidebar-peek .fd-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1000;
        width: min(280px, calc(100vw - 48px));
        height: 100dvh;
        padding: max(16px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
        margin: 0;
        transform: translateX(-100%);
        box-shadow: 0 18px 44px -14px rgba(0, 0, 0, .26);
        transition: transform .22s var(--fd-sb-ease);
    }
    .fd-dashboard.is-sidebar-drawer-open .fd-sidebar { transform: translateX(0); }
    .fd-dashboard.is-sidebar-drawer-open .fd-sidebar-scrim { display: block; z-index: 999; }
    body:has(.fd-dashboard.is-sidebar-drawer-open) { overflow: hidden; }
    .fd-dashboard .fd-sidebar .fd-nav { overflow-y: auto; overscroll-behavior: contain; }
    .fd-dashboard .fd-sidebar .fd-brand { width: auto; justify-content: flex-start; }
    .fd-dashboard .fd-sidebar .fd-brand-name { display: inline; }
    .fd-dashboard .fd-sidebar .fd-sidebar-top { justify-content: flex-start; padding-inline: 4px; }
    .fd-dashboard .fd-sidebar :is(.fd-nav-item, .fd-ai-nav-item, .fd-sidebar-link) {
        justify-content: flex-start; padding-inline: 10px; min-height: 44px;
    }
    .fd-dashboard.is-sidebar-drawer-open .fd-sidebar :is(.fd-nav-label, .fd-sidebar-link-label) {
        display: block; max-width: 220px; opacity: 1;
    }
    .fd-dashboard .fd-sidebar .fd-sidebar-link { justify-content: space-between; }
    .fd-dashboard .fd-sidebar .fd-sidebar-link .fd-sidebar-link-icon { display: flex; }
    .fd-dashboard .fd-sidebar .fd-sidebar-link .fd-nav-icon { display: none; }
    .fd-dashboard .fd-sidebar .fd-sidebar-tour { height: auto; padding: 10px; justify-content: flex-start; }
    .fd-dashboard.is-sidebar-drawer-open .fd-sidebar .fd-sidebar-tour > span:last-child { display: flex; }
    .fd-dashboard .fd-sidebar-collapse { display: none; }

    .fd-dashboard > :is(.fd-body, .fp-body, .sn-body) { min-width: 0; width: 100%; padding: 20px 24px 32px; }
    .fd-dashboard .wt-page-header { gap: 12px; align-items: center; }
    .fd-dashboard .wt-page-header .wt-header-copy { min-width: 0; flex: 1; }
    .fd-dashboard .wt-page-header h1 { white-space: normal; overflow-wrap: anywhere; }
    .fd-dashboard .wt-page-header :is(.fd-title-row, .fp-title-row, .wt-account-title-row) { flex-wrap: wrap; gap: 8px; }
    .fd-dashboard.fp-page .wt-page-header { display: grid; grid-template-columns: 44px minmax(0, 1fr); }
    .fd-dashboard.fp-page .wt-page-header .wt-header-copy { grid-column: 2; }
    .fd-dashboard.fp-page .wt-page-header .wt-header-actions {
        grid-column: 1 / -1; display: flex; justify-content: flex-end; flex-wrap: wrap; width: 100%; max-width: none;
    }
    .fd-dashboard .wt-page-header .wt-header-actions .wt-header-pill { min-width: 44px; min-height: 44px; }
    .fd-dashboard :is(.fd-icon-button, .fp-icon-button) { min-width: 44px; min-height: 44px; }

    /* Dashboard shortcuts must grow with their labels, including the historical
       balances link and its optional Not Viewed badge. */
    .fd-fast-links { height: auto; }
    :is(.fd-fast-link, .fd-bottom-link) strong,
    .fd-bottom-link small {
        white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere;
    }
    .fd-fast-link-title { flex-wrap: wrap; }
    .fd-projection-card .fd-panel-header { height: auto; flex-wrap: wrap; padding-block: 16px; }
    .fd-projection-card .fd-chart-controls { flex-direction: row; flex-wrap: wrap; min-width: 0; max-width: 100%; }
    .fd-projection-card .fd-select-button { min-height: 44px; max-width: 100%; }

    /* Drawers overlay the tablet instead of crushing the chart into a sliver. */
    .fp-page.is-drawer-open .fp-body { margin-right: 0; padding-right: 24px; }
    .fp-drawer-shell { grid-template-columns: minmax(0, 1fr) min(540px, 100%); background: rgba(48,48,48,.28); pointer-events: auto; }
    .fp-drawer-backdrop { pointer-events: auto; }
    body:has(.fp-drawer-shell:not([hidden])) { overflow: hidden; }
    .fp-drawer-shell .fp-drawer {
        width: 100%; height: 100dvh; max-height: 100dvh; margin: 0;
        padding-top: env(safe-area-inset-top);
    }
    .fp-drawer-body { overscroll-behavior-y: contain; }
    .fp-drawer-footer { flex-wrap: wrap; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
    .fp-drawer-shell :is(.fp-drawer-close, .fp-icon-btn) { min-width: 40px; min-height: 40px; }

    /* Dense data stays in its own scroll region, never widening the page. */
    :is(.fp-table-scroll, .cfp-tablewrap, .cfp-ledgerwrap, .ii-tablewrap, .pc-tablewrap, .table-responsive) {
        min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain;
    }
    .fp-table-row .fp-cell-title { width: auto; max-width: 100%; }
    :is(.fp-chart-tabs, .fp-account-tabs, .fd-tabs, .cfp-subtabs, .gs-maintabs) {
        min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain;
        flex-wrap: nowrap; scroll-padding-inline: 12px;
    }
    :is(.fp-chart-tabs, .fp-account-tabs, .fd-tabs, .cfp-subtabs) > button { flex-shrink: 0; min-height: 44px; }
    :is(.fp-chart-header, .fp-chart-controls, .fd-chart-controls, .cfp-ctrlbar, .ii-filters, .ii-panelhead--inline) { flex-wrap: wrap; }
    :is(.fp-chart-header, .fd-panel-header, .cfp-phead) { gap: 12px; }
    .fp-chart-header { height: auto; min-height: 60px; flex: 0 0 auto; padding: 16px 24px; }
    :is(.fp-chart-controls, .fd-chart-controls, .ii-filters__group) { min-width: 0; max-width: 100%; }
    :is(.fp-chart-controls, .fd-chart-controls) > * { min-width: 0; }

    /* Scenarios, confidence and reports need a full-width result on a tablet. */
    :is(.sc-page, .pc-page, .rp-page) .sc-layout { grid-template-columns: minmax(0, 1fr); }
    :is(.sc-page, .pc-page, .rp-page) .sc-layout__inputs { position: static; min-width: 0; }
    :is(.sc-page, .pc-page, .rp-page) .sc-railwrap { max-height: none; }
    :is(.sc-page, .pc-page, .rp-page) .sc-rail__body { max-height: none; }
    .rp-viewer, .rp-preview, .rp-pdf { height: min(600px, 70dvh); min-height: 300px; }

    /* Overlay content must remain reachable above browser chrome/keyboards. */
    :is(.wt-aa-modal, .sc-modal__card, .cp-modal, .cfp-modal, .fp-confirm-dialog, .fp-item-type-picker-card) {
        max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto;
    }
    :is(.wt-aa-overlay, .sc-modal, .cp-overlay, .cfp-modal-scrim, .rp-dialog) {
        padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    }
    :is(.wt-header-menu, .fd-action-menu, .fp-select-menu, .sc-select__menu, .sc-export__menu, .sc-ddmenu, .cp-menu, .cfp-menu, .rp-pop) {
        box-sizing: border-box; max-width: calc(100vw - 24px);
        max-height: min(440px, 70dvh); overflow-y: auto; overscroll-behavior-y: contain;
    }
    /* Existing menu controllers keep selection/focus behavior. The responsive
       helper only positions menus that otherwise clip inside their cards. */
    .wt-mobile-bounded-menu {
        position: fixed !important; z-index: 1100 !important;
        inset: auto !important; margin: 0 !important;
        left: var(--wt-menu-left) !important; top: var(--wt-menu-top) !important;
        width: var(--wt-menu-width) !important; min-width: 0 !important; max-height: var(--wt-menu-height) !important;
        transform: none !important; animation: none !important;
    }

    .wt-onboarding-top { width: calc(100% - 32px); flex-wrap: wrap; gap: 20px; }
    .wt-onboarding-steps { flex: 1 1 100%; order: 3; overflow-x: auto; padding: 6px 4px 12px; }
    .wt-onboarding-steps li { flex: 1 0 76px; }
    .wt-onboarding-workspace { width: calc(100% - 32px); grid-template-columns: minmax(0, 1fr) minmax(240px, .6fr); }
    .wt-onboarding-workspace > * { min-width: 0; }
    .wt-onboarding-standalone { width: calc(100% - 32px); }
    .wt-ob-actions { flex-wrap: wrap; }
    .wt-ob-support { position: static; width: fit-content; max-width: calc(100% - 32px); margin: 24px auto; }

    @media (max-width: 767px) {
        .fd-dashboard > :is(.fd-body, .fp-body, .sn-body), .fp-page.is-drawer-open .fp-body { padding: 16px 12px 28px; gap: 16px; }
        .fd-dashboard .wt-page-header { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
        .fd-dashboard .wt-page-header .wt-header-copy { grid-column: 2; }
        .fd-dashboard .wt-page-header h1 { font-size: 22px; line-height: 1.2; }
        .fd-dashboard .wt-page-header .wt-header-actions {
            grid-column: 1 / -1; width: 100%; margin: 0; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
        }
        .fd-dashboard .wt-page-header .wt-header-actions > :is(.fd-control, .fp-control) { max-width: 100%; min-width: 0; }
        .fd-dashboard .wt-page-header .wt-header-actions .wt-header-pill { padding-inline: 10px; }
        .fd-dashboard .wt-page-header .wt-header-actions .wt-header-account {
            width: 44px; min-width: 44px; max-width: 44px; padding: 0; justify-content: center;
        }
        .fd-dashboard .wt-page-header .wt-header-account > :is(span, .wt-header-caret) { display: none; }
        .fd-dashboard .wt-page-header .wt-header-actions .wt-header-notifications { padding: 0; }
        .fd-dashboard .wt-page-header .wt-header-copy > p { display: block; font-size: 13px; line-height: 1.45; margin-top: 4px; }

        .fp-drawer-shell { display: flex; justify-content: flex-end; }
        .fp-drawer-backdrop { display: none; }
        .fp-drawer-shell .fp-drawer { width: 100%; max-width: 100%; border-radius: 0; }
        .fp-drawer-header { padding: 16px; }
        .fp-drawer-body { padding: 16px; scrollbar-gutter: auto; }
        .fp-drawer-footer { padding-inline: 12px; gap: 6px; }
        .fp-drawer-footer :is(.fp-link-btn, .fp-secondary-btn, .fp-drawer-delete, .fp-drawer-unlink) { min-height: 44px; }
        .fp-drawer-title-row { flex-wrap: wrap; }

        .fd-panel-header, .fp-chart-header { padding: 16px; height: auto; min-height: 60px; flex-wrap: wrap; }
        .fp-chart-header { align-items: flex-start; }
        .fd-chart-controls, .fp-chart-controls { width: 100%; gap: 8px; }
        .fd-projection-card .fd-chart-legend { height: auto; flex-basis: auto; flex-wrap: wrap; gap: 10px; padding: 16px; }
        .fp-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
        .fp-metric { min-width: 0; padding: 0; border: 0; }
        .fp-metric-label { white-space: normal; }
        .gs-page .sc-card__head { flex-wrap: wrap; height: auto; gap: 12px; }
        .gs-page .sc-card__head-l { flex: 1 1 100%; min-width: 0; }
        .gs-page .sc-card__head-r { min-width: 0; max-width: 100%; }
        .gs-page .gs-acts { flex-wrap: wrap; gap: 8px; }
        .fd-metrics, .fd-metrics.is-networth { gap: 12px; }
        .fd-allocation-content, .fd-allocation-content.is-bar { padding: 16px; }
        .fd-account-list { padding-inline: 12px; }
        .fd-accounts-metrics { padding: 16px; }
        .fd-bottom-links { gap: 12px; }
        .fp-kpis { flex-wrap: wrap; gap: 12px; }
        .fp-card.fp-accounts { height: auto; min-height: 0; max-height: none; }
        .fp-accounts .fp-table-scroll { flex: 0 1 auto; max-height: 65dvh; }
        .fp-accounts .fp-card-header { height: auto; min-height: 60px; flex-wrap: wrap; padding: 16px; }
        .fp-accounts .fp-card-headline { flex: 1 1 100%; }
        .fp-accounts .fp-primary-btn { white-space: nowrap; }
        .fp-accounts .fp-card-footer, .fp-accounts .fp-footer-stats { flex-wrap: wrap; gap: 8px; height: auto; }
        .fp-chart-legend { flex-wrap: wrap; gap: 10px; }
        .cfp-flow__tl { max-width: 100%; }
        .cfp-sankeywrap { overflow-x: auto; overscroll-behavior-x: contain; }
        .cfp-ctrlbar, .cfp-phead__r { gap: 10px; flex-wrap: wrap; }
        .ii-page .ii-ctrl { max-width: 100%; min-width: 0; }
        .ii-page .ii-ctrl__val { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
        .sc-modetabs { flex-wrap: wrap; }
        .sc-modetab { flex: 1 1 100%; }
        .sc-landing__grid { grid-template-columns: minmax(0, 1fr); }
        .pc-success { flex-wrap: wrap; }
        .rp-doc__acts, .rp-secmodal__footr { flex-wrap: wrap; }
        .rp-secmodal__grid { grid-template-columns: minmax(0, 1fr); }

        .wt-account-card { padding: 20px 16px; }
        .wt-account-fields { grid-template-columns: minmax(0, 1fr); }
        .wt-account-footer, .wt-account-footer-actions, .wt-account-security { flex-wrap: wrap; gap: 12px; }
        .wt-account-title-row { flex-wrap: wrap; }
        .wt-onboarding-workspace { grid-template-columns: minmax(0, 1fr); }
        .wt-onboarding-page .step2-card, .wt-ob-card { padding: 24px 16px; }
        .wt-onboarding-aside { padding: 20px; }
        .wt-ob-grid, .wt-password-rules:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
        .wt-ob-heading { align-items: flex-start; }
        .wt-ob-heading h1 { font-size: 22px; }
        .wt-signin-shell { padding: 32px 16px; min-height: 100svh; }
        .wt-signin-card { padding: 24px 20px; }
        .wt-signin-card :is(.alert, .validation-summary-errors) { overflow-wrap: anywhere; }

        /* 16px inputs avoid iOS focus zoom; keep checkbox/radio geometry intact. */
        :is(.fd-dashboard, .fp-drawer-shell, .wt-signin-page, .wt-onboarding-page, .wt-aa-modal, .sc-modal__card, .cp-modal)
        :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]), select, textarea) {
            font-size: 16px;
        }
        .pm-page .step-heading, .pm-page .matching-actions, .pm-page .effective-date { flex-wrap: wrap; }
        .pm-page .matching-actions { margin-left: 0; }
        .pm-page .remove-option { white-space: normal; flex-wrap: wrap; }
    }

    @media (max-width: 479px) {
        .fp-drawer-footer-spacer { display: none; }
        .fp-drawer-footer { justify-content: flex-end; }
        .fp-drawer-footer :is(.fp-link-btn, .fp-secondary-btn) { flex: 1 1 40%; }
        .fp-drawer-footer :is(.fp-drawer-delete, .fp-drawer-unlink) { margin-right: auto; }
        .fp-field-row, #fpItemDrawer .fp-field-grid { grid-template-columns: minmax(0, 1fr); }
        .wt-aa-type-grid, .wt-aa-options { grid-template-columns: minmax(0, 1fr); }
        .wt-aa-modal-header, .wt-aa-modal-body { padding: 16px; }
        .wt-aa-security, .wt-aa-type-foot { flex-wrap: wrap; }
        .wt-ob-actions { gap: 12px; }
        .wt-ob-actions .btn-next { flex: 1 1 100%; min-height: 44px; }
    }

    /* Compact selectors keep every section reachable without clipped tab strips. */
    .wt-mobile-picker-source { display: none !important; }
    .wt-mobile-section {
        display: flex; align-items: center; gap: 12px; min-width: 0; width: 100%;
        padding: 8px 14px; margin: 0; border: 1px solid #e7e7eb; border-radius: 16px;
        background: #fff; box-shadow: 0 2px 5px #00000006;
    }
    .wt-mobile-section > span { flex: 0 0 auto; color: #777; font-size: 12px; }
    .wt-mobile-section select {
        flex: 1; min-width: 0; width: 100%; min-height: 44px; border: 0; border-radius: 8px;
        padding: 8px 28px 8px 8px; background: transparent; color: #254df1;
        font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1.3; text-overflow: ellipsis; cursor: pointer;
    }
    .wt-mobile-section select:focus-visible { outline: 2px solid #5477ff; outline-offset: 2px; }
    .fp-inputs-grid:has(> .wt-mobile-section) { grid-template-columns: minmax(0, 1fr); }
    .wt-mobile-nav-close {
        position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px;
        display: grid; place-items: center; width: 44px; height: 44px;
        border: 1px solid #e7e7eb; border-radius: 12px; background: #fff; color: #444; cursor: pointer;
    }
    .fd-dashboard .fd-sidebar .fd-sidebar-top { padding-right: 42px; min-height: 48px; }

    /* Keep a real-sized net-worth plot, then show the detailed totals below. */
    .fp-chart-panel.is-net-worth-today :is(.fp-chart-wrap, .fp-chart-mount, #fpProjectionChart) {
        height: auto !important; max-height: none !important; flex: none;
    }
    .fp-chart-panel.is-net-worth-today .fp-net-worth-today-layout {
        display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; height: auto; gap: 12px;
    }
    .fp-chart-panel.is-net-worth-today .fp-net-worth-plot { width: 100%; height: 280px; min-height: 280px; }
    .fp-chart-panel.is-net-worth-today .fp-nw-detail { display: flex; flex-direction: column; height: auto; margin: 0; }
    .fp-nw-detail :is(.fp-nw-detail-head, section, .fp-nw-detail-net) { border-right: 0; border-bottom: 1px solid #e7e7e7; }
    .fp-nw-detail .fp-nw-detail-net { margin-top: 0; border-bottom: 0; }
    .fp-nw-detail-toggle { min-height: 44px; gap: 12px; }
    .fp-nw-detail-toggle > span { overflow-wrap: anywhere; }
    .cfp-sankeywrap { padding-inline: 12px; }
    .cfp-sk-compact-groups { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
    .cfp-sk-compact-groups button { min-height: 44px; border: 1px solid #dde3f3; background: #f6f8ff; color: #3153c4; border-radius: 10px; padding: 8px 12px; }

    .wt-onboarding-page .btn-next {
        display: inline-flex !important; align-items: center; justify-content: center; gap: 10px;
        min-height: 48px; line-height: 1.3; text-decoration: none; white-space: normal;
    }
    .wt-onboarding-page .btn-next svg { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; }
    .wt-onboarding-page .wt-ob-actions { align-items: center; }
    .wt-onboarding-page :is(.wt-ob-previous, .wt-ob-skip) { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
    .wt-onboarding-page .modal-dialog { width: auto !important; max-width: calc(100vw - 24px) !important; margin: 12px auto; }
    .wt-onboarding-page .modal-content { max-height: calc(100dvh - 24px); overflow-y: auto; }

    @media (max-width: 767px) {
        .fd-dashboard .wt-page-header { padding: 12px; border: 1px solid #fff; border-radius: 20px; background: #ffffffb8; gap: 10px; }
        .fd-dashboard .wt-page-header .wt-header-copy > p { display: none; }
        .fd-dashboard .wt-page-header .wt-header-actions { justify-content: flex-end; border-top: 1px solid #eee; padding-top: 10px; gap: 6px; }
        .fd-dashboard .wt-page-header .wt-header-actions > :is(.fd-control, .fp-control):has(.wt-header-dollar) { margin-right: auto; }
        .fd-dashboard .wt-page-header .wt-header-pill { box-shadow: none; }
        .wt-mobile-section { padding: 6px 10px; gap: 6px; border-radius: 14px; }
        .wt-mobile-section > span { font-size: 11px; }
        .wt-mobile-section select { font-size: 16px; }
        .ii-hi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 16px; gap: 20px 12px; margin-bottom: 0; }
        .ii-hi .ii-hi__cell { flex-direction: column; gap: 8px; padding: 0; }
        .ii-hi .ii-hi__ic { width: 28px; height: 28px; border-radius: 9px; }
        .ii-hi__val { font-size: 20px; overflow-wrap: anywhere; }
        .ii-hi__lab { font-size: 10px; }
        .ii-hi__name { white-space: normal; overflow-wrap: anywhere; }
        .ii-filters, .ii-section, .ii-chartbox { padding-inline: 14px; }
        .ii-table :is(th.ii-col-name, td.ii-col-name) { width: 160px; min-width: 160px; max-width: 160px; padding-inline: 12px; }
        .ii-table { min-width: 620px; }
        .ii-table td.ii-col-name { white-space: normal; }
        .ii-table th.ii-col-name .ii-th-in { white-space: normal; }
        .ii-tablewrap { max-height: 60dvh; }
        .cfp-flow__bar { grid-template-columns: minmax(0,1fr) minmax(0,1fr); padding: 16px 12px; gap: 12px; }
        .cfp-flow__side, .cfp-flow__side--r { flex-direction: column; gap: 7px; width: 100%; }
        .cfp-flow__side .cfp-flow__col { text-align: center; align-items: center; }
        .cfp-flow__badge { display: none; }
        .cfp-flow__total { font-size: 22px; }
        .cfp-flow__cap { font-size: 11px; }
        .cfp-flow__center { grid-column: 1 / -1; grid-row: 2; }
        .cfp-flow__timeline { padding: 48px 22px 58px; }
        .cfp-flow__legend { padding: 12px; gap: 10px; }
        .cfp-sankeywrap { overflow: visible; }
        .cfp-sk-tip { max-width: calc(100vw - 60px); white-space: normal; }
        .cfp-sk-tip__v { flex-wrap: wrap; gap: 4px; }
        .cfp-sankey .cfp-sk-label__name, .cfp-sankey .cfp-sk-label__amt { font-size: 11px; }
        .wt-onboarding-page .wt-ob-actions {
            display: grid; grid-template-columns: minmax(90px, .7fr) minmax(0, 1fr); gap: 12px !important;
        }
        .wt-onboarding-page .wt-ob-actions .wt-ob-previous { order: 1; margin: 0; justify-content: flex-start; }
        .wt-onboarding-page .wt-ob-actions .btn-next { order: 2; grid-column: 2; width: 100% !important; margin: 0 !important; }
        .wt-onboarding-page .wt-ob-actions .wt-ob-skip { order: 3; grid-column: 1 / -1; margin: 0 !important; }
        .wt-onboarding-page .wt-ob-support { position: static !important; margin: 20px auto !important; }
        .wt-signup-page main.layout { width: calc(100% - 24px); margin: 0 auto 32px; padding: 0; grid-template-columns: minmax(0, 1fr); gap: 20px; }
        .wt-signup-page .form-card { padding: 24px 20px; }
        .wt-signup-page .form-card h1 { font-size: 28px; line-height: 1.18; }
        .wt-signup-page .btnSignupsubmit { min-height: 48px; width: 100%; }
    }

    /* The desktop two-column placement must not create an implicit tablet
       column after the section rail becomes a selector. */
    .fp-page .fp-inputs-grid:has(> .wt-mobile-section) { grid-template-columns: minmax(0, 1fr); }
    .fp-page .fp-inputs-grid:has(> .wt-mobile-section) > * { grid-column: 1; grid-row: auto; min-width: 0; }
    .ps-page .ps-work:has(> .wt-mobile-section) { grid-template-columns: minmax(0, 1fr); }
    .ps-page .fp-chart-header { height: auto; flex-basis: auto; flex-wrap: wrap; }
    .ps-page .fp-chart-controls { flex-wrap: wrap; max-width: 100%; }
    .ps-page .ps-chart-title { flex-wrap: wrap; min-width: 0; }

    .sc-modal__foot { flex-wrap: wrap; }
    .sc-modal__title { min-width: 0; overflow-wrap: anywhere; }
    .sc-modal__title svg { flex-shrink: 0; }
    .sc-modal__x { flex: 0 0 44px; min-height: 44px; align-items: center; justify-content: center; }
    .sc-modal__head, .sc-modal__foot { flex-shrink: 0; }

    /* Keep visually hidden native toggles inside their labels. Focusing an
       unanchored checkbox can scroll the outer drawer past its fixed footer. */
    .fp-drawer :is(.fp-item-grp-head, .fp-switch-row) { position: relative; }
    .fp-drawer :is(.fp-item-grp-head, .fp-switch-row) > input {
        top: 0; left: 0; width: 1px; height: 1px; margin: 0;
        clip-path: inset(50%);
    }
    .fp-drawer :is(.fp-item-grp-head, .fp-switch-row) > input:focus-visible + span {
        outline: 2px solid #5477ff; outline-offset: 3px;
    }

    @media (max-width: 767px) {
        .fp-legend-item { max-width: 100%; white-space: normal; text-align: left; flex-wrap: wrap; min-height: 32px; }
        .fp-legend-swatch { flex-shrink: 0; }
        .fp-legend-note { white-space: normal; }
        #fpItemDrawer .fp-item-grp-body { margin-left: 0; padding-left: 0; border-left: 0; }
        #fpItemDrawer .fp-item-section-body { padding: 12px; }
        #fpItemDrawer .fp-choice-details { margin-inline: 10px; padding: 10px; }
        .ps-page .fp-chart-controls { width: 100%; }
        .sc-modal__foot > button { min-height: 44px; }
        .sc-modal__body :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea) { font-size: 16px; }
    }
    @media (max-width: 380px) {
        .wt-mobile-section { flex-direction: column; align-items: stretch; gap: 0; padding: 8px 12px; }
        .wt-mobile-section > span { padding-inline: 6px; }
        .wt-mobile-section select { padding-left: 6px; font-size: 16px; }
        .sc-modal__foot > button { flex: 1 1 100%; }
    }

    /* One compact toolbar, with support in the account menu. Page tabs remain
       directly accessible beneath it, matching the mobile navigation model. */
    .fd-dashboard .wt-page-header,
    .fd-dashboard.fp-page .wt-page-header,
    .fd-dashboard .wt-page-header:has(.wt-modern-help) {
        display: flex; flex-wrap: nowrap; align-items: center; gap: 10px;
        padding: 0; border: 0; border-radius: 0; background: transparent; min-height: 44px;
    }
    .fd-dashboard .wt-page-header .wt-header-copy { flex: 1 1 0; min-width: 0; }
    .fd-dashboard .wt-page-header .wt-header-copy > p,
    .fd-dashboard .wt-page-header :is(.wt-plan-badge) { display: none; }
    .fd-dashboard .wt-page-header .wt-header-actions,
    .fd-dashboard.fp-page .wt-page-header .wt-header-actions,
    .fd-dashboard .wt-page-header:has(.wt-modern-help) .wt-header-actions {
        display: flex; flex: 0 0 auto; flex-wrap: nowrap; width: auto; max-width: none;
        gap: 6px; padding: 0; border: 0; margin: 0;
    }
    .fd-dashboard .wt-page-header .wt-header-actions .wt-modern-help { display: contents; }
    .fd-dashboard .wt-page-header .wt-modern-help .wt-header-help-button { display: none; }
    .fd-dashboard .wt-page-header .wt-header-actions > :is(.fd-control, .fp-control):has(.wt-header-dollar) { order: 0; margin: 0; }
    .fd-dashboard .wt-page-header .wt-header-actions > :is(.fd-control, .fp-control):has(.wt-header-account) { order: 1; }
    .fd-dashboard .wt-page-header .wt-header-actions > .wt-header-notifications { order: 2; }
    .fd-dashboard .wt-page-header .wt-header-actions .wt-header-account {
        width: 44px; min-width: 44px; max-width: 44px; padding: 0; gap: 3px;
    }
    .fd-dashboard .wt-page-header .wt-header-account > span { display: none; }
    .fd-dashboard .wt-page-header .wt-header-account > .wt-header-caret { display: block; width: 10px; }
    .fd-dashboard .wt-page-header.wt-header-compact .wt-header-actions .wt-header-dollar {
        width: auto; min-width: 0; padding-inline: 8px; gap: 4px;
    }
    .fd-dashboard .wt-page-header.wt-header-compact .wt-header-dollar::before { display: none; }
    .fd-dashboard .wt-page-header.wt-header-compact .wt-header-dollar > strong,
    .fd-dashboard .wt-page-header.wt-header-compact .wt-header-dollar > .wt-header-caret { display: inline; }
    .fd-dashboard .wt-page-header .wt-header-dollar > span { display: none; }
    .fd-dashboard .wt-page-header .wt-header-actions .wt-header-pill { box-shadow: 0 1px 3px #00000008; }

    :is(.fp-chart-tabs, .cfp-maintabs) {
        display: flex; flex-wrap: nowrap; align-items: stretch; gap: 20px;
        width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain;
        border: 0; border-bottom: 1px solid #e3e5e9; border-radius: 0;
        background: transparent; box-shadow: none; scrollbar-width: thin;
    }
    :is(.fp-chart-tabs, .cfp-maintabs) > button {
        flex: 0 0 auto; min-width: 0; min-height: 44px; padding: 10px 0;
        white-space: nowrap; background: transparent; border-radius: 0; font-size: 13px;
    }
    .cfp-mtab .cfp-mtab__ic, .cfp-mtab::before { display: none; }
    .cfp-mtab .cfp-mtab__lab { white-space: nowrap; text-wrap: nowrap; font-size: 13px; }
    .cfp-mtab.is-on { background: transparent; }
    .cfp-mtab.is-on::after { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 2px; }

    .wt-mobile-table-nav:not([hidden]) {
        display: flex; align-items: center; gap: 6px; padding: 6px 12px;
        border-block: 1px solid #eceef2; background: #fafbff; color: #666; font-size: 12px;
    }
    .wt-mobile-table-nav > span { flex: 1; min-width: 0; }
    .wt-mobile-table-nav > button {
        flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid #e1e5ef; border-radius: 10px;
        background: #fff; color: #3153d5; font-size: 20px; cursor: pointer;
    }
    .wt-mobile-table-nav > button:disabled { opacity: .35; cursor: default; }
    .wt-mobile-table-nav > button:focus-visible { outline: 2px solid #5477ff; }
    :is(.cfp-tablewrap, .cfp-ledgerwrap, .ii-tablewrap, .fp-table-scroll, .atable__scroll):focus-visible { outline: 2px solid #5477ff; outline-offset: -2px; }

    /* The one-time table hint participates in layout instead of covering data
       or extending left of its anchor on a phone. */
    .cfp-viewgroup:has(.cfp-coach) { flex: 1 1 100%; }
    .cfp-viewgroup__anchor:has(.cfp-coach) { width: 100%; }
    .cfp-coach.cfp-coach--view { position: static; width: 100%; max-width: 100%; margin-top: 10px; box-sizing: border-box; box-shadow: none; }
    .cfp-coach__arrow { display: none; }
    .cfp-coach__btn { min-height: 44px; }

    @media (max-width: 767px) {
        .fd-dashboard .wt-page-header h1,
        .fd-dashboard.wt-account-page .wt-page-header h1 { font-size: 18px; line-height: 1.12; letter-spacing: -.5px; overflow-wrap: normal; }
        .fd-dashboard .wt-page-header :is(.fd-title-row, .fp-title-row, .wt-account-title-row) { gap: 0; }
        .fd-dashboard .wt-page-header { gap: 6px; }
        .fd-dashboard .wt-page-header .wt-header-actions { gap: 4px; }
        .fd-dashboard .wt-page-header .wt-header-actions .wt-header-dollar { padding-inline: 8px; gap: 4px; font-size: 12px; }
        .fd-dashboard > :is(.fd-body, .fp-body, .sn-body) { gap: 12px; }
        .cfp-table th.col-year, .cfp-table td.col-year { width: 60px; min-width: 60px; padding-inline: 10px; }
        .cfp-table th.col-ages, .cfp-table td.col-ages { left: 60px; width: 64px; min-width: 64px; max-width: 64px; padding-inline: 8px; }
        .cfp-table.no-ages th.col-total, .cfp-table.no-ages td.col-total { left: 60px; min-width: 104px; padding-inline: 10px; }
        .cfp-ledger .lcell-label { width: 140px; min-width: 140px; max-width: 140px; padding-inline: 10px; overflow-wrap: anywhere; }
        .cfp-ledger .cfp-lname { min-width: 0; }
        .cfp-ledger td.lcell-label:not(:has(> .cfp-role)) > .cfp-lname { max-width: 100%; }
        .cfp-ledger .cfp-lname .cfp-info { flex-shrink: 0; }
        .cfp-tablewrap, .cfp-ledgerwrap { max-height: 65dvh; }
        .cfp-tfoot { flex-wrap: wrap; padding: 12px; }
        /* Show the holdings first; the full allocation chart remains below. */
        .ii-holdings2 { grid-template-columns: minmax(0, 1fr); }
        .ii-holdings2__table { order: -1; }
        .ii-holdings2 .ii-holdings2__table .ii-tablewrap { max-height: 60dvh; }
        .ii-holdings2__chart { border: 0; border-top: 1px solid #e7e7e7; }
        .ii-hold--blend .ii-hold__t { margin-left: 0; }
        .ii-table td.ii-col-name { overflow-wrap: anywhere; }
        .ii-table .ii-hold__n { white-space: normal; overflow-wrap: anywhere; }
        .ii-blendtoggle, .ii-grouptoggle { width: 28px; height: 32px; flex: 0 0 28px; }
    }
    @media (max-width: 600px) {
        .fd-dashboard .wt-page-header:has(.wt-header-plan) { flex-wrap: wrap; }
        .fd-dashboard .wt-page-header .wt-header-actions:has(.wt-header-plan) { flex: 1 0 100%; }
        .wt-header-actions .wt-plan-switch:has(.wt-header-plan) { min-width: 0; max-width: none; flex: 1; }
    }
    @media (max-width: 359px) {
        .fd-dashboard .wt-page-header .wt-header-actions .wt-header-dollar { width: 44px; padding: 0; }
        .fd-dashboard .wt-page-header .wt-header-dollar > :is(strong, .wt-header-caret) { display: none; }
        .fd-dashboard .wt-page-header .wt-header-dollar::before { display: block; content: '$'; font-size: 16px; }
    }

    @media (prefers-reduced-motion: reduce) {
        .fd-dashboard .fd-sidebar { transition: none; }
    }
}
