.mfo-as-dir-widget {
    max-width: 1100px;
    margin: 0 auto;
    font-family: inherit;
}

.mfo-as-dir-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.mfo-as-dir-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    color: #1f2d3d;
}

.mfo-as-dir-counts {
    font-size: 14px;
    color: #6b7785;
}

.mfo-as-dir-toprow {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e6eaee;
}

.mfo-as-dir-sort-col {
    flex: 1 1 auto;
    max-width: 420px;
}

.mfo-as-dir-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2d3d;
}

.mfo-as-dir-sort-wrap {
    display: flex;
    gap: 10px;
}

.mfo-as-dir-sort-wrap .mfo-as-dir-select {
    flex: 1 1 auto;
    margin: 0;
}

.mfo-as-dir-show-btn {
    flex: 0 0 auto;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #4a6fa5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.mfo-as-dir-show-btn:hover {
    background: #3b5c8a;
}

.mfo-as-dir-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.mfo-as-dir-select {
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d3dbe3;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    color: #1f2d3d;
}

.mfo-as-dir-alphabet {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e6eaee;
}

.mfo-as-dir-alphabet-break {
    flex-basis: 100%;
    height: 0;
}

.mfo-as-dir-letter {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #d3dbe3;
    border-radius: 999px;
    background: #fff;
    color: #4a5568;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.mfo-as-dir-letter:hover {
    border-color: #4a6fa5;
}

.mfo-as-dir-letter.active {
    background: #4a6fa5;
    border-color: #4a6fa5;
    color: #fff;
}

.mfo-as-dir-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    min-height: 60px;
}

.mfo-as-dir-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 12px 16px;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease;
}

.mfo-as-dir-item:hover {
    border-color: #2271b1;
    color: inherit;
}

.mfo-as-dir-empty,
.mfo-as-dir-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px 10px;
    color: #6b7785;
    font-size: 14px;
}

.mfo-as-dir-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 28px;
}

.mfo-as-dir-show-more {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    color: #4a6fa5;
    background: #fff;
    border: 1px solid #4a6fa5;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.mfo-as-dir-show-more:hover {
    background: #4a6fa5;
    color: #fff;
}

.mfo-as-dir-widget .mfo-as-detail-panel {
    padding: 20px;
    border: 1px solid #e2e7ed;
    border-radius: 10px;
    background: #f7f9fb;
    max-width: var(--mfo-dir-detail-max-width, 900px);
    margin: var(--mfo-dir-detail-margin, 20px auto 0);
}

.mfo-as-dir-close {
    display: inline-block;
    background: none;
    border: none;
    color: #2271b1;
    cursor: pointer;
    padding: 0 0 12px 0;
    font-size: 13px;
}

.mfo-as-dir-close:hover {
    text-decoration: underline;
}

.mfo-as-detail-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.mfo-as-detail-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mfo-as-field-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mfo-as-field-value {
    font-size: 15px;
    word-break: break-word;
}

.mfo-as-link {
    font-size: 15px;
    color: #2271b1;
    word-break: break-all;
}

.mfo-as-copyable-text {
    font-size: 15px;
    word-break: break-word;
    text-decoration: none !important;
    -webkit-text-decoration-skip: none;
}

.mfo-as-multi-value {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mfo-as-multi-row {
    font-size: 15px;
}

.mfo-as-copy-btn {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    color: #333;
    vertical-align: middle;
}

.mfo-as-copy-btn:hover {
    border-color: #2271b1;
    color: #2271b1;
}

/* Список вариантов в выписке — намеренно НЕ <ul>/<li>, чтобы стили темы
   (буллеты, отступы, заглавные буквы и т.п.) не перебивали внешний вид */
.mfo-as-plain-list {
    margin: 4px 0 0 0;
    padding: 0;
    list-style: none;
}

.mfo-as-plain-line {
    font-size: 14px;
    padding: 2px 0;
    text-transform: none;
    list-style: none;
}

.mfo-as-global-block--top {
    margin: 0 0 20px 0;
}

.mfo-as-global-block--bottom {
    margin: 20px 0 0 0;
}

/* Подсказка-"?" с инструкцией по всплытию */
.mfo-as-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ccc;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
}

.mfo-as-tooltip-text {
    display: none;
    position: absolute;
    bottom: 130%;
    left: 0;
    width: 260px;
    background: #333;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    padding: 8px 10px;
    border-radius: 6px;
    z-index: 10;
}

.mfo-as-tooltip:hover .mfo-as-tooltip-text,
.mfo-as-tooltip:focus .mfo-as-tooltip-text {
    display: block;
}

.mfo-as-related {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed #d5d9dd;
}

.mfo-as-related-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f4f6fb;
    border: 1px solid #d5d9dd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #4a6fa5;
    cursor: pointer;
    transition: background 0.15s ease;
}

.mfo-as-related-toggle:hover {
    background: #e9edf5;
}

.mfo-as-dir-widget .mfo-as-related-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px;
    margin-top: 12px;
}

.mfo-as-dir-widget .mfo-as-related-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: #1f2d3d;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.mfo-as-related-item:hover {
    border-color: #4a6fa5;
}

.mfo-as-related-item--hidden {
    display: none !important;
}

.mfo-as-related-more {
    display: inline-block;
    margin: 4px 0 0;
    padding: 6px 12px;
    font-size: 12px;
    border: 1px dashed #b0b0b0;
    border-radius: 6px;
    background: #f7f7f7;
    color: #555;
    cursor: pointer;
}

.mfo-as-related-more:hover {
    border-color: #4a6fa5;
    color: #4a6fa5;
}

@media screen and (max-width: 700px) {
    .mfo-as-dir-toprow {
        flex-direction: column;
        gap: 16px;
    }
    .mfo-as-dir-sort-col {
        flex: 1 1 auto;
        max-width: 100%;
    }
    .mfo-as-dir-sort-wrap {
        flex-direction: column;
    }
    .mfo-as-dir-controls {
        flex-direction: column;
    }
}

@media screen and (max-width: 700px) {
    .mfo-as-dir-widget .mfo-as-related-list {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media screen and (max-width: 420px) {
    .mfo-as-dir-widget .mfo-as-related-list {
        grid-template-columns: 1fr !important;
    }
}
