.market-section {
    padding-top: 0.85rem !important;
}

.market-section .catalog-beaver-intro {
    margin-top: 0.35rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.75rem;
}

.market-aside-note {
    flex: 0 1 16rem;
    margin: 0 0 1.1rem;
    font-size: 0.68rem;
    line-height: 1.45;
    font-weight: 500;
    color: #94a3b8;
}

@media (max-width: 900px) {
    .market-section .catalog-beaver-intro {
        flex-wrap: wrap;
    }

    .market-aside-note {
        flex-basis: 100%;
        max-width: 22rem;
        margin: 0.2rem 0 0;
    }
}

.market-filters {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.market-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem 0.65rem;
    margin-top: 0.15rem;
    align-items: end;
}

.market-field {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    min-width: 0;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.market-field__pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
}

.market-field .search-input {
    width: 100%;
    box-sizing: border-box;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    color: #1e293b;
}

.market-filter-actions {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.7rem;
}

.market-filter-actions .search-btn,
.market-filter-actions .catalog-btn-secondary {
    text-decoration: none;
}

.market-types {
    margin-top: 0.15rem;
}

.market-type {
    font-weight: 700;
    font-size: 0.84rem;
    min-height: 40px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.market-type span {
    opacity: 0.72;
    font-weight: 700;
}

.market-type.is-active {
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.28);
}

.market-type.is-active span {
    opacity: 0.9;
}

.market-section .market-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.market-section .market-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(49, 46, 129, 0.12);
}

@media (max-width: 900px) {
    .market-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .market-filter-actions .search-btn {
        flex: 1;
    }
}

.market-empty,
.market-count,
.market-card__wholesale {
    color: var(--text-secondary);
}

.market-empty {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    background: var(--bg-secondary);
}

.market-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 1.25rem;
}

.market-type {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: #fff;
    color: var(--text-primary);
    text-decoration: none;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.market-type.is-active {
    background: var(--bg-gradient);
    color: #fff;
    border-color: transparent;
}

/* Сетка берём из catalog_staging; только выравниваем высоту карточек */
.market-section.catalog-staging .products-grid {
    align-items: stretch;
}

.market-section.catalog-staging .products-grid .product-card.cat-card.market-card {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
    cursor: pointer;
    overflow: hidden !important;
}

.market-section .market-card--token {
    cursor: pointer;
}

.market-section .market-card .cat-card__media.market-card__media {
    position: relative;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 5;
    flex: none;
    overflow: hidden;
    background: linear-gradient(145deg, #e2e8f0, #f8fafc);
}

.market-section .market-card .market-card__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.market-card__fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #64748b;
    background: linear-gradient(160deg, #eef2ff, #f8fafc 55%, #e2e8f0);
}

.market-card__media:has(img) .market-card__fallback {
    display: none;
}

.market-section .market-card .cat-card__price.market-card__price {
    position: absolute;
    left: 0.45rem;
    bottom: 0.45rem;
    top: auto;
    right: auto;
    z-index: 2;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.1;
    color: #fff;
    background: linear-gradient(135deg, var(--cat-indigo, #6366f1), var(--cat-indigo-dark, #4f46e5));
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.22);
}

.market-section .market-card .cat-card__body {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box;
    padding: 0.55rem 0.6rem 0.65rem !important;
    gap: 0.3rem !important;
    min-width: 0;
    min-height: 0;
}

.market-section .market-card .cat-card__title {
    margin: 0 !important;
    font-size: 0.82rem !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    min-height: 2.05rem;
    max-height: 2.05rem;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.market-card__size {
    margin: 0;
    min-height: 1.05rem;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-card__profile {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 1.35rem;
    margin: 0;
    padding: 0.16rem 0.45rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 0.7rem;
    font-weight: 800;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-card__profile--spacer {
    visibility: hidden;
    background: transparent;
    padding-left: 0;
    padding-right: 0;
}

.market-card__profile:hover {
    background: rgba(37, 99, 235, 0.14);
}

.market-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.25rem;
    min-height: 2.6rem;
    max-height: 2.6rem;
    overflow: hidden;
}

.market-card__wholesale {
    margin: 0;
    font-size: 0.65rem;
}

.market-section .market-card .market-buy {
    margin-top: auto;
    width: 100%;
    height: 36px;
    flex: none;
}

body.market-sheet-open {
    overflow: hidden;
}

.market-sheet {
    position: fixed;
    inset: 0;
    z-index: 410;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
}

.market-sheet[hidden] {
    display: none;
}

.market-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 6, 20, 0.72);
}

.market-sheet__card {
    position: relative;
    width: min(440px, calc(100vw - 1.5rem));
    max-height: min(88vh, 760px);
    overflow: auto;
    padding: 1.25rem 1.2rem 1.25rem;
    border-radius: 20px;
    background: #16122b;
    color: #f8f5ff;
    border: 1px solid rgba(196, 181, 253, 0.28);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.market-sheet__body {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.market-sheet__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.market-sheet__hero {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    align-items: center;
    gap: 0.9rem;
    padding-right: 2.4rem;
    min-width: 0;
}

.market-sheet__avatar {
    position: relative;
    flex: none;
    width: 84px;
    height: 84px;
    border-radius: 18px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #312e81, #1e1b4b);
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #c4b5fd;
}

.market-sheet__avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.market-sheet__avatar:has(img) span {
    visibility: hidden;
}

.market-sheet__head {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.market-sheet__title {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.market-sheet__sub {
    margin: 0;
    color: #c4b5fd;
    font-size: 0.85rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-sheet__price {
    margin: 0.15rem 0 0;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.2;
    color: #fbbf24;
}

.market-sheet__rows {
    margin: 1rem 0 0;
    padding: 0.15rem 0;
    display: grid;
    gap: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.market-sheet__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    min-height: 2.15rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.market-sheet__row:last-child {
    border-bottom: 0;
}

.market-sheet__rows dt {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    color: #a89bc4;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
}

.market-sheet__rows dd {
    margin: 0;
    flex: 0 0 auto;
    text-align: right;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
    color: #f8f5ff;
    white-space: nowrap;
}

.market-sheet__actions {
    display: grid;
    gap: 0.55rem;
    margin-top: 1rem;
}

.market-sheet__vk,
.market-sheet__buy {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.market-sheet__vk {
    background: #2787f5;
    color: #fff;
}

.market-sheet__buy,
.market-sheet__buy.market-buy {
    margin-top: 0;
    height: 46px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: none;
}

.market-buy {
    margin-top: auto;
    width: 100%;
    height: 38px;
    padding: 0 0.85rem;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--cat-indigo, #6366f1), var(--cat-indigo-dark, #4f46e5));
    color: #fff;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.22);
}

.market-buy:hover {
    filter: brightness(1.05);
}

.market-buy:disabled {
    cursor: wait;
    opacity: 0.72;
    filter: none;
}

.market-buy-note {
    margin: 0.45rem 0 0;
    font-size: 0.78rem;
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: #b91c1c;
}

.market-pay-dialog {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.45);
    overflow: auto;
}

.market-pay-dialog[hidden] {
    display: none;
}

.market-pay-dialog__card {
    width: min(420px, 100%);
    margin-bottom: 0.5rem;
    padding: 1rem;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
}

.market-pay-dialog__title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    font-weight: 800;
}

.market-id-note {
    margin: 0 0 0.85rem;
    padding: 0.75rem 0.8rem;
    border-radius: 14px;
    background: #f5f3ff;
}

.market-id-note[hidden] {
    display: none;
}

.market-id-note__text {
    margin: 0 0 0.65rem;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    color: #312e81;
}

.market-id-note__bot {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    border-radius: 12px;
    background: #4f46e5;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 800;
    text-decoration: none;
}

.market-pay-choice,
.market-pay-cancel {
    display: block;
    width: 100%;
    margin-top: 0.45rem;
    height: 46px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
}

.market-pay-choice {
    background: linear-gradient(135deg, var(--cat-indigo, #6366f1), var(--cat-indigo-dark, #4f46e5));
    color: #fff;
}

.market-pay-choice--crypto {
    background: linear-gradient(135deg, #0f766e, #115e59);
}

.market-pay-cancel {
    background: transparent;
    color: #64748b;
}

.market-count {
    margin: 0.75rem 0 0;
    text-align: center;
    font-size: 0.85rem;
}

.pagination a.page-btn {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
}

.market-section.catalog-staging .cat-card.market-card {
    cursor: pointer;
}

.market-section .market-card .market-buy {
    margin-top: auto;
    width: 100%;
    pointer-events: auto;
}

a.market-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 240px;
    height: 52px;
    padding: 0 1.75rem;
    font-size: 1.05rem;
    text-decoration: none;
}

.market-my-orders {
    margin: 0.75rem 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    text-align: left;
}

.market-my-orders h2 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
}

.market-my-orders ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.market-my-orders li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 0.92rem;
}

.market-my-orders a {
    color: inherit;
    font-weight: 700;
}

.market-my-orders span {
    color: #64748b;
    white-space: nowrap;
}

.market-instruction {
    margin: 1rem 0 0;
    text-align: left;
}

.market-instruction__title {
    margin: 0 0 0.35rem;
    font-weight: 700;
}

.market-instruction__text,
.market-section pre.market-instruction__text {
    margin: 0.25rem 0 0.75rem;
    padding: 0.65rem 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
    line-height: 1.45;
    color: #0f172a;
    -webkit-text-fill-color: #0f172a;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.market-card.is-bought {
    outline: 2px solid #6d5efc;
    outline-offset: 0;
}

.market-card__bought {
    background: #efeaff;
    color: #3b2f8a;
}

.market-phone {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(79, 70, 229, 0.15);
}

.market-phone__text {
    margin: 0 0 0.75rem;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.45;
}

.market-order-expired {
    margin: 0.85rem 0;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.28);
    color: #991b1b;
    font-size: 0.95rem;
    line-height: 1.45;
    text-align: left;
}

.market-order-ttl {
    margin: 0.55rem 0 0;
    color: #92400e;
    font-size: 0.92rem;
    line-height: 1.4;
}

.market-phone__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 240px;
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    border-radius: 14px;
    background: #229ED9;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.market-skup {
    margin: 0.85rem 0 0.35rem;
}

.market-skup__card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.04), rgba(99, 102, 241, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.18);
}

.market-skup__card.is-active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
    border-color: rgba(16, 185, 129, 0.28);
}

.market-skup__copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.market-skup__copy strong {
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    color: #0f172a;
}

.market-skup__copy span {
    font-size: 0.82rem;
    line-height: 1.35;
    color: #475569;
}

.market-skup__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
}

.market-skup__actions .market-skup__btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.market-skup__btn {
    flex: 0 0 auto;
    height: 38px;
    padding: 0 0.95rem;
    border: 0;
    border-radius: 12px;
    background: #0f172a;
    color: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.market-skup__btn--gold {
    background: #e8b923;
    color: #1a1205;
}

.market-skup__btn--gold:hover {
    background: #f0c43a;
    filter: none;
}

.market-skup__btn:hover {
    filter: brightness(1.08);
}

.market-skup__btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.market-skup__note {
    margin: 0.45rem 0 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: #b91c1c;
}

@media (max-width: 640px) {
    .market-skup__card {
        flex-direction: column;
        align-items: stretch;
    }

    .market-skup__btn {
        width: 100%;
    }
}
