/* Keep search beside the heading at every viewport. The existing shared
 * heading insets and decorative icon frames remain unchanged. */
#n321-catalog > .panel-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 16px;
}
#n321-catalog > .panel-header > .panel-title {
    margin: 0;
    white-space: nowrap;
}
#n321-catalog .catalog-search {
    box-sizing: border-box;
    width: 100%;
    max-width: 460px;
    min-width: 0;
    min-height: 38px;
    margin: 0 0 0 auto;
    padding: 3px 3px 3px 10px;
    gap: 6px;
    border-radius: 10px;
}
#n321-catalog .catalog-search input {
    width: 0;
    min-width: 0;
    padding: 2px 0;
}
#n321-catalog .catalog-search button {
    min-height: 30px;
    padding: 0 12px;
    border-radius: 7px;
    line-height: 20px;
}

/* Compact, wrapping category pills retain the established pale-blue palette. */
#n321-catalog .catalog-categories .chip-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
#n321-catalog .catalog-categories .chip {
    box-sizing: border-box;
    flex: 0 1 auto;
    min-height: 32px;
    height: auto;
    max-width: 100%;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 14px;
    line-height: 20px;
    white-space: normal;
}
#n321-catalog .catalog-category-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Retain the result name for assistive technology without a second visible
 * category heading. The count stays visible at the right-hand edge. */
#n321-catalog .catalog-result-bar {
    align-items: center;
    min-height: 18px;
    margin-top: 10px;
    padding-bottom: 8px;
}
#n321-catalog .catalog-result-label.catalog-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
#n321-catalog .catalog-result-count { margin-left: auto; }
#n321-catalog .catalog-clear {
    padding: 4px 9px;
    border-radius: 7px;
    font-size: 12px;
    line-height: 18px;
}

@media (max-width: 640px) {
    #n321-catalog > .panel-header { column-gap: 8px; }
    #n321-catalog .catalog-search {
        max-width: 340px;
        min-height: 36px;
        padding: 2px 2px 2px 8px;
        gap: 4px;
        border-radius: 9px;
    }
    #n321-catalog .catalog-search input {
        /* Avoid automatic iOS zoom while keeping the field shrinkable. */
        font-size: 16px;
        line-height: 24px;
    }
    #n321-catalog .catalog-search button {
        min-height: 28px;
        padding: 0 9px;
        font-size: 13px;
    }
    #n321-catalog .catalog-categories .chip {
        min-height: 30px;
        padding: 4px 10px;
        font-size: 14px;
    }
    #n321-catalog .catalog-result-bar {
        margin-top: 8px;
        padding-bottom: 6px;
    }
    #n321-catalog .catalog-result-count { font-size: 12px; }
}
