/*
 * Fairfield mobile UI
 *
 * A dependency-free component layer for the phone and compact-tablet site.
 * Everything is intentionally scoped below the existing desktop breakpoint so
 * the desktop application keeps its current rendering and behavior.
 */

.detail-mobile-toolbar {
    display: none;
}

.mobile-header-filter,
.mobile-page-heading,
.mobile-results-row {
    display: none;
}

@media (max-width: 900px) {
    :root {
        --header-search-height: 44px;
        --header-search-button-width: 44px;
        --header-search-bg: #fff;
        --header-search-bg-strong: #fff;
        --header-search-segment-bg: #fff;
        --ffm-navy: #071d49;
        --ffm-navy-strong: #031431;
        --ffm-blue: #075fca;
        --ffm-blue-press: #064fa8;
        --ffm-blue-soft: #eaf3ff;
        --ffm-canvas: #f4f6f9;
        --ffm-surface: #ffffff;
        --ffm-surface-muted: #f7f9fc;
        --ffm-text: #14213a;
        --ffm-muted: #667085;
        --ffm-border: #dfe4eb;
        --ffm-border-strong: #cbd3de;
        --ffm-success: #16723a;
        --ffm-success-soft: #edf9f1;
        --ffm-danger: #c61f3d;
        --ffm-radius-sm: 10px;
        --ffm-radius-md: 14px;
        --ffm-radius-lg: 18px;
        --ffm-tap: 44px;
        --ffm-top-height: 61px;
        --ffm-tab-content-height: 58px;
        --ffm-tabbar-height: calc(var(--ffm-tab-content-height) + env(safe-area-inset-bottom, 0px));
        --ffm-shadow-card: 0 1px 2px rgba(15, 28, 50, 0.06), 0 7px 22px rgba(15, 28, 50, 0.05);
        --ffm-shadow-raised: 0 -8px 28px rgba(15, 28, 50, 0.10);
        --ffm-focus: 0 0 0 3px rgba(7, 95, 202, 0.24);
        --ffm-ease: cubic-bezier(0.2, 0, 0, 1);
    }

    html {
        background: var(--ffm-canvas);
        color-scheme: light;
        -webkit-text-size-adjust: 100%;
    }

    body {
        background: var(--ffm-canvas);
        color: var(--ffm-text);
        overscroll-behavior-y: none;
    }

    button,
    a,
    input,
    select {
        -webkit-tap-highlight-color: transparent;
    }

    button:focus-visible,
    a:focus-visible,
    input:focus-visible,
    select:focus-visible {
        outline: 2px solid var(--ffm-blue);
        outline-offset: 2px;
    }

    /* Inventory and shared top shells */
    .header,
    .ff-site-header {
        border-bottom: 0;
        background: var(--ffm-navy);
        box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07), 0 5px 18px rgba(3, 20, 49, 0.16);
        color: #fff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .header .header-row,
    .ff-site-header-row {
        min-height: var(--ffm-top-height);
        padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 9px;
        gap: 8px;
        background: transparent;
        box-sizing: border-box;
    }

    .header .header-lead {
        display: none !important;
    }

    body:has(#main-content.homepage-main) .header .header-lead {
        display: flex !important;
        width: 100%;
        min-height: 30px;
        order: 1;
        justify-content: flex-start;
        padding: 0 2px;
    }

    body:has(#main-content.homepage-main) .header .header-brand-row,
    body:has(#main-content.homepage-main) .header .home-button {
        width: 100%;
        justify-content: flex-start;
    }

    body:has(#main-content.homepage-main) .header .home-button {
        height: 30px;
        color: #fff;
        font-size: 17px;
        font-weight: 760;
        letter-spacing: -0.02em;
    }

    body:has(#main-content.homepage-main) .header .home-logo {
        height: 20px;
        filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
    }

    body:has(#main-content.homepage-main) .header .home-counts .filter-option-count {
        color: rgba(255, 255, 255, 0.72);
        font-size: 11px;
    }

    .header .header-subtitle {
        display: none;
    }

    .header .header-center,
    .ff-site-center {
        width: 100%;
        min-width: 0;
    }

    .header .header-center {
        order: 2;
    }

    .stock-search,
    .header-search-row .stock-search,
    .ff-site-search,
    .ff-site-center .ff-site-search {
        width: 100%;
        height: 44px;
        min-height: 44px;
        border: 1px solid rgba(255, 255, 255, 0.24);
        border-radius: var(--ffm-radius-sm);
        background: var(--ffm-surface);
        box-shadow: 0 2px 8px rgba(3, 20, 49, 0.20);
        overflow: visible;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .stock-search:focus-within,
    .ff-site-search:focus-within {
        border-color: rgba(255, 255, 255, 0.92);
        box-shadow: 0 0 0 3px rgba(125, 184, 255, 0.36), 0 3px 10px rgba(3, 20, 49, 0.20);
    }

    .stock-search input,
    .header-search-row .stock-search input,
    .ff-site-search input {
        min-width: 0;
        height: 100%;
        min-height: 0;
        padding: 0 12px;
        border: 0;
        border-radius: var(--ffm-radius-sm) 0 0 var(--ffm-radius-sm);
        background: transparent;
        color: var(--ffm-text);
        font-size: 16px;
        line-height: 1.25;
        clip-path: none;
    }

    .stock-search input::placeholder,
    .ff-site-search input::placeholder {
        color: #858f9f;
        opacity: 1;
    }

    .stock-search-submit,
    .qr-scan-button,
    .ff-site-search-submit {
        width: var(--ffm-tap);
        min-width: var(--ffm-tap);
        height: var(--ffm-tap);
        min-height: var(--ffm-tap);
        border: 0;
        border-left: 1px solid var(--ffm-border);
        border-radius: 0;
        background: var(--ffm-surface);
        color: var(--ffm-text);
        box-shadow: none;
    }

    .qr-scan-button {
        border-radius: 0 var(--ffm-radius-sm) var(--ffm-radius-sm) 0;
    }

    .stock-search-submit:active,
    .qr-scan-button:active,
    .ff-site-search-submit:active {
        background: #edf1f6;
        color: var(--ffm-blue);
        transform: none;
    }

    .stock-search-dropdown,
    .crm-search-dropdown {
        top: calc(100% + 8px);
        border: 1px solid var(--ffm-border);
        border-radius: var(--ffm-radius-md);
        background: var(--ffm-surface);
        box-shadow: 0 16px 36px rgba(15, 28, 50, 0.18);
        overflow: hidden;
    }

    .header .mobile-back-button:not([hidden]),
    .ff-mobile-back:not([hidden]) {
        width: var(--ffm-tap);
        min-width: var(--ffm-tap);
        height: var(--ffm-tap);
        border: 0;
        border-radius: var(--ffm-radius-sm);
        background: rgba(255, 255, 255, 0.13);
        color: #fff;
        box-shadow: none;
    }

    .ff-site-header .ff-site-lead {
        display: none;
    }

    body:has(.ff-site-search-placeholder) .ff-site-header .ff-site-lead {
        display: flex;
        width: 100%;
    }

    body:has(.ff-site-search-placeholder) .ff-site-center {
        display: none;
    }

    body:has(.ff-site-search-placeholder) .ff-site-home {
        width: 100%;
        min-height: 38px;
        justify-content: center;
        gap: 6px;
        color: #fff;
        font-size: 17px;
        font-weight: 760;
    }

    body:has(.ff-site-search-placeholder) .ff-site-logo {
        height: 20px;
    }

    body:has(.ff-site-search-placeholder) .ff-site-count {
        display: none;
    }

    /* Stable, edge-attached navigation shared by every mobile destination. */
    .header .header-right,
    body:has(.main:not(.homepage-main)) .header .header-right:not(.hidden),
    .ff-site-actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        z-index: 10010;
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-items: start;
        gap: 0;
        width: 100% !important;
        max-width: none;
        height: var(--ffm-tabbar-height);
        min-height: var(--ffm-tabbar-height);
        padding: 3px 8px env(safe-area-inset-bottom, 0px);
        border: 0;
        border-top: 1px solid var(--ffm-border);
        border-radius: 0;
        background: rgba(252, 253, 255, 0.98);
        box-shadow: var(--ffm-shadow-raised);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transform: none;
        overflow: visible;
        isolation: isolate;
        box-sizing: border-box;
        transition: none;
        will-change: auto;
    }

    .header .header-right::before,
    body:has(.main:not(.homepage-main)) .header .header-right:not(.hidden)::before,
    .ff-site-actions::before {
        content: none !important;
        display: none !important;
    }

    .header .header-right > *,
    .ff-site-actions > * {
        display: none !important;
    }

    .header .header-right > #crm-button,
    .header .header-right > #mobile-tab-new,
    .header .header-right > #mobile-tab-used,
    .header .header-right > .profile-button-wrap,
    .ff-site-actions > .ff-site-tab-crm,
    .ff-site-actions > .ff-site-tab-new,
    .ff-site-actions > .ff-site-tab-used,
    .ff-site-actions > .ff-site-tab-profile {
        display: flex !important;
        position: relative;
        z-index: 1;
    }

    .header .header-right #crm-button,
    .header .header-right #mobile-tab-new,
    .header .header-right #mobile-tab-used,
    .header .header-right #profile-button,
    .ff-site-actions .ff-site-tab-crm,
    .ff-site-actions .ff-site-tab-new,
    .ff-site-actions .ff-site-tab-used,
    .ff-site-actions .ff-site-tab-profile .profile-button {
        width: 100%;
        min-width: var(--ffm-tap);
        height: 55px;
        min-height: 55px;
        padding: 4px 2px 3px;
        border: 0;
        border-radius: var(--ffm-radius-sm);
        background: transparent !important;
        color: #56657a;
        box-shadow: none !important;
        font-size: 11px;
        font-weight: 650;
        line-height: 1;
        letter-spacing: 0;
        text-decoration: none;
        transform: none;
        transition: background 90ms linear, color 90ms linear;
        box-sizing: border-box;
        touch-action: manipulation;
    }

    .header .header-right .profile-button-wrap,
    .ff-site-actions .profile-button-wrap {
        position: static;
        width: 100%;
        height: 55px;
        min-height: 55px;
        padding: 0;
        background: transparent;
    }

    .header .header-right #crm-button:active,
    .header .header-right #mobile-tab-new:active,
    .header .header-right #mobile-tab-used:active,
    .header .header-right #profile-button:active,
    .ff-site-actions .ff-site-tab-crm:active,
    .ff-site-actions .ff-site-tab-new:active,
    .ff-site-actions .ff-site-tab-used:active,
    .ff-site-actions .profile-button:active {
        background: #e9edf3 !important;
        color: var(--ffm-blue);
        transform: none !important;
    }

    .header .header-right .mobile-tab-icon,
    .ff-site-actions .ff-site-action-mobile-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 26px;
        height: 25px;
    }

    .header .header-right .mobile-tab-icon svg,
    .header .header-right #profile-button svg,
    .ff-site-actions .ff-site-action-mobile-icon svg,
    .ff-site-actions .profile-button svg {
        display: block !important;
        width: 23px;
        height: 23px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .header .header-right .mobile-tab-label,
    .ff-site-actions .ff-site-action-mobile-label {
        display: block !important;
        max-height: none;
        opacity: 1;
        overflow: visible;
        transform: none;
        transition: none;
    }

    .header .header-right .profile-button .avatar-initials,
    .ff-site-actions .profile-button .avatar-initials,
    .ff-site-actions .ff-site-action-label,
    .ff-site-actions .ff-site-profile-desktop-icon {
        display: none !important;
    }

    .header .header-right .is-active,
    .header .header-right .profile-button.is-active,
    .header .header-right .profile-button.is-active.is-authed,
    .ff-site-actions .ff-site-action.is-active,
    .ff-site-actions .profile-button.is-active,
    .ff-site-actions .profile-button.is-active.is-authed {
        background: var(--ffm-blue-soft) !important;
        color: var(--ffm-blue) !important;
        box-shadow: none !important;
        font-weight: 760;
    }

    .header .header-right .is-active::after,
    .ff-site-actions .ff-site-action.is-active::after,
    .ff-site-actions .profile-button.is-active::after {
        content: none;
    }

    .header .header-right.ff-tabbar-minimized,
    body:has(.main:not(.homepage-main)) .header .header-right.ff-tabbar-minimized:not(.hidden),
    .ff-site-actions.ff-tabbar-minimized {
        height: var(--ffm-tabbar-height);
        min-height: var(--ffm-tabbar-height);
        transform: none;
    }

    .header .header-right.ff-tabbar-minimized #crm-button,
    .header .header-right.ff-tabbar-minimized #mobile-tab-new,
    .header .header-right.ff-tabbar-minimized #mobile-tab-used,
    .header .header-right.ff-tabbar-minimized #profile-button,
    .header .header-right.ff-tabbar-minimized .profile-button-wrap,
    .ff-site-actions.ff-tabbar-minimized .ff-site-tab-crm,
    .ff-site-actions.ff-tabbar-minimized .ff-site-tab-new,
    .ff-site-actions.ff-tabbar-minimized .ff-site-tab-used,
    .ff-site-actions.ff-tabbar-minimized .ff-site-tab-profile,
    .ff-site-actions.ff-tabbar-minimized .profile-button,
    .ff-site-actions.ff-tabbar-minimized .profile-button-wrap {
        height: 55px;
        min-height: 55px;
    }

    .header .header-right.ff-tabbar-minimized .mobile-tab-label,
    .ff-site-actions.ff-tabbar-minimized .ff-site-action-mobile-label {
        max-height: none;
        opacity: 1;
        overflow: visible;
        transform: none;
    }

    .header .header-right .account-menu,
    .ff-site-actions .account-menu {
        display: none !important;
    }

    .page,
    body:has(.ff-site-header) {
        padding-bottom: var(--ffm-tabbar-height);
    }

    /* Homepage and model browsing */
    .main.homepage-main {
        min-height: 0;
        padding: 12px 12px calc(18px + var(--ffm-tabbar-height));
        background: var(--ffm-canvas);
    }

    .main.homepage-main .homepage-grid.model-selector-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        touch-action: pan-y;
    }

    .main.homepage-main .model-card,
    .main.homepage-main .model-card--selector {
        min-width: 0;
        border: 1px solid var(--ffm-border);
        border-radius: var(--ffm-radius-md);
        background: var(--ffm-surface);
        box-shadow: var(--ffm-shadow-card);
        overflow: hidden;
        transform: none;
        transition: border-color 100ms linear, background 100ms linear;
    }

    .main.homepage-main .model-card:active {
        border-color: #aeb9c8;
        background: #f8fafc;
        transform: none;
    }

    .main.homepage-main .model-card--selector .model-card-image {
        flex-basis: 108px;
        height: 108px;
        padding: 6px 8px 2px;
        border-bottom: 1px solid var(--ffm-border);
        background: #fff;
    }

    .main.homepage-main .model-card--selector .model-card-image img {
        object-fit: contain;
        transform: none;
    }

    .main.homepage-main .model-card--selector .model-card-content {
        min-height: 45px;
        padding: 9px 10px 10px;
        background: var(--model-group-tint, var(--ffm-surface-muted));
    }

    .main.homepage-main .model-card--selector .model-card-title-row {
        align-items: center;
        gap: 6px;
    }

    .main.homepage-main .model-card--selector .model-card-title {
        min-width: 0;
        color: var(--ffm-text);
        font-size: 14px;
        font-weight: 760;
        line-height: 1.12;
        letter-spacing: -0.01em;
    }

    .main.homepage-main .model-card--selector .model-card-title-count {
        color: var(--ffm-muted);
        font-size: 11px;
        font-weight: 700;
    }

    .main.homepage-main .model-powertrain-tag {
        top: 6px;
        left: 6px;
        min-height: 18px;
        padding: 2px 5px;
        border-radius: 5px;
        font-size: 8px;
    }

    /* Inventory list and compact controls */
    .main:not(.homepage-main) {
        gap: 10px;
        padding: 0 10px calc(18px + var(--ffm-tabbar-height));
        background: var(--ffm-canvas);
    }

    .main:not(.homepage-main) .mobile-filter-bar {
        top: var(--inventory-header-height, var(--ffm-top-height));
        width: calc(100% + 20px);
        margin: 0 -10px;
        padding: 8px 10px;
        border-bottom: 1px solid var(--ffm-border);
        background: rgba(244, 246, 249, 0.98);
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transition: top 140ms var(--ffm-ease);
    }

    body.inventory-header-collapsible.inventory-header-hidden .main:not(.homepage-main) .mobile-filter-bar {
        top: 0;
        box-shadow: 0 5px 14px rgba(15, 28, 50, 0.08);
    }

    .main:not(.homepage-main) .mobile-filter-bar-inner {
        display: block;
    }

    .main:not(.homepage-main) .mobile-filter-button {
        width: 100%;
        min-height: var(--ffm-tap);
        padding: 0 14px;
        border: 1px solid var(--ffm-navy);
        border-radius: var(--ffm-radius-sm);
        background: var(--ffm-navy);
        box-shadow: none;
        color: #fff;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        transform: none;
    }

    .main:not(.homepage-main) .mobile-filter-button::after {
        content: "Refine";
        color: rgba(255, 255, 255, 0.72);
        font-size: 12px;
        font-weight: 650;
    }

    .main:not(.homepage-main) .mobile-filter-button:active {
        border-color: var(--ffm-navy-strong);
        background: var(--ffm-navy-strong);
        transform: none;
    }

    .main:not(.homepage-main) .mobile-filter-button.is-active {
        border-color: var(--ffm-blue);
        background: var(--ffm-blue);
    }

    .main:not(.homepage-main) .mobile-control-label {
        color: #fff;
        font-size: 14px;
        font-weight: 760;
        letter-spacing: 0;
        text-transform: none;
    }

    .main:not(.homepage-main) .mobile-filter-count {
        display: inline-flex;
        margin-left: auto;
        color: #fff;
        font-size: 12px;
        font-weight: 700;
    }

    .main:not(.homepage-main) .mobile-filter-button.is-active::after {
        content: "Edit";
    }

    .main:not(.homepage-main) .active-filters {
        margin: 0;
        padding: 0 0 2px;
        gap: 6px;
    }

    .main:not(.homepage-main) .active-filter-tag {
        min-height: 32px;
        padding: 6px 10px;
        border: 1px solid #b9d5f8;
        border-radius: 999px;
        background: var(--ffm-blue-soft);
        color: #174f92;
        font-size: 12px;
        font-weight: 650;
    }

    .main:not(.homepage-main) .cards-grid {
        gap: 10px;
    }

    .main:not(.homepage-main) .card {
        border: 1px solid var(--ffm-border);
        border-radius: var(--ffm-radius-md);
        background: var(--ffm-surface);
        box-shadow: var(--ffm-shadow-card);
        content-visibility: visible;
        contain-intrinsic-size: none;
        transform: none;
        transition: border-color 100ms linear, background 100ms linear;
    }

    .main:not(.homepage-main) .card:active {
        border-color: var(--ffm-border-strong);
        background: #fbfcfe;
        transform: none;
    }

    .main:not(.homepage-main) .card-title {
        color: var(--ffm-text);
        font-weight: 780;
        letter-spacing: -0.01em;
    }

    .main:not(.homepage-main) .card-subtitle,
    .main:not(.homepage-main) .card-id-label {
        color: var(--ffm-muted);
    }

    .main:not(.homepage-main) .card-price-pair strong,
    .main:not(.homepage-main) .card-footer-used .price {
        color: var(--ffm-blue);
        font-variant-numeric: tabular-nums;
    }

    .main:not(.homepage-main) .bookmark-button,
    .main:not(.homepage-main) .vehicle-service-action-button {
        min-width: 44px;
        min-height: 44px;
        border-radius: var(--ffm-radius-sm);
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    #mobile-filters-backdrop {
        background: rgba(7, 18, 36, 0.48);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    body.mobile-filters-open #filters-sidebar {
        top: 10vh;
        max-height: 90vh;
        padding: 0 16px calc(20px + env(safe-area-inset-bottom, 0px));
        border: 0;
        border-radius: 22px 22px 0 0;
        background: var(--ffm-surface);
        box-shadow: 0 -18px 48px rgba(7, 18, 36, 0.24);
    }

    #filters-sidebar .mobile-filters-header {
        min-height: 58px;
        padding: 16px 0 10px;
        border-bottom: 1px solid var(--ffm-border);
        background: var(--ffm-surface);
    }

    #filters-sidebar .mobile-filters-header::before {
        top: 7px;
        width: 38px;
        height: 4px;
        background: #c9d0da;
    }

    .mobile-filters-title {
        color: var(--ffm-text);
        font-size: 18px;
        font-weight: 780;
        letter-spacing: -0.02em;
        text-transform: none;
    }

    .mobile-filters-close {
        min-width: var(--ffm-tap);
        min-height: var(--ffm-tap);
        padding: 0 13px;
        border: 0;
        border-radius: var(--ffm-radius-sm);
        background: var(--ffm-blue-soft);
        color: var(--ffm-blue);
        font-size: 14px;
        font-weight: 760;
        transform: none;
    }

    .mobile-filters-close:active {
        background: #dcecff;
        transform: none;
    }

    #filters-sidebar .filter-section {
        border-bottom-color: var(--ffm-border);
    }

    /* Mobile vehicle detail */
    .vehicle-detail.active {
        z-index: 10030;
        background: var(--ffm-canvas);
    }

    .vehicle-detail .vehicle-detail-main {
        padding: 0 0 calc(18px + var(--ffm-tabbar-height));
        background: var(--ffm-canvas);
    }

    .detail-mobile-toolbar {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        align-items: center;
        min-height: calc(52px + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) 10px 0;
        border-bottom: 1px solid var(--ffm-border);
        background: rgba(255, 255, 255, 0.98);
    }

    .detail-mobile-back {
        min-width: var(--ffm-tap);
        min-height: var(--ffm-tap);
        padding: 0 12px 0 8px;
        border: 0;
        border-radius: var(--ffm-radius-sm);
        background: transparent;
        color: var(--ffm-text);
        font: inherit;
        font-size: 15px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .detail-mobile-back svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .detail-mobile-back:active {
        background: #edf1f6;
    }

    .vehicle-detail .detail-body,
    .vehicle-detail .detail-media-stack,
    .vehicle-detail .detail-panel {
        width: 100%;
        max-width: 100%;
    }

    .vehicle-detail .detail-body {
        gap: 0;
    }

    .vehicle-detail .detail-hero {
        width: 100%;
        max-height: none;
        margin: 0;
        border: 0;
        border-bottom: 1px solid var(--ffm-border);
        border-radius: 0;
        background: var(--ffm-surface);
        box-shadow: none;
        aspect-ratio: 4 / 3;
    }

    .vehicle-detail .detail-bookmark-button {
        top: 10px;
        right: 10px;
        width: var(--ffm-tap);
        height: var(--ffm-tap);
        border: 1px solid var(--ffm-border);
        border-radius: var(--ffm-radius-sm);
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .vehicle-detail .detail-thumbnails {
        min-height: 0;
        margin: 0;
        padding: 8px 12px;
        border-bottom: 1px solid var(--ffm-border);
        background: var(--ffm-surface);
    }

    .vehicle-detail .detail-panel {
        height: auto;
        max-height: none;
        margin: 0;
        padding: 18px 14px 12px;
        border: 0;
        border-radius: 0;
        background: var(--ffm-surface);
        box-shadow: none;
        overflow: visible;
    }

    .vehicle-detail .detail-title {
        margin-bottom: 5px;
        color: var(--ffm-text);
        font-size: 24px;
        font-weight: 820;
        line-height: 1.08;
        letter-spacing: -0.03em;
    }

    .vehicle-detail .detail-subtitle {
        margin-bottom: 10px;
        color: var(--ffm-muted);
        font-size: 13px;
        line-height: 1.4;
    }

    .vehicle-detail .detail-tags {
        margin-bottom: 14px;
    }

    .vehicle-detail .detail-tags .tag {
        min-height: 28px;
        padding: 5px 9px;
        border-radius: 999px;
        font-size: 11px;
    }

    .vehicle-detail .detail-price-section {
        margin: 0 -14px 14px;
        padding: 14px;
        border: 0;
        border-top: 1px solid var(--ffm-border);
        border-bottom: 1px solid var(--ffm-border);
        border-radius: 0;
        background: var(--ffm-surface-muted);
        box-shadow: none;
    }

    .vehicle-detail .final-price .price-value {
        color: var(--ffm-blue);
        font-size: 23px;
        font-weight: 850;
    }

    .vehicle-detail .detail-cta {
        gap: 9px;
        margin-bottom: 16px;
    }

    .vehicle-detail .detail-cta button {
        min-height: var(--ffm-tap);
        border-radius: var(--ffm-radius-sm);
        font-size: 14px;
        font-weight: 760;
        transform: none;
    }

    .vehicle-detail .detail-cta #detail-contact {
        min-height: 50px;
        background: var(--ffm-blue);
    }

    .vehicle-detail .detail-cta #detail-contact:active {
        background: var(--ffm-blue-press);
        transform: none;
    }

    .vehicle-detail .detail-cta .secondary {
        border: 1px solid var(--ffm-blue);
        background: var(--ffm-surface);
        color: var(--ffm-blue);
    }

    .vehicle-detail .detail-content-grid {
        gap: 10px;
    }

    .vehicle-detail .detail-module {
        border: 1px solid var(--ffm-border);
        border-radius: var(--ffm-radius-md);
        background: var(--ffm-surface);
        box-shadow: none;
    }

    /* Utility overlays leave room for the stable destination bar. */
    .status-list-overlay,
    #vehicle-map-overlay,
    #feedback-overlay,
    .ford-doc-chooser-overlay {
        inset: var(--ffm-top-height) 0 var(--ffm-tabbar-height) !important;
    }

    .qr-scan-close {
        width: var(--ffm-tap);
        min-width: var(--ffm-tap);
        height: var(--ffm-tap);
        min-height: var(--ffm-tap);
        border-radius: var(--ffm-radius-sm);
    }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
    .header,
    .mobile-filter-bar,
    .mobile-tab-label,
    .ff-site-action-mobile-label,
    .model-card,
    .card,
    button,
    a {
        scroll-behavior: auto !important;
        animation: none !important;
        transition-duration: 1ms !important;
    }
}

@media (max-width: 900px) and (prefers-contrast: more) {
    :root {
        --ffm-border: #aab4c2;
        --ffm-border-strong: #7f8a9a;
    }

    .header .header-right,
    .ff-site-actions,
    .stock-search,
    .ff-site-search,
    .card,
    .model-card {
        box-shadow: none !important;
    }
}

/*
 * Canonical mobile inventory presentation
 *
 * This section owns the current inventory header, results row, cards, and
 * destination bar. Desktop remains governed by the original styles.
 */
@media (max-width: 900px) {
    :root {
        --ffm-navy: #002b5c;
        --ffm-blue: #0067d9;
        --ffm-blue-press: #0055b3;
        --ffm-blue-soft: transparent;
        --ffm-canvas: #f7f8fa;
        --ffm-text: #172033;
        --ffm-muted: #657084;
        --ffm-border: #dde2e9;
        --ffm-radius-sm: 8px;
        --ffm-radius-md: 10px;
        --ffm-shadow-card: 0 1px 4px rgba(20, 31, 49, 0.08);
        --ffm-shadow-raised: 0 -1px 10px rgba(20, 31, 49, 0.08);
    }

    body:has(#main-content.homepage-main) .header .home-counts {
        display: none !important;
    }

    body:has(#main-content.homepage-main) .header .header-row {
        min-height: 104px;
        padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 10px;
        gap: 7px;
    }

    body:has(#main-content.homepage-main) .header .header-lead {
        min-height: 23px;
        padding: 0;
        justify-content: center;
    }

    body:has(#main-content.homepage-main) .header .header-brand-row,
    body:has(#main-content.homepage-main) .header .home-button {
        justify-content: center;
    }

    body:has(#main-content.homepage-main) .header .home-button {
        height: 38px;
        min-height: 38px;
        font-size: 17px;
        font-weight: 760;
        letter-spacing: -0.015em;
    }

    .header-search-row {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    body:has(#main-content.homepage-main) .mobile-header-filter {
        display: none !important;
    }

    body:has(#main-content:not(.homepage-main)) .header {
        border-bottom: 1px solid var(--ffm-border);
        background: #fff;
        box-shadow: none;
        color: var(--ffm-text);
    }

    body:has(#main-content:not(.homepage-main)) .header .header-row {
        min-height: 62px;
        padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px;
    }

    body:has(#main-content:not(.homepage-main)) .header .mobile-back-button {
        display: none !important;
    }

    body:has(#main-content:not(.homepage-main)) .stock-search {
        flex: 1 1 auto;
        min-width: 0;
        border-color: #d3d9e2;
        box-shadow: none;
    }

    body:has(#main-content:not(.homepage-main)) .qr-scan-button {
        display: none;
    }

    body:has(#main-content:not(.homepage-main)) .stock-search-submit {
        border-radius: 0 8px 8px 0;
    }

    .mobile-header-filter {
        flex: 0 0 auto;
        min-width: 88px;
        min-height: 44px;
        padding: 0 11px;
        border: 1px solid var(--ffm-navy);
        border-radius: 8px;
        background: var(--ffm-navy);
        color: #fff;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 13px;
        font-weight: 720;
    }

    body:has(#main-content:not(.homepage-main)) .mobile-header-filter {
        display: inline-flex;
    }

    .mobile-header-filter svg {
        width: 17px;
        height: 17px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
    }

    .mobile-header-filter.is-active::after {
        content: attr(data-count);
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        border-radius: 999px;
        background: #fff;
        color: var(--ffm-navy);
        display: inline-grid;
        place-items: center;
        font-size: 9px;
        font-weight: 850;
    }

    .main.homepage-main {
        padding: 10px 10px calc(12px + var(--ffm-tabbar-height));
        background: #fff;
    }

    .mobile-page-heading {
        margin: 0 0 8px;
        color: var(--ffm-text);
        font-size: 15px;
        font-weight: 760;
        letter-spacing: -0.01em;
    }

    .main.homepage-main .mobile-page-heading {
        display: block;
    }

    .main.homepage-main .cards-grid,
    .main.homepage-main .homepage-grid,
    .main.homepage-main .model-selector-grid {
        gap: 7px;
    }

    .main.homepage-main .model-card,
    .main.homepage-main .model-card--selector {
        min-height: 94px;
        height: 94px;
        border: 1px solid #e0e4ea;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(20, 31, 49, 0.06);
    }

    .main.homepage-main .model-card--selector .model-card-image {
        flex: 0 0 66px;
        height: 66px;
        min-height: 66px;
        padding: 5px 6px 2px;
        background: #fff;
    }

    .main.homepage-main .model-card-image img {
        object-fit: contain;
    }

    .main.homepage-main .model-card--selector .model-card-content {
        flex: 0 0 28px;
        min-height: 28px;
        padding: 4px 7px;
        border-top: 1px solid #e4e8ed;
        background: var(--model-group-tint, var(--ffm-surface-muted));
    }

    .main.homepage-main .model-card-title {
        font-size: 12px;
        font-weight: 730;
        line-height: 1.1;
    }

    .main.homepage-main .model-card-title-count {
        padding: 0;
        background: transparent;
        color: var(--ffm-muted);
        font-size: 10px;
        font-weight: 760;
    }

    .main.homepage-main .model-powertrain-tag {
        top: 5px;
        left: 5px;
        padding: 2px 5px;
        border-radius: 4px;
        font-size: 7px;
    }

    .main.homepage-main .inventory {
        margin-top: -14px;
    }

    .main:not(.homepage-main) {
        padding: 0 9px calc(14px + var(--ffm-tabbar-height));
        background: var(--ffm-canvas);
    }

    .main:not(.homepage-main) .mobile-page-heading,
    .main:not(.homepage-main) .mobile-filter-bar,
    .main:not(.homepage-main) #active-filters {
        display: none !important;
    }

    .mobile-results-row {
        min-height: 44px;
        margin: 0 -9px 7px;
        padding: 0 11px;
        border-bottom: 1px solid var(--ffm-border);
        background: #fff;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .main:not(.homepage-main) .mobile-results-row {
        display: flex;
    }

    .mobile-results-count {
        color: var(--ffm-text);
        font-size: 12px;
        font-weight: 650;
        font-variant-numeric: tabular-nums;
    }

    .mobile-dealer-trade-button {
        min-width: 100px;
        min-height: 44px;
        padding: 0 8px;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: var(--ffm-blue);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        font-size: 10px;
        font-weight: 740;
        white-space: nowrap;
    }

    .mobile-dealer-trade-button[hidden] {
        display: none;
    }

    .mobile-dealer-trade-button:active {
        background: #edf5ff;
    }

    .mobile-dealer-trade-button:disabled {
        opacity: 0.7;
    }

    .mobile-sort-control {
        min-width: 0;
        display: inline-flex;
        align-items: center;
        color: var(--ffm-muted);
        font-size: 11px;
        white-space: nowrap;
    }

    .mobile-sort-control select {
        max-width: 128px;
        height: 44px;
        padding: 0 19px 0 3px;
        border: 0;
        background: transparent;
        color: var(--ffm-text);
        font: inherit;
        font-weight: 650;
    }

    .main:not(.homepage-main) .cards-grid,
    .main:not(.homepage-main) .cards-grid.mobile-grid-two-up {
        grid-template-columns: minmax(0, 1fr);
        gap: 7px;
        touch-action: pan-y;
    }

    .main:not(.homepage-main) .card,
    .main:not(.homepage-main) .mobile-grid-two-up .card {
        min-height: 0;
        padding: 0;
        gap: 0;
        overflow: hidden;
        border: 1px solid #dfe3e9;
        border-radius: 9px;
        background: #fff;
        box-shadow: var(--ffm-shadow-card);
    }

    .main:not(.homepage-main) .card-link,
    .main:not(.homepage-main) .mobile-grid-two-up .card-link {
        min-height: 0;
        display: grid;
        grid-template-columns: 118px minmax(0, 1fr);
        gap: 0;
        padding: 0;
    }

    .main:not(.homepage-main) .card-image-placeholder,
    .main:not(.homepage-main) .mobile-grid-two-up .card-image-placeholder {
        position: relative;
        inset: auto;
        width: 118px;
        min-height: 0;
        height: auto;
        aspect-ratio: 4 / 3;
        margin: 0;
        border: 0;
        border-right: 1px solid #e5e8ed;
        border-radius: 0;
        background: #fff;
    }

    .main:not(.homepage-main) .card-image-placeholder img {
        object-fit: contain;
        object-position: center;
        transition: none;
    }

    .main:not(.homepage-main) .bookmark-button,
    .main:not(.homepage-main) .vehicle-service-action-button,
    .main:not(.homepage-main) .card-image-placeholder > .available-badge,
    .main:not(.homepage-main) .card-image-placeholder > .in-transit-badge,
    .main:not(.homepage-main) .card-meta,
    .main:not(.homepage-main) .card-photo-controls,
    .main:not(.homepage-main) .vehicle-dol-stack {
        display: none !important;
    }

    .main:not(.homepage-main) .card-image-placeholder > .sold-badge {
        display: inline-flex !important;
    }

    .main:not(.homepage-main) .card-link {
        position: relative;
    }

    .main:not(.homepage-main) .card-link::after {
        content: '›';
        position: absolute;
        top: 50%;
        right: 9px;
        color: #8b94a3;
        font-size: 23px;
        font-weight: 350;
        line-height: 1;
        transform: translateY(-50%);
    }

    .main:not(.homepage-main) .card-heading {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        min-height: 0;
        height: 100%;
        padding: 8px 31px 7px 10px;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: 1fr auto auto 1fr;
        align-content: stretch;
        column-gap: 7px;
    }

    .main:not(.homepage-main) .card-title {
        grid-column: 1;
        grid-row: 2;
        min-width: 0;
        overflow: hidden;
        color: var(--ffm-text);
        font-size: 13px;
        font-weight: 770;
        line-height: 1.17;
        letter-spacing: -0.01em;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .main:not(.homepage-main) .card-subtitle {
        grid-column: 1;
        grid-row: 3;
        min-width: 0;
        overflow: hidden;
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        color: #737d8e;
        font-size: 9px;
        line-height: 1.35;
        white-space: nowrap;
    }

    .main:not(.homepage-main) .card-subtitle .card-dealer-label {
        overflow: hidden;
        color: #174f8e;
        font-size: 9px;
        font-weight: 720;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .main:not(.homepage-main) .card-heading > :is(.card-price-final, .vehicle-card-price-group) {
        grid-column: 2;
        grid-row: 1 / -1;
        align-self: center;
        margin: 0;
        color: var(--vehicle-card-price-color);
    }

    .main:not(.homepage-main) .card-heading > .card-price-final strong,
    .main:not(.homepage-main) .card-heading > .vehicle-card-price-group .card-price-final strong {
        color: var(--vehicle-card-price-color);
        font-size: 14px;
        font-weight: 800;
        font-variant-numeric: tabular-nums;
        letter-spacing: -0.015em;
        white-space: nowrap;
    }

    .main:not(.homepage-main) .card-heading > .card-price-final.is-sold strong,
    .main:not(.homepage-main) .card-heading > .vehicle-card-price-group .card-price-final.is-sold strong {
        display: inline-flex;
        padding: 5px 10px;
        border-radius: 999px;
        background: #dc2626;
        color: #fff;
        font-size: 12px;
        line-height: 1;
        letter-spacing: .02em;
        text-transform: uppercase;
    }

    .main:not(.homepage-main) .vehicle-card-price-group .card-odometer {
        margin: 0;
        color: var(--text);
        font-size: 14px;
        font-weight: 800;
        font-variant-numeric: tabular-nums;
        letter-spacing: -0.015em;
        line-height: 1.12;
        white-space: nowrap;
    }

    .main:not(.homepage-main) .card-id-chip {
        width: fit-content;
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 4px;
        padding: 0;
        line-height: 1.25;
        font-variant-numeric: tabular-nums;
    }

    .main:not(.homepage-main) .card-id-label {
        color: #7c8797;
        font-size: 9px;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .main:not(.homepage-main) .card-id-value {
        color: var(--ffm-text);
        font-size: 11px;
        font-weight: 650;
    }

    .main:not(.homepage-main) .card:not(.dealer-trade-card) .card-footer {
        display: none !important;
    }

    .main:not(.homepage-main) .dealer-trade-card {
        overflow: hidden;
    }

    .main:not(.homepage-main) .dealer-trade-button {
        min-height: 44px;
    }

    .main:not(.homepage-main) [data-dealer-trade-list-option] {
        display: none !important;
    }

    .main:not(.homepage-main) .dealer-trade-card .card-link {
        min-height: 112px;
    }

    .main:not(.homepage-main) .dealer-trade-card .card-image-placeholder {
        min-height: 110px;
    }

    .main:not(.homepage-main) .dealer-trade-card .card-heading {
        min-height: 110px;
        grid-template-rows: auto auto auto 1fr;
    }

    .main:not(.homepage-main) .dealer-trade-card .card-title {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .main:not(.homepage-main) .dealer-trade-card .card-subtitle {
        grid-column: 1 / -1;
        grid-row: 2 / 4;
        align-content: start;
        flex-wrap: wrap;
    }

    .main:not(.homepage-main) .dealer-trade-card .card-footer {
        min-height: 56px;
        margin-left: 118px;
        padding: 6px 31px 7px 10px;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
        border-top: 1px solid #e5e8ed;
        background: #f8fafc;
    }

    .main:not(.homepage-main) .dealer-trade-card .dealer-trade-price-link {
        min-width: 0;
        min-height: 44px;
        padding: 3px 6px;
        display: grid;
        align-content: center;
        gap: 1px;
        border: 1px solid #c9d8eb;
        border-radius: 6px;
        background: #fff;
        text-decoration: none;
    }

    .main:not(.homepage-main) .dealer-trade-card .dealer-trade-price-link span {
        color: #647084;
        font-size: 7px;
        font-weight: 700;
        line-height: 1;
        text-transform: uppercase;
    }

    .main:not(.homepage-main) .dealer-trade-card .dealer-trade-price-link strong {
        overflow: hidden;
        color: var(--ffm-blue);
        font-size: 10px;
        line-height: 1.15;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .main:not(.homepage-main) .dealer-trade-results-banner {
        position: relative;
        scroll-margin-top: calc(var(--inventory-header-height, 68px) + 8px);
        outline: none;
    }

    .header .header-right,
    body:has(.main:not(.homepage-main)) .header .header-right:not(.hidden),
    .ff-site-actions {
        padding: 2px 7px env(safe-area-inset-bottom, 0px);
        border-top-color: #dfe3e8;
        background: rgba(255, 255, 255, 0.99);
        box-shadow: var(--ffm-shadow-raised);
    }

    .header .header-right #crm-button,
    .header .header-right #mobile-tab-new,
    .header .header-right #mobile-tab-used,
    .header .header-right #profile-button,
    .ff-site-actions .ff-site-tab-crm,
    .ff-site-actions .ff-site-tab-new,
    .ff-site-actions .ff-site-tab-used,
    .ff-site-actions .ff-site-tab-profile .profile-button {
        border-radius: 0;
        color: #30394a;
        font-size: 10px;
        font-weight: 620;
    }

    .header .header-right .is-active,
    .header .header-right .profile-button.is-active,
    .header .header-right .profile-button.is-active.is-authed,
    .ff-site-actions .ff-site-action.is-active,
    .ff-site-actions .profile-button.is-active,
    .ff-site-actions .profile-button.is-active.is-authed {
        background: transparent !important;
        color: var(--ffm-blue) !important;
        font-weight: 760;
    }

    .header .header-right .mobile-tab-icon svg.ff-nav-glyph,
    .header .header-right #profile-button svg.ff-nav-glyph,
    .ff-site-actions .ff-site-action-mobile-icon svg.ff-nav-glyph,
    .ff-site-actions .profile-button svg.ff-nav-glyph {
        width: 24px;
        height: 24px;
        fill: currentColor !important;
        stroke: none !important;
    }

    .ff-nav-glyph-fill {
        display: none;
    }

    .is-active .ff-nav-glyph-regular,
    .profile-button.is-active .ff-nav-glyph-regular {
        display: none;
    }

    .is-active .ff-nav-glyph-fill,
    .profile-button.is-active .ff-nav-glyph-fill {
        display: block;
    }
}

@media (max-width: 360px) {
    .main:not(.homepage-main) .card-link,
    .main:not(.homepage-main) .mobile-grid-two-up .card-link {
        grid-template-columns: 106px minmax(0, 1fr);
        padding: 0;
    }

    .main:not(.homepage-main) .card-image-placeholder,
    .main:not(.homepage-main) .mobile-grid-two-up .card-image-placeholder {
        width: 106px;
    }

    .main:not(.homepage-main) .card-heading > .card-price-final strong,
    .main:not(.homepage-main) .card-heading > .vehicle-card-price-group .card-price-final strong,
    .main:not(.homepage-main) .vehicle-card-price-group .card-odometer {
        font-size: 13px;
    }
}

/* CRM mobile navigation, search, and customer workspace. */
@media (max-width: 900px) {
    body:has(.crm-shell) {
        background: #0f1013;
        color: #f7f7f8;
    }

    body:has(.crm-shell) .ff-site-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background: #002f63;
        box-shadow: 0 3px 16px rgba(0, 20, 49, 0.22);
    }

    body:has(.crm-shell) .ff-site-header-row {
        min-height: 64px;
        padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
    }

    body:has(.crm-shell) .ff-site-center,
    body:has(.crm-shell) .ff-site-search.crm-search {
        width: 100%;
        max-width: none;
    }

    body:has(.crm-shell) .ff-site-search.crm-search {
        display: flex;
        flex: 1 1 auto;
        align-items: center;
        gap: 10px;
        height: 44px;
        min-height: 44px;
        max-height: none;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }

    body:has(.crm-shell) .ff-site-search.crm-search:hover,
    body:has(.crm-shell) .ff-site-search.crm-search:focus-within {
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .crm-search-mobile-idle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-width: 0;
    }

    .crm-search-mobile-idle > strong {
        color: #fff;
        font-size: 25px;
        font-weight: 820;
        letter-spacing: -0.03em;
    }

    .crm-search-open,
    .crm-search-cancel {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        border: 0;
        color: #fff;
        font: inherit;
        font-size: 14px;
        font-weight: 760;
        cursor: pointer;
    }

    .crm-search-open {
        gap: 7px;
        min-width: 100px;
        padding: 0 16px;
        border: 1px solid rgba(255, 255, 255, 0.58);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.08);
    }

    .crm-search-open svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
    }

    .crm-search-field {
        display: none;
    }

    .crm-search.is-searching .crm-search-mobile-idle {
        display: none;
    }

    .crm-search.is-searching .crm-search-field {
        display: flex;
        flex: 1 1 auto;
        align-items: stretch;
        min-width: 0;
        height: 44px;
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, 0.72);
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(125, 184, 255, 0.24);
    }

    body:has(.crm-shell) .crm-search:not(.is-searching) > .crm-search-field,
    body:has(.crm-shell) .crm-search:not(.is-searching) > .crm-search-cancel,
    body:has(.crm-shell) .crm-search:not(.is-searching) > .crm-search-dropdown {
        display: none;
    }

    body:has(.crm-shell) .crm-search.is-searching input {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        height: 42px;
        padding: 0 12px;
        border-radius: 9px 0 0 9px;
        color: #172033;
        font-size: 16px;
        font-weight: 560;
    }

    body:has(.crm-shell) .crm-search.is-searching .ff-site-search-submit {
        display: inline-flex;
        flex: 0 0 44px;
        width: 44px;
        min-width: 44px;
        height: 42px;
        min-height: 42px;
        border-left: 1px solid #d9dee6;
        border-radius: 0 9px 9px 0;
        background: #fff;
        color: #172033;
    }

    .crm-search-cancel {
        flex: 0 0 auto;
        padding: 0 2px;
        background: transparent;
    }

    body:has(.crm-shell) .crm-search-dropdown {
        top: calc(100% + 10px);
        right: 0;
        left: 0;
        z-index: 1300;
        max-height: min(430px, calc(100dvh - 150px));
        padding: 6px;
        border-color: #343842;
        border-radius: 12px;
        background: #191b20;
        box-shadow: 0 22px 56px rgba(0, 0, 0, 0.46);
    }

    body:has(.crm-shell) .crm-search-result {
        grid-template-columns: 42px minmax(0, 1fr);
        min-height: 62px;
        gap: 12px;
        padding: 8px 10px;
        border-radius: 9px;
        color: #f7f7f8;
    }

    body:has(.crm-shell) .crm-search-result:hover,
    body:has(.crm-shell) .crm-search-result:focus-visible {
        background: #25282f;
    }

    body:has(.crm-shell) .crm-search-result .crm-customer-avatar {
        width: 42px;
        height: 42px;
        font-size: 14px;
    }

    body:has(.crm-shell) .crm-search-result-name {
        color: #fff;
        font-size: 16px;
    }

    body:has(.crm-shell) .crm-search-result-meta,
    body:has(.crm-shell) .crm-search-heading,
    body:has(.crm-shell) .crm-search-empty {
        color: #a7abb4;
    }

    .crm-home-progress {
        gap: 7px;
        padding: 12px 16px 14px;
        border-color: #25272d;
        background: #0f1013;
    }

    .crm-home-progress-value {
        color: #f7f7f8;
        font-size: 13px;
    }

    .crm-home-progress .crm-progress-track {
        height: 7px;
        background: #2b2e34;
    }
}

@media (max-width: 720px) {
    body.crm-modal-open .ff-site-header {
        position: static;
        z-index: auto;
        height: 0;
        min-height: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    body.crm-modal-open .ff-site-header-row {
        height: 0;
        min-height: 0;
        padding: 0;
    }

    body.crm-modal-open .ff-site-center,
    body.crm-modal-open .ff-site-lead {
        display: none;
    }

    body.crm-modal-open {
        overscroll-behavior: none;
    }

    .crm-modal {
        inset: 0 0 calc(68px + env(safe-area-inset-bottom, 0px));
        z-index: 10005;
        display: block;
        padding: 0;
    }

    .crm-modal-backdrop {
        display: none;
    }

    .crm-modal-card {
        width: 100%;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
        background: #111318;
        box-shadow: none;
        transform: translateX(16px);
    }

    .crm-modal.is-open .crm-modal-card {
        transform: translateX(0);
    }

    .crm-modal-bar {
        display: grid;
        flex: 0 0 auto;
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        align-items: center;
        min-height: calc(48px + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) 8px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background: #002f63;
        color: #fff;
    }

    .crm-modal-bar > strong {
        display: block;
        min-width: 0;
        overflow: hidden;
        font-size: 16px;
        font-weight: 800;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .crm-modal-bar > span {
        display: block;
    }

    .crm-modal-close {
        position: static;
        width: 44px;
        height: 44px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #fff;
        box-shadow: none;
    }

    .crm-modal-close-x {
        display: none;
    }

    .crm-modal-close-back {
        display: block;
        width: 24px;
        height: 24px;
    }

    .crm-modal .crm-detail-header {
        align-items: center;
        padding: 4px 12px;
        border-color: #2b2e34;
        background: #111318;
    }

    .crm-modal .crm-detail-title {
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .crm-modal .crm-detail-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .crm-modal .crm-detail-title-text {
        gap: 0;
        width: 100%;
    }

    .crm-modal .crm-detail-header h2 {
        font-size: 18px;
        line-height: 1;
    }

    .crm-modal .crm-detail-subtitle {
        margin: 0;
        color: #a7abb4;
        font-size: 12px;
        font-weight: 650;
    }

    .crm-modal .crm-detail-contact {
        flex-wrap: nowrap;
        gap: 6px;
        margin-top: 0;
        width: 100%;
        min-width: 0;
    }

    .crm-modal .crm-contact-control {
        min-width: 0;
        min-height: 44px;
    }

    .crm-modal .crm-contact-control[data-crm-contact-control="phone"] {
        flex: 0 1 148px;
    }

    .crm-modal .crm-contact-control[data-crm-contact-control="email"] {
        flex: 1 1 0;
        max-width: none;
    }

    .crm-modal .crm-copy-contact {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 44px;
        padding: 0 7px;
        border: 1px solid #30343c;
        background: #1d2025;
        color: #58a8ff;
        font-size: 11px;
        box-shadow: none;
    }

    .crm-modal .crm-contact-select {
        flex-basis: 44px;
        width: 44px;
        min-height: 44px;
        border-color: #30343c;
        background: #1d2025;
        color: #58a8ff;
    }

    .crm-detail-body {
        display: grid;
        align-content: start;
        gap: 7px;
        padding: 8px 12px 10px;
        overscroll-behavior: contain;
        scroll-padding-top: 12px;
    }

    .crm-detail-main {
        display: grid;
        gap: 7px;
    }

    .crm-vehicle-rail {
        gap: 12px;
        margin: -8px -12px 0;
        padding: 12px;
        border-color: #2b2e34;
        background: #15171b;
    }

    .crm-vehicle-empty strong {
        color: #f7f7f8;
    }

    .crm-vehicle-empty {
        border-color: #3f4652;
    }

    .crm-customer-memory {
        padding: 8px 10px;
        border-color: #30343c;
        border-radius: 9px;
        background: #1b1e23;
    }

    .crm-customer-memory summary {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        color: #f3f4f6;
        font-size: 12px;
        line-height: 1.35;
    }

    .crm-customer-memory[open] summary {
        display: block;
        overflow: visible;
    }

    .crm-comm-panel {
        gap: 6px;
        padding: 0;
        border: 0;
    }

    .crm-comm-action-bar {
        border-color: #30343c;
        border-radius: 9px;
        background: #1b1e23;
    }

    .crm-comm-tabs {
        min-height: 40px;
        gap: 0;
        padding: 3px;
    }

    .crm-comm-tab {
        min-height: 34px;
        gap: 4px;
        padding: 0 5px;
        border-radius: 7px;
        color: #aeb2ba;
        font-size: 11px;
    }

    .crm-comm-tab span {
        display: block;
    }

    .crm-comm-tab.is-active {
        border-color: rgba(8, 184, 146, 0.32);
        background: #12332c;
        color: #22d3ad;
    }

    .crm-comm-tab.is-workplan-action:not(.is-active) {
        color: #f7f7f8;
    }

    .crm-comm-task-badge {
        min-width: 16px;
        height: 16px;
        padding: 0 3px;
        background: rgba(65, 130, 215, 0.2);
        color: #89b8f2;
        font-size: 9px;
    }

    .crm-comm-send {
        width: auto;
        min-width: 76px;
        min-height: 44px;
        border-radius: 8px;
    }

    .crm-comm-body {
        gap: 5px;
    }

    .crm-comm-message {
        height: 40px;
        min-height: 40px;
        max-height: 150px;
        padding: 9px;
        font-size: 13px;
        line-height: 22px;
        overflow-y: hidden;
        resize: none;
    }

    .crm-comm-status {
        width: 100%;
        font-size: 10px;
        line-height: 1.2;
    }

    .crm-more-context {
        border-color: #30343c;
    }

    .crm-more-context > summary {
        min-height: 32px;
        padding: 8px 2px;
        color: #aeb2ba;
        font-size: 11px;
    }

    .crm-notifications {
        padding: 12px 16px;
        border-color: #25272d;
        background: #111318;
    }

    .crm-notifications-load {
        min-height: 44px;
        border-color: #3a4655;
        background: #171a1f;
        color: #49c9ab;
    }

    .crm-today-overview {
        gap: 14px;
        padding: 18px 16px;
    }

    .crm-start-next {
        min-height: 44px;
    }
}
