.natives-directory {
    max-width: 1180px;
}

.directory-search {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.directory-search input {
    flex: 1;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid rgba(15, 104, 132, 0.26);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    color: #153747;
    font-size: 15px;
    font-weight: 700;
    outline: none;
}

.directory-search input:focus {
    border-color: rgba(15, 104, 132, 0.75);
    box-shadow: 0 0 0 4px rgba(15, 104, 132, 0.12);
}

.directory-search button,
.reset-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: #0f6884;
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(9, 65, 83, 0.18);
}

.reset-link {
    background: rgba(47, 69, 126, 0.78);
}

.filter-status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin-left: 8px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(15, 104, 132, 0.12);
    color: #0f6884;
    font-size: 12px;
    font-weight: 900;
}

/* Алфавит */
.alphabet-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 24px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.36);
}

.alphabet-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    color: #173948;
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
    transition: 0.2s ease;
}

.alphabet-link:hover,
.alphabet-link.is-active {
    background: #0f6884;
    color: #ffffff;
}

/* Расширенный поиск */
.advanced-search-card {
    margin: 26px 0 28px;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.48);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.58),
        0 18px 44px rgba(74, 54, 125, 0.08);
}

.advanced-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.advanced-card-header h3 {
    margin: 4px 0 0;
    color: #173948;
    font-size: 24px;
    line-height: 1.15;
}

.advanced-card-note {
    max-width: 720px;
    margin: 8px 0 0;
    color: rgba(23, 57, 72, 0.72);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}

.advanced-reset-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(47, 69, 126, 0.1);
    color: #2f457e;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

.advanced-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.advanced-section {
    padding: 16px;
    border: 1px solid rgba(15, 104, 132, 0.09);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 26px rgba(74, 54, 125, 0.06);
}

.advanced-section-wide {
    grid-column: 1 / -1;
}

.advanced-section h4 {
    margin: 0 0 14px;
    color: #173948;
    font-size: 15px;
    font-weight: 900;
}

.advanced-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.advanced-section:not(.advanced-section-wide) .advanced-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.advanced-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.advanced-field span {
    color: rgba(23, 57, 72, 0.76);
    font-size: 12px;
    font-weight: 900;
}

.advanced-select {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(15, 104, 132, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    color: #173948;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    outline: none;
    cursor: pointer;
}

.advanced-select:focus {
    border-color: rgba(15, 104, 132, 0.72);
    box-shadow: 0 0 0 4px rgba(15, 104, 132, 0.1);
}

.advanced-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

.advanced-actions button,
.advanced-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.advanced-actions button {
    background: #0f6884;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(9, 65, 83, 0.18);
}

.advanced-actions a {
    background: rgba(47, 69, 126, 0.1);
    color: #2f457e;
}

.advanced-actions button:hover {
    background: #1180a4;
}

.advanced-actions a:hover,
.advanced-reset-link:hover {
    background: rgba(47, 69, 126, 0.18);
}

/* Список нативов */
.native-list {
    display: grid;
    gap: 10px;
}

.native-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    min-height: 74px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(15, 104, 132, 0.88);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(9, 65, 83, 0.14);
    transition: 0.18s ease;
}

.native-row:hover {
    transform: translateY(-1px);
    background: rgba(17, 128, 164, 0.92);
}

.native-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 20px;
    font-weight: 900;
}

.native-main h3 {
    margin: 0 0 7px;
    font-size: 19px;
    line-height: 1.2;
}

.native-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.native-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.86);
    font-size: 12px;
    font-weight: 800;
}

.native-actions {
    display: flex;
    gap: 8px;
}

.native-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

.native-actions a:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Старый вариант карточек. Оставляем безопасно. */
.native-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.native-card {
    min-height: 150px;
    padding: 20px;
    border-radius: 22px;
    background: rgba(15, 104, 132, 0.88);
    color: #ffffff;
    box-shadow: 0 14px 34px rgba(9, 65, 83, 0.22);
}

.native-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 26px;
}

.native-card h3 {
    margin: 0;
    font-size: 21px;
    line-height: 1.25;
}

.gender-badge {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 12px;
    font-weight: 800;
}

.native-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.native-link:hover {
    background: rgba(255, 255, 255, 0.28);
}

.native-muted {
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
}

@media (max-width: 1100px) {
    .native-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .advanced-fields,
    .advanced-section:not(.advanced-section-wide) .advanced-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .advanced-card-grid {
        grid-template-columns: 1fr;
    }

    .advanced-section-wide {
        grid-column: auto;
    }
}

@media (max-width: 820px) {
    .directory-search {
        flex-direction: column;
    }

    .native-row {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .native-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-left: 60px;
    }
}

@media (max-width: 720px) {
    .native-grid {
        grid-template-columns: 1fr;
    }

    .advanced-search-card {
        padding: 16px;
        border-radius: 22px;
    }

    .advanced-card-header {
        flex-direction: column;
    }

    .advanced-card-header h3 {
        font-size: 21px;
    }

    .advanced-fields,
    .advanced-section:not(.advanced-section-wide) .advanced-fields {
        grid-template-columns: 1fr;
    }

    .advanced-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .advanced-actions button,
    .advanced-actions a {
        width: 100%;
    }
}


/* Управление каталогом: пол и база в одной строке */
.catalog-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    flex-wrap: nowrap;
}

.catalog-control-row > .filter-row {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 12px;
    margin: 0;
}

.catalog-control-row > .database-filter-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
    margin: 0;
}

.database-filter-label {
    color: rgba(23, 57, 72, 0.72);
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.database-filter-button {
    min-height: 40px;
    padding-left: 13px;
    padding-right: 13px;
    font-size: 13px;
    white-space: nowrap;
}

.database-filter-button.is-locked {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.database-filter-button.is-locked:hover {
    background: transparent;
    color: #173948;
}

/* Разделённые результаты: база Елизаветы / моя база */
.native-result-section {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.native-result-section + .native-result-section {
    margin-top: 28px;
}

.native-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.42);
}

.native-section-title h3 {
    margin: 0;
    color: #173948;
    font-size: 18px;
    font-weight: 900;
}

.native-section-title span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(15, 104, 132, 0.14);
    color: #0f6884;
    font-size: 13px;
    font-weight: 900;
}

.native-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 7px;
}

.native-title-line h3 {
    margin: 0;
}

.native-origin-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.86);
    font-size: 11px;
    font-weight: 900;
}

.native-origin-badge.is-private {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.native-row-private {
    background: rgba(47, 69, 126, 0.9);
}

.native-row-private:hover {
    background: rgba(72, 91, 154, 0.94);
}

/* Только на реально узких экранах переносим базу вниз */
@media (max-width: 760px) {
    .catalog-control-row {
        align-items: stretch;
        flex-direction: column;
        flex-wrap: wrap;
    }

    .catalog-control-row > .filter-row,
    .catalog-control-row > .database-filter-row {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .catalog-control-row .filter-button,
    .database-filter-button {
        flex: 1 1 100%;
    }
}


/* Выравниваем кнопки выбора базы по размеру с кнопками пола */
.database-filter-button.filter-button {
    min-height: 46px;
    height: 46px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 900;
    box-sizing: border-box;
}

.database-filter-row {
    align-items: center;
}

.database-filter-label {
    display: inline-flex;
    align-items: center;
    min-height: 46px;
}