:root {
    --ah-mobile-tabbar-height: 78px;
    --ah-mobile-page-gutter: clamp(14px, 3vw, 28px);
}

.ah-mobile-tabbar,
.ah-mobile-tabbar__more,
.ah-mobile-tabbar__dismiss {
    display: none;
}

@media (max-width: 1024px) {
    body.ah-has-mobile-tabbar {
        padding-bottom: calc(var(--ah-mobile-tabbar-height) + env(safe-area-inset-bottom)) !important;
    }

    body.ah-has-mobile-tabbar #wrapper,
    body.ah-has-mobile-tabbar #main-content {
        min-width: 0;
        max-width: 100%;
    }

    body.ah-has-mobile-tabbar #main-content,
    body.ah-has-mobile-tabbar .dashboard-content,
    body.ah-has-mobile-tabbar .user-dashboard-content,
    body.ah-has-mobile-tabbar .dashboard-main,
    body.ah-has-mobile-tabbar #dashboard {
        box-sizing: border-box;
    }

    body.ah-has-mobile-tabbar .dashboard-content,
    body.ah-has-mobile-tabbar .user-dashboard-content,
    body.ah-has-mobile-tabbar .dashboard-main {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        padding-left: var(--ah-mobile-page-gutter) !important;
        padding-right: var(--ah-mobile-page-gutter) !important;
    }

    body.ah-has-mobile-tabbar #dashboard {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.ah-has-mobile-tabbar .dashboard-content,
    body.ah-has-mobile-tabbar .user-dashboard-content,
    body.ah-has-mobile-tabbar .dashboard-main {
        padding-bottom: calc(var(--ah-mobile-tabbar-height) + 22px + env(safe-area-inset-bottom)) !important;
    }

    body.ah-has-mobile-tabbar .ah-mobile-sidebar-trigger,
    body.ah-has-mobile-tabbar .ah-sidebar-overlay,
    body.ah-has-mobile-tabbar .ah-dashboard-sidebar {
        display: none !important;
    }

    body.ah-has-mobile-tabbar #backtotop {
        display: none !important;
    }

    body.ah-has-mobile-tabbar .ah-chatbot {
        bottom: calc(var(--ah-mobile-tabbar-height) + 14px + env(safe-area-inset-bottom));
    }

    .ah-mobile-tabbar {
        position: fixed;
        z-index: 9990;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(var(--ah-mobile-tab-count), minmax(0, 1fr));
        align-items: end;
        min-height: calc(var(--ah-mobile-tabbar-height) + env(safe-area-inset-bottom));
        padding: 7px 8px max(7px, env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid #e7e9ef;
        box-shadow: 0 -10px 30px rgba(16, 24, 40, .12);
    }

    .ah-mobile-tabbar__item {
        position: relative;
        min-width: 0;
        min-height: 56px;
        margin: 0;
        padding: 7px 3px;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: #7b8190;
        font-family: inherit;
        font-size: 11px;
        font-weight: 600;
        line-height: 1.15;
        text-align: center;
        text-decoration: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .ah-mobile-tabbar__item:focus-visible,
    .ah-mobile-tabbar__more-trigger[aria-expanded="true"],
    .ah-mobile-tabbar__item.is-active {
        color: #f91942;
        background: #fff0f3;
    }

    .ah-mobile-tabbar__icon {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 20px;
        font-size: 19px;
    }

    .ah-mobile-tabbar__icon b {
        position: absolute;
        top: -8px;
        left: calc(50% + 5px);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        border: 2px solid #fff;
        border-radius: 999px;
        background: #f91942;
        color: #fff;
        font-size: 9px;
        line-height: 1;
    }

    .ah-mobile-tabbar__item.is-create {
        width: 60px;
        height: 60px;
        min-height: 60px;
        align-self: end;
        justify-self: center;
        margin-top: -23px;
        padding: 7px;
        border-radius: 50%;
        background: #f91942;
        color: #fff;
        box-shadow: 0 9px 24px rgba(249, 25, 66, .32);
    }

    .ah-mobile-tabbar__item.is-create:focus-visible,
    .ah-mobile-tabbar__item.is-create.is-active {
        background: #d90f35;
        color: #fff;
    }

    .ah-mobile-tabbar__item.is-create .ah-mobile-tabbar__icon {
        font-size: 20px;
    }

    .ah-mobile-tabbar__item.is-create > span:last-child {
        max-width: 52px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ah-mobile-tabbar__dismiss {
        position: fixed;
        z-index: 9978;
        inset: 0 0 calc(var(--ah-mobile-tabbar-height) + env(safe-area-inset-bottom)) 0;
        width: 100%;
        height: auto;
        margin: 0;
        padding: 0;
        border: 0;
        background: rgba(15, 18, 28, .28);
        opacity: 0;
        pointer-events: none;
    }

    .ah-mobile-tabbar__dismiss.is-open {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .ah-mobile-tabbar__more {
        position: fixed;
        z-index: 9985;
        right: 14px;
        bottom: calc(var(--ah-mobile-tabbar-height) + 14px + env(safe-area-inset-bottom));
        display: flex;
        max-height: calc(100dvh - var(--ah-mobile-tabbar-height) - 118px);
        flex-direction: column;
        align-items: flex-end;
        gap: 9px;
        overflow-y: auto;
        padding: 8px 3px 8px 12px;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(16px);
        transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
        scrollbar-width: none;
    }

    .ah-mobile-tabbar__more::-webkit-scrollbar {
        display: none;
    }

    .ah-mobile-tabbar__more.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .ah-mobile-tabbar__more form {
        margin: 0;
    }

    .ah-mobile-tabbar__fab {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 9px;
        min-height: 46px;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: #242833;
        font-family: inherit;
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
    }

    .ah-mobile-tabbar__fab span {
        display: inline-flex;
        align-items: center;
        min-height: 34px;
        padding: 7px 11px;
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 7px 22px rgba(15, 18, 28, .16);
        white-space: nowrap;
    }

    .ah-mobile-tabbar__fab i {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 46px;
        width: 46px;
        height: 46px;
        border-radius: 50%;
        background: #11101d;
        color: #fff;
        box-shadow: 0 8px 22px rgba(15, 18, 28, .24);
    }

    .ah-mobile-tabbar__fab:hover,
    .ah-mobile-tabbar__fab:focus,
    .ah-mobile-tabbar__fab.is-active {
        color: #f91942;
    }

    .ah-mobile-tabbar__fab:hover i,
    .ah-mobile-tabbar__fab:focus i,
    .ah-mobile-tabbar__fab.is-active i {
        background: #f91942;
    }

    .ah-mobile-tabbar__fab--logout i {
        background: #f91942;
    }

    body.ah-mobile-tabbar-more-open {
        overflow: hidden;
    }

    html.ah-chat-v2-thread-open body.ah-has-mobile-tabbar #main-content {
        height: calc(100dvh - var(--ah-header-height, 76px) - var(--ah-mobile-tabbar-height) - env(safe-area-inset-bottom));
    }

    html.ah-chat-v2-thread-open body.ah-has-mobile-tabbar .dashboard-content.ah-chat-v2-page--thread {
        height: 100%;
        margin-left: 0 !important;
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 0 !important;
    }

    html.ah-chat-v2-thread-open body.ah-has-mobile-tabbar .ah-chat-v2-page--thread .ah-chat-v2--thread {
        height: 100% !important;
        min-height: 0 !important;
    }

    @media (hover: hover) {
        .ah-mobile-tabbar__item:hover {
            color: #f91942;
            background: #fff0f3;
        }

        .ah-mobile-tabbar__item.is-create:hover {
            background: #d90f35;
            color: #fff;
        }
    }
}

@media (max-width: 420px) {
    :root {
        --ah-mobile-tabbar-height: 74px;
    }

    .ah-mobile-tabbar {
        padding-right: 4px;
        padding-left: 4px;
    }

    .ah-mobile-tabbar__item {
        padding-right: 1px;
        padding-left: 1px;
        font-size: 10px;
    }

    .ah-mobile-tabbar__item.is-create {
        width: 56px;
        height: 56px;
        min-height: 56px;
    }
}
