/* DROPX GLOBAL SEARCH — shared component for desktop, mobile web and PWA */
.dx-global-search {
    --dx-search-accent: #c18a22;
    --dx-search-accent-strong: #93620b;
    --dx-search-border: rgba(150, 112, 49, .25);
    --dx-search-hover: rgba(191, 145, 62, .11);
    --dx-search-soft: rgba(160, 130, 85, .10);
    --dx-search-muted: #82786b;
    --dx-search-text: #27231d;
    --dx-search-panel: #fffdf9;
    position: relative;
    min-width: 0;
    z-index: 120;
}

.theme-dark .dx-global-search,
.dark-mode .dx-global-search {
    --dx-search-accent: #e1ad3d;
    --dx-search-accent-strong: #f0c66c;
    --dx-search-border: rgba(207, 158, 57, .24);
    --dx-search-hover: rgba(221, 169, 57, .10);
    --dx-search-soft: rgba(255, 255, 255, .06);
    --dx-search-muted: #9b9da3;
    --dx-search-text: #f0f0f1;
    --dx-search-panel: #111315;
}

.dx-global-search .search-form {
    margin: 0;
}

.dx-global-search .search-input-container {
    position: relative;
}

.dx-global-search [data-global-search-input] {
    min-width: 0;
}

.dx-global-search-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    width: min(620px, calc(100vw - 32px));
    max-height: min(76vh, 720px);
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--dx-search-border);
    border-radius: 17px;
    background: var(--dx-search-panel);
    color: var(--dx-search-text);
    box-shadow: 0 18px 55px rgba(0, 0, 0, .24);
    z-index: 1000;
    scrollbar-width: thin;
    scrollbar-color: var(--dx-search-accent) transparent;
}

.dx-global-search-panel[hidden] {
    display: none;
}

.dx-gs-panel-inner {
    padding: 12px;
}

.dx-gs-panel-top,
.dx-gs-category > header,
.dx-gs-category > header > span,
.dx-gs-category > header > a,
.dx-gs-result {
    display: flex;
    align-items: center;
}

.dx-gs-panel-top {
    justify-content: space-between;
    padding: 5px 5px 11px;
    color: var(--dx-search-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .13em;
}

.dx-gs-panel-top kbd {
    padding: 3px 7px;
    border: 1px solid var(--dx-search-border);
    border-radius: 5px;
    font: inherit;
    letter-spacing: 0;
}

.dx-gs-category {
    padding: 8px 0 10px;
    border-top: 1px solid var(--dx-search-border);
}

.dx-gs-category > header {
    justify-content: space-between;
    padding: 2px 5px 7px;
}

.dx-gs-category > header > span {
    gap: 8px;
    color: var(--dx-search-text);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.dx-gs-category > header > span svg,
.dx-gs-category > header > a svg {
    width: 15px;
    height: 15px;
    color: var(--dx-search-accent);
}

.dx-gs-category > header > a {
    gap: 4px;
    color: var(--dx-search-muted);
    font-size: 11px;
    text-decoration: none;
}

.dx-gs-result {
    gap: 10px;
    min-height: 58px;
    padding: 7px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    transition: background-color .16s ease, transform .16s ease;
}

.dx-gs-result:hover,
.dx-gs-result.is-keyboard-active {
    background: var(--dx-search-hover);
}

.dx-gs-type-icon {
    display: grid;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    place-items: center;
    color: var(--dx-search-accent);
}

.dx-gs-type-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.dx-gs-image-pair {
    position: relative;
    display: block;
    flex: 0 0 52px;
    width: 52px;
    height: 44px;
}

.dx-gs-avatar {
    display: block;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border: 1px solid var(--dx-search-border);
    border-radius: 11px;
    background: var(--dx-search-soft);
    object-fit: cover;
}

.dx-gs-result[data-result-index] .dx-gs-avatar {
    border-radius: 11px;
}

.dx-gs-result[data-result-index] .dx-gs-avatar-user {
    border-radius: 50%;
}

.dx-gs-image-pair .dx-gs-avatar {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 2;
    width: 38px;
    height: 38px;
}

.dx-gs-image-pair .dx-gs-avatar-user {
    border-radius: 50%;
}

.dx-gs-cover {
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 27px;
    border: 1px solid var(--dx-search-border);
    border-radius: 6px;
    background: var(--dx-search-soft);
    object-fit: cover;
}

.dx-gs-avatar-fallback {
    display: grid;
    place-items: center;
    color: var(--dx-search-muted);
}

.dx-gs-result-copy {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.dx-gs-result-copy strong {
    overflow: hidden;
    color: var(--dx-search-text);
    font-size: 13px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dx-gs-result-copy small,
.dx-gs-result-copy em {
    overflow: hidden;
    color: var(--dx-search-muted);
    font-size: 11px;
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dx-gs-verified {
    display: inline-grid;
    width: 15px;
    height: 15px;
    place-items: center;
    border-radius: 50%;
    background: #2687e8;
    color: #fff;
    font-size: 10px;
    font-style: normal;
    vertical-align: 1px;
}

.dx-gs-chevron {
    width: 15px;
    height: 15px;
    color: var(--dx-search-muted);
}

.dx-gs-all-categories {
    padding: 11px 5px 4px;
    border-top: 1px solid var(--dx-search-border);
}

.dx-gs-all-categories > span {
    display: block;
    margin-bottom: 8px;
    color: var(--dx-search-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}

.dx-gs-all-categories > div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dx-gs-all-categories a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 8px;
    border: 1px solid var(--dx-search-border);
    border-radius: 8px;
    color: var(--dx-search-text);
    font-size: 10px;
    text-decoration: none;
}

.dx-gs-all-categories a svg {
    width: 13px;
    height: 13px;
    color: var(--dx-search-accent);
}

.dx-gs-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    margin-top: 11px;
    border: 1px solid var(--dx-search-accent);
    border-radius: 10px;
    color: var(--dx-search-accent-strong);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.dx-gs-view-all svg {
    width: 15px;
    height: 15px;
}

.dx-gs-loading,
.dx-gs-empty {
    display: flex;
    min-height: 110px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    color: var(--dx-search-muted);
    font-size: 12px;
    text-align: center;
}

.dx-gs-empty strong {
    color: var(--dx-search-text);
    font-size: 13px;
}

.dx-gs-empty svg {
    width: 23px;
    height: 23px;
    color: var(--dx-search-accent);
}

.dx-gs-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid var(--dx-search-border);
    border-top-color: var(--dx-search-accent);
    border-radius: 50%;
    animation: dx-search-spin .7s linear infinite;
}

@keyframes dx-search-spin {
    to { transform: rotate(360deg); }
}

/* Full results page */
.dx-search-page {
    --dx-search-accent: #c18a22;
    --dx-search-accent-strong: #93620b;
    --dx-search-border: rgba(150, 112, 49, .25);
    --dx-search-hover: rgba(191, 145, 62, .11);
    --dx-search-soft: rgba(160, 130, 85, .10);
    --dx-search-muted: #82786b;
    --dx-search-text: #27231d;
    --dx-search-panel: #fffdf9;
    width: min(1120px, calc(100% - 32px));
    margin: 26px auto 60px;
    padding: clamp(16px, 2.5vw, 30px);
    border: 1px solid var(--dx-search-border);
    border-radius: 20px;
    background: var(--dx-search-panel);
    color: var(--dx-search-text);
    box-shadow: 0 14px 40px rgba(49, 37, 20, .08);
}

.theme-dark .dx-search-page,
.dark-mode .dx-search-page {
    --dx-search-accent: #e1ad3d;
    --dx-search-accent-strong: #f0c66c;
    --dx-search-border: rgba(207, 158, 57, .24);
    --dx-search-hover: rgba(221, 169, 57, .10);
    --dx-search-soft: rgba(255, 255, 255, .06);
    --dx-search-muted: #9b9da3;
    --dx-search-text: #f0f0f1;
    --dx-search-panel: #111315;
    background: var(--dx-search-panel);
    box-shadow: 0 14px 42px rgba(0, 0, 0, .25);
}

.dx-search-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.dx-search-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--dx-search-accent);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .16em;
}

.dx-search-eyebrow svg { width: 14px; height: 14px; }
.dx-search-page-header h1 { margin: 7px 0 4px; color: var(--dx-search-text); font-size: clamp(22px, 3vw, 31px); }
.dx-search-page-header p { margin: 0; color: var(--dx-search-muted); font-size: 13px; }

.dx-search-total {
    display: flex;
    min-width: 78px;
    flex-direction: column;
    align-items: center;
    padding: 10px 13px;
    border: 1px solid var(--dx-search-border);
    border-radius: 12px;
    color: var(--dx-search-muted);
    font-size: 10px;
}
.dx-search-total strong { color: var(--dx-search-accent); font-size: 22px; }

.dx-search-page-live { margin-bottom: 16px; }
.dx-search-page-form { display: flex; gap: 9px; margin-bottom: 0; }
.dx-search-page-input-wrap { display: flex; flex: 1; min-width: 0; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--dx-search-border); border-radius: 12px; background: var(--dx-search-soft); }
.dx-search-page-input-wrap svg { flex: 0 0 auto; width: 18px; height: 18px; color: var(--dx-search-accent); }
.dx-search-page-input-wrap input { width: 100%; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; color: var(--dx-search-text); font: inherit; }
.dx-search-page-form button { min-width: 110px; padding: 0 18px; border: 1px solid var(--dx-search-accent); border-radius: 12px; background: linear-gradient(135deg, #e6bd62, #c38b29); color: #21190d; font-weight: 800; cursor: pointer; }

.dx-search-category-nav { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 13px; border-bottom: 1px solid var(--dx-search-border); scrollbar-width: thin; }
.dx-search-category-pill { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; min-height: 36px; padding: 0 11px; border: 1px solid var(--dx-search-border); border-radius: 10px; color: var(--dx-search-muted); font-size: 12px; font-weight: 700; text-decoration: none; }
.dx-search-category-pill svg { width: 15px; height: 15px; color: var(--dx-search-accent); }
.dx-search-category-pill.is-active { border-color: var(--dx-search-accent); background: var(--dx-search-hover); color: var(--dx-search-text); }

.dx-search-results { display: grid; gap: 19px; padding-top: 17px; }
.dx-search-result-section { min-width: 0; }
.dx-search-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dx-search-section-heading h2 { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--dx-search-text); font-size: 15px; }
.dx-search-section-heading h2 svg { width: 18px; height: 18px; color: var(--dx-search-accent); }
.dx-search-section-heading > span { color: var(--dx-search-muted); font-size: 11px; }
.dx-search-result-list { display: grid; gap: 6px; }
.dx-search-result-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px; border: 1px solid var(--dx-search-border); border-radius: 12px; background: var(--dx-search-soft); color: var(--dx-search-text); text-decoration: none; transition: background-color .16s ease, border-color .16s ease; }
.dx-search-result-card:hover { border-color: var(--dx-search-accent); background: var(--dx-search-hover); }
.dx-search-result-type-icon { display: grid; flex: 0 0 25px; width: 25px; height: 25px; place-items: center; color: var(--dx-search-accent); }
.dx-search-result-type-icon svg { width: 19px; height: 19px; }
.dx-search-result-image-pair { position: relative; display: block; flex: 0 0 66px; width: 66px; height: 54px; }
.dx-search-result-image-pair .dx-search-result-image { position: absolute; left: 0; bottom: 0; z-index: 2; width: 46px; height: 46px; }
.dx-search-result-cover { position: absolute; top: 0; right: 0; width: 43px; height: 31px; border: 1px solid var(--dx-search-border); border-radius: 6px; background: var(--dx-search-soft); object-fit: cover; }
.dx-search-result-image { display: block; flex: 0 0 54px; width: 54px; height: 54px; border: 1px solid var(--dx-search-border); border-radius: 12px; background: var(--dx-search-soft); object-fit: cover; }
.dx-search-result-users .dx-search-result-image { border-radius: 50%; }
.dx-search-result-users .dx-search-result-image-pair .dx-search-result-image { border-radius: 50%; }
.dx-search-result-image-fallback { display: grid; place-items: center; color: var(--dx-search-muted); }
.dx-search-result-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.dx-search-result-copy strong { display: flex; align-items: center; gap: 5px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.dx-search-result-copy small { color: var(--dx-search-muted); font-size: 11px; }
.dx-search-result-copy .dx-search-engagement { color: var(--dx-search-accent-strong); font-size: 10px; }
.dx-search-result-copy > span { display: -webkit-box; overflow: hidden; color: var(--dx-search-muted); font-size: 12px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.dx-search-verified { width: 15px; height: 15px; color: #2789e8; }
.dx-search-result-arrow { flex: 0 0 16px; width: 16px; height: 16px; color: var(--dx-search-muted); }
.dx-search-empty-state { display: flex; min-height: 250px; align-items: center; justify-content: center; flex-direction: column; gap: 9px; color: var(--dx-search-muted); text-align: center; }
.dx-search-empty-state > svg { width: 32px; height: 32px; color: var(--dx-search-accent); }
.dx-search-empty-state h2 { margin: 0; color: var(--dx-search-text); font-size: 18px; }
.dx-search-empty-state p { max-width: 440px; margin: 0; font-size: 13px; }

@media (max-width: 760px) {
    .dx-global-search-panel {
        position: fixed;
        top: var(--dx-search-mobile-top, 68px);
        left: 8px;
        width: calc(100vw - 16px);
        max-height: calc(100dvh - var(--dx-search-mobile-top, 68px) - 12px - env(safe-area-inset-bottom, 0px));
        border-radius: 14px;
    }
    .mobile-search-wrapper .dx-global-search-panel { top: calc(var(--dx-search-mobile-top, 68px) + 48px); }
    .dx-search-page-live .dx-global-search-panel { position: absolute; top: calc(100% + 8px); left: 0; width: 100%; max-height: 65dvh; }
    .dx-gs-panel-inner { padding: 9px; }
    .dx-gs-result { min-height: 58px; padding: 7px 5px; }
    .dx-gs-type-icon { flex-basis: 18px; width: 18px; }
    .dx-gs-avatar { flex-basis: 42px; width: 42px; height: 42px; }
    .dx-search-page { width: calc(100% - 16px); margin: 10px auto 35px; padding: 14px 11px; border-radius: 15px; }
    .dx-search-page-header { align-items: flex-start; }
    .dx-search-page-header p { max-width: 260px; font-size: 12px; }
    .dx-search-total { min-width: 61px; padding: 8px; }
    .dx-search-page-form { gap: 6px; }
    .dx-search-page-form button { min-width: 78px; padding: 0 10px; font-size: 12px; }
    .dx-search-category-nav { gap: 6px; margin-right: -2px; }
    .dx-search-category-pill { min-height: 34px; padding: 0 9px; font-size: 11px; }
    .dx-search-result-card { gap: 8px; padding: 8px 6px; }
    .dx-search-result-type-icon { flex-basis: 19px; width: 19px; }
    .dx-search-result-image { flex-basis: 46px; width: 46px; height: 46px; border-radius: 10px; }
    .dx-search-result-image-pair { flex-basis: 56px; width: 56px; height: 46px; }
    .dx-search-result-image-pair .dx-search-result-image { width: 40px; height: 40px; }
    .dx-search-result-cover { width: 36px; height: 25px; }
    .dx-search-result-users .dx-search-result-image { border-radius: 50%; }
.dx-search-result-users .dx-search-result-image-pair .dx-search-result-image { border-radius: 50%; }
    .dx-search-result-copy strong { font-size: 12px; }
    .dx-search-result-copy small { font-size: 10px; }
    .dx-search-result-copy > span { font-size: 11px; }
}

@media (max-width: 380px) {
    .dx-search-page-header h1 { font-size: 21px; }
    .dx-search-total { min-width: 54px; }
    .dx-search-result-type-icon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .dx-gs-spinner { animation-duration: 1.8s; }
    .dx-gs-result,
    .dx-search-result-card { transition: none; }
}

/* Broken-media fallback: keep result geometry stable and show a category glyph. */
.dx-gs-image-fallback {
    display: inline-grid;
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    place-items: center;
    border: 1px solid var(--dx-search-border);
    border-radius: 12px;
    background: var(--dx-search-soft);
    color: var(--dx-search-accent);
}
.dx-gs-image-pair .dx-gs-image-fallback {
    position: relative;
    z-index: 2;
    width: 40px;
    height: 40px;
    flex-basis: 40px;
}
.dx-search-result-image-fallback {
    display: grid;
    place-items: center;
    color: var(--dx-search-accent);
}

/* Recent mixed search history */
.dx-gs-history { padding-top: 10px; }
.dx-gs-history .dx-gs-panel-top { align-items: center; gap: 10px; }
.dx-gs-history-clear { padding: 4px 7px; border: 0; background: transparent; color: var(--dx-search-accent-strong); font: inherit; font-size: 11px; cursor: pointer; }
.dx-gs-history-row { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 4px 3px; border-top: 1px solid var(--dx-search-border); }
.dx-gs-history-row > a { display: flex; flex: 1; min-width: 0; align-items: center; gap: 11px; color: var(--dx-search-text); text-decoration: none; }
.dx-gs-history-row > a > svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--dx-search-accent); }
.dx-gs-history-row > a > span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.dx-gs-history-row strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.dx-gs-history-row small { color: var(--dx-search-muted); font-size: 10px; }
.dx-gs-history-remove { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--dx-search-muted); font-size: 21px; line-height: 1; cursor: pointer; }
.dx-gs-history-remove:hover { background: var(--dx-search-hover); color: var(--dx-search-text); }
.dx-gs-history-empty { display: flex; min-height: 90px; align-items: center; justify-content: center; gap: 9px; padding: 14px; color: var(--dx-search-muted); font-size: 12px; text-align: center; }
.dx-gs-history-empty svg { flex: 0 0 18px; color: var(--dx-search-accent); }

@media (max-width: 760px) {
    /* PWA app search becomes a dedicated top layer, above chats and app navigation. */
    .sticky-header-wrapper:has(.desktop-header.dx-search-mobile-active) {
        position: relative;
        z-index: 2147483000;
    }
    .desktop-header.dx-search-mobile-active {
        position: static;
        z-index: 2147483000;
        min-height: 0;
        padding: 0;
        background: transparent;
        box-shadow: none;
    }
    .desktop-header.dx-search-mobile-active > :not(.mobile-search-wrapper) { display: none; }
    .mobile-search-wrapper.is-mobile-active {
        position: fixed;
        top: env(safe-area-inset-top, 0px);
        right: 0;
        left: 0;
        z-index: 2147483001;
        display: flex;
        width: 100%;
        max-width: none;
        min-height: 54px;
        align-items: center;
        gap: 8px;
        margin: 0;
        padding: 7px 12px;
        box-sizing: border-box;
        border-bottom: 1px solid var(--dx-search-border);
        background: var(--dx-search-panel);
        box-shadow: 0 5px 22px rgba(0, 0, 0, .24);
    }
    .dx-gs-mobile-back {
        display: grid;
        flex: 0 0 34px;
        width: 34px;
        height: 38px;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 9px;
        background: transparent;
        color: var(--dx-search-text);
        cursor: pointer;
    }
    .dx-gs-mobile-back svg { width: 23px; height: 23px; }
    .mobile-search-wrapper.is-mobile-active .search-form { flex: 1; min-width: 0; }
    .mobile-search-wrapper.is-mobile-active .search-input-container { width: 100%; }
    .mobile-search-wrapper.is-mobile-active .search-input-container .search-icon { display: none; }
    .mobile-search-wrapper.is-mobile-active .search-input-container input {
        width: 100%;
        height: 40px;
        padding: 0 13px;
        border: 1px solid var(--dx-search-border);
        border-radius: 22px;
        background: var(--dx-search-soft);
        color: var(--dx-search-text);
        font-size: 15px;
        box-shadow: none;
    }
    .mobile-search-wrapper.is-mobile-active .dx-global-search-panel {
        position: absolute;
        top: calc(100% + 5px);
        right: 8px;
        left: 8px;
        z-index: 2147483002;
        width: auto;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 66px - env(safe-area-inset-bottom, 0px));
        border-radius: 13px;
        box-shadow: 0 16px 42px rgba(0, 0, 0, .38);
    }
    body.dx-mobile-search-open { overflow: hidden; }
}

/* Mobile app: dedicated full-screen search surface. It is inactive until the input receives focus. */
@media (max-width: 760px) {
    .dx-gs-mobile-back[hidden] {
        display: none;
    }

    .mobile-search-wrapper.is-mobile-active {
        position: fixed;
        inset: 0;
        z-index: 2147483647;
        display: flex;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        min-height: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
        overflow: hidden;
        box-sizing: border-box;
        border: 0;
        border-radius: 0;
        background: var(--dx-search-panel);
        box-shadow: none;
        isolation: isolate;
        pointer-events: auto;
    }

    .dx-gs-mobile-toolbar {
        position: relative;
        z-index: 2;
        display: flex;
        flex: 0 0 56px;
        width: 100%;
        min-height: 56px;
        align-items: center;
        gap: 8px;
        padding: 7px 12px;
        box-sizing: border-box;
        border-bottom: 1px solid var(--dx-search-border);
        background: var(--dx-search-panel);
        pointer-events: auto;
    }

    .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar .search-form {
        display: block;
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        margin: 0;
    }

    .mobile-search-wrapper.is-mobile-active .search-input-container {
        position: relative;
        width: 100%;
        min-width: 0;
    }

    .mobile-search-wrapper.is-mobile-active .search-input-container .search-icon {
        display: none;
    }

    .mobile-search-wrapper.is-mobile-active .search-input-container input {
        display: block;
        width: 100%;
        height: 40px;
        min-width: 0;
        padding: 0 14px;
        box-sizing: border-box;
        border: 1px solid var(--dx-search-border);
        border-radius: 22px;
        background: var(--dx-search-soft);
        color: var(--dx-search-text);
        font-size: 15px;
        box-shadow: none;
    }

    .dx-gs-mobile-back {
        display: grid;
        flex: 0 0 34px;
        width: 34px;
        height: 40px;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 9px;
        background: transparent;
        color: var(--dx-search-text);
        cursor: pointer;
        pointer-events: auto;
    }

    .dx-gs-mobile-back svg {
        width: 23px;
        height: 23px;
    }

    .mobile-search-wrapper.is-mobile-active .dx-global-search-panel {
        position: relative;
        inset: auto;
        display: block;
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        max-height: none;
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 0;
        border-radius: 0;
        background: var(--dx-search-panel);
        box-shadow: none;
        z-index: 2;
        pointer-events: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-search-wrapper.is-mobile-active .dx-global-search-panel[hidden] {
        display: none;
    }

    body.dx-mobile-search-open {
        overflow: hidden;
    }
}

/* R5: PWA search is portalled to body, creating a true modal layer above every app widget. */
@media (max-width: 760px) {
    body.dx-mobile-search-open {
        overflow: hidden;
        overscroll-behavior: none;
        touch-action: none;
    }

    body > .mobile-search-wrapper.is-mobile-active {
        position: fixed;
        inset: 0;
        z-index: 2147483647;
        display: flex;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        min-width: 0;
        min-height: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
        overflow: hidden;
        box-sizing: border-box;
        border: 0;
        border-radius: 0;
        background: var(--dx-search-panel, #111315);
        box-shadow: none;
        isolation: isolate;
        pointer-events: auto;
        overscroll-behavior: none;
        touch-action: pan-y;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar {
        position: relative;
        z-index: 2;
        flex: 0 0 56px;
        min-height: 56px;
        background: var(--dx-search-panel, #111315);
        pointer-events: auto;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar input,
    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar input:focus,
    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar input:focus-visible {
        outline: none;
        box-shadow: none;
        -webkit-appearance: none;
        appearance: none;
        background: var(--dx-search-soft, rgba(255,255,255,.06));
        border-color: var(--dx-search-border);
        -webkit-tap-highlight-color: transparent;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-global-search-panel,
    body > .mobile-search-wrapper.is-mobile-active .dx-global-search-panel:not([hidden]) {
        position: relative;
        inset: auto;
        z-index: 3;
        display: block;
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        max-height: none;
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 0;
        border-radius: 0;
        background: var(--dx-search-panel, #111315);
        box-shadow: none;
        pointer-events: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-global-search-panel[hidden] {
        display: none;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-panel-inner,
    body > .mobile-search-wrapper.is-mobile-active .dx-gs-history {
        pointer-events: auto;
    }

    body > .mobile-search-wrapper.is-mobile-active a,
    body > .mobile-search-wrapper.is-mobile-active button {
        pointer-events: auto;
        touch-action: manipulation;
    }

    body > .mobile-search-wrapper.is-mobile-active .search-input-container input {
        outline: none;
        box-shadow: none;
    }
}

/* Search history thumbnails: preserve the real profile/content artwork. */
.dx-gs-history-row > a > .dx-gs-history-thumb {
    display: block;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    overflow: hidden;
    border: 1px solid var(--dx-search-border);
    border-radius: 9px;
    background: var(--dx-search-surface, #202124);
    object-fit: cover;
}
.dx-gs-history-row > a > .dx-gs-history-thumb-fallback {
    display: grid;
    place-items: center;
    color: var(--dx-search-accent);
}
.dx-gs-history-row > a > .dx-gs-history-thumb-fallback svg {
    width: 17px;
    height: 17px;
}
.dx-gs-history-row > a > span {
    overflow: hidden;
}
.dx-gs-history-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* R7: history keeps the category SVG and the entity's real main image side by side. */
.dx-gs-history-row > a {
    gap: 9px;
}
.dx-gs-history-type-icon {
    display: grid;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    place-items: center;
    color: var(--dx-search-accent);
}
.dx-gs-history-type-icon svg {
    display: block;
    width: 16px;
    height: 16px;
    stroke-width: 2;
}
.dx-gs-history-row > a > .dx-gs-history-thumb {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
}
.dx-gs-history-row > a > .dx-gs-history-thumb-fallback {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--dx-search-border);
    background: var(--dx-search-soft);
    color: var(--dx-search-accent);
}
.dx-gs-history-row > a > .dx-gs-history-thumb-fallback svg {
    width: 18px;
    height: 18px;
}

/* Remove the unwanted pale focus halo around the mobile search field in both themes. */
@media (max-width: 760px) {
    .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar,
    .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar .search-input-container,
    .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar .search-input-container:focus-within {
        box-shadow: none;
        outline: none;
        filter: none;
    }
    .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar .search-input-container input,
    .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar .search-input-container input:focus,
    .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar .search-input-container input:focus-visible {
        outline: none;
        box-shadow: none;
        filter: none;
    }
}


/* R9: history thumbnails use the entity's real main image; people remain circular. */
.dx-gs-history-row > a > .dx-gs-history-thumb-users {
    border-radius: 50%;
}
.dx-gs-history-row > a > .dx-gs-history-thumb-groups {
    border-radius: 10px;
}
.dx-gs-history-row > a > .dx-gs-history-thumb-music,
.dx-gs-history-row > a > .dx-gs-history-thumb-events,
.dx-gs-history-row > a > .dx-gs-history-thumb-businesses {
    border-radius: 9px;
    object-fit: cover;
}


/* Keep hidden panels truly absent even when component styles define display. */
.dx-global-search-panel[hidden] {
    display: none;
}



/* R11: compact desktop dropdown, anchored to the header search field. */
@media (min-width: 881px) {
    .header-integrated-search .dx-global-search-panel {
        position: absolute;
        top: calc(100% + 8px);
        right: auto;
        left: 0;
        width: min(460px, calc(100vw - 32px));
        max-width: calc(100vw - 32px);
        max-height: min(72vh, 660px);
        margin: 0;
        box-sizing: border-box;
        transform: none;
    }
}

/* R11: failed cover thumbnails in paired group results stay in their own corner. */
.dx-gs-image-pair .dx-gs-image-fallback {
    position: absolute;
    top: 0;
    right: 0;
    bottom: auto;
    left: auto;
    z-index: 1;
    width: 36px;
    height: 27px;
    flex-basis: 36px;
    box-sizing: border-box;
}

/* R11: PWA/mobile keeps the ordinary dropdown below the mobile header. */
@media (max-width: 760px) {
    .mobile-search-wrapper .dx-global-search-panel {
        display: block;
        position: fixed;
        top: calc(var(--dx-search-mobile-top, 68px) + 48px);
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        max-height: calc(100dvh - var(--dx-search-mobile-top, 68px) - 60px - env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
        border-radius: 14px;
    }

    .mobile-search-wrapper .dx-global-search-panel[hidden] {
        display: none;
    }
}


/* R12: PWA search is a true full-screen view only while the mobile search is active. */
@media (max-width: 760px) {
    body.dx-mobile-search-open {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
        overscroll-behavior: none;
        touch-action: none;
    }

    body > .mobile-search-wrapper.is-mobile-active {
        position: fixed;
        inset: 0;
        z-index: 2147483647;
        display: flex;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        min-width: 0;
        min-height: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
        overflow: hidden;
        box-sizing: border-box;
        border: 0;
        border-radius: 0;
        background: var(--dx-search-panel, #111315);
        box-shadow: none;
        isolation: isolate;
        pointer-events: auto;
        overscroll-behavior: none;
        touch-action: pan-y;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar {
        position: relative;
        z-index: 4;
        display: flex;
        flex: 0 0 64px;
        width: 100%;
        min-height: 64px;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        box-sizing: border-box;
        border-bottom: 1px solid var(--dx-search-border);
        background: var(--dx-search-panel, #111315);
        pointer-events: auto;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-back {
        display: grid;
        flex: 0 0 34px;
        width: 34px;
        height: 42px;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--dx-search-text);
        cursor: pointer;
        pointer-events: auto;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-back[hidden] {
        display: none;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar .search-form {
        display: block;
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        margin: 0;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar .search-input-container {
        position: relative;
        width: 100%;
        min-width: 0;
        box-shadow: none;
        outline: none;
        filter: none;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar .search-input-container .search-icon {
        display: none;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar input,
    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar input:focus,
    body > .mobile-search-wrapper.is-mobile-active .dx-gs-mobile-toolbar input:focus-visible {
        display: block;
        width: 100%;
        height: 42px;
        min-width: 0;
        padding: 0 14px;
        box-sizing: border-box;
        border: 1px solid var(--dx-search-border);
        border-radius: 22px;
        outline: none;
        background: var(--dx-search-soft, rgba(255,255,255,.06));
        color: var(--dx-search-text);
        font-size: 16px;
        box-shadow: none;
        filter: none;
        -webkit-appearance: none;
        appearance: none;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-global-search-panel,
    body > .mobile-search-wrapper.is-mobile-active .dx-global-search-panel:not([hidden]) {
        position: relative;
        inset: auto;
        z-index: 3;
        display: block;
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        max-height: none;
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 0;
        border-radius: 0;
        background: var(--dx-search-panel, #111315);
        box-shadow: none;
        pointer-events: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-global-search-panel[hidden] {
        display: none;
    }

    body > .mobile-search-wrapper.is-mobile-active .dx-gs-panel-inner,
    body > .mobile-search-wrapper.is-mobile-active .dx-gs-history,
    body > .mobile-search-wrapper.is-mobile-active a,
    body > .mobile-search-wrapper.is-mobile-active button {
        pointer-events: auto;
        touch-action: manipulation;
    }
}
