.roles-page {
    max-width: 1600px;
    width: 100%;
    margin-inline: auto;
}

    .roles-page .table-form-card {
        border-radius: 12px;
        min-width: 0;
    }

.role-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.role-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.role-options {
    max-height: 288px;
    overflow-y: auto;
}

.role-list-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--bs-border-color);
    padding: 8px 0;
}

.role-choice {
    display: grid;
    gap: 8px;
    text-align: left;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 8px;
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

    .role-choice[aria-pressed="true"] {
        background: var(--bs-primary-bg-subtle, #e7f1ff);
        color: var(--bs-primary-text-emphasis, #084298);
        border-radius: 12px;
    }

.role-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 24px;
}

.role-save {
    margin-left: auto;
}

.permission-group {
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 12px;
    margin-top: 16px;
}

    .permission-group legend {
        float: none;
        width: auto;
        font-size: 1rem;
        margin: 0;
        padding: 0 8px;
    }

.permission-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    cursor: pointer;
}

    .permission-option input {
        flex-shrink: 0;
    }

.function-entry {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    border-bottom: 1px solid var(--bs-border-color);
    padding: 16px 0;
}

.function-fields {
    flex: 1;
    min-width: min(100%, 240px);
}

.function-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

    .function-controls label {
        display: flex;
        gap: 8px;
        align-items: center;
    }

.rights-list {
    display: grid;
    gap: 8px;
}

    .rights-list > div {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 24px;
        justify-content: space-between;
        border-bottom: 1px solid var(--bs-border-color);
        padding: 8px 0;
    }

@media (min-width: 851px) {
    .role-options {
        max-height: 640px;
    }

    .role-layout {
        grid-template-columns: minmax(230px, 1fr) minmax(0, 2fr);
    }
}

@media (pointer: coarse) {
    .permission-option {
        min-height: 44px;
    }

    .function-controls button {
        min-height: 44px;
        min-width: 44px;
    }
}

.member-editor .table-form-card,
.member-editor .modal-content {
    border-radius: 12px;
}
