.tg-mini-app {
    --tg-safe-top: env(safe-area-inset-top, 0px);
    --tg-safe-bottom: env(safe-area-inset-bottom, 0px);
    background: #07080d;
}

.tg-mini-app [hidden] {
    display: none !important;
}

.tg-appbar {
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 62px;
    padding: calc(10px + var(--tg-safe-top)) 16px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
    background: rgba(7, 8, 13, .94);
    backdrop-filter: blur(20px);
}

.tg-appbar__brand {
    display: flex;
    align-items: baseline;
    gap: 7px;
    color: #f7f8fc;
    text-decoration: none;
    letter-spacing: -.04em;
}

.tg-appbar__brand strong {
    font: 800 21px/1 "Space Grotesk", sans-serif;
}

.tg-appbar__brand span {
    color: #00e0ff;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .14em;
}

.tg-appbar__profile {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-width: 0;
}

.tg-appbar__name {
    max-width: 105px;
    overflow: hidden;
    color: #a6a8b5;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tg-icon-btn,
.tg-orders-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 12px;
    color: #f7f8fc;
    background: rgba(255, 255, 255, .06);
    font: inherit;
    cursor: pointer;
}

.tg-icon-btn {
    padding: 0;
    font-size: 17px;
}

.tg-icon-btn:disabled {
    opacity: .5;
}

.tg-orders-btn {
    position: relative;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.tg-orders-count {
    position: absolute;
    top: -6px;
    right: -5px;
    display: grid;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    place-items: center;
    border-radius: 20px;
    color: #07080d;
    background: #00e0ff;
    font-size: 10px;
    font-weight: 800;
}

.tg-mini-app:not(.order-page) > .header {
    display: none;
}

.tg-mini-app:not(.order-page) .hero {
    min-height: auto;
    padding-top: 28px;
}

.tg-mini-app:not(.order-page) .hero__grid {
    grid-template-columns: minmax(0, 1fr);
}

.tg-mini-app:not(.order-page) .hero__stage {
    display: none;
}

.tg-mini-app:not(.order-page) .hero__text {
    text-align: left;
}

.tg-mini-app:not(.order-page) .h-hero {
    max-width: 650px;
    font-size: clamp(30px, 7vw, 48px);
}

.tg-mini-app:not(.order-page) .widget {
    width: 100%;
    max-width: 620px;
}

.tg-mini-app.order-page .order-header {
    top: calc(62px + var(--tg-safe-top));
}

.tg-orders-open {
    overflow: hidden;
}

.tg-orders {
    position: fixed;
    inset: 0;
    z-index: 5000;
}

.tg-orders__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(6px);
}

.tg-orders__sheet {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 82vh;
    padding: 20px 16px calc(22px + var(--tg-safe-bottom));
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 26px 26px 0 0;
    background: #10121b;
    box-shadow: 0 -20px 80px rgba(0, 0, 0, .45);
}

.tg-orders__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tg-orders__title {
    color: #f7f8fc;
    font: 700 23px/1.2 "Space Grotesk", sans-serif;
}

.tg-orders__list {
    display: grid;
    gap: 10px;
    max-width: 620px;
    margin: 0 auto;
}

.tg-orders__loading,
.tg-orders__empty {
    padding: 28px 18px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 18px;
    color: #a6a8b5;
    background: rgba(255, 255, 255, .035);
    text-align: center;
}

.tg-orders__empty strong {
    display: block;
    margin-bottom: 8px;
    color: #f7f8fc;
    font-size: 17px;
}

.tg-orders__empty p {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.55;
}

.tg-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 13px;
    color: #fff;
    background: #7b61ff;
    font-weight: 700;
    text-decoration: none;
}

.tg-order-card {
    display: block;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 17px;
    color: inherit;
    background: rgba(255, 255, 255, .04);
    text-decoration: none;
}

.tg-order-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 11px;
}

.tg-order-card__top code {
    color: #a6a8b5;
    font-size: 12px;
}

.tg-order-card__pair {
    color: #f7f8fc;
    font-size: 16px;
    font-weight: 700;
}

.tg-order-card__meta {
    margin-top: 6px;
    color: #777b8e;
    font-size: 11px;
}

.tg-status {
    padding: 5px 8px;
    border-radius: 8px;
    color: #00e0ff;
    background: rgba(0, 224, 255, .09);
    font-size: 10px;
    font-weight: 700;
}

.tg-status--completed {
    color: #19f5a1;
    background: rgba(25, 245, 161, .09);
}

.tg-status--cancelled,
.tg-status--rejected,
.tg-status--expired {
    color: #ff8996;
    background: rgba(255, 100, 120, .09);
}

@media (min-width: 700px) {
    .tg-appbar {
        padding-right: max(24px, calc((100vw - 1160px) / 2));
        padding-left: max(24px, calc((100vw - 1160px) / 2));
    }

    .tg-orders__sheet {
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: 430px;
        max-height: none;
        padding-top: calc(24px + var(--tg-safe-top));
        border-radius: 26px 0 0 26px;
    }
}

@media (max-width: 430px) {
    .tg-appbar {
        gap: 7px;
        padding-right: 10px;
        padding-left: 12px;
    }

    .tg-appbar__name {
        display: none;
    }
}
