.agency-selector-modal,
.agency-recover-pass-modal {
    --agency-access-accent: #4188c7;
    --agency-access-accent-hover: #2f6fa8;
    --agency-access-accent-soft-border: #92bfe8;
    --agency-access-accent-soft-bg: #eef6fd;
    --agency-access-accent-shadow: rgba(65, 136, 199, 0.15);
    --agency-access-action-bg: var(--agency-access-accent);
}

.app-modal__dialog.modal-dialog.agency-selector-modal {
    width: 100%;
    max-width: min(calc(100vw - 32px), 980px) !important;
}

.agency-selector-modal .app-modal__shell {
    align-items: flex-start;
}

.app-modal__dialog.modal-dialog.agency-recover-pass-modal {
    width: 100%;
    max-width: min(calc(100vw - 32px), 560px) !important;
}

.agency-selector-modal .app-modal__content.modal-content {
    border-radius: 14px;
    height: calc(100vh - 48px);
    max-height: calc(100vh - 48px);
}

.agency-selector-modal .app-modal__body.modal-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 1.25rem 1.5rem 1rem;
}

.agency-selector-modal .app-modal__content-inner {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.agency-selector {
    color: #444;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

.agency-selector__search {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    margin-bottom: 16px;
}

.agency-selector__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.agency-selector__label {
    color: #444;
    font-size: 0.813rem;
    font-weight: 700;
    line-height: 1rem;
    margin: 0;
}

.agency-selector__input,
.agency-recover-pass__input {
    appearance: none;
    background: #fff;
    border: 1px solid #c9d3df;
    border-radius: 10px;
    color: #111827;
    font-size: 0.9375rem;
    line-height: 1.25rem;
    min-height: 38px;
    outline: none;
    padding: 10px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.agency-selector__input:focus,
.agency-recover-pass__input:focus {
    border-color: var(--agency-access-accent);
    box-shadow: 0 0 0 3px var(--agency-access-accent-shadow);
}

.agency-selector__search-button,
.agency-recover-pass__button {
    align-items: center;
    background: var(--agency-access-accent);
    border: 1px solid var(--agency-access-accent);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.9375rem;
    font-weight: 700;
    gap: 8px;
    justify-content: center;
    line-height: 1rem;
    min-height: 44px;
    padding: 0 18px;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.agency-selector__search-button i {
    font-size: 0.9375rem;
}

.agency-selector__search-button {
    align-self: end;
    height: 38px;
    justify-self: start;
    min-width: 132px;
    padding: 0 20px;
}

.agency-selector__search-button:hover,
.agency-recover-pass__button:hover {
    background: var(--agency-access-accent-hover);
    border-color: var(--agency-access-accent-hover);
    color: #fff;
}

.agency-selector__results {
    background: #fff;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.agency-selector__table {
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    width: 100%;
}

.agency-selector__table th,
.agency-selector__table td {
    border-bottom: 1px solid #e8edf3;
    font-size: 0.813rem;
    line-height: 1.25rem;
    padding: 0.45rem 0.75rem;
    position: relative;
    text-align: left;
    transition: background-color 0.18s ease;
    vertical-align: middle;
}

.agency-selector__table th {
    border-bottom: 1px solid #d6dee8;
    color: #5b6675;
    font-weight: 700;
    text-transform: uppercase;
    padding: .4rem 0.75rem;
}

.agency-selector__table td {
    border-left: 1px solid transparent;
    border-right: 1px solid transparent;
    border-top: 1px solid #f4f7fa;
}

.agency-selector__table tbody tr:last-child td {
    border-bottom: none;
}

.agency-selector__row {
    cursor: pointer;
    transition: transform 0.18s ease;
}

.agency-selector__row:hover td {
    background: var(--agency-access-accent-soft-bg);
    border-top-color: transparent;
    border-bottom-color: transparent;
    box-shadow: 0 -1px 0 0 var(--agency-access-accent-soft-border), 0 1px 0 0 var(--agency-access-accent-soft-border);
    z-index: 1;
}

.agency-selector__row:hover td:first-child {
    border-left-color: var(--agency-access-accent-soft-border);
    border-radius: 12px 0 0 12px;
    box-shadow: 0 -1px 0 0 var(--agency-access-accent-soft-border), 0 1px 0 0 var(--agency-access-accent-soft-border), -4px 0 10px -10px var(--agency-access-accent-shadow);
}

.agency-selector__row:hover td:last-child {
    border-right-color: var(--agency-access-accent-soft-border);
    border-radius: 0 12px 12px 0;
    box-shadow: 0 -1px 0 0 var(--agency-access-accent-soft-border), 0 1px 0 0 var(--agency-access-accent-soft-border), 4px 0 10px -10px var(--agency-access-accent-shadow);
}

.agency-selector__action-cell {
    text-align: right;
    white-space: nowrap;
    width: 88px;
}

.agency-selector__action {
    align-items: center;
    background: rgba(65, 136, 199, 0.08);
    border-radius: .25rem;
    color: rgba(65, 136, 199, 0.45);
    display: inline-flex;
    height: 22px;
    justify-content: center;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease, filter 0.18s ease, transform 0.18s ease;
    width: 22px;
    padding-right: 0.85rem;
    padding-left: 0.85rem;
}

.agency-selector__row:hover .agency-selector__action,
.agency-selector__action:hover,
.agency-selector__action:focus-visible {
    background: var(--agency-access-action-bg);
    color: #fff;
}

.agency-selector__action:hover,
.agency-selector__action:focus-visible {
    filter: brightness(0.95);
    outline: none;
    text-decoration: none;
}

.agency-selector__action:active {
    transform: translateX(1px);
}

.agency-selector__empty {
    color: #6b7280;
    padding: 28px 16px;
    text-align: center;
}

.agency-selector__footer {
    align-items: center;
    column-gap: 16px;
    display: grid;
    grid-template-columns: minmax(152px, max-content) minmax(0, 1fr);
    row-gap: 16px;
    margin-top: auto;
    padding-top: 16px;
}

.agency-selector__count {
    color: #5b6675;
    font-size: 0.875rem;
    grid-column: 1;
    min-width: 152px;
}

.agency-selector__count strong {
    color: #111827;
}

.agency-selector__pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    grid-column: 2;
    justify-content: center;
    min-width: 0;
}

.agency-selector__page {
    background: #fff;
    border: 1px solid #cfd9e5;
    border-radius: 8px;
    color: var(--agency-access-accent);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1rem;
    min-height: 32px;
    min-width: 32px;
    padding: 0 10px;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.agency-selector__page:hover {
    background: var(--agency-access-accent-soft-bg);
    border-color: var(--agency-access-accent-soft-border);
}

.agency-selector__page--nav {
    min-width: 38px;
    padding: 0 12px;
}

.agency-selector__page--ellipsis,
.agency-selector__page--ellipsis:hover {
    background: transparent;
    border-color: transparent;
    color: #7a8796;
    cursor: default;
    pointer-events: none;
}

.agency-selector__page--active,
.agency-selector__page--active:hover {
    background: var(--agency-access-accent);
    border-color: var(--agency-access-accent);
    color: #fff;
    cursor: default;
}

.agency-recover-pass {
    color: #444;
    width: 100%;
}

.agency-recover-pass__description {
    color: #576674;
    font-size: 0.9375rem;
    line-height: 1.5rem;
    margin: 0 0 18px;
    text-align: left;
}

.agency-recover-pass__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 22px;
}

.agency-recover-pass__result {
    color: #444;
    font-size: 0.9375rem;
    line-height: 1.5rem;
    margin: 0;
}

.agency-selector-modal .agency-selector,
.agency-selector-modal .agency-selector * {
    box-sizing: border-box;
}

.agency-selector-modal .agency-selector {
    float: none;
    margin: 0;
    min-width: 0;
    text-align: left;
}

.agency-selector-modal .agency-selector__search {
    align-items: end;
    margin: 0 0 16px;
}

.agency-selector-modal .agency-selector__field,
.agency-selector-modal .agency-selector__label,
.agency-selector-modal .agency-selector__input,
.agency-selector-modal .agency-selector__table,
.agency-selector-modal .agency-selector__table th,
.agency-selector-modal .agency-selector__table td,
.agency-selector-modal .agency-selector__footer,
.agency-selector-modal .agency-selector__count,
.agency-selector-modal .agency-selector__pagination {
    clear: none;
    float: none;
    margin-left: 0;
    margin-right: 0;
    max-width: none;
    text-transform: none;
}

.agency-selector-modal .agency-selector__label {
    display: block;
    padding: 0;
    text-align: left;
    width: auto;
}

.agency-selector-modal .agency-selector__input {
    display: block;
    height: auto;
    margin: 0;
    width: 100%;
}

.agency-selector-modal .agency-selector__search-button {
    display: inline-flex;
    margin: 0;
    min-width: 120px;
    width: auto;
}

.agency-selector-modal .agency-selector__results,
.agency-selector-modal .agency-selector__table {
    width: 100%;
}

.agency-selector-modal .agency-selector__action-cell {
    text-align: right;
}

.agency-selector-modal .agency-selector__footer {
    width: 100%;
}

.agency-recover-pass-modal .agency-recover-pass,
.agency-recover-pass-modal .agency-recover-pass * {
    box-sizing: border-box;
}

.agency-recover-pass-modal .agency-recover-pass {
    float: none;
    margin: 0;
    min-width: 0;
    text-align: left;
}

.agency-recover-pass-modal .agency-recover-pass__description,
.agency-recover-pass-modal .agency-recover-pass__input,
.agency-recover-pass-modal .agency-recover-pass__actions {
    clear: none;
    float: none;
    margin-left: 0;
    margin-right: 0;
    max-width: none;
}

.agency-recover-pass-modal .agency-recover-pass__input {
    display: block;
    height: auto;
    margin: 0;
    width: 100%;
}

.agency-recover-pass-modal .agency-recover-pass__button {
    display: inline-flex;
    min-width: 120px;
    width: auto;
}

@media only screen and (max-width: 767px) {
    .agency-selector-modal .app-modal__content.modal-content {
        height: calc(100vh - 32px);
        max-height: calc(100vh - 32px);
    }

    .agency-selector {
        min-height: 0;
    }

    .agency-selector-modal .app-modal__body.modal-body {
        padding: 1rem;
    }

    .agency-selector__search {
        grid-template-columns: 1fr;
    }

    .agency-selector__table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .agency-selector__footer {
        display: flex;
        align-items: stretch;
        flex-direction: column;
    }

    .agency-selector__count {
        min-width: 0;
    }

    .agency-selector__pagination {
        justify-content: flex-start;
    }

    .agency-selector__search-button,
    .agency-recover-pass__button {
        width: 100%;
    }

    .agency-selector-modal .agency-selector__search-button {
        justify-self: stretch;
    }

    .agency-recover-pass-modal .agency-recover-pass__button {
        width: 100%;
    }

    .agency-recover-pass__actions {
        justify-content: stretch;
    }
}