.app-discovery {
    --app-touch-target: 44px;
    --app-section-gap: 12px;
    min-width: 0;
    font-size: 14px;
}

.app-discovery form[data-filter-sheet]:not(.app-filter-sheet--open) {
    padding: clamp(12px, 1.5vw, 24px);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-card);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-soft);
}

.app-discovery.home-page,
.app-discovery.directory-page,
.app-discovery.auto-page,
.app-discovery.job-home {
    width: 100%;
    max-width: none;
    margin: 0;
}

.app-discovery.home-page,
.app-discovery.directory-page { padding: 0; }

.app-discovery .app-search,
.app-discovery .app-filter-field { font-size: 14px; font-weight: 400; }

.app-discovery .app-home-actions {
    gap: 8px;
    margin-block: 12px;
}

.app-discovery .app-button,
.app-discovery .app-filter-trigger {
    min-height: 44px;
    padding: 8px 12px;
    border-radius: var(--app-radius-control);
    font: inherit;
    font-weight: 600;
    line-height: 1.3;
}

.app-discovery .app-icon { width: 18px; height: 18px; flex-shrink: 0; }
.app-discovery .app-discovery-composition { display: grid; gap: 12px; margin-block: 12px; min-width: 0; }
.app-discovery .app-discovery-composition > * { margin-block: 0; }
.app-discovery [data-discovery-quick-filters] { min-width: 0; }
.app-discovery .app-quick-filter-all { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; }
.app-discovery .app-quick-filter-all[aria-pressed="true"] .app-segmented__label {
    border-color: var(--app-primary);
    color: var(--app-accent-text);
    background: var(--app-accent-soft);
}
.app-discovery .app-quick-filter-all[aria-pressed="true"] .app-icon {
    color: var(--app-on-primary);
    background: var(--app-primary);
}
.app-discovery .app-frozen-order-notice {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-block: 8px 12px;
    color: var(--app-primary);
    font-size: 13px;
}
.app-discovery .order-lock { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; }
.app-discovery .app-search-row { padding: 0; gap: 12px; border: 0; border-radius: 0; }
.app-discovery .app-search-row--single { grid-template-columns: minmax(0, 8fr) minmax(180px, 2fr); }
.app-discovery .app-search { min-height: 44px; border-radius: var(--app-radius-control); }
.app-discovery .app-search input { min-height: 42px; height: 42px; font: inherit; }
.app-discovery .app-search-mode-segment { padding: 6px 12px; font: inherit; font-weight: 600; }
.app-discovery .app-search-modes { min-height: 44px; padding: 2px; }
.app-discovery .app-search-mode-segment { min-height: 38px; }
.app-discovery .app-filter-trigger { min-height: 44px; height: 44px; align-self: center; }
.app-discovery .app-segmented__option { min-height: 44px; }
.app-discovery .app-segmented__label { min-height: 44px; padding: 5px 12px; gap: 8px; font: inherit; font-weight: 600; }
.app-discovery .app-choice-rail .app-segmented__label > .app-icon { width: 24px; height: 24px; padding: 4px; }
.app-discovery .app-filter-field { gap: 6px; min-width: 0; }
.app-discovery .app-filter-field__label { margin: 0; gap: 7px; color: var(--app-text-muted); font-size: 11px; font-weight: 600; line-height: 1.5; letter-spacing: .07em; text-transform: uppercase; }
.app-discovery .app-filter-field input,
.app-discovery .app-filter-field select { min-height: 44px; height: 44px; padding: 0 10px; font: inherit; border-radius: var(--app-radius-control); }
.app-discovery .app-filter-range-pair { min-height: 44px; height: 44px; }
.app-discovery .app-filter-range-pair input { width: 0; border: 0; border-radius: 0; background: transparent; }
.app-discovery .app-filter-range-unit { margin-inline: 4px 7px; font-size: 11px; padding: 3px 5px; }
.app-discovery .app-filter-field .ts-wrapper { min-height: 44px; }
.app-discovery .app-filter-field .ts-wrapper .ts-control { min-height: 44px; padding: 8px 10px; border-radius: var(--app-radius-control); font: inherit; line-height: 22px; }
.app-discovery .app-filter-field .ts-wrapper .ts-control input { min-height: 22px; height: 22px; padding: 0; font: inherit; line-height: 22px; }
.app-discovery .app-filter-field .ts-control > .item { margin-block: 0; }
.app-discovery .app-discovery-primary { display: grid; grid-template-columns: repeat(var(--discovery-columns, 5), minmax(0, 1fr)); gap: 12px; align-items: start; min-width: 0; }
.app-discovery .app-discovery-primary--four { --discovery-columns: 4; }
.app-discovery .primary-filter-row,
.app-discovery .discovery-field-grid { gap: 12px; align-items: start; margin-block: 0; }
.app-discovery .app-filter-group { padding: 16px 0; margin-block: 0; }
.app-discovery .app-filter-group header { margin-bottom: 10px; }
.app-discovery .app-filter-group h3 { font-family: var(--app-font-sans); font-size: 14px; font-weight: 600; letter-spacing: 0; margin: 0; }
.app-discovery .app-filter-group__grid { gap: 12px; }
.app-discovery .app-discovery-additional-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: 14px; }
.app-discovery .app-filter-panel:not(.app-filter-panel--collapsed) { display: grid; gap: 12px; }
.app-discovery .app-filter-panel--collapsed { display: none; }
.app-discovery .app-results-toolbar { width: 100%; margin-block: 12px; gap: 10px; }
.app-discovery .results-view-controls { width: 100%; }
.app-discovery .app-results-toolbar__meta { margin-inline-start: auto; }
.app-discovery .app-results-toolbar__controls { gap: 8px; }
.app-discovery .app-results-toolbar__layout-button { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.app-discovery .app-results-toolbar__step { min-height: 32px; height: 32px; width: 32px; flex-basis: 32px; }
.app-discovery .app-active-filters { margin-block: 10px; }
.app-discovery .app-discovery-pager, .app-discovery-pager--numbered { display: flex; align-items: center; justify-content: center; gap: 10px; margin-block: 16px; font-size: 14px; }
.app-discovery .app-discovery-pager [aria-current="page"] { padding-inline: 8px; font-weight: 650; }
.app-discovery-pager__numbers { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; }
.app-discovery-pager--numbered .app-discovery-pager__numbers .app-button { min-inline-size: 2.75rem; min-block-size: 2.75rem; padding-inline: .5rem; font-variant-numeric: tabular-nums; }

@media (max-width: 36rem) {
    .app-discovery-pager.app-discovery-pager--numbered {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem;
        max-inline-size: 26rem;
        margin-inline: auto;
    }
    .app-discovery-pager--numbered .app-discovery-pager__numbers { grid-area: 1 / 1 / 2 / -1; }
    .app-discovery-pager--numbered > .app-button { grid-row: 2; min-block-size: 2.75rem; white-space: normal; }
}
.app-discovery .field-help,
.app-discovery .form-field__hint { font-size: 12px; line-height: 1.5; margin-block: 8px; }
.app-discovery [data-frozen-results],
.app-discovery .discovery-results { position: relative; min-height: 240px; }
.app-discovery .app-results-loading--refresh.app-results-loading--surface.htmx-request {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: grid;
    align-content: start;
    justify-content: stretch;
    gap: 16px;
    min-height: 240px;
    padding: 24px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-control);
    background: var(--app-surface);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
}
.app-discovery .app-results-loading__status { justify-content: center; min-height: 36px; color: var(--app-primary); font-size: 16px; font-weight: 650; }
.app-discovery .app-results-loading--refresh .app-results-loading__status .app-icon { animation: discovery-spin 1s linear infinite; }
.app-discovery .app-results-loading--refresh .app-results-loading__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.app-discovery .app-results-loading--refresh .app-results-loading__placeholder { aspect-ratio: auto; min-height: 64px; animation: discovery-pulse 1.2s ease-in-out infinite alternate; }
@keyframes discovery-spin { to { transform: rotate(360deg); } }
@keyframes discovery-pulse { to { opacity: .45; } }
@media (max-width: 1100px) {
    .app-discovery .app-discovery-primary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .app-discovery .order-lock { flex-basis: 44px; width: 44px; height: 44px; }
    .app-discovery [data-discovery-quick-filters] .app-segmented__label { padding-inline: 10px; gap: 6px; }
    .app-discovery .app-search { min-height: 44px; }
    .app-discovery .app-search input { min-height: 42px; height: 42px; }
    .app-discovery .app-search-modes { min-height: 44px; }
    .app-discovery .app-search-mode-segment { min-height: 44px; }
    .app-discovery form:not(.app-filter-sheet--open) .app-discovery-primary { display: none; }
    .app-discovery .app-filter-sheet--open .app-discovery-primary,
    .app-discovery .app-filter-sheet--open .app-filter-sheet__advanced { display: grid; }
    .app-discovery .app-filter-sheet--open input,
    .app-discovery .app-filter-sheet--open .app-filter-field .ts-wrapper .ts-control { font-size: 16px; }
    .app-discovery .app-filter-field input,
    .app-discovery .app-filter-field select,
    .app-discovery .app-filter-range-pair,
    .app-discovery .app-filter-field .ts-wrapper .ts-control { min-height: 44px; }
    .app-discovery .app-filter-field input,
    .app-discovery .app-filter-field select,
    .app-discovery .app-filter-range-pair { height: 44px; }
    .app-discovery .app-filter-field .ts-wrapper .ts-control input { min-height: 22px; height: 22px; }
    .app-discovery .app-button,
    .app-discovery .app-filter-trigger,
    .app-discovery .app-segmented__label { min-height: 44px; }
    .app-discovery .app-filter-trigger { height: 44px; }
    .app-discovery .app-results-toolbar__layout-button,
    .app-discovery .app-results-toolbar__step { min-height: 44px; height: 44px; min-width: 44px; }
    .app-discovery .app-discovery-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-discovery .app-search-row--single { grid-template-columns: minmax(0, 1fr); }
    .app-discovery .app-filter-sheet--open .app-discovery-composition { margin: 0; }
    .app-discovery .app-filter-group { padding: 12px 0; }
}
@media (max-width: 480px) {
    .app-discovery .app-filter-sheet--open .app-discovery-primary { grid-template-columns: minmax(0, 1fr); }
    .app-discovery .app-results-loading--refresh.app-results-loading--surface { padding: 16px; }
    .app-discovery .app-results-loading--refresh .app-results-loading__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .app-discovery .app-results-loading--refresh .app-results-loading__status .app-icon,
    .app-discovery .app-results-loading--refresh .app-results-loading__placeholder { animation: none; }
}

.app-discovery .discovery-context-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 5fr); align-items: start; gap: 12px; }
.app-discovery .discovery-offer-group, .app-discovery .discovery-category-group { max-width: none; width: 100%; gap: 6px; }
@media (max-width: 1100px) { .app-discovery .discovery-context-row { grid-template-columns: minmax(0, 1fr); } }

.app-discovery .discovery-page { margin: 0; padding: 0; }
.app-discovery form[data-filter-sheet] { margin-block: 0; }

.app-discovery .app-results__item[id^="discovery-item-"] {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
    scroll-margin-block-start: calc(var(--app-header-height-desktop, 52px) + 1rem);
}
