.fg-row { display: none; }
.filter-popup-back { display: none; }

.fl-list { margin-bottom: .5rem; }
.fl-search { display: flex; align-items: center; gap: .5rem; height: 38px; margin-bottom: .4rem; padding: 0 .7rem; border-radius: 8px; background: var(--b2c-surface-muted, #f6f7f9); color: var(--b2c-steel, #6b7280); font-size: .85rem; }
.fl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: .86rem; color: var(--b2c-ink, #171a1f); }
.fl-options { max-height: 264px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.fl-opt { display: flex; align-items: center; gap: .6rem; min-height: 38px; padding: 0 .1rem; font-size: .87rem; color: var(--b2c-ink, #171a1f); cursor: pointer; }
.fl-opt[hidden] { display: none; }
.fl-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.fl-mark { width: 18px; height: 18px; flex-shrink: 0; border: 1.5px solid var(--b2c-line, #c9ced6); border-radius: 50%; background: var(--b2c-surface, #fff); }
.fl-opt:hover .fl-mark { border-color: var(--b2c-primary, #1d4ed8); }
.fl-opt input:focus-visible + .fl-mark { outline: 2px solid var(--b2c-primary, #1d4ed8); outline-offset: 2px; }
.fl-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-count { flex-shrink: 0; margin-left: -.3rem; font-size: .8rem; color: var(--b2c-muted, #6b7280); font-variant-numeric: tabular-nums; }
.fl-empty { display: block; padding: .5rem 0; font-size: .84rem; color: var(--b2c-steel, #6b7280); }
.fl-picked { display: flex; align-items: center; gap: .5rem; min-height: 40px; margin-bottom: .35rem; padding: 0 .1rem; border-bottom: 1px solid var(--b2c-line-soft, #eef0f3); font-size: .87rem; }
.fl-picked-key { color: var(--b2c-steel, #6b7280); white-space: nowrap; }
.fl-picked-val { flex: 1; min-width: 0; font-weight: 700; color: var(--b2c-ink, #171a1f); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-change { flex-shrink: 0; border: 0; background: transparent; padding: 4px 0; color: var(--b2c-primary, #1d4ed8); font-size: .8rem; font-weight: 700; }
.fl-change:hover { text-decoration: underline; }

.market-content > .active-filters { margin: 0 0 .9rem; }
.market-count-clear { margin-left: .6rem; font-size: .8rem; font-weight: 700; color: var(--b2c-primary, #1d4ed8); text-decoration: none; }

@media (min-width: 768px) {
    .filter-actions { flex-direction: column-reverse; }
    .list-mobile-bar, .sort-sheet, .sort-sheet-backdrop { display: none !important; }
}

@media (max-width: 767.98px) {
    .list-mobile-bar { position: sticky; top: var(--list-bar-top, 60px); z-index: 1019; margin: 0 -12px .5rem; padding: 0 12px; background: var(--bg-main, var(--b2c-surface, #fff)); border-bottom: 1px solid var(--b2c-line, #e6e8ec); }
    .lmb-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .lmb-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 46px; border: 0; background: transparent; font-size: .92rem; font-weight: 700; color: var(--b2c-ink, #171a1f); }
    .lmb-cell { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; }
    .lmb-cell + .lmb-cell { border-left: 1px solid var(--b2c-line, #e6e8ec); }
    .lmb-clear { width: 30px; height: 30px; margin-left: 2px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--b2c-surface-muted, #f1f3f6); color: var(--b2c-ink-soft, #4b5160); font-size: .78rem; text-decoration: none; }
    .lmb-clear:active { background: var(--b2c-line, #e6e8ec); }
    .lmb-btn i { color: var(--b2c-primary, #1d4ed8); }
    .lmb-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--b2c-primary, #1d4ed8); color: #fff; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; }
    .lmb-chips { display: flex; gap: .45rem; padding: 0 0 .6rem; overflow-x: auto; scrollbar-width: none; }
    .lmb-chips::-webkit-scrollbar { display: none; }
    .lmb-chips .af-chip { flex-shrink: 0; white-space: nowrap; border-color: var(--b2c-primary, #1d4ed8); color: var(--b2c-primary-dark, #1739ab); background: var(--b2c-primary-soft, #e8eefd); }

    .market-toolbar { flex-wrap: nowrap; margin-bottom: .75rem; }
    .market-toolbar .sort-select { display: none; }
    .market-toolbar .market-toolbar-controls { width: auto; margin-left: auto; }
    .market-toolbar .view-toggle button { width: 38px; height: 38px; }

    .filter-card:not([data-mobile-filter="inline"]) [data-fg] { padding: 0 !important; border-top: 0 !important; border-bottom: 1px solid var(--b2c-line-soft, #eef0f3); }
    .filter-card:not([data-mobile-filter="inline"]) .fg-row { display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 54px; padding: 0; border: 0; background: transparent; text-align: left; color: var(--b2c-ink, #171a1f); }
    .filter-card:not([data-mobile-filter="inline"]) .fg-name { font-size: .95rem; font-weight: 600; flex-shrink: 0; }
    .filter-card:not([data-mobile-filter="inline"]) .fg-value { margin-left: auto; min-width: 0; max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; color: var(--b2c-steel, #6b7280); }
    .filter-card:not([data-mobile-filter="inline"]) .fg-value.is-set { color: var(--b2c-primary-dark, #1739ab); font-weight: 700; }
    .filter-card:not([data-mobile-filter="inline"]) .fg-row > i { font-size: .72rem; color: var(--b2c-steel, #6b7280); }
    .filter-card:not([data-mobile-filter="inline"]) [data-fg] > .fg-body { display: none; }
    .filter-card:not([data-mobile-filter="inline"]) [data-fg] > .fg-body > .filter-group-label { display: none; }
    .filter-card:not([data-mobile-filter="inline"]) .filter-group-toggles { padding-top: 1rem; border-top: 0; }

    #filterCollapse.fg-drilled .filter-popup-body > .filter-group:not(.is-open) { display: none; }
    #filterCollapse.fg-drilled [data-fg].is-open { border-bottom: 0; }
    #filterCollapse.fg-drilled [data-fg].is-open > .fg-row { display: none; }
    #filterCollapse.fg-drilled [data-fg].is-open > .fg-body { display: block; padding-top: .25rem; }
    #filterCollapse.fg-drilled .fl-options { max-height: none; }
    #filterCollapse.fg-drilled .fl-opt { min-height: 50px; font-size: .95rem; border-bottom: 1px solid var(--b2c-line-soft, #eef0f3); }
    #filterCollapse.fg-drilled .fl-search { height: 44px; margin-bottom: .25rem; }
    #filterCollapse.fg-drilled .fl-picked { min-height: 50px; font-size: .92rem; }
    #filterCollapse.fg-drilled .form-select { min-height: 48px; margin-bottom: .6rem; }

    .filter-popup-back { width: 32px; height: 32px; margin-right: .35rem; flex-shrink: 0; border: 0; border-radius: 50%; background: transparent; color: var(--b2c-ink, #171a1f); align-items: center; justify-content: center; }
    #filterCollapse.fg-drilled .filter-popup-back { display: flex; }
    .filter-popup-head-row strong { flex: 1; }

    .filter-card:not([data-mobile-filter="inline"]) .filter-actions .btn-outline-secondary { flex: 0 0 auto; padding-left: 1.1rem; padding-right: 1.1rem; }

    .sort-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20000; display: flex; flex-direction: column; max-height: 80vh; background: var(--b2c-surface, #fff); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .28); transform: translateY(105%); visibility: hidden; transition: transform .3s cubic-bezier(.22, .8, .25, 1), visibility .3s; }
    .sort-sheet.is-open { transform: none; visibility: visible; }
    .sort-sheet-head { flex-shrink: 0; padding: 10px 18px 12px; border-bottom: 1px solid var(--b2c-line, #e6e8ec); }
    .sort-sheet-body { overflow-y: auto; padding: 4px 18px max(12px, env(safe-area-inset-bottom)); }
    .sort-opt { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; padding: 0; border: 0; border-bottom: 1px solid var(--b2c-line-soft, #eef0f3); background: transparent; font-size: .95rem; color: var(--b2c-ink, #171a1f); text-align: left; }
    .sort-opt:last-child { border-bottom: 0; }
    .sort-opt.is-current { font-weight: 700; }
    .sort-radio { width: 20px; height: 20px; border: 1.5px solid var(--b2c-line, #c9ced6); border-radius: 50%; }
    .sort-opt.is-current .sort-radio { border: 6px solid var(--b2c-primary, #1d4ed8); }
    .sort-sheet-backdrop { position: fixed; inset: 0; z-index: 19950; background: rgba(15, 17, 21, .55); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s; }
    body.sort-sheet-open { overflow: hidden; }
    body.sort-sheet-open .sort-sheet-backdrop { opacity: 1; visibility: visible; }
}

@media (prefers-reduced-motion: reduce) {
    .sort-sheet, .sort-sheet-backdrop { transition: none; }
}

@media (min-width: 768px) {
    .market-sidebar .filter-card { padding-top: 0; }
    .market-sidebar .filter-group-search { position: sticky; top: 0; z-index: 3; margin: 0 0 1rem; padding: 1.1rem 0 .9rem; background: var(--b2c-surface, #fff); border-bottom: 1px solid var(--b2c-line-soft, #eef0f3); }
    .market-sidebar .filter-card-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 .5rem; padding: 0; border: 0; }
    .market-sidebar .filter-card-head h2 { margin: 0; font-size: .95rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--b2c-ink, #171a1f); }
    .market-sidebar .filter-card-head h2 i { display: none; }
    .market-sidebar .filter-card-head .filter-clear-link { font-size: .8rem; font-weight: 600; text-transform: none; letter-spacing: 0; }
}
